forked from cmusphinx/pocketsphinx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
165 lines (144 loc) · 4.34 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
dnl Welcome to the Sphinx automated build system.
dnl try not to hurt yourself ;)
AC_INIT(pocketsphinx, 5prealpha)
AM_INIT_AUTOMAKE([no-define foreign])
AC_CONFIG_MACRO_DIR([m4])
CFLAGS=${CFLAGS:--g -O2 -Wall}
AC_CANONICAL_HOST
AC_PROG_CC
AC_WORDS_BIGENDIAN
AC_CHECK_TYPES(long long)
AC_CHECK_SIZEOF(long long)
LT_INIT
dnl
dnl Check for pkgconfig
dnl
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
dnl
dnl Check for Doxygen, and build dox if present
dnl
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
AM_CONDITIONAL(BUILD_DOXYGEN, test "x$HAVE_DOXYGEN" = "xyes")
dnl Check for SWIG and Python
AC_ARG_WITH(python,
AS_HELP_STRING([--with-python],
[Enable Python extension, built with swig, enabled by default]))
if test "x${with_python}" != "xno"; then
AM_PATH_PYTHON(2.6, [], [AC_MSG_ERROR([python not found])])
AX_PYTHON_DEVEL()
AX_PKG_SWIG(2.0, [], [AC_MSG_ERROR([swig not found])])
fi
AC_SUBST([PYTHON_CPPFLAGS])
AM_CONDITIONAL(BUILD_SWIG, test "x$SWIG" != "x")
dnl swig python check
dnl
dnl Now check for GStreamer, and build the plugin if it's available
dnl
GST_MAJORMINOR=1.0
PKG_CHECK_MODULES(GStreamer, [gstreamer-$GST_MAJORMINOR >= 1.0
gstreamer-base-$GST_MAJORMINOR >= 1.0
gstreamer-plugins-base-$GST_MAJORMINOR >= 1.0],
HAVE_GST=yes, HAVE_GST=no)
dnl Don't build GStreamer when cross-compiling
AM_CONDITIONAL(BUILD_GST, test x$cross_compiling != xyes && test "x$HAVE_GST" = "xyes")
GST_CFLAGS="$GStreamer_CFLAGS $GStreamer_ERROR"
GST_LIBS="$GStreamer_LIBS"
AC_SUBST(GST_MAJORMINOR)
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
dnl set the plugindir where plugins should be installed
if test "x${prefix}" = "x$HOME"; then
plugindir="$HOME/.gstreamer-$GST_MAJORMINOR/plugins"
else
plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
fi
AC_SUBST(plugindir)
dnl set proper LDFLAGS for plugins
GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
AC_SUBST(GST_PLUGIN_LDFLAGS)
dnl
dnl Get SphinxBase from command line if given
dnl
AC_ARG_WITH(sphinxbase,
AS_HELP_STRING([--with-sphinxbase=DIRECTORY],
[Look for SphinxBase installation in DIRECTORY. If this is 'auto',
the system-wide installation will be used.]),
sphinxbase=$withval)
dnl
dnl Check for SphinxBase in parent directories
dnl
if test x$sphinxbase = x; then
dn=`dirname $0`
case "$dn" in
.)
sbdir="`pwd`/.."
;;
[\\/]* | ?:[\\/]*)
sbdir="$dn/.."
;;
*)
sbdir="`pwd`/$dn/.."
;;
esac
# Look for sphinxbase in the parent directory
for sb in "$sbdir/sphinxbase" \
"$sbdir/sphinxbase"*; do
AC_MSG_CHECKING([for sphinxbase in $sb])
if test -f "$sb/src/libsphinxbase/libsphinxbase.la"; then
sphinxbase="$sb"
AC_MSG_RESULT(yes)
break
else
AC_MSG_RESULT(no)
fi
done
fi
dnl
dnl Check for system SphinxBase if none was passed to us
dnl Also allow --with-sphinxbase=auto to use system one explicitly
dnl
if test x$sphinxbase = x || test x$sphinxbase = xauto; then
sphinxbase=
if test "x$HAVE_PKGCONFIG" = "xno"; then
SPHINXBASE_CFLAGS = "-I/usr/include/sphinxbase -I/usr/local/include/sphinxbase"
SPHINXBASE_LIBS = "-lsphinxbase"
SPHINXBASE_PREFIX="/usr/local"
else
PKG_CHECK_MODULES(SPHINXBASE, [sphinxbase],,[
AC_MSG_FAILURE(dnl
[SphinxBase was not found on your system.
Make sure that you have installed it and that the
PKG_CONFIG_PATH environment variable is set correctly, if
it was installed in a non-standard prefix.])])
SPHINXBASE_PREFIX=`pkg-config --variable=prefix sphinxbase`
fi
LIBS="$LIBS $SPHINXBASE_LIBS"
CPPFLAGS="$CPPFLAGS $SPHINXBASE_CFLAGS"
SPHINXBASE_SWIG="$SPHINXBASE_PREFIX/share/sphinxbase/swig"
AC_CHECK_HEADER(sphinx_config.h,,[AC_MSG_FAILURE([SphinxBase was not found on your system.])])
else
LIBS="$LIBS -lsphinxbase"
LDFLAGS="$LDFLAGS -L$sphinxbase/lib -L$sphinxbase/src/libsphinxad -L$sphinxbase/src/libsphinxbase"
CPPFLAGS="$CPPFLAGS -I$sphinxbase/include -I$sphinxbase/include/sphinxbase"
SPHINXBASE_SWIG="$sphinxbase/swig"
fi
AC_SUBST(SPHINXBASE_SWIG)
AC_OUTPUT([
pocketsphinx.pc
Makefile
include/Makefile
src/Makefile
swig/Makefile
swig/python/Makefile
swig/python/test/Makefile
src/libpocketsphinx/Makefile
src/programs/Makefile
src/gst-plugin/Makefile
doc/Makefile
doc/doxyfile
model/Makefile
test/Makefile
test/testfuncs.sh
test/unit/Makefile
test/regression/Makefile
])