configure.in 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. dnl########################################################################
  2. dnl ##
  3. dnl Language Technologies Institute ##
  4. dnl Carnegie Mellon University ##
  5. dnl Copyright (c) 1999-2008 ##
  6. dnl All Rights Reserved. ##
  7. dnl ##
  8. dnl Permission is hereby granted, free of charge, to use and distribute ##
  9. dnl this software and its documentation without restriction, including ##
  10. dnl without limitation the rights to use, copy, modify, merge, publish, ##
  11. dnl distribute, sublicense, and/or sell copies of this work, and to ##
  12. dnl permit persons to whom this work is furnished to do so, subject to ##
  13. dnl the following conditions: ##
  14. dnl 1. The code must retain the above copyright notice, this list of ##
  15. dnl conditions and the following disclaimer. ##
  16. dnl 2. Any modifications must be clearly marked as such. ##
  17. dnl 3. Original authors' names are not deleted. ##
  18. dnl 4. The authors' names are not used to endorse or promote products ##
  19. dnl derived from this software without specific prior written ##
  20. dnl permission. ##
  21. dnl ##
  22. dnl CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
  23. dnl DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
  24. dnl ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
  25. dnl SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
  26. dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
  27. dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
  28. dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
  29. dnl ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
  30. dnl THIS SOFTWARE. ##
  31. dnl ##
  32. dnl########################################################################
  33. AC_INIT(include/flite.h)
  34. AC_CANONICAL_SYSTEM
  35. AC_PROG_CC
  36. AC_PROG_RANLIB
  37. AC_PROG_INSTALL
  38. AC_CHECK_TOOL(AR, ar)
  39. AC_C_BIGENDIAN
  40. if test "x$GCC" = "xyes"; then
  41. CFLAGS="$CFLAGS -Wall"
  42. fi
  43. AC_ARG_ENABLE( shared,
  44. [ --disable-shared without shared library support],
  45. [case "${enableval}" in
  46. yes) shared=true ;;
  47. no) shared=false ;;
  48. *) AC_MSG_ERROR(bad value ${enableval} for shared options) ;;
  49. esac],
  50. [shared=false])
  51. case "$target_cpu" in
  52. i386|i486|i586|i686)
  53. TARGET_CPU=i386
  54. ;;
  55. *)
  56. TARGET_CPU=$target_cpu
  57. ;;
  58. esac
  59. TARGET_OS=$target_os
  60. M68KCC=
  61. M68KCLAGS=
  62. WINDRES=
  63. CHROMEBIN_PREFIX=
  64. if test "$target_os" = "chrome" ; then
  65. case "$TARGET_CPU" in
  66. i386*)
  67. CFLAGS="$CFLAGS -m32"
  68. CHROMEBIN_PREFIX=" $CHROME_NDK/toolchain/linux_x86_newlib/bin/i686-nacl"
  69. ;;
  70. x86_64*)
  71. CFLAGS="$CFLAGS -m64"
  72. CHROMEBIN_PREFIX=" $CHROME_NDK/toolchain/linux_x86_newlib/bin/x86_64-nacl"
  73. esac
  74. fi
  75. case "$target_os" in
  76. palmos*)
  77. shared=false
  78. CFLAGS="$CFLAGS -DCST_NO_SOCKETS"
  79. # PalmOS Apps are always in M68K
  80. M68KCC=/usr/m68k-palmos/bin/gcc
  81. # Generic build is ARM or M68K (probably ARM though)
  82. CC="/usr/$TARGET_CPU-palmos/bin/gcc"
  83. if test "$target_cpu" = "arm"
  84. then
  85. CC="$CC -fPIC -march=armv4t"
  86. fi
  87. RANLIB=/usr/$TARGET_CPU-palmos/bin/ranlib
  88. AR=/usr/$TARGET_CPU-palmos/bin/ar
  89. LEXDEFS="-DCST_NO_STATIC_LEX -DCST_NO_STATIC_LTS_MODEL"
  90. VOXDEFS="-DCST_NO_STATIC_VOX"
  91. ;;
  92. dnl wince*)
  93. dnl # For the GNUWINCE environment
  94. dnl # http://win-ce.voxware.com:28575/Development%20Tools/
  95. dnl shared=false
  96. dnl CFLAGS="$CFLAGS -DCST_NO_SOCKETS -march=armv4 -mapcs-32 -malignment-traps -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
  97. dnl CC="/usr/local/wince/bin/arm-wince-pe-gcc"
  98. dnl RANLIB=/usr/local/wince/bin/arm-wince-pe-ranlib
  99. dnl AR=/usr/local/wince/bin/arm-wince-pe-ar
  100. dnl ;;
  101. wince*)
  102. # For the CEGCC environment (mingw32ce)
  103. # http://cegcc.sourceforge.net/
  104. shared=false
  105. # cegcc
  106. # CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_CE -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
  107. # CC="/opt/cegcc/bin/arm-cegcc-gcc"
  108. # RANLIB="/opt/cegcc/bin/arm-cegcc-ranlib"
  109. # AR="/opt/cegcc/bin/arm-cegcc-ar"
  110. # mingw32ce
  111. CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_CE -DSARM -DWIN32"
  112. if test -f "/opt/mingw32ce/bin/arm-mingw32ce-gcc"
  113. then
  114. MINGW32CEPREF="/opt/mingw32ce/bin/arm-mingw32ce-"
  115. else
  116. MINGW32CEPREF="/opt/mingw32ce/bin/arm-wince-mingw32ce-"
  117. fi
  118. CC="${MINGW32CEPREF}gcc"
  119. RANLIB="${MINGW32CEPREF}ranlib"
  120. AR="${MINGW32CEPREF}ar"
  121. SIZE="${MINGW32CEPREF}size"
  122. STRIP="${MINGW32CEPREF}strip"
  123. WINDRES="${MINGW32CEPREF}windres"
  124. DLLTOOL="${MINGW32CEPREF}dlltool"
  125. DLLWRAP="${MINGW32CEPREF}dllwrap"
  126. NM="${MINGW32CEPREF}nm"
  127. ;;
  128. mingw*)
  129. # For the Windows under mingw32 environment
  130. # http://www.mingw.org
  131. shared=false
  132. CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared"
  133. MINGWPREF="i386-mingw32-"
  134. CC="${MINGWPREF}gcc"
  135. RANLIB="${MINGWPREF}ranlib"
  136. AR="${MINGWPREF}ar"
  137. WINDRES="${MINGWPREF}windres"
  138. DLLTOOL="${MINGWPREF}dlltool"
  139. DLLWRAP="${MINGWPREF}dllwrap"
  140. NM="${MINGWPREF}nm"
  141. ;;
  142. android*)
  143. # For Android with Android NDK
  144. # http://developer.android.com/sdk/ndk/index.html
  145. shared=false
  146. # We target our compilation to android-14 (4.0) platform
  147. ANDROID_NDK_PLATFORM_PATH="$ANDROID_NDK/platforms/android-14"
  148. ANDROID_GCC_VERSION=4.6
  149. if test "$target_cpu" = "armeabi"
  150. then
  151. ANDROID_TOOLCHAIN="arm-linux-androideabi-$ANDROID_GCC_VERSION"
  152. ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-arm"
  153. ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/arm-linux-androideabi"
  154. CFLAGS="$CFLAGS -fpic -mthumb -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
  155. fi
  156. if test "$target_cpu" = "armeabiv7a"
  157. then
  158. ANDROID_TOOLCHAIN="arm-linux-androideabi-$ANDROID_GCC_VERSION"
  159. ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-arm"
  160. ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/arm-linux-androideabi"
  161. CFLAGS="$CFLAGS -fpic -march=armv7-a -mfloat-abi=softfp -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
  162. LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
  163. fi
  164. if test "$target_cpu" = "x86"
  165. then
  166. ANDROID_TOOLCHAIN="x86-$ANDROID_GCC_VERSION"
  167. ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-x86"
  168. ANDROIDBIN="$ANDROID_NDK/toolchains/x86-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/i686-linux-android"
  169. CFLAGS="$CFLAGS -fpic -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
  170. fi
  171. if test "$target_cpu" = "mips"
  172. then
  173. ANDROID_TOOLCHAIN="mipsel-linux-android-$ANDROID_GCC_VERSION"
  174. ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-mips"
  175. ANDROIDBIN="$ANDROID_NDK/toolchains/mipsel-linux-android-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/mipsel-linux-android"
  176. CFLAGS="$CFLAGS -fpic -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
  177. fi
  178. # Common to all android variants
  179. CC="${ANDROIDBIN}-gcc"
  180. RANLIB="${ANDROIDBIN}-ranlib"
  181. AR="${ANDROIDBIN}-ar"
  182. NM="${ANDROIDBIN}-nm"
  183. ;;
  184. chrome*)
  185. shared=false
  186. CFLAGS="$CFLAGS -DCST_NO_SOCKETS"
  187. CC="${CHROMEBIN_PREFIX}-gcc"
  188. RANLIB="${CHROMEBIN_PREFIX}-ranlib"
  189. AR="${CHROMEBIN_PREFIX}-ar"
  190. NM="${CHROMEBIN_PREFIX}-nm"
  191. ;;
  192. uclinux*)
  193. LDFLAGS="$LDFLAGS -Wl,-elf2flt"
  194. ;;
  195. darwin*)
  196. CFLAGS="$CFLAGS -no-cpp-precomp"
  197. ;;
  198. esac
  199. AC_SUBST(TARGET_OS)
  200. AC_SUBST(TARGET_CPU)
  201. AC_SUBST(M68KCC)
  202. AC_SUBST(WINDRES)
  203. AC_SUBST(SIZE)
  204. AC_SUBST(STRIP)
  205. AC_SUBST(DLLTOOL)
  206. AC_SUBST(DLLWRAP)
  207. AC_SUBST(NM)
  208. AC_SUBST(LEXDEFS)
  209. AC_SUBST(VOXDEFS)
  210. case "$host_cpu" in
  211. i386|i486|i586|i686)
  212. HOST_CPU=i386
  213. ;;
  214. *)
  215. HOST_CPU=$host_cpu
  216. ;;
  217. esac
  218. HOST_OS=$host_os
  219. AC_SUBST(HOST_OS)
  220. AC_SUBST(HOST_CPU)
  221. SHFLAGS=
  222. OTHERLIBS=
  223. dnl For OpenPandora and other (softfloat) ARMs with neon
  224. if grep -q Pandora /proc/cpuinfo
  225. then
  226. CFLAGS="$CFLAGS -DPANDORA -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
  227. fi
  228. withpic=false
  229. AC_ARG_WITH( pic, [ --with-pic with pic ],
  230. withpic=$with_pic )
  231. if test "x$with_pic" = "xyes"; then
  232. case "$target_os" in
  233. linux*)
  234. CFLAGS="$CFLAGS -fPIC"
  235. ;;
  236. solaris*)
  237. CFLAGS="$CFLAGS -fPIC"
  238. ;;
  239. *)
  240. CFLAGS="$CFLAGS -fPIC"
  241. ;;
  242. esac
  243. fi
  244. if test "$shared" = true; then
  245. case "$target_os" in
  246. linux*|k*bsd*-gnu|gnu*)
  247. SHFLAGS="-fPIC"
  248. ;;
  249. solaris*)
  250. SHFLAGS="-fPIC"
  251. OTHERLIBS="-lsocket -ldl"
  252. ;;
  253. *)
  254. ;;
  255. esac
  256. fi
  257. case "$target_os" in
  258. wince*)
  259. # cegcc
  260. #OTHERLIBS="-lc -lgcc -lwinsock -lcoredll"
  261. # mingw32ce
  262. OTHERLIBS=
  263. ;;
  264. *)
  265. ;;
  266. esac
  267. AC_SUBST(OTHERLIBS)
  268. AC_SUBST(SHFLAGS)
  269. AC_ARG_ENABLE( sockets,
  270. [ --disable-sockets without socket support],
  271. [case "${enableval}" in
  272. yes) sockets=true ;;
  273. no) sockets=false ;;
  274. *) AC_MSG_ERROR(bad value ${enableval} for sockets options) ;;
  275. esac],
  276. [sockets=true])
  277. if test "$sockets" = false; then
  278. AC_DEFINE(CST_NO_SOCKETS)
  279. fi
  280. dnl
  281. dnl Does this compiler support initialization of unions
  282. dnl
  283. AC_TRY_COMPILE([#include <stdio.h>],
  284. [ struct a { union { float b; int c; } d; };
  285. const struct a e = { .d={ .b=3.14 } }; ],
  286. [unioninit=yes],
  287. [unioninit=no])
  288. if test "$unioninit" = no; then
  289. AC_DEFINE(NO_UNION_INITIALIZATION)
  290. fi
  291. dnl
  292. dnl Does this platform support mmap(2)
  293. dnl Note we don't use AC_FUNC_MMAP because we really only care whether
  294. dnl read-only mappings work.
  295. dnl
  296. AC_CHECK_FUNC(mmap,MMAPTYPE=posix)
  297. dnl Force no mmap for chrome
  298. if test "$target_os" = "chrome"
  299. then
  300. MMAPTYPE=none
  301. fi
  302. dnl AC_CHECK_FUNC doesn't seem to work for Win32 API calls...
  303. if test "x$MMAPTYPE" = x; then
  304. case "$target_os" in
  305. cygwin*|mingw*)
  306. MMAPTYPE=win32
  307. ;;
  308. android*)
  309. MMAPTYPE=posix
  310. ;;
  311. *)
  312. MMAPTYPE=none
  313. ;;
  314. esac
  315. fi
  316. dnl
  317. dnl allow the user to override the one detected above
  318. dnl
  319. AC_ARG_WITH( mmap,
  320. [ --with-mmap with specific mmap support (none posix win32) ],
  321. MMAPTYPE=$with_mmap )
  322. AC_SUBST(MMAPTYPE)
  323. dnl stdio type, palmos/wince are different
  324. if test "$target_os" = "palmos"
  325. then
  326. STDIOTYPE=palmos
  327. else
  328. if test "$target_os" = "wince"
  329. then
  330. STDIOTYPE=wince
  331. else
  332. STDIOTYPE=stdio
  333. fi
  334. fi
  335. AC_SUBST(STDIOTYPE)
  336. dnl
  337. dnl determine audio type or use none if none supported on this platform
  338. dnl
  339. AUDIODRIVER=none
  340. AC_CHECK_HEADER(sys/soundcard.h,
  341. [AUDIODRIVER="oss"
  342. AUDIODEFS=-DCST_AUDIO_LINUX])
  343. AC_CHECK_HEADER(machine/soundcard.h,
  344. [AUDIODRIVER="oss"
  345. AUDIODEFS=-DCST_AUDIO_FREEBSD])
  346. AC_CHECK_HEADER(sys/audioio.h,
  347. [AUDIODRIVER="sun"
  348. AUDIODEFS=-DCST_AUDIO_SUNOS])
  349. # Seems the alsa code I have breaks on earlier versions
  350. # I'm not sure what the threshold version is, but made this depend on
  351. # the one I know -- you can still specific --with-audio=alsa
  352. AC_TRY_COMPILE([#include <alsa/version.h>],
  353. [int j=
  354. #if SND_LIB_SUBMINOR >= 11
  355. 3;
  356. #endif],
  357. [AUDIODRIVER="alsa"
  358. AUDIODEFS=-DCST_AUDIO_ALSA
  359. AUDIOLIBS=-lasound])
  360. AC_CHECK_HEADER(mmsystem.h,
  361. [AUDIODRIVER="wince"
  362. AUDIODEFS=-DCST_AUDIO_WINCE
  363. AUDIOLIBS=-lwinmm])
  364. dnl I don't care what you ask for, for wince you get wince
  365. case "$target_os" in
  366. wince*)
  367. AUDIODRIVER="wince"
  368. AUDIODEFS=-DCST_AUDIO_WINCE
  369. AUDIOLIBS=
  370. ;;
  371. mingw*)
  372. AUDIODRIVER="none"
  373. AUDIODEFS=-DCST_AUDIO_NONE
  374. AUDIOLIBS=
  375. ;;
  376. android*)
  377. AUDIODRIVER="none"
  378. AUDIODEFS=-DCST_AUDIO_NONE
  379. AUDIOLIBS=
  380. ;;
  381. chrome*)
  382. AUDIODRIVER="none"
  383. AUDIODEFS=-DCST_AUDIO_NONE
  384. AUDIOLIBS=
  385. ;;
  386. *)
  387. ;;
  388. esac
  389. dnl
  390. dnl allow the user to override the one detected above
  391. dnl
  392. AC_ARG_WITH( audio,
  393. [ --with-audio with specific audio support (none linux freebsd etc) ],
  394. AUDIODRIVER=$with_audio
  395. AUDIODEFS="" )
  396. if test "x$AUDIODEFS" = x; then
  397. case "$AUDIODRIVER" in
  398. linux|oss)
  399. AUDIODRIVER=oss
  400. AUDIODEFS=-DCST_AUDIO_LINUX
  401. ;;
  402. alsa)
  403. AUDIODRIVER="alsa"
  404. AUDIODEFS=-DCST_AUDIO_ALSA
  405. AUDIOLIBS=-lasound
  406. ;;
  407. pa|pulseaudio)
  408. AUDIODRIVER="pulseaudio"
  409. AUDIODEFS=-DCST_AUDIO_PULSEAUDIO
  410. AUDIOLIBS='-lpulse-simple -lpulse'
  411. ;;
  412. *bsd)
  413. AUDIODRIVER=oss
  414. AUDIODEFS=-DCST_AUDIO_FREEBSD
  415. ;;
  416. qnx)
  417. AUDIODRIVER=alsa
  418. AUDIODEFS=-DCST_AUDIO_QNX
  419. ;;
  420. none)
  421. AUDIODEFS=-DCST_AUDIO_NONE
  422. ;;
  423. esac
  424. fi
  425. AC_SUBST(AUDIODRIVER)
  426. AC_SUBST(AUDIODEFS)
  427. AC_SUBST(AUDIOLIBS)
  428. dnl
  429. dnl language/lexicon/voice parameters
  430. dnl
  431. AC_ARG_WITH( lang, [ --with-lang with language ],
  432. FL_LANG=$with_lang )
  433. if test "x$with_lang" = "x"; then
  434. FL_LANG="usenglish"
  435. fi
  436. AC_SUBST(FL_LANG)
  437. AC_ARG_WITH( vox, [ --with-vox with vox ],
  438. FL_VOX=$with_vox )
  439. if test "x$with_vox" = "x"; then
  440. FL_VOX="cmu_us_kal"
  441. fi
  442. AC_SUBST(FL_VOX)
  443. AC_ARG_WITH( lex, [ --with-lex with lexicon ],
  444. FL_LEX=$with_lex )
  445. if test "x$with_lex" = "x"; then
  446. FL_LEX="cmulex"
  447. fi
  448. AC_SUBST(FL_LEX)
  449. AC_SUBST(EXEEXT)
  450. FL_LANGVOX="default"
  451. AC_ARG_WITH( langvox,
  452. [ --with-langvox with subsets of lang, lex and voices ],
  453. FL_LANGVOX=$with_langvox )
  454. AC_SUBST(FL_LANGVOX)
  455. AC_OUTPUT(config/config config/system.mak)