packaging: updated changelog.
[profile/ivi/sphinxbase.git] / configure.in
1 dnl Welcome to the Sphinx automated build system.
2 dnl try not to hurt yourself ;)
3
4 AC_INIT([sphinxbase], 0.7)
5 AC_CONFIG_HEADERS([include/config.h include/sphinx_config.h])
6 AM_INIT_AUTOMAKE([no-define])
7 AC_CONFIG_MACRO_DIR([m4])
8
9 CFLAGS=${CFLAGS:--g -O2 -Wall}
10
11 AC_CANONICAL_HOST
12
13 dnl
14 dnl Set proper compiler flags and such for some platforms
15 dnl
16 case $host in
17      arm-wince-pe*)
18         CFLAGS=${CFLAGS:--march=armv4 -mapcs-32 -malignment-traps}
19         LIBS='-lc -lgcc -lwinsock -lcoredll'
20         CFLAGS="$CFLAGS -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
21         ;;
22      *uclinux*)
23         # uClinux needs special "flat" binaries
24         LDFLAGS="$LDFLAGS -Wl,-elf2flt"
25         ;;
26      *)
27      ;;
28 esac     
29
30 AC_ISC_POSIX
31 AC_PROG_CC
32 AC_PROG_CC_STDC
33
34 # We don't bother ourselves with flex checks until the rest of the world has an up-to-date Flex
35 # We need specific bison extensions, so check for bison
36 AC_CHECK_PROG(YACC, bison, [bison -y], no)
37 if test "x$YACC" = "xno";
38 then
39     AC_MSG_ERROR([You need to install bison])
40 fi
41 AC_ARG_VAR(YACC,[Bison command])
42
43 AC_HEADER_STDC
44 AC_C_BIGENDIAN
45 AC_TYPE_SIGNAL
46 AC_CHECK_TYPES(long long)
47 AC_CHECK_SIZEOF(long long)
48 AC_CHECK_SIZEOF(long)
49 AC_CHECK_FUNCS([popen perror snprintf])
50 AC_CHECK_HEADER(errno.h)
51 AM_ICONV
52
53 dnl
54 dnl Check for Lapack stuff unless disabled
55 dnl
56 use_lapack=true
57 use_internal_lapack=false
58 AC_ARG_WITH(lapack,
59         AS_HELP_STRING([--without-lapack],
60                        [Disable matrix algebra support (depends on LAPACK)]),[
61 if test x$withval = xno; then
62    use_lapack=false
63 fi
64 ])
65 if test x$use_lapack = xtrue; then
66    AC_CHECK_LIB(lapack, sgesv_,,use_internal_lapack=true)
67    if test x$use_internal_lapack != xtrue; then
68       AC_CHECK_LIB(blas, sgemm_,,use_internal_lapack=true)
69    fi
70    AC_DEFINE(WITH_LAPACK, [], [Enable matrix algebra with LAPACK])
71 fi
72 AM_CONDITIONAL(LAPACK_LITE, test x$use_internal_lapack = xtrue)
73 AM_CONDITIONAL(USE_LAPACK, test x$use_lapack = xtrue)
74
75 dnl
76 dnl Just make sure we have this...
77 dnl
78 AC_CHECK_LIB(m, log)
79
80 dnl
81 dnl Enable thread-safe versions of some internal functions
82 dnl
83 threadsafe=auto
84 AC_ARG_ENABLE(threads,
85         AS_HELP_STRING([--disable-threads],
86                        [Disable thread-safe versions of memory allocation functions (default: check)]),[
87 if test x$enableval != x; then
88    threadsafe=$enableval
89 fi
90 ])
91 if test x$threadsafe != xno; then
92    threads=false
93    dnl
94    dnl Can't seem to check for Windows API functions, but that's okay
95    dnl because we know they will be there...
96    dnl
97    case $host in
98      *cygwin*|*mingw*|*wince*)
99         threads=true
100      ;;
101      *)
102         AC_CHECK_HEADERS([pthread.h], [threads=true])
103         AC_CHECK_LIB(pthread, pthread_create)
104      ;;
105    esac
106    if test x$threads = xtrue; then
107      AC_DEFINE(ENABLE_THREADS, [], [Enable thread safety])
108      threadsafe=yes
109    elif test x$threadsafe = xyes; then
110      AC_MSG_ERROR(--enable-threads was given but test for thread functions failed!)
111    else
112      threadsafe=no
113    fi
114 fi
115 AM_CONDITIONAL(USE_THREADS, test x$threadsafe = xyes)
116
117 dnl
118 dnl Allow compilation for fixed or floating-point MFCC and GMM computation
119 dnl
120 fixed_point=false
121 AC_ARG_ENABLE(fixed,
122         AS_HELP_STRING([--enable-fixed=RADIX],
123                        [Use 32-bit fixed-point for MFCC and GMM computation,
124                         optionally specifying a radix point]),[
125 if test x$enableval = xyes; then
126    AC_DEFINE(FIXED_POINT)
127    fixed_point=true
128 else
129    AC_DEFINE(FIXED_POINT, [], [Use fixed-point computation])
130    AC_DEFINE_UNQUOTED(DEFAULT_RADIX,$enableval,[Default radix point for fixed-point])
131 fi])
132 AM_CONDITIONAL(FIXED_POINT, test x$fixed_point = xtrue)
133
134 dnl
135 dnl Enable 16-bit fixed-point (Q15) format for MFCC (less accurate, more fast)
136 dnl
137 AC_ARG_ENABLE(fixed16,
138         AS_HELP_STRING([--enable-fixed16],
139                        [Use 16-bit fixed-point for MFCC computation]),[
140 if test x$enableval = xyes; then
141    AC_DEFINE(FIXED_POINT, [], [Use fixed-point computation])
142    AC_DEFINE(FIXED16, [], [Use Q15 fixed-point computation])
143 fi])
144
145 dnl
146 dnl Enable debugging
147 dnl
148 AC_ARG_ENABLE(debug,
149         AS_HELP_STRING([--enable-debug],
150                         [Enable debugging output]),
151         AC_DEFINE(SPHINX_DEBUG, [],
152                   [Enable debugging output]))
153
154 dnl
155 dnl determine audio type or use none if none supported on this platform
156 dnl
157 case $host in
158         *-*-linux*|*-*-uclinux*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
159                 # Check for ALSA, fall back to OSS
160                 AC_CHECK_HEADER(alsa/asoundlib.h,[
161                         AC_DEFINE(AD_BACKEND_ALSA, [],
162                                  [Use ALSA library for sound I/O])
163                         ad_files="ad_alsa.lo"
164                         ad_backend="AD_BACKEND_ALSA"
165                         AC_CHECK_LIB(asound, snd_pcm_open)],[
166                         AC_DEFINE(AD_BACKEND_OSS, [],
167                                  [Use OSS for sound I/O])
168                         ad_files="ad_oss.lo"
169                         ad_backend="AD_BACKEND_OSS"
170                         ])
171                 ;;
172         *-*-*cygwin*|*-*-*mingw*)
173                 ad_files="play_win32.lo rec_win32.lo"
174                 ad_libs="-lwinmm"
175                 ad_backend="AD_BACKEND_WIN32"
176                 AC_DEFINE(AD_BACKEND_WIN32, [], [Use WinMM interface for sound I/O])
177                 ;;
178         *)
179                 ad_files="ad_base.lo"
180                 ad_backend="AD_BACKEND_NONE"
181                 AC_MSG_RESULT([No audio interface for host type $host.])
182                 AC_DEFINE(AD_BACKEND_NONE, [], [No interface for sound I/O])
183                 ;;
184 esac
185
186 AC_SUBST(ad_files)
187 AC_SUBST(ad_libs)
188 AC_SUBST(ad_backend)
189
190 AM_PROG_LIBTOOL
191
192 dnl
193 dnl Check for Doxygen, and build dox if present
194 dnl
195 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
196 AM_CONDITIONAL(BUILD_DOXYGEN, test "x$HAVE_DOXYGEN" = "xyes")
197
198 dnl
199 dnl Check for Python, and build python module if present
200 dnl
201 use_python=true
202 PYTHON=python
203 AC_ARG_WITH(python,
204         AS_HELP_STRING([--without-python],
205                        [Disable Python extension]),[
206 if test x$withval = xno; then
207    use_python=false
208    PYTHON=bogus
209 elif test x$withval = xyes; then
210    # No specific python binary was given, so check for it in PATH
211    use_python=true
212    PYTHON=python
213 else
214    # A python was given, assume it is in the user's PATH or is fully qualified
215    use_python=true
216    PYTHON="$withval"
217    PYTHON_CONFIG="$withval"-config
218 fi
219 ])
220 if test "x$use_python" = xtrue -a "x$PYTHON" = xpython; then
221    AC_PATH_PROG(PYTHON, python, bogus)
222    AC_PATH_PROG(PYTHON_CONFIG, python-config, bogus)
223 fi
224 if test "x$use_python" = xtrue -a "x$PYTHON" != xbogus -a "x$PYTHON_CONFIG" != xbogus; then
225     PYTHON_INCLUDES=`"$PYTHON_CONFIG" --includes` 
226     CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
227     AC_CHECK_HEADER(Python.h,use_python=true,use_python=false)
228 else
229     use_python=false
230     PYTHON=bogus
231 fi
232 if test "x$use_python" != xtrue ; then
233     AC_WARN([Disabling python since development headers were not found])
234 fi
235 AM_CONDITIONAL(BUILD_PYTHON, test "x$use_python" = "xtrue")
236 AC_SUBST(PYTHON)
237
238 dnl
239 dnl Check for Cython, and rebuild python module if present
240 dnl
241 if test "x$PYTHON" != xbogus; then
242    AC_CHECK_PROG(HAVE_CYTHON, cython, yes, no)
243 fi
244 AM_CONDITIONAL(BUILD_CYTHON, test "x$HAVE_CYTHON" = "xyes")
245
246 dnl
247 dnl Check for pkgconfig
248 dnl
249 AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
250
251 dnl
252 dnl Check for libsndfile
253 dnl
254 if test "x$HAVE_PKGCONFIG" = "xyes"; then
255    PKG_CHECK_MODULES(SNDFILE,sndfile,,true)
256    AC_CHECK_HEADERS([sndfile.h])
257 fi
258 AC_SUBST(SNDFILE_LIBS)
259 AC_SUBST(SNDFILE_CFLAGS)
260
261 AC_CONFIG_FILES([
262 sphinxbase.pc
263 Makefile
264 include/Makefile
265 include/sphinxbase/Makefile
266 python/Makefile
267 python/setup.py
268 src/Makefile
269 src/libsphinxad/Makefile
270 src/libsphinxbase/Makefile
271 src/libsphinxbase/util/Makefile
272 src/libsphinxbase/feat/Makefile
273 src/libsphinxbase/fe/Makefile
274 src/libsphinxbase/lm/Makefile
275 src/sphinx_fe/Makefile
276 src/sphinx_cepview/Makefile
277 src/sphinx_jsgf2fsg/Makefile
278 src/sphinx_adtools/Makefile
279 src/sphinx_lmtools/Makefile
280 doc/Makefile
281 doc/doxyfile
282 test/Makefile
283 test/unit/testfuncs.sh
284 test/unit/Makefile
285 test/unit/test_ad/Makefile
286 test/unit/test_alloc/Makefile
287 test/unit/test_bitvec/Makefile
288 test/unit/test_case/Makefile
289 test/unit/test_string/Makefile
290 test/unit/test_cmdln/Makefile
291 test/unit/test_hash/Makefile
292 test/unit/test_matrix/Makefile
293 test/unit/test_feat/Makefile
294 test/unit/test_fe/Makefile
295 test/unit/test_logmath/Makefile
296 test/unit/test_ngram/Makefile
297 test/unit/test_fsg/Makefile
298 test/unit/test_thread/Makefile
299 test/unit/test_util/Makefile
300 test/regression/testfuncs.sh
301 test/regression/Makefile
302 ])
303 AC_OUTPUT