1dnl Welcome to the Sphinx automated build system. 2dnl try not to hurt yourself ;) 3 4AC_INIT([sphinxbase], 0.8) 5AC_CONFIG_HEADERS([include/config.h include/sphinx_config.h]) 6AM_INIT_AUTOMAKE([no-define]) 7AC_CONFIG_MACRO_DIR([m4]) 8 9CFLAGS=${CFLAGS:--g -O2 -Wall} 10 11AC_CANONICAL_HOST 12 13dnl 14dnl Set proper compiler flags and such for some platforms 15dnl 16case $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 ;; 28esac 29 30AC_ISC_POSIX 31AC_PROG_CC 32AC_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 36AC_CHECK_PROG(YACC, bison, [bison -y], no) 37if test "x$YACC" = "xno"; 38then 39 AC_MSG_ERROR([You need to install bison]) 40fi 41AC_ARG_VAR(YACC,[Bison command]) 42 43AC_HEADER_STDC 44AC_C_BIGENDIAN 45AC_TYPE_SIGNAL 46AC_CHECK_TYPES(long long) 47AC_CHECK_SIZEOF(long long) 48AC_CHECK_SIZEOF(long) 49AC_CHECK_FUNCS([popen perror snprintf]) 50AC_CHECK_HEADER(errno.h) 51AM_ICONV 52 53dnl 54dnl Check for Lapack stuff unless disabled 55dnl 56use_lapack=true 57use_internal_lapack=false 58AC_ARG_WITH(lapack, 59 AS_HELP_STRING([--without-lapack], 60 [Disable matrix algebra support (depends on LAPACK)]),[ 61if test x$withval = xno; then 62 use_lapack=false 63fi 64]) 65if 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]) 71fi 72AM_CONDITIONAL(LAPACK_LITE, test x$use_internal_lapack = xtrue) 73AM_CONDITIONAL(USE_LAPACK, test x$use_lapack = xtrue) 74 75dnl 76dnl Just make sure we have this... 77dnl 78AC_CHECK_LIB(m, log) 79 80dnl 81dnl Enable thread-safe versions of some internal functions 82dnl 83threadsafe=auto 84AC_ARG_ENABLE(threads, 85 AS_HELP_STRING([--disable-threads], 86 [Disable thread-safe versions of memory allocation functions (default: check)]),[ 87if test x$enableval != x; then 88 threadsafe=$enableval 89fi 90]) 91if 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 114fi 115AM_CONDITIONAL(USE_THREADS, test x$threadsafe = xyes) 116 117dnl 118dnl Allow compilation for fixed or floating-point MFCC and GMM computation 119dnl 120fixed_point=false 121AC_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]),[ 125if test x$enableval = xyes; then 126 AC_DEFINE(FIXED_POINT) 127 fixed_point=true 128else 129 AC_DEFINE(FIXED_POINT, [], [Use fixed-point computation]) 130 AC_DEFINE_UNQUOTED(DEFAULT_RADIX,$enableval,[Default radix point for fixed-point]) 131fi]) 132AM_CONDITIONAL(FIXED_POINT, test x$fixed_point = xtrue) 133 134dnl 135dnl Enable 16-bit fixed-point (Q15) format for MFCC (less accurate, more fast) 136dnl 137AC_ARG_ENABLE(fixed16, 138 AS_HELP_STRING([--enable-fixed16], 139 [Use 16-bit fixed-point for MFCC computation]),[ 140if test x$enableval = xyes; then 141 AC_DEFINE(FIXED_POINT, [], [Use fixed-point computation]) 142 AC_DEFINE(FIXED16, [], [Use Q15 fixed-point computation]) 143fi]) 144 145dnl 146dnl Enable debugging 147dnl 148AC_ARG_ENABLE(debug, 149 AS_HELP_STRING([--enable-debug], 150 [Enable debugging output]), 151 AC_DEFINE(SPHINX_DEBUG, [], 152 [Enable debugging output])) 153 154dnl 155dnl determine audio type or use none if none supported on this platform 156dnl 157case $host in 158 *-*-linux*|*-*-uclinux*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*) 159 # Check for PulseAudio, JACK, then fallback ALSA, then fall back to OSS 160 AC_CHECK_HEADER(pulse/pulseaudio.h,[ 161 AC_DEFINE(AD_BACKEND_PULSEAUDIO, [], 162 [Use PulseAudio library for sound I/O]) 163 ad_files="ad_pulse.lo" 164 ad_backend="AD_BACKEND_PULSEAUDIO" 165 AC_CHECK_LIB(pulse-simple, pa_simple_new) 166 AC_CHECK_LIB(pulse, pa_strerror) 167 ],[ 168 AC_CHECK_HEADER(jack/jack.h,[ 169 AC_DEFINE(AD_BACKEND_JACK, [], 170 [Use Jack library for sound I/O]) 171 ad_files="ad_jack.lo" 172 ad_backend="AD_BACKEND_JACK" 173 AC_CHECK_LIB(jack, jack_connect)],[ 174 AC_CHECK_HEADER(alsa/asoundlib.h,[ 175 AC_DEFINE(AD_BACKEND_ALSA, [], 176 [Use ALSA library for sound I/O]) 177 ad_files="ad_alsa.lo" 178 ad_backend="AD_BACKEND_ALSA" 179 AC_CHECK_LIB(asound, snd_pcm_open)],[ 180 AC_DEFINE(AD_BACKEND_OSS, [], 181 [Use OSS for sound I/O]) 182 ad_files="ad_oss.lo" 183 ad_backend="AD_BACKEND_OSS" 184 ]) 185 ]) 186 ]) 187 ;; 188 *-*-*cygwin*|*-*-*mingw*) 189 ad_files="play_win32.lo rec_win32.lo" 190 ad_libs="-lwinmm" 191 ad_backend="AD_BACKEND_WIN32" 192 AC_DEFINE(AD_BACKEND_WIN32, [], [Use WinMM interface for sound I/O]) 193 ;; 194 *) 195 ad_files="ad_base.lo" 196 ad_backend="AD_BACKEND_NONE" 197 AC_MSG_RESULT([No audio interface for host type $host.]) 198 AC_DEFINE(AD_BACKEND_NONE, [], [No interface for sound I/O]) 199 ;; 200esac 201 202AC_SUBST(ad_files) 203AC_SUBST(ad_libs) 204AC_SUBST(ad_backend) 205 206AM_PROG_LIBTOOL 207 208dnl 209dnl Check for Doxygen, and build dox if present 210dnl 211AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no) 212AM_CONDITIONAL(BUILD_DOXYGEN, test "x$HAVE_DOXYGEN" = "xyes") 213 214dnl 215dnl Check for Python, and build python module if present 216dnl 217use_python=true 218PYTHON=python 219AC_ARG_WITH(python, 220 AS_HELP_STRING([--without-python], 221 [Disable Python extension]),[ 222if test x$withval = xno; then 223 use_python=false 224 PYTHON=bogus 225elif test x$withval = xyes; then 226 # No specific python binary was given, so check for it in PATH 227 use_python=true 228 PYTHON=python 229else 230 # A python was given, assume it is in the user's PATH or is fully qualified 231 use_python=true 232 PYTHON="$withval" 233 PYTHON_CONFIG="$withval"-config 234fi 235]) 236if test "x$use_python" = xtrue -a "x$PYTHON" = xpython; then 237 AC_PATH_PROG(PYTHON, python, bogus) 238 AC_PATH_PROG(PYTHON_CONFIG, python-config, bogus) 239fi 240if test "x$use_python" = xtrue -a "x$PYTHON" != xbogus -a "x$PYTHON_CONFIG" != xbogus; then 241 PYTHON_INCLUDES=`"$PYTHON_CONFIG" --includes` 242 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" 243 AC_CHECK_HEADER(Python.h,use_python=true,use_python=false) 244else 245 use_python=false 246 PYTHON=bogus 247fi 248if test "x$use_python" != xtrue ; then 249 AC_WARN([Disabling python since development headers were not found]) 250fi 251AM_CONDITIONAL(BUILD_PYTHON, test "x$use_python" = "xtrue") 252AC_SUBST(PYTHON) 253 254dnl 255dnl Check for Cython, and rebuild python module if present 256dnl 257if test "x$PYTHON" != xbogus; then 258 AC_CHECK_PROG(HAVE_CYTHON, cython, yes, no) 259fi 260AM_CONDITIONAL(BUILD_CYTHON, test "x$HAVE_CYTHON" = "xyes") 261 262dnl 263dnl Check for pkgconfig 264dnl 265AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no) 266 267dnl 268dnl Check for libsndfile 269dnl 270if test "x$HAVE_PKGCONFIG" = "xyes"; then 271 PKG_CHECK_MODULES(SNDFILE,sndfile,,true) 272 AC_CHECK_HEADERS([sndfile.h]) 273 PKG_CHECK_MODULES(SAMPLERATE,samplerate,,true) 274 AC_CHECK_HEADERS([samplerate.h]) 275fi 276AC_SUBST(SNDFILE_LIBS) 277AC_SUBST(SNDFILE_CFLAGS) 278AC_SUBST(SAMPLERATE_LIBS) 279AC_SUBST(SAMPLERATE_CFLAGS) 280 281AC_CONFIG_FILES([ 282sphinxbase.pc 283Makefile 284include/Makefile 285include/sphinxbase/Makefile 286python/Makefile 287python/setup.py 288src/Makefile 289src/libsphinxad/Makefile 290src/libsphinxbase/Makefile 291src/libsphinxbase/util/Makefile 292src/libsphinxbase/feat/Makefile 293src/libsphinxbase/fe/Makefile 294src/libsphinxbase/lm/Makefile 295src/sphinx_fe/Makefile 296src/sphinx_cepview/Makefile 297src/sphinx_jsgf2fsg/Makefile 298src/sphinx_adtools/Makefile 299src/sphinx_lmtools/Makefile 300doc/Makefile 301doc/doxyfile 302test/Makefile 303test/unit/testfuncs.sh 304test/unit/Makefile 305test/unit/test_ad/Makefile 306test/unit/test_alloc/Makefile 307test/unit/test_bitvec/Makefile 308test/unit/test_case/Makefile 309test/unit/test_string/Makefile 310test/unit/test_cmdln/Makefile 311test/unit/test_hash/Makefile 312test/unit/test_matrix/Makefile 313test/unit/test_feat/Makefile 314test/unit/test_fe/Makefile 315test/unit/test_logmath/Makefile 316test/unit/test_lineiter/Makefile 317test/unit/test_ngram/Makefile 318test/unit/test_fsg/Makefile 319test/unit/test_thread/Makefile 320test/unit/test_util/Makefile 321test/regression/testfuncs.sh 322test/regression/Makefile 323]) 324AC_OUTPUT 325