3 # Process this file with autoconf to produce a configure script.
7 AC_INIT([speech-recognition],
8 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
9 [krisztian.litkey at intel.com])
11 AC_CONFIG_SRCDIR([src])
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_HEADER([src/config.h])
16 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
18 m4_define(version_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
19 m4_define(version_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
20 m4_define(version_patch, `echo $VERSION | cut -d. -f3 | cut -d- -f1`)
23 AC_SUBST(VERSION_MAJOR, version_major)
24 AC_SUBST(VERSION_MINOR, version_minor)
25 AC_SUBST(VERSION_PATCH, version_patch)
26 AC_SUBST(VERSION_FULL, version_major.version_minor.version_patch)
28 SRS_VERSION_INFO="0:0:0"
29 AC_SUBST(SRS_VERSION_INFO)
31 # Disable static libraries.
34 # Checks for programs.
37 # We need AC_PROG_CXX if Qt support is enabled but (at least some
38 # versions of autotools) cannot handle conditional use of this.
45 # Checks for libraries.
46 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
48 # Checks for header files.
50 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
52 # Checks for typedefs, structures, and compiler characteristics.
62 AC_CHECK_MEMBERS([struct stat.st_rdev])
67 AC_CHECK_TYPES([ptrdiff_t])
69 # Checks for library functions.
74 AC_CHECK_FUNCS([memmove memset])
76 # Check and enable extra compiler warnings if they are supported.
77 AC_ARG_ENABLE(extra-warnings,
78 [ --enable-extra-warnings enable extra compiler warnings],
79 [extra_warnings=$enableval], [extra_warnings=auto])
82 warncflags="-Wall -Wextra"
83 if test "$extra_warnings" != "no"; then
84 save_CPPFLAGS="$CPPFLAGS"
85 for opt in $warncflags; do
86 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
87 [WARNING_CFLAGS="$WARNING_CFLAGS $opt"])
89 CPPFLAGS="$save_CPPFLAGS"
92 AC_SUBST(WARNING_CFLAGS)
94 # Check for the necessary Murphy components.
95 PKG_CHECK_MODULES(MURPHY_COMMON, murphy-common)
96 PKG_CHECK_MODULES(MURPHY_PULSE, murphy-pulse)
97 PKG_CHECK_MODULES(MURPHY_GLIB, murphy-glib)
98 PKG_CHECK_MODULES(MURPHY_RESOURCE, murphy-resource)
99 PKG_CHECK_MODULES(MURPHY_BREEDLINE, breedline-murphy)
100 AC_SUBST(MURPHY_COMMON_CFLAGS)
101 AC_SUBST(MURPHY_COMMON_LIBS)
102 AC_SUBST(MURPHY_PULSE_CFLAGS)
103 AC_SUBST(MURPHY_PULSE_LIBS)
104 AC_SUBST(MURPHY_GLIB_CFLAGS)
105 AC_SUBST(MURPHY_GLIB_LIBS)
106 AC_SUBST(MURPHY_RESOURCE_CFLAGS)
107 AC_SUBST(MURPHY_RESOURCE_LIBS)
108 AC_SUBST(MURPHY_BREEDLINE_CFLAGS)
109 AC_SUBST(MURPHY_BREEDLINE_LIBS)
111 # Check for PulseAudio.
112 PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.22)
113 PKG_CHECK_MODULES(PULSE_GLIB, libpulse-mainloop-glib >= 0.922)
114 AC_SUBST(PULSE_CFLAGS)
116 AC_SUBST(PULSE_GLIB_CFLAGS)
117 AC_SUBST(PULSE_GLIB_LIBS)
119 # Check if potentially GPL bits are allowed to be enabled.
121 [ --enable-gpl enable linking against GPL code],
122 [enable_gpl=$enableval], [enable_gpl=no])
124 # Check if DBUS was enabled.
126 [ --enable-dbus enable D-BUS support],
127 [enable_dbus=$enableval], [enable_dbus=no])
129 if test "$enable_dbus" = "yes"; then
130 if test "$enable_gpl" = "no"; then
131 AC_MSG_ERROR([D-Bus support requires the --enable-gpl option.])
133 PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.70)
134 DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
135 AC_SUBST(DBUS_SESSION_DIR)
137 PKG_CHECK_MODULES(MURPHY_DBUS, murphy-dbus-libdbus)
139 AC_MSG_NOTICE([D-Bus support is disabled.])
142 if test "$enable_dbus" = "yes"; then
143 AC_DEFINE([DBUS_ENABLED], 1, [Enable D-BUS support ?])
146 AM_CONDITIONAL(DBUS_ENABLED, [test "$enable_dbus" = "yes"])
147 AC_SUBST(DBUS_ENABLED)
148 AC_SUBST(MURPHY_DBUS_CFLAGS)
149 AC_SUBST(MURPHY_DBUS_LIBS)
150 AC_SUBST(DBUS_CFLAGS)
153 # XXX TODO temporarily disable mpris2 and bluetooth plugins
154 AM_CONDITIONAL(MPRIS2_ENABLED, [test "xno" = "xyes"])
155 AM_CONDITIONAL(BLUETOOTH_ENABLED, [test "xno" = "xyes"])
156 AC_SUBST(MPRIS2_ENABLED)
157 AC_SUBST(BLUETOOTH_ENABLED)
159 # Set up common SRS compilation and linking flags.
165 # Add LIBDIR to config.h.
166 AC_MSG_CHECKING([libdir])
167 AC_MSG_RESULT([$libdir])
168 AC_SUBST(LIBDIR, [$libdir])
170 # Check if sphinx was enabled.
171 AC_ARG_ENABLE(sphinx,
172 [ --enable-sphinx enable pocketsphinx support in SRS],
173 [enable_sphinx=$enableval], [enable_sphinx=auto])
175 if test "$enable_sphinx" != "no"; then
176 PKG_CHECK_MODULES(SPHINX, [sphinxbase pocketsphinx],
177 [have_sphinx=yes], [have_sphinx=no])
178 if test "$have_sphinx" = "no" -a "$enable_sphinx" = "yes"; then
179 AC_MSG_ERROR([Sphinx development libraries not found.])
182 # sphinxbase is packetised in wrong way in Fedora
183 # and pkg-config reports libraries what we really
184 # do not need; so as a temporary hack here we get
186 SPHINX_LIBS=`echo $SPHINX_LIBS | \
187 sed -e "s/ -lpulse-simple//g" | \
188 sed -e "s/ -lblas//g" | \
189 sed -e "s/ -llapack//g" | \
190 sed -e "s/ -lsamplerate//g" | \
191 sed -e "s/ -lsndfile//g" | \
192 sed -e "s/ -lpthread//g"`
194 enable_sphinx="$have_sphinx"
196 AC_MSG_NOTICE([Sphinx support disabled])
199 AM_CONDITIONAL(SPHINX_ENABLED, [test "$enable_sphinx" = "yes"])
200 AC_SUBST(SPHINX_ENABLED)
201 AC_SUBST(SPHINX_CFLAGS)
202 AC_SUBST(SPHINX_LIBS)
205 PKG_CHECK_MODULES(UDEV, libudev)
207 # Check for glib et al that we need temporarily to allow plugins use gdbus.
208 PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0)
209 PKG_CHECK_MODULES(MURPHY_GLIB, murphy-glib)
210 AC_SUBST(GLIB_CFLAGS)
212 AC_SUBST(MURPHY_GLIB_CFLAGS)
213 AC_SUBST(MURPHY_GLIB_LIBS)
215 # Check if WRT media client should be enabled.
216 AC_ARG_ENABLE(wrt-client,
217 [ --enable-wrt-client enable WRT media client plugin],
218 [enable_wrtc=$enableval], [enable_wrtc=yes])
220 if test "$enable_wrtc" = "yes"; then
221 PKG_CHECK_MODULES(GIO, gio-2.0)
223 AC_MSG_NOTICE([WRT media client plugin is disabled.])
226 AM_CONDITIONAL(WRTC_ENABLED, [test "$enable_wrtc" = "yes"])
230 # Check if festival support should be enabled.
231 AC_ARG_ENABLE(festival,
232 [ --enable-festival enable festival support],
233 [enable_festival=$enableval], [enable_festival=auto])
235 if test "$enable_festival" != "no"; then
237 AC_MSG_NOTICE([festival support is enabled.])
239 AC_MSG_NOTICE([festival support is disabled.])
242 if test "$enable_festival" = "yes"; then
243 AC_DEFINE([FESTIVAL_ENABLED], 1, [Enable festival support ?])
246 if test -f $prefix/include/festival/festival.h; then
247 FESTIVAL_INCLUDES="-I$prefix/include \
248 -I$prefix/include/festival \
249 -I$prefix/include/speech_tools"
251 FESTIVAL_INCLUDES="-I$prefix/include"
254 FESTIVAL_CXXFLAGS="$FESTIVAL_INCLUDES"
257 AM_CONDITIONAL(FESTIVAL_ENABLED, [test "$enable_festival" = "yes"])
258 AC_SUBST(FESTIVAL_ENABLED)
259 AC_SUBST(FESTIVAL_CXXFLAGS)
260 AC_SUBST(FESTIVAL_LIBS)
263 SHAVE_INIT([build-aux], [enable])
265 # Create murphy symlink to src.
266 if test ! -L srs; then
267 AC_MSG_NOTICE([Symlinking src to srs...])
272 AC_CONFIG_FILES([build-aux/shave
273 build-aux/shave-libtool
277 src/plugins/client-api/native/srs-native-client.pc
282 # Display the configuration.
283 echo "----- configuration -----"
284 echo "Extra C warnings flags: $WARNING_CFLAGS"
285 echo "D-Bus support: $enable_dbus"
286 echo "Sphinx support: $enable_sphinx"
287 echo "Festival support: $enable_festival"
289 if test "$DUMP_LIB_FLAGS" = "yes"; then
290 echo "MURPHY_COMMON:"
291 echo " CFLAGS: $MURPHY_COMMON_CFLAGS"
292 echo " LIBS : $MURPHY_COMMON_LIBS"
295 echo " CFLAGS: $MURPHY_DBUS_CFLAGS"
296 echo " LIBS : $MURPHY_DBUS_LIBS"
299 echo " CFLAGS: $MURPHY_PULSE_CFLAGS"
300 echo " LIBS : $MURPHY_PULSE_LIBS"
302 echo "MURPHY_RESOURCE:"
303 echo " CFLAGS: $MURPHY_RESOURCE_CFLAGS"
304 echo " LIBS : $MURPHY_RESOURCE_LIBS"
306 echo "MURPHY_BREEDLINE:"
307 echo " CFLAGS: $MURPHY_BREEDLINE_CFLAGS"
308 echo " LIBS : $MURPHY_BREEDLINE_LIBS"