1 dnl Welcome to the Sphinx automated build system.
2 dnl try not to hurt yourself ;)
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])
9 CFLAGS=${CFLAGS:--g -O2 -Wall}
14 dnl Set proper compiler flags and such for some platforms
18 CFLAGS=${CFLAGS:--march=armv4 -mapcs-32 -malignment-traps}
19 LIBS='-lc -lgcc -lwinsock -lcoredll'
20 CFLAGS="$CFLAGS -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
23 # uClinux needs special "flat" binaries
24 LDFLAGS="$LDFLAGS -Wl,-elf2flt"
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";
39 AC_MSG_ERROR([You need to install bison])
41 AC_ARG_VAR(YACC,[Bison command])
46 AC_CHECK_TYPES(long long)
47 AC_CHECK_SIZEOF(long long)
49 AC_CHECK_FUNCS([popen perror snprintf])
50 AC_CHECK_HEADER(errno.h)
54 dnl Check for Lapack stuff unless disabled
57 use_internal_lapack=false
59 AS_HELP_STRING([--without-lapack],
60 [Disable matrix algebra support (depends on LAPACK)]),[
61 if test x$withval = xno; then
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)
70 AC_DEFINE(WITH_LAPACK, [], [Enable matrix algebra with LAPACK])
72 AM_CONDITIONAL(LAPACK_LITE, test x$use_internal_lapack = xtrue)
73 AM_CONDITIONAL(USE_LAPACK, test x$use_lapack = xtrue)
76 dnl Just make sure we have this...
81 dnl Enable thread-safe versions of some internal functions
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
91 if test x$threadsafe != xno; then
94 dnl Can't seem to check for Windows API functions, but that's okay
95 dnl because we know they will be there...
98 *cygwin*|*mingw*|*wince*)
102 AC_CHECK_HEADERS([pthread.h], [threads=true])
103 AC_CHECK_LIB(pthread, pthread_create)
106 if test x$threads = xtrue; then
107 AC_DEFINE(ENABLE_THREADS, [], [Enable thread safety])
109 elif test x$threadsafe = xyes; then
110 AC_MSG_ERROR(--enable-threads was given but test for thread functions failed!)
115 AM_CONDITIONAL(USE_THREADS, test x$threadsafe = xyes)
118 dnl Allow compilation for fixed or floating-point MFCC and GMM computation
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)
129 AC_DEFINE(FIXED_POINT, [], [Use fixed-point computation])
130 AC_DEFINE_UNQUOTED(DEFAULT_RADIX,$enableval,[Default radix point for fixed-point])
132 AM_CONDITIONAL(FIXED_POINT, test x$fixed_point = xtrue)
135 dnl Enable 16-bit fixed-point (Q15) format for MFCC (less accurate, more fast)
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])
149 AS_HELP_STRING([--enable-debug],
150 [Enable debugging output]),
151 AC_DEFINE(SPHINX_DEBUG, [],
152 [Enable debugging output]))
155 dnl determine audio type or use none if none supported on this platform
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])
169 ad_backend="AD_BACKEND_OSS"
172 *-*-*cygwin*|*-*-*mingw*)
173 ad_files="play_win32.lo rec_win32.lo"
175 ad_backend="AD_BACKEND_WIN32"
176 AC_DEFINE(AD_BACKEND_WIN32, [], [Use WinMM interface for sound I/O])
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])
193 dnl Check for Doxygen, and build dox if present
195 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
196 AM_CONDITIONAL(BUILD_DOXYGEN, test "x$HAVE_DOXYGEN" = "xyes")
199 dnl Check for Python, and build python module if present
204 AS_HELP_STRING([--without-python],
205 [Disable Python extension]),[
206 if test x$withval = xno; then
209 elif test x$withval = xyes; then
210 # No specific python binary was given, so check for it in PATH
214 # A python was given, assume it is in the user's PATH or is fully qualified
217 PYTHON_CONFIG="$withval"-config
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)
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)
232 if test "x$use_python" != xtrue ; then
233 AC_WARN([Disabling python since development headers were not found])
235 AM_CONDITIONAL(BUILD_PYTHON, test "x$use_python" = "xtrue")
239 dnl Check for Cython, and rebuild python module if present
241 if test "x$PYTHON" != xbogus; then
242 AC_CHECK_PROG(HAVE_CYTHON, cython, yes, no)
244 AM_CONDITIONAL(BUILD_CYTHON, test "x$HAVE_CYTHON" = "xyes")
247 dnl Check for pkgconfig
249 AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
252 dnl Check for libsndfile
254 if test "x$HAVE_PKGCONFIG" = "xyes"; then
255 PKG_CHECK_MODULES(SNDFILE,sndfile,,true)
256 AC_CHECK_HEADERS([sndfile.h])
258 AC_SUBST(SNDFILE_LIBS)
259 AC_SUBST(SNDFILE_CFLAGS)
265 include/sphinxbase/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
283 test/unit/testfuncs.sh
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