1dnl Welcome to the Sphinx automated build system. 2dnl try not to hurt yourself ;) 3 4AC_INIT(pocketsphinx, 0.8) 5AM_INIT_AUTOMAKE([no-define]) 6AC_CONFIG_MACRO_DIR([m4]) 7 8CFLAGS=${CFLAGS:--g -O2 -Wall} 9 10AC_CANONICAL_HOST 11 12dnl 13dnl Set proper compiler flags and such for some platforms 14dnl 15case $host in 16 arm-wince-pe*) 17 CFLAGS=${CFLAGS:--march=armv4 -mapcs-32 -malignment-traps} 18 LIBS='-lc -lgcc -lwinsock -lcoredll' 19 CFLAGS="$CFLAGS -DNEWLIB -DSARM -DWIN32 -DGNUWINCE" 20 ;; 21 *apple*) 22 LIBS="$LIBS -framework CoreAudio -framework AudioToolbox" 23 ;; 24 *uclinux*) 25 # uClinux needs special "flat" binaries 26 LDFLAGS="$LDFLAGS -Wl,-elf2flt" 27 ;; 28 *) 29 ;; 30esac 31 32AC_PROG_CC 33AM_PROG_LIBTOOL 34AC_WORDS_BIGENDIAN 35AC_CHECK_TYPES(long long) 36AC_CHECK_SIZEOF(long long) 37AC_CHECK_FUNCS(dup2) 38 39dnl 40dnl Check for pkgconfig 41dnl 42AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no) 43 44dnl 45dnl Check for Doxygen, and build dox if present 46dnl 47AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no) 48AM_CONDITIONAL(BUILD_DOXYGEN, test "x$HAVE_DOXYGEN" = "xyes") 49 50dnl 51dnl Check for Python, and build python module if present 52dnl 53use_python=true 54PYTHON=python 55AC_ARG_WITH(python, 56 AS_HELP_STRING([--without-python], 57 [Disable Python extension]),[ 58if test x$withval = xno; then 59 use_python=false 60 PYTHON=bogus 61elif test x$withval = xyes; then 62 # No specific python binary was given, so check for it in PATH 63 use_python=true 64 PYTHON=python 65else 66 # A python was given, assume it is in the user's PATH or is fully qualified 67 use_python=true 68 PYTHON="$withval" 69 PYTHON_CONFIG="$withval"-config 70fi 71]) 72if test "x$use_python" = xtrue -a "x$PYTHON" = xpython; then 73 AC_PATH_PROG(PYTHON, python, bogus) 74 AC_PATH_PROG(PYTHON_CONFIG, python-config, bogus) 75fi 76if test "x$use_python" = xtrue -a "x$PYTHON" != xbogus -a "x$PYTHON_CONFIG" != xbogus; then 77 PYTHON_INCLUDES=`"$PYTHON_CONFIG" --includes` 78 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" 79 AC_CHECK_HEADER(Python.h,use_python=true,use_python=false) 80else 81 use_python=false 82 PYTHON=bogus 83fi 84if test "x$use_python" != xtrue ; then 85 AC_WARN([Disabling python since development headers were not found]) 86fi 87AM_CONDITIONAL(BUILD_PYTHON, test "x$use_python" = "xtrue") 88AC_SUBST(PYTHON) 89 90dnl 91dnl Check for Cython, and rebuild python module if present 92dnl 93if test "x$PYTHON" != "xbogus"; then 94 AC_CHECK_PROG(HAVE_CYTHON, cython, yes, no) 95fi 96AM_CONDITIONAL(BUILD_CYTHON, test "x$HAVE_CYTHON" = "xyes") 97 98dnl 99dnl Now check for GStreamer, and build the plugin if it's available 100dnl 101GST_MAJORMINOR=0.10 102PKG_CHECK_MODULES(GStreamer, [gstreamer-$GST_MAJORMINOR >= 0.10.0 103 gstreamer-base-$GST_MAJORMINOR >= 0.10.0 104 gstreamer-plugins-base-$GST_MAJORMINOR >= 0.10.0], 105 HAVE_GST=yes, HAVE_GST=no) 106dnl Don't build GStreamer when cross-compiling 107AM_CONDITIONAL(BUILD_GST, test x$cross_compiling != xyes && test "x$HAVE_GST" = "xyes") 108GST_CFLAGS="$GStreamer_CFLAGS $GStreamer_ERROR" 109GST_LIBS="$GStreamer_LIBS" 110AC_SUBST(GST_MAJORMINOR) 111AC_SUBST(GST_CFLAGS) 112AC_SUBST(GST_LIBS) 113 114dnl set the plugindir where plugins should be installed 115if test "x${prefix}" = "x$HOME"; then 116 plugindir="$HOME/.gstreamer-$GST_MAJORMINOR/plugins" 117else 118 plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" 119fi 120AC_SUBST(plugindir) 121 122dnl set proper LDFLAGS for plugins 123GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*' 124AC_SUBST(GST_PLUGIN_LDFLAGS) 125 126dnl 127dnl Get SphinxBase source from command line if given 128dnl 129AC_ARG_WITH(sphinxbase, 130 AS_HELP_STRING([--with-sphinxbase=DIRECTORY], 131 [Look for SphinxBase source files in DIRECTORY. If this is 'auto', 132 the system-wide installation will be used.]), 133 sphinxbase=$withval) 134 135dnl 136dnl Get SphinxBase build directory from command line if given 137dnl 138AC_ARG_WITH(sphinxbase-build, 139 AS_HELP_STRING([--with-sphinxbase-build=DIRECTORY], 140 [Look for SphinxBase object files in DIRECTORY]), 141 sphinxbasebuild=$withval) 142 143 144dnl 145dnl Check for SphinxBase in parent directories 146dnl 147if test x$sphinxbase = x; then 148 dn=`dirname $0` 149 case "$dn" in 150 .) 151 sbdir="`pwd`/.." 152 ;; 153 [\\/]* | ?:[\\/]*) 154 sbdir="$dn/.." 155 ;; 156 *) 157 sbdir="`pwd`/$dn/.." 158 ;; 159 esac 160 # Look for sphinxbase in the parent directory 161 for sb in "$sbdir/sphinxbase" \ 162 "$sbdir/sphinxbase"*; do 163 AC_MSG_CHECKING([for sphinxbase in $sb]) 164 if test -f "$sb/src/libsphinxbase/libsphinxbase.la"; then 165 sphinxbase="$sb" 166 AC_MSG_RESULT(yes) 167 break 168 else 169 AC_MSG_RESULT(no) 170 fi 171 done 172fi 173 174dnl 175dnl Check for system SphinxBase if none was passed to us 176dnl Also allow --with-sphinxbase=auto to use system one explicitly 177dnl 178if test x$sphinxbase = x || test x$sphinxbase = xauto; then 179 sphinxbase= 180 if test "x$HAVE_PKGCONFIG" = "xno"; then 181 SphinxBase_CFLAGS = "-Iusr/include/sphinxbase -I/usr/local/include/sphinxbase" 182 SphinxBase_LIBS = "-lsphinxbase" 183 else 184 PKG_CHECK_MODULES(SphinxBase, [sphinxbase],,[ 185 AC_MSG_FAILURE(dnl 186[SphinxBase was not found on your system. 187Make sure that you have installed it and that the 188PKG_CONFIG_PATH environment variable is set correctly, if 189it was installed in a non-standard prefix.])]) 190 fi 191 LIBS="$LIBS $SphinxBase_LIBS" 192 CPPFLAGS="$CPPFLAGS $SphinxBase_CFLAGS" 193 AC_CHECK_HEADER(sphinx_config.h,,[ 194 AC_MSG_FAILURE(dnl 195[SphinxBase was not found on your system.])]) 196fi 197 198dnl 199dnl Now verify SphinxBase if defined 200dnl Sadly, this doesn't work when cross-compiling (for some dumb reason...) 201dnl 202: ${sphinxbasebuild=$sphinxbase} 203if test x$sphinxbase != x && test x$cross_compiling = xyes; then 204 CPPFLAGS="-I$sphinxbase/include -I$sphinxbasebuild/include $CPPFLAGS" 205 LIBS="$LIBS -lsphinxbase" 206 # We include libsphinxbase/.libs because of stupid broken versions of libtool 207 LDFLAGS="$LDFLAGS -L$sphinxbasebuild/src/libsphinxad \ 208 -L$sphinxbasebuild/src/libsphinxbase \ 209 -L$sphinxbasebuild/src/libsphinxbase/.libs" 210fi 211if test x$sphinxbase != x && test x$cross_compiling != xyes; then 212 AC_CHECK_FILE($sphinxbase/include/sphinxbase/prim_type.h, 213 CPPFLAGS="-I$sphinxbase/include $CPPFLAGS", 214 AC_ERROR( 215[SphinxBase headers not found in $sphinxbase. Please use the 216--with-sphinxbase option to `configure' to specify the location of 217SphinxBase. Run $0 --help for more information.])) 218fi 219# We include libsphinxbase/.libs because of stupid broken versions of libtool 220if test x$sphinxbasebuild != x && test x$cross_compiling != xyes; then 221 AC_CHECK_FILE($sphinxbasebuild/src/libsphinxbase/libsphinxbase.la, 222[CPPFLAGS="-I$sphinxbasebuild/include $CPPFLAGS" 223LIBS="$LIBS -lsphinxbase" 224LDFLAGS="$LDFLAGS -L$sphinxbasebuild/src/libsphinxad \ 225 -L$sphinxbasebuild/src/libsphinxbase \ 226 -L$sphinxbasebuild/src/libsphinxbase/.libs"], 227 AC_ERROR( 228[SphinxBase libraries were not found in $sphinxbasebuild. 229Use the --with-sphinxbase-build option to `configure' to specify 230the build directory for SphinxBase. Run $0 --help for more information.])) 231fi 232 233AC_SUBST(sphinxbase) 234AC_SUBST(sphinxbasebuild) 235 236AC_OUTPUT([ 237pocketsphinx.pc 238Makefile 239include/Makefile 240python/Makefile 241python/setup.py 242src/Makefile 243src/libpocketsphinx/Makefile 244src/programs/Makefile 245src/gst-plugin/Makefile 246doc/Makefile 247doc/doxyfile 248model/Makefile 249model/hmm/Makefile 250model/lm/Makefile 251test/Makefile 252test/testfuncs.sh 253test/unit/Makefile 254test/regression/Makefile 255]) 256