-
Notifications
You must be signed in to change notification settings - Fork 16
/
configure.in
569 lines (528 loc) · 16.5 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
dnl########################################################################
dnl ##
dnl Language Technologies Institute ##
dnl Carnegie Mellon University ##
dnl Copyright (c) 2012 ##
dnl All Rights Reserved. ##
dnl ##
dnl Permission is hereby granted, free of charge, to use and distribute ##
dnl this software and its documentation without restriction, including ##
dnl without limitation the rights to use, copy, modify, merge, publish, ##
dnl distribute, sublicense, and/or sell copies of this work, and to ##
dnl permit persons to whom this work is furnished to do so, subject to ##
dnl the following conditions: ##
dnl 1. The code must retain the above copyright notice, this list of ##
dnl conditions and the following disclaimer. ##
dnl 2. Any modifications must be clearly marked as such. ##
dnl 3. Original authors' names are not deleted. ##
dnl 4. The authors' names are not used to endorse or promote products ##
dnl derived from this software without specific prior written ##
dnl permission. ##
dnl ##
dnl CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
dnl DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
dnl ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
dnl SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
dnl ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
dnl THIS SOFTWARE. ##
dnl ##
dnl########################################################################
AC_INIT(include/bard.h)
AC_CANONICAL_SYSTEM
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_CHECK_TOOL(AR, ar)
AC_C_BIGENDIAN
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall"
fi
AC_ARG_ENABLE( shared,
[ --disable-shared without shared library support],
[case "${enableval}" in
yes) shared=true ;;
no) shared=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for shared options) ;;
esac],
[shared=false])
case "$target_cpu" in
i386|i486|i586|i686)
TARGET_CPU=i386
;;
*)
TARGET_CPU=$target_cpu
;;
esac
TARGET_OS=$target_os
M68KCC=
M68KCLAGS=
WINDRES=
OTHERLIBS=
CHROMEBIN_PREFIX=
if test "$target_os" = "chrome" ; then
case "$TARGET_CPU" in
i386*)
CFLAGS="$CFLAGS -m32"
CHROMEBIN_PREFIX=" $CHROME_NDK/toolchain/linux_x86_newlib/bin/i686-nacl"
;;
x86_64*)
CFLAGS="$CFLAGS -m64"
CHROMEBIN_PREFIX=" $CHROME_NDK/toolchain/linux_x86_newlib/bin/x86_64-nacl"
esac
fi
case "$target_os" in
palmos*)
shared=false
CFLAGS="$CFLAGS -DCST_NO_SOCKETS"
# PalmOS Apps are always in M68K
M68KCC=/usr/m68k-palmos/bin/gcc
# Generic build is ARM or M68K (probably ARM though)
CC="/usr/$TARGET_CPU-palmos/bin/gcc"
if test "$target_cpu" = "arm"
then
CC="$CC -fPIC -march=armv4t"
fi
RANLIB=/usr/$TARGET_CPU-palmos/bin/ranlib
AR=/usr/$TARGET_CPU-palmos/bin/ar
LEXDEFS="-DCST_NO_STATIC_LEX -DCST_NO_STATIC_LTS_MODEL"
VOXDEFS="-DCST_NO_STATIC_VOX"
;;
dnl wince*)
dnl # For the GNUWINCE environment
dnl # http://win-ce.voxware.com:28575/Development%20Tools/
dnl shared=false
dnl CFLAGS="$CFLAGS -DCST_NO_SOCKETS -march=armv4 -mapcs-32 -malignment-traps -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
dnl CC="/usr/local/wince/bin/arm-wince-pe-gcc"
dnl RANLIB=/usr/local/wince/bin/arm-wince-pe-ranlib
dnl AR=/usr/local/wince/bin/arm-wince-pe-ar
dnl ;;
wince*)
# For the CEGCC environment (mingw32ce)
# http://cegcc.sourceforge.net/
shared=false
# cegcc
# CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_CE -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
# CC="/opt/cegcc/bin/arm-cegcc-gcc"
# RANLIB="/opt/cegcc/bin/arm-cegcc-ranlib"
# AR="/opt/cegcc/bin/arm-cegcc-ar"
# mingw32ce
CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_CE -DSARM -DWIN32"
if test -f "/opt/mingw32ce/bin/arm-mingw32ce-gcc"
then
MINGW32CEPREF="/opt/mingw32ce/bin/arm-mingw32ce-"
else
MINGW32CEPREF="/opt/mingw32ce/bin/arm-wince-mingw32ce-"
fi
CC="${MINGW32CEPREF}gcc"
RANLIB="${MINGW32CEPREF}ranlib"
AR="${MINGW32CEPREF}ar"
SIZE="${MINGW32CEPREF}size"
STRIP="${MINGW32CEPREF}strip"
WINDRES="${MINGW32CEPREF}windres"
DLLTOOL="${MINGW32CEPREF}dlltool"
DLLWRAP="${MINGW32CEPREF}dllwrap"
NM="${MINGW32CEPREF}nm"
;;
mingw*)
# For the Windows under mingw32 environment
# http://www.mingw.org
shared=false
CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared"
MINGWPREF="i386-mingw32-"
CC="${MINGWPREF}gcc"
RANLIB="${MINGWPREF}ranlib"
AR="${MINGWPREF}ar"
WINDRES="${MINGWPREF}windres"
DLLTOOL="${MINGWPREF}dlltool"
DLLWRAP="${MINGWPREF}dllwrap"
NM="${MINGWPREF}nm"
;;
android*)
# For Android with Android NDK
# http://developer.android.com/sdk/ndk/index.html
shared=false
ANDROIDBIN="$ANDROID_NDK/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin"
# Use the line below to compile for ARMv5 (default)
CFLAGS="$CFLAGS -march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -I$ANDROID_NDK/build/platforms/android-4/arch-arm/usr/include/ "
# Use the two lines below to compile for ARMv7-A (Nexus one, Droid, etc.)
#CFLAGS="$CFLAGS -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-exceptions -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I$ANDROID_NDK/build/platforms/android-4/arch-arm/usr/include/ -DANDROID -Wa,--noexecstack -O2 -DNDEBUG "
#LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
CC="${ANDROIDBIN}/arm-eabi-gcc"
RANLIB="${ANDROIDBIN}/arm-eabi-ranlib"
AR="${ANDROIDBIN}/arm-eabi-ar"
NM="${ANDROIDBIN}/arm-eabi-nm"
;;
chrome*)
shared=false
CFLAGS="$CFLAGS -DCST_NO_SOCKETS"
CC="${CHROMEBIN_PREFIX}-gcc"
RANLIB="${CHROMEBIN_PREFIX}-ranlib"
AR="${CHROMEBIN_PREFIX}-ar"
NM="${CHROMEBIN_PREFIX}-nm"
;;
uclinux*)
LDFLAGS="$LDFLAGS -Wl,-elf2flt"
;;
linux-uclibc*)
CC="${GCW0TOOLCHAIN}/usr/bin/mipsel-gcw0-linux-uclibc-gcc"
AR="${GCW0TOOLCHAIN}/usr/bin/mipsel-gcw0-linux-uclibc-ar"
RANLIB="${GCW0TOOLCHAIN}/usr/bin/mipsel-gcw0-linux-uclibc-ranlib"
OTHERLIBS="-lz"
;;
darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp"
;;
esac
AC_SUBST(TARGET_OS)
AC_SUBST(TARGET_CPU)
AC_SUBST(M68KCC)
AC_SUBST(WINDRES)
AC_SUBST(SIZE)
AC_SUBST(STRIP)
AC_SUBST(DLLTOOL)
AC_SUBST(DLLWRAP)
AC_SUBST(NM)
AC_SUBST(LEXDEFS)
AC_SUBST(VOXDEFS)
case "$host_cpu" in
i386|i486|i586|i686)
HOST_CPU=i386
;;
*)
HOST_CPU=$host_cpu
;;
esac
HOST_OS=$host_os
AC_SUBST(HOST_OS)
AC_SUBST(HOST_CPU)
SHFLAGS=
dnl For OpenPandora and other (sorftfloat) ARMS with neon
if grep -q Pandora /proc/cpuinfo
then
CFLAGS="$CFLAGS -DPANDORA -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
fi
withpic=false
AC_ARG_WITH( pic, [ --with-pic with pic ],
withpic=$with_pic )
if test "x$with_pic" = "xyes"; then
case "$target_os" in
linux*)
CFLAGS="$CFLAGS -fPIC"
;;
solaris*)
CFLAGS="$CFLAGS -fPIC"
;;
*)
CFLAGS="$CFLAGS -fPIC"
;;
esac
fi
if test "$shared" = true; then
case "$target_os" in
linux*|k*bsd*-gnu|gnu*)
SHFLAGS="-fPIC"
;;
solaris*)
SHFLAGS="-fPIC"
OTHERLIBS="-lsocket -ldl"
;;
*)
;;
esac
fi
case "$target_os" in
wince*)
# cegcc
#OTHERLIBS="-lc -lgcc -lwinsock -lcoredll"
# mingw32ce
OTHERLIBS=
;;
*)
;;
esac
AC_SUBST(OTHERLIBS)
AC_SUBST(SHFLAGS)
AC_ARG_ENABLE( sockets,
[ --disable-sockets without socket support],
[case "${enableval}" in
yes) sockets=true ;;
no) sockets=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for sockets options) ;;
esac],
[sockets=true])
if test "$sockets" = false; then
AC_DEFINE(CST_NO_SOCKETS)
fi
dnl
dnl Does this compiler support initialization of unions
dnl
AC_TRY_COMPILE([#include <stdio.h>],
[ struct a { union { float b; int c; } d; };
const struct a e = { .d={ .b=3.14 } }; ],
[unioninit=yes],
[unioninit=no])
if test "$unioninit" = no; then
AC_DEFINE(NO_UNION_INITIALIZATION)
fi
dnl
dnl Does this platform support mmap(2)
dnl Note we don't use AC_FUNC_MMAP because we really only care whether
dnl read-only mappings work.
dnl
AC_CHECK_FUNC(mmap,MMAPTYPE=posix)
dnl Force no mmap for chrome
if test "$target_os" = "chrome"
then
MMAPTYPE=none
fi
dnl AC_CHECK_FUNC doesn't seem to work for Win32 API calls...
if test "x$MMAPTYPE" = x; then
case "$target_os" in
cygwin*|mingw*)
MMAPTYPE=win32
;;
android*)
MMAPTYPE=posix
;;
*)
MMAPTYPE=none
;;
esac
fi
AC_SUBST(MMAPTYPE)
dnl stdio type, palmos/wince are different
if test "$target_os" = "palmos"
then
STDIOTYPE=palmos
else
if test "$target_os" = "wince"
then
STDIOTYPE=wince
else
STDIOTYPE=stdio
fi
fi
AC_SUBST(STDIOTYPE)
dnl
dnl determine audio type or use none if none supported on this platform
dnl
AUDIODRIVER=none
AC_CHECK_HEADER(sys/soundcard.h,
[AUDIODRIVER="oss"
AUDIODEFS=-DCST_AUDIO_LINUX])
AC_CHECK_HEADER(machine/soundcard.h,
[AUDIODRIVER="oss"
AUDIODEFS=-DCST_AUDIO_FREEBSD])
AC_CHECK_HEADER(sys/audioio.h,
[AUDIODRIVER="sun"
AUDIODEFS=-DCST_AUDIO_SUNOS])
AC_CHECK_HEADER(alsa/asoundlib.h,
[AUDIODRIVER="alsa"
AUDIODEFS=-DCST_AUDIO_ALSA
AUDIOLIBS=-lasound])
AC_CHECK_HEADER(mmsystem.h,
[AUDIODRIVER="wince"
AUDIODEFS=-DCST_AUDIO_WINCE
AUDIOLIBS=-lwinmm])
dnl I don't care what you ask for, for wince you get wince
case "$target_os" in
wince*)
AUDIODRIVER="wince"
AUDIODEFS=-DCST_AUDIO_WINCE
AUDIOLIBS=
;;
mingw*)
AUDIODRIVER="none"
AUDIODEFS=-DCST_AUDIO_NONE
AUDIOLIBS=
;;
android*)
AUDIODRIVER="none"
AUDIODEFS=-DCST_AUDIO_NONE
AUDIOLIBS=
;;
chrome*)
AUDIODRIVER="none"
AUDIODEFS=-DCST_AUDIO_NONE
AUDIOLIBS=
;;
*)
;;
esac
dnl
dnl allow the user to override the one detected above
dnl
AC_ARG_WITH( audio,
[ --with-audio with specific audio support (none linux freebsd etc) ],
AUDIODRIVER=$with_audio
AUDIODEFS="" )
if test "x$AUDIODEFS" = x; then
case "$AUDIODRIVER" in
linux|oss)
AUDIODRIVER=oss
AUDIODEFS=-DCST_AUDIO_LINUX
;;
alsa)
AUDIODRIVER="alsa"
AUDIODEFS=-DCST_AUDIO_ALSA
AUDIOLIBS=-lasound
;;
*bsd)
AUDIODRIVER=oss
AUDIODEFS=-DCST_AUDIO_FREEBSD
;;
qnx)
AUDIODRIVER=alsa
AUDIODEFS=-DCST_AUDIO_QNX
;;
none)
AUDIODEFS=-DCST_AUDIO_NONE
;;
esac
fi
AC_SUBST(AUDIODRIVER)
AC_SUBST(AUDIODEFS)
AC_SUBST(AUDIOLIBS)
dnl
dnl Platform specific DEFS: Not needed yet
dnl
PLATFORM_DEFS=
dnl case "$TARGET_CPU" in
dnl mipsel)
dnl PLATFORM_DEFS=-DBARD_TARGET_BEN_NANONOTE
dnl ;;
dnl *)
dnl PLATFORM_DEFS=
dnl ;;
dnl esac
AC_SUBST(PLATFORM_DEFS)
dnl
dnl Flite support
dnl
if test "x$FLITEDIR" = x; then
if test -f /usr/include/flite.h; then
FLITEDIR=/usr
fi
fi
if test "x$FLITEDIR" = x; then
if test -f "$PWD/../flite/include/flite.h"; then
FLITEDIR="$PWD/../flite"
fi
fi
if test "x$FLITEDIR" = x; then
AC_MSG_ERROR("Cannot locate CMU Flite specify FLITEDIR explicitly.")
fi
echo CMU Flite found in $FLITEDIR
AC_SUBST(FLITEDIR)
dnl
dnl EPUB support
dnl
AC_CHECK_HEADER(zip.h,
[EPUBDEFS=-DBARD_EPUB
EPUBLIBS="-lzip"])
dnl
dnl harfbuzz support
dnl
AC_CHECK_HEADER(harfbuzz/hb.h,
[HBDEFS=-DBARD_HARFBUZZ
HBINCS="-I/usr/include/freetype2"
HBLIBS="-lfreetype -lcairo"])
dnl Some versions don't have harfbuzz-icu
AC_CHECK_LIB(harfbuzz,
hb_icu_get_unicode_funcs,
[HBLIBS+=" -lharfbuzz"],
[HBLIBS+=" -lharfbuzz -lharfbuzz-icu"])
dnl
dnl SDL support
dnl
dnl AC_CHECK_HEADER(SDL/SDL.h,,[AC_MSG_ERROR([Cannot locate SDL/SDL.h])])
if ! test -f /usr/include/SDL/SDL.h; then
AC_MSG_ERROR("Cannot locate /usr/include/SDL/SDL.h.")
fi
SDLLIBS="-lSDL_mixer -lSDL"
dnl Fix this ....
if ! test -f /usr/include/SDL/SDL_ttf.h; then
AC_MSG_ERROR("Cannot locate /usr/include/SDL/SDL_ttf.h.")
fi
SDLLIBS="-lSDL_ttf $SDLLIBS"
dnl AC_CHECK_HEADER(SDL/SDL_ttf.h,,[AC_MSG_ERROR([Cannot locate SDL/SDL_ttf.h])])
if ! test "x$EPUBDEFS" = x; then
if test -f /usr/include/SDL/SDL_image.h -a -f /usr/include/SDL/SDL_rotozoom.h
then
echo "EPUB (with SDL images) support found"
SDLLIBS="-lSDL_gfx -lSDL_image $SDLLIBS"
EPUBDEFS="-DBARD_EPUB_IMAGES $EPUBDEFS"
else
echo "EPUB (without SDL images) support found"
fi
else
echo "No EPUB support found (missing libzip)"
fi
AC_SUBST(SDLLIBS)
AC_SUBST(EPUBLIBS)
AC_SUBST(EPUBDEFS)
AC_SUBST(HBDEFS)
AC_SUBST(HBINCS)
AC_SUBST(HBLIBS)
dnl
dnl Find a font.
dnl
if test "x$DEFAULTFONT" = "x"
then
DEFAULTFONT=`find /usr/share/fonts -name LiberationSerif-Regular.ttf | head -1`
fi
if test "x$DEFAULTFONT" = "x"
then
DEFAULTFONT=`find /usr/share/fonts -name DejaVuSerif.ttf | head -1`
fi
if test "x$DEFAULTFONT" = "x"
then
DEFAULTFONT=`find /usr/share/fonts -name DroidSerif.ttf | head -1`
fi
dnl Android, but your probably not running configure on the device
if test "x$DEFAULTFONT" = "x"
then
DEFAULTFONT=`find /system/fonts -name DroidSerif.ttf | head -1`
fi
dnl N900
if test "x$DEFAULTFONT" = "x"
then
DEFAULTFONT=`find /usr/share/fonts -name NtmRR4nh.ttf | head -1`
fi
if test "x$DEFAULTFONT" = "x"; then
echo No installed font found
else
echo Using installed font: $DEFAULTFONT
fi
AC_SUBST(DEFAULTFONT)
dnl
dnl language/lexicon/voice parameters
dnl
AC_ARG_WITH( lang, [ --with-lang with language ],
FL_LANG=$with_lang )
if test "x$with_lang" = "x"; then
FL_LANG="usenglish"
fi
AC_SUBST(FL_LANG)
AC_ARG_WITH( vox, [ --with-vox with vox ],
FL_VOX=$with_vox )
if test "x$with_vox" = "x"; then
FL_VOX="cmu_us_kal"
fi
AC_SUBST(FL_VOX)
AC_ARG_WITH( lex, [ --with-lex with lexicon ],
FL_LEX=$with_lex )
if test "x$with_lex" = "x"; then
FL_LEX="cmulex"
fi
AC_SUBST(FL_LEX)
AC_SUBST(EXEEXT)
FL_LANGVOX="default"
AC_ARG_WITH( langvox,
[ --with-langvox with subsets of lang, lex and voices ],
FL_LANGVOX=$with_langvox )
AC_SUBST(FL_LANGVOX)
AC_OUTPUT(config/config config/system.mak)