1 dnl Welcome to the Sphinx automated build system.
2 dnl try not to hurt yourself ;)
4 AC_INIT(pocketsphinx, 0.7)
5 AM_INIT_AUTOMAKE([no-define])
6 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
8 CFLAGS=${CFLAGS:--g -O2 -Wall}
13 dnl Set proper compiler flags and such for some platforms
17 CFLAGS=${CFLAGS:--march=armv4 -mapcs-32 -malignment-traps}
18 LIBS='-lc -lgcc -lwinsock -lcoredll'
19 CFLAGS="$CFLAGS -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
22 LIBS="$LIBS -framework CoreAudio -framework AudioToolbox"
25 # uClinux needs special "flat" binaries
26 LDFLAGS="$LDFLAGS -Wl,-elf2flt"
35 AC_CHECK_TYPES(long long)
36 AC_CHECK_SIZEOF(long long)
40 dnl Check for pkgconfig
42 AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
45 dnl Check for Doxygen, and build dox if present
47 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
48 AM_CONDITIONAL(BUILD_DOXYGEN, test "x$HAVE_DOXYGEN" = "xyes")
51 dnl Check for Python, and build python module if present
56 AS_HELP_STRING([--without-python],
57 [Disable Python extension]),[
58 if test x$withval = xno; then
61 elif test x$withval = xyes; then
62 # No specific python binary was given, so check for it in PATH
66 # A python was given, assume it is in the user's PATH or is fully qualified
69 PYTHON_CONFIG="$withval"-config
72 if 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)
76 if 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)
84 if test "x$use_python" != xtrue ; then
85 AC_WARN([Disabling python since development headers were not found])
87 AM_CONDITIONAL(BUILD_PYTHON, test "x$use_python" = "xtrue")
91 dnl Check for Cython, and rebuild python module if present
93 if test "x$PYTHON" != "xbogus"; then
94 AC_CHECK_PROG(HAVE_CYTHON, cython, yes, no)
96 AM_CONDITIONAL(BUILD_CYTHON, test "x$HAVE_CYTHON" = "xyes")
99 dnl Now check for GStreamer, and build the plugin if it's available
102 PKG_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)
106 dnl Don't build GStreamer when cross-compiling
107 AM_CONDITIONAL(BUILD_GST, test x$cross_compiling != xyes && test "x$HAVE_GST" = "xyes")
108 GST_CFLAGS="$GStreamer_CFLAGS $GStreamer_ERROR"
109 GST_LIBS="$GStreamer_LIBS"
110 AC_SUBST(GST_MAJORMINOR)
114 dnl set the plugindir where plugins should be installed
115 if test "x${prefix}" = "x$HOME"; then
116 plugindir="$HOME/.gstreamer-$GST_MAJORMINOR/plugins"
118 plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
122 dnl set proper LDFLAGS for plugins
123 GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
124 AC_SUBST(GST_PLUGIN_LDFLAGS)
127 dnl Get SphinxBase source from command line if given
129 AC_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.]),
136 dnl Get SphinxBase build directory from command line if given
138 AC_ARG_WITH(sphinxbase-build,
139 AS_HELP_STRING([--with-sphinxbase-build=DIRECTORY],
140 [Look for SphinxBase object files in DIRECTORY]),
141 sphinxbasebuild=$withval)
145 dnl Check for SphinxBase in parent directories
147 if test x$sphinxbase = x; then
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
175 dnl Check for system SphinxBase if none was passed to us
176 dnl Also allow --with-sphinxbase=auto to use system one explicitly
178 if test x$sphinxbase = x || test x$sphinxbase = xauto; then
180 if test "x$HAVE_PKGCONFIG" = "xno"; then
181 SphinxBase_CFLAGS = "-Iusr/include/sphinxbase -I/usr/local/include/sphinxbase"
182 SphinxBase_LIBS = "-lsphinxbase"
184 PKG_CHECK_MODULES(SphinxBase, [sphinxbase],,[
186 [SphinxBase was not found on your system.
187 Make sure that you have installed it and that the
188 PKG_CONFIG_PATH environment variable is set correctly, if
189 it was installed in a non-standard prefix.])])
191 LIBS="$LIBS $SphinxBase_LIBS"
192 CPPFLAGS="$CPPFLAGS $SphinxBase_CFLAGS"
193 AC_CHECK_HEADER(sphinx_config.h,,[
195 [SphinxBase was not found on your system.])])
199 dnl Now verify SphinxBase if defined
200 dnl Sadly, this doesn't work when cross-compiling (for some dumb reason...)
202 : ${sphinxbasebuild=$sphinxbase}
203 if 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"
211 if 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",
215 [SphinxBase headers not found in $sphinxbase. Please use the
216 --with-sphinxbase option to `configure' to specify the location of
217 SphinxBase. Run $0 --help for more information.]))
219 # We include libsphinxbase/.libs because of stupid broken versions of libtool
220 if 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"
223 LIBS="$LIBS -lsphinxbase"
224 LDFLAGS="$LDFLAGS -L$sphinxbasebuild/src/libsphinxad \
225 -L$sphinxbasebuild/src/libsphinxbase \
226 -L$sphinxbasebuild/src/libsphinxbase/.libs"],
228 [SphinxBase libraries were not found in $sphinxbasebuild.
229 Use the --with-sphinxbase-build option to `configure' to specify
230 the build directory for SphinxBase. Run $0 --help for more information.]))
234 AC_SUBST(sphinxbasebuild)
243 src/libpocketsphinx/Makefile
244 src/programs/Makefile
245 src/gst-plugin/Makefile
255 test/regression/Makefile