forked from intel/winthorpe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
360 lines (296 loc) · 10.4 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([speech-recognition],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[krisztian.litkey at intel.com])
AC_CONFIG_SRCDIR([src])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([src/config.h])
AM_INIT_AUTOMAKE
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
m4_define(version_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
m4_define(version_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
m4_define(version_patch, `echo $VERSION | cut -d. -f3 | cut -d- -f1`)
AC_SUBST(VERSION)
AC_SUBST(VERSION_MAJOR, version_major)
AC_SUBST(VERSION_MINOR, version_minor)
AC_SUBST(VERSION_PATCH, version_patch)
AC_SUBST(VERSION_FULL, version_major.version_minor.version_patch)
SRS_VERSION_INFO="0:0:0"
AC_SUBST(SRS_VERSION_INFO)
# Disable static libraries.
AC_DISABLE_STATIC
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
# We need AC_PROG_CXX if Qt support is enabled but (at least some
# versions of autotools) cannot handle conditional use of this.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_INSTALL
AM_PROG_CC_C_O
AM_PROG_LIBTOOL
# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
# Checks for header files.
AC_PATH_X
AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_HEADER_MAJOR
AC_FUNC_MALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memmove memset])
# Check and enable extra compiler warnings if they are supported.
AC_ARG_ENABLE(extra-warnings,
[ --enable-extra-warnings enable extra compiler warnings],
[extra_warnings=$enableval], [extra_warnings=auto])
WARNING_CFLAGS=""
warncflags="-Wall -Wextra"
if test "$extra_warnings" != "no"; then
save_CPPFLAGS="$CPPFLAGS"
for opt in $warncflags; do
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
[WARNING_CFLAGS="$WARNING_CFLAGS $opt"])
done
CPPFLAGS="$save_CPPFLAGS"
fi
AC_SUBST(WARNING_CFLAGS)
# Check for the necessary Murphy components.
PKG_CHECK_MODULES(MURPHY_COMMON, murphy-common)
PKG_CHECK_MODULES(MURPHY_PULSE, murphy-pulse)
PKG_CHECK_MODULES(MURPHY_GLIB, murphy-glib)
PKG_CHECK_MODULES(MURPHY_RESOURCE, murphy-resource)
PKG_CHECK_MODULES(MURPHY_BREEDLINE, breedline-murphy)
AC_SUBST(MURPHY_COMMON_CFLAGS)
AC_SUBST(MURPHY_COMMON_LIBS)
AC_SUBST(MURPHY_PULSE_CFLAGS)
AC_SUBST(MURPHY_PULSE_LIBS)
AC_SUBST(MURPHY_GLIB_CFLAGS)
AC_SUBST(MURPHY_GLIB_LIBS)
AC_SUBST(MURPHY_RESOURCE_CFLAGS)
AC_SUBST(MURPHY_RESOURCE_LIBS)
AC_SUBST(MURPHY_BREEDLINE_CFLAGS)
AC_SUBST(MURPHY_BREEDLINE_LIBS)
# Check for PulseAudio.
PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.22)
PKG_CHECK_MODULES(PULSE_GLIB, libpulse-mainloop-glib >= 0.922)
AC_SUBST(PULSE_CFLAGS)
AC_SUBST(PULSE_LIBS)
AC_SUBST(PULSE_GLIB_CFLAGS)
AC_SUBST(PULSE_GLIB_LIBS)
# Check if potentially GPL bits are allowed to be enabled.
AC_ARG_ENABLE(gpl,
[ --enable-gpl enable linking against GPL code],
[enable_gpl=$enableval], [enable_gpl=no])
# Check if DBUS was enabled.
AC_ARG_ENABLE(dbus,
[ --enable-dbus enable D-BUS support],
[enable_dbus=$enableval], [enable_dbus=no])
if test "$enable_dbus" = "yes"; then
if test "$enable_gpl" = "no"; then
AC_MSG_ERROR([D-Bus support requires the --enable-gpl option.])
fi
PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.70)
DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
AC_SUBST(DBUS_SESSION_DIR)
PKG_CHECK_MODULES(MURPHY_DBUS, murphy-dbus-libdbus)
else
AC_MSG_NOTICE([D-Bus support is disabled.])
fi
if test "$enable_dbus" = "yes"; then
AC_DEFINE([DBUS_ENABLED], 1, [Enable D-BUS support ?])
fi
AM_CONDITIONAL(DBUS_ENABLED, [test "$enable_dbus" = "yes"])
AC_SUBST(DBUS_ENABLED)
AC_SUBST(MURPHY_DBUS_CFLAGS)
AC_SUBST(MURPHY_DBUS_LIBS)
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
# XXX TODO temporarily disable mpris2 and bluetooth plugins
AM_CONDITIONAL(MPRIS2_ENABLED, [test "xno" = "xyes"])
AM_CONDITIONAL(BLUETOOTH_ENABLED, [test "xno" = "xyes"])
AC_SUBST(MPRIS2_ENABLED)
AC_SUBST(BLUETOOTH_ENABLED)
# Set up common SRS compilation and linking flags.
SRS_CFLAGS=""
SRS_LIBS=""
AC_SUBST(SRS_CFLAGS)
AC_SUBST(SRS_LIBS)
# Add LIBDIR to config.h.
AC_MSG_CHECKING([libdir])
AC_MSG_RESULT([$libdir])
AC_SUBST(LIBDIR, [$libdir])
# Check if sphinx was enabled.
AC_ARG_ENABLE(sphinx,
[ --enable-sphinx enable pocketsphinx support in SRS],
[enable_sphinx=$enableval], [enable_sphinx=auto])
if test "$enable_sphinx" != "no"; then
PKG_CHECK_MODULES(SPHINX, [sphinxbase pocketsphinx],
[have_sphinx=yes], [have_sphinx=no])
if test "$have_sphinx" = "no" -a "$enable_sphinx" = "yes"; then
AC_MSG_ERROR([Sphinx development libraries not found.])
fi
# sphinxbase is packetised in wrong way in Fedora
# and pkg-config reports libraries what we really
# do not need; so as a temporary hack here we get
# rid of them
SPHINX_LIBS=`echo $SPHINX_LIBS | \
sed -e "s/ -lpulse-simple//g" | \
sed -e "s/ -lblas//g" | \
sed -e "s/ -llapack//g" | \
sed -e "s/ -lsamplerate//g" | \
sed -e "s/ -lsndfile//g" | \
sed -e "s/ -lpthread//g"`
enable_sphinx="$have_sphinx"
else
AC_MSG_NOTICE([Sphinx support disabled])
fi
AM_CONDITIONAL(SPHINX_ENABLED, [test "$enable_sphinx" = "yes"])
AC_SUBST(SPHINX_ENABLED)
AC_SUBST(SPHINX_CFLAGS)
AC_SUBST(SPHINX_LIBS)
# Check for libudev.
PKG_CHECK_MODULES(UDEV, libudev)
# Check for glib et al that we need temporarily to allow plugins use gdbus.
PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0)
PKG_CHECK_MODULES(MURPHY_GLIB, murphy-glib)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(MURPHY_GLIB_CFLAGS)
AC_SUBST(MURPHY_GLIB_LIBS)
# Check if WRT media client should be enabled.
AC_ARG_ENABLE(wrt-client,
[ --enable-wrt-client enable WRT media client plugin],
[enable_wrtc=$enableval], [enable_wrtc=yes])
if test "$enable_wrtc" = "yes"; then
PKG_CHECK_MODULES(GIO, gio-2.0)
else
AC_MSG_NOTICE([WRT media client plugin is disabled.])
fi
AM_CONDITIONAL(WRTC_ENABLED, [test "$enable_wrtc" = "yes"])
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
# Check if festival support should be enabled.
AC_ARG_ENABLE(festival,
[ --enable-festival enable festival support],
[enable_festival=$enableval], [enable_festival=auto])
if test "$enable_festival" != "no"; then
enable_festival=yes
AC_MSG_NOTICE([festival support is enabled.])
else
AC_MSG_NOTICE([festival support is disabled.])
fi
if test "$enable_festival" = "yes"; then
AC_DEFINE([FESTIVAL_ENABLED], 1, [Enable festival support ?])
fi
if test -f $prefix/include/festival/festival.h; then
FESTIVAL_INCLUDES="-I$prefix/include \
-I$prefix/include/festival \
-I$prefix/include/speech_tools"
else
FESTIVAL_INCLUDES="-I$prefix/include"
fi
FESTIVAL_CXXFLAGS="$FESTIVAL_INCLUDES"
FESTIVAL_LIBS=""
AM_CONDITIONAL(FESTIVAL_ENABLED, [test "$enable_festival" = "yes"])
AC_SUBST(FESTIVAL_ENABLED)
AC_SUBST(FESTIVAL_CXXFLAGS)
AC_SUBST(FESTIVAL_LIBS)
# Check if espeak support should be enabled.
AC_ARG_ENABLE(espeak,
[ --enable-espeak enable espeak synthesizer support],
[enable_espeak=$enableval], [enable_espeak=auto])
if test "$enable_espeak" != "no"; then
AC_CHECK_HEADERS([espeak/speak_lib.h], [have_espeak=yes], [have_espeak=no])
if test "$have_espeak" = "no" -a "$enable_espeak" = "yes"; then
AC_MSG_ERROR([espeak development libraries not found.])
fi
enable_espeak=$have_espeak
fi
if test "$enable_espeak" = "yes"; then
AC_MSG_NOTICE([espeak synthesizer support is enabled.])
AC_DEFINE([ESPEAK_ENABLED], 1, [Enable espeak support ?])
ESPEAK_INCLUDES="-I$prefix/include"
ESPEAK_CFLAGS="$ESPEAK_INCLUDES"
ESPEAK_LIBS="-lespeak"
else
AC_MSG_NOTICE([espeak synthesizer support is disabled.])
fi
AM_CONDITIONAL(ESPEAK_ENABLED, [test "$enable_espeak" = "yes"])
AC_SUBST(ESPEAK_ENABLED)
AC_SUBST(ESPEAK_CFLAGS)
AC_SUBST(ESPEAK_LIBS)
# Check if systemd socket-based activation was enabled.
AC_ARG_ENABLE(systemd,
[ --enable-systemd enable systemd socket-based activation],
[enable_systemd=$enableval], [enable_systemd=no])
if test "$enable_systemd" = "yes"; then
PKG_CHECK_MODULES(SYSTEMD, libsystemd-daemon)
else
AC_MSG_NOTICE([systemd support is disabled.])
fi
if test "$enable_systemd" = "yes"; then
AC_DEFINE([SYSTEMD_ENABLED], 1, [Enable systemd socket-based activation ?])
fi
AM_CONDITIONAL(SYSTEMD_ENABLED, [test "$enable_systemd" = "yes"])
AC_SUBST(SYSTEMD_CFLAGS)
AC_SUBST(SYSTEMD_LIBS)
# Shave by default.
SHAVE_INIT([build-aux], [enable])
# Create murphy symlink to src.
if test ! -L srs; then
AC_MSG_NOTICE([Symlinking src to srs...])
ln -s src srs
fi
# Generate output.
AC_CONFIG_FILES([build-aux/shave
build-aux/shave-libtool
Makefile
utils/Makefile
src/Makefile
src/plugins/client-api/native/srs-native-client.pc
])
AC_OUTPUT
# Display the configuration.
echo "----- configuration -----"
echo "Extra C warnings flags: $WARNING_CFLAGS"
echo "D-Bus support: $enable_dbus"
echo "Sphinx support: $enable_sphinx"
echo "Festival support: $enable_festival"
echo "Espeak support: $enable_espeak"
echo "systemd socket-based activation: $enable_systemd"
if test "$DUMP_LIB_FLAGS" = "yes"; then
echo "MURPHY_COMMON:"
echo " CFLAGS: $MURPHY_COMMON_CFLAGS"
echo " LIBS : $MURPHY_COMMON_LIBS"
echo "MURPHY_DBUS:"
echo " CFLAGS: $MURPHY_DBUS_CFLAGS"
echo " LIBS : $MURPHY_DBUS_LIBS"
echo "MURPHY_PULSE:"
echo " CFLAGS: $MURPHY_PULSE_CFLAGS"
echo " LIBS : $MURPHY_PULSE_LIBS"
echo "MURPHY_RESOURCE:"
echo " CFLAGS: $MURPHY_RESOURCE_CFLAGS"
echo " LIBS : $MURPHY_RESOURCE_LIBS"
echo "MURPHY_BREEDLINE:"
echo " CFLAGS: $MURPHY_BREEDLINE_CFLAGS"
echo " LIBS : $MURPHY_BREEDLINE_LIBS"
fi