bleutooth-client: start to use the new audio buffer interface
[profile/ivi/speech-recognition.git] / configure.ac
1
2 #                                               -*- Autoconf -*-
3 # Process this file with autoconf to produce a configure script.
4
5 AC_PREREQ(2.59)
6
7 AC_INIT([speech-recognition],
8         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
9         [krisztian.litkey at intel.com])
10
11 AC_CONFIG_SRCDIR([src])
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_HEADER([src/config.h])
14 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
15
16 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
17
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`)
21
22 AC_SUBST(VERSION)
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)
27
28 SRS_VERSION_INFO="0:0:0"
29 AC_SUBST(SRS_VERSION_INFO)
30
31 # Disable static libraries.
32 AC_DISABLE_STATIC
33
34 # Checks for programs.
35 AC_PROG_CC
36 AC_PROG_CC_C99
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.
39 AC_PROG_CXX
40 AC_PROG_AWK
41 AC_PROG_INSTALL
42 AM_PROG_CC_C_O
43 AM_PROG_LIBTOOL
44
45 # Checks for libraries.
46 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
47
48 # Checks for header files.
49 AC_PATH_X
50 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
51
52 # Checks for typedefs, structures, and compiler characteristics.
53 AC_HEADER_STDBOOL
54 AC_C_INLINE
55 AC_TYPE_INT16_T
56 AC_TYPE_INT32_T
57 AC_TYPE_INT64_T
58 AC_TYPE_MODE_T
59 AC_TYPE_PID_T
60 AC_TYPE_SIZE_T
61 AC_TYPE_SSIZE_T
62 AC_CHECK_MEMBERS([struct stat.st_rdev])
63 AC_TYPE_UINT16_T
64 AC_TYPE_UINT32_T
65 AC_TYPE_UINT64_T
66 AC_TYPE_UINT8_T
67 AC_CHECK_TYPES([ptrdiff_t])
68
69 # Checks for library functions.
70 AC_FUNC_ERROR_AT_LINE
71 AC_HEADER_MAJOR
72 AC_FUNC_MALLOC
73 AC_FUNC_STRTOD
74 AC_CHECK_FUNCS([memmove memset])
75
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])
80
81 WARNING_CFLAGS=""
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"])
88     done
89     CPPFLAGS="$save_CPPFLAGS"
90 fi
91
92 AC_SUBST(WARNING_CFLAGS)
93
94 # Check for PulseAudio.
95 PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.22)
96 AC_SUBST(PULSE_CFLAGS)
97 AC_SUBST(PULSE_LIBS)
98
99 # Check if potentially GPL bits are allowed to be enabled.
100 AC_ARG_ENABLE(gpl,
101               [  --enable-gpl            enable linking against GPL code],
102               [enable_gpl=$enableval], [enable_gpl=no])
103
104 # Check if DBUS was enabled.
105 AC_ARG_ENABLE(dbus,
106               [  --enable-dbus           enable D-BUS support],
107               [enable_dbus=$enableval], [enable_dbus=no])
108
109 if test "$enable_dbus" = "yes"; then
110     if test "$enable_gpl" = "no"; then
111         AC_MSG_ERROR([D-Bus support requires the --enable-gpl option.])
112     fi
113     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.70)
114
115     DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
116     AC_SUBST(DBUS_SESSION_DIR)
117 else
118     AC_MSG_NOTICE([D-Bus support is disabled.])
119 fi
120
121 if test "$enable_dbus" = "yes"; then
122     AC_DEFINE([DBUS_ENABLED], 1, [Enable D-BUS support ?])
123 fi
124
125 AM_CONDITIONAL(DBUS_ENABLED, [test "$enable_dbus" = "yes"])
126 AC_SUBST(DBUS_ENABLED)
127 AC_SUBST(DBUS_CFLAGS)
128 AC_SUBST(DBUS_LIBS)
129
130 # Set up common SRS compilation and linking flags.
131 SRS_CFLAGS=""
132 SRS_LIBS=""
133 AC_SUBST(SRS_CFLAGS)
134 AC_SUBST(SRS_LIBS)
135
136 # Add LIBDIR to config.h.
137 AC_MSG_CHECKING([libdir])
138 AC_MSG_RESULT([$libdir])
139 AC_SUBST(LIBDIR, [$libdir])
140
141 # Check for Check (unit test framework).
142 PKG_CHECK_MODULES(CHECK, 
143                   check >= 0.9.4,
144                   [has_check="yes"], [has_check="no"])
145 AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes")
146
147 AC_SUBST(CHECK_CFLAGS)
148 AC_SUBST(CHECK_LIBS)
149
150 if test "x$has_check" = "xno"; then
151     AC_MSG_WARN([Check framework not found, unit tests are DISABLED.])
152 fi
153
154 # Check if sphinx was enabled.
155 AC_ARG_ENABLE(sphinx,
156               [  --enable-sphinx         enable pocketsphinx support in SRS],
157               [enable_sphinx=$enableval], [enable_sphinx=auto])
158
159 if test "$enable_sphinx" != "no"; then
160     PKG_CHECK_MODULES(SPHINX, [sphinxbase pocketsphinx],
161                       [have_sphinx=yes], [have_sphinx=no])
162     if test "$have_sphinx" = "no" -a "$enable_sphinx" = "yes"; then
163         AC_MSG_ERROR([Sphinx development libraries not found.])
164     fi
165
166     # sphinxbase is packetised in wrong way in Fedora
167     # and pkg-config reports libraries what we really
168     # do not need; so as a temporary hack here we get
169     # rid of them
170     SPHINX_LIBS=`echo $SPHINX_LIBS                      | \
171                       sed -e "s/ -lpulse-simple//g"     | \
172                       sed -e "s/ -lblas//g"             | \
173                       sed -e "s/ -llapack//g"           | \
174                       sed -e "s/ -lsamplerate//g"       | \
175                       sed -e "s/ -lsndfile//g"          | \
176                       sed -e "s/ -lpthread//g"`
177
178     enable_sphinx="$have_sphinx"
179 else
180     AC_MSG_NOTICE([Sphinx support disabled])
181 fi
182
183 AM_CONDITIONAL(SPHINX_ENABLED, [test "$enable_sphinx" = "yes"])
184 AC_SUBST(SPHINX_ENABLED)
185 AC_SUBST(SPHINX_CFLAGS)
186 AC_SUBST(SPHINX_LIBS)
187
188 # Check for libudev.
189 PKG_CHECK_MODULES(UDEV, libudev)
190
191 # Shave by default.
192 SHAVE_INIT([build-aux], [enable])
193
194 # Create murphy symlink to src.
195 if test ! -L srs; then
196     AC_MSG_NOTICE([Symlinking src to srs...])
197     ln -s src srs
198 fi
199
200 # Generate output.
201 AC_CONFIG_FILES([build-aux/shave
202                  build-aux/shave-libtool
203                  Makefile
204                  utils/Makefile
205                  src/Makefile
206                  ])
207 AC_OUTPUT
208
209
210 # Display the configuration.
211 echo "----- configuration -----"
212 echo "Extra C warnings flags: $WARNING_CFLAGS"
213 echo "D-Bus support: $enable_dbus"
214 echo "Sphinx support: $enable_sphinx"