Removing gstreamer plugin
[profile/ivi/pocketsphinx.git] / configure.in
1 dnl Welcome to the Sphinx automated build system.
2 dnl try not to hurt yourself ;)
3
4 AC_INIT(pocketsphinx, 0.7)
5 AM_INIT_AUTOMAKE([no-define])
6 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
7
8 CFLAGS=${CFLAGS:--g -O2 -Wall}
9
10 AC_CANONICAL_HOST
11
12 dnl
13 dnl Set proper compiler flags and such for some platforms
14 dnl
15 case $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      ;;
30 esac     
31
32 AC_PROG_CC
33 AM_PROG_LIBTOOL
34 AC_WORDS_BIGENDIAN
35 AC_CHECK_TYPES(long long)
36 AC_CHECK_SIZEOF(long long)
37 AC_CHECK_FUNCS(dup2)
38
39 dnl
40 dnl Check for pkgconfig
41 dnl
42 AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
43
44 dnl
45 dnl Check for Doxygen, and build dox if present
46 dnl
47 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
48 AM_CONDITIONAL(BUILD_DOXYGEN, test "x$HAVE_DOXYGEN" = "xyes")
49
50 dnl
51 dnl Check for Python, and build python module if present
52 dnl
53 use_python=true
54 PYTHON=python
55 AC_ARG_WITH(python,
56         AS_HELP_STRING([--without-python],
57                        [Disable Python extension]),[
58 if test x$withval = xno; then
59    use_python=false
60    PYTHON=bogus
61 elif 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
65 else
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
70 fi
71 ])
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)
75 fi
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)
80 else
81     use_python=false
82     PYTHON=bogus
83 fi
84 if test "x$use_python" != xtrue ; then
85     AC_WARN([Disabling python since development headers were not found])
86 fi
87 AM_CONDITIONAL(BUILD_PYTHON, test "x$use_python" = "xtrue")
88 AC_SUBST(PYTHON)
89
90 dnl
91 dnl Check for Cython, and rebuild python module if present
92 dnl
93 if test "x$PYTHON" != "xbogus"; then
94    AC_CHECK_PROG(HAVE_CYTHON, cython, yes, no)
95 fi
96 AM_CONDITIONAL(BUILD_CYTHON, test "x$HAVE_CYTHON" = "xyes")
97
98 dnl
99 dnl Now check for GStreamer, and build the plugin if it's available
100 dnl
101 GST_MAJORMINOR=0.10
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)
111 AC_SUBST(GST_CFLAGS)
112 AC_SUBST(GST_LIBS)
113
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"
117 else
118   plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
119 fi
120 AC_SUBST(plugindir)
121
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)
125
126 dnl
127 dnl Get SphinxBase source from command line if given
128 dnl
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.]),
133                         sphinxbase=$withval)
134
135 dnl
136 dnl Get SphinxBase build directory from command line if given
137 dnl
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)
142
143
144 dnl
145 dnl Check for SphinxBase in parent directories
146 dnl
147 if 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
172 fi
173
174 dnl
175 dnl Check for system SphinxBase if none was passed to us
176 dnl Also allow --with-sphinxbase=auto to use system one explicitly
177 dnl
178 if 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.
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.])])
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.])])
196 fi
197
198 dnl
199 dnl Now verify SphinxBase if defined
200 dnl Sadly, this doesn't work when cross-compiling (for some dumb reason...)
201 dnl
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"
210 fi
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",
214    AC_ERROR(
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.]))
218 fi
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"],
227                    AC_ERROR(
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.]))
231 fi
232
233 AC_SUBST(sphinxbase)
234 AC_SUBST(sphinxbasebuild)
235
236 AC_OUTPUT([
237 pocketsphinx.pc
238 Makefile
239 include/Makefile
240 python/Makefile
241 python/setup.py
242 src/Makefile
243 src/libpocketsphinx/Makefile
244 src/programs/Makefile
245 src/gst-plugin/Makefile
246 doc/Makefile
247 doc/doxyfile
248 model/Makefile
249 model/hmm/Makefile
250 model/lm/Makefile
251 scripts/Makefile
252 test/Makefile
253 test/testfuncs.sh
254 test/unit/Makefile
255 test/regression/Makefile
256 ])