Fix some error
[kdeaccessibility.git] / kttsd / configure.in.in
blobf4c82c3ca0ee943a072e4b0dd0bff61a4f077a65
1 #MIN_CONFIG(3.2)
3 ### AM_INIT_AUTOMAKE(kttsd,0.2.0)
5 dnl ================================================================================
7 dnl Check for GStreamer >= 0.8.7
9 AC_ARG_WITH(gstreamer,
10   [AC_HELP_STRING(--with-gstreamer,
11     [enable support for GStreamer @<:@default=no@:>@])],
12   [], with_gstreamer=no)
14 have_gst=no
15 if test "x$with_gstreamer" != xno; then
16   # pkg-config seems to have a bug where it masks needed -L entries when it
17   # shouldn't, so disable that.
19   PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
20   export PKG_CONFIG_ALLOW_SYSTEM_LIBS
22   dnl start with 0.8
23   GST_MAJORMINOR=0.8
24   dnl Actually need 0.8.7, but plugins were version 0.8.5.  argh!
25   GST_REQ=0.8.5
27   PKG_CHECK_MODULES(GST, \
28     gstreamer-$GST_MAJORMINOR >= $GST_REQ \
29     gstreamer-control-$GST_MAJORMINOR >= $GST_REQ \
30     gstreamer-libs-$GST_MAJORMINOR >= $GST_REQ,
31     have_gst=yes, have_gst=no)
33   if test "x$with_gstreamer" != xcheck && test "x$have_gst" != xyes; then
34     AC_MSG_ERROR([--with-gstreamer was given, but test for GStreamer >= 0.8.5 failed])
35   fi
38 if test "x$have_gst" = "xno"; then
39   GST_CFLAGS=""
40   LDADD_GST=""
41   LDFLAGS_GST=""
42   AC_DEFINE(HAVE_GSTREAMER, 0, [have GStreamer])
43 else
44   LDADD_GST=`$PKG_CONFIG --libs-only-l gstreamer-$GST_MAJORMINOR`
45   LDFLAGS_GST=`$PKG_CONFIG --libs-only-other gstreamer-$GST_MAJORMINOR`
47   # Append -L entries, since they are masked by --libs-only-l and
48   # --libs-only-other
49   LIBDIRS_GST=`$PKG_CONFIG --libs-only-L gstreamer-$GST_MAJORMINOR`
50   LDADD_GST="$LDADD_GST $LIBDIRS_GST"
52   AC_MSG_NOTICE([GStreamer version >= $GST_REQ found.])
53   AC_DEFINE(HAVE_GSTREAMER, 1, [have GStreamer])
55   if test "x$with_gstreamer" != xcheck && test "x$have_gst" != xyes; then
56     AC_MSG_ERROR([--with-gstreamer was given, but test for GStreamer >= 0.8.7 failed])
57   fi
60 AC_SUBST(GST_CFLAGS)
61 AC_SUBST(LDADD_GST)
62 AC_SUBST(LDFLAGS_GST)
64 AM_CONDITIONAL(include_kttsd_gstplayer, [test "x$have_gst" = "xyes"])
66 dnl ================================================================================
68 dnl Do not compile artsplayer plugin if user specifies --without-arts
70 AM_CONDITIONAL(include_kttsd_artsplayer, [test "x$build_arts" = "xyes"])
72 dnl ================================================================================
74 dnl Check for ALSA.
75 dnl TODO: Don't know if 0.5 works or not.
77 AC_DEFUN([KDE_CHECK_ALSA],
79   have_alsa=no
81   AC_CHECK_HEADERS([sys/asoundlib.h alsa/asoundlib.h],
82     [have_alsa=yes])
84   AC_CHECK_LIB(asound, snd_seq_create_simple_port,
85     [:], [have_alsa=no])
87   AC_LANG_SAVE
88   AC_LANG_C
89   if test "x$have_alsa" = xyes; then
90     AC_TRY_COMPILE([
91       #include "confdefs.h"
92       #ifdef HAVE_SYS_ASOUNDLIB_H
93       #include <sys/asoundlib.h>
94       #endif
95       #ifdef HAVE_ALSA_ASOUNDLIB_H
96       #include <alsa/asoundlib.h>
97       #endif
98     ],[
99       #if (SND_LIB_MAJOR == 0) && (SND_LIB_MINOR == 5)
100         /* we have ALSA 0.5.x */
101       #else
102         #error not ALSA 0.5.x
103       #endif
104     ],
105     have_alsa_0_5=yes)
107     AC_TRY_COMPILE([
108       #include "confdefs.h"
109       #ifdef HAVE_SYS_ASOUNDLIB_H
110       #include <sys/asoundlib.h>
111       #endif
112       #ifdef HAVE_ALSA_ASOUNDLIB_H
113       #include <alsa/asoundlib.h>
114       #endif
115     ],[
116       #if (SND_LIB_MAJOR == 0) && (SND_LIB_MINOR == 9)
117         /* we have ALSA 0.9.x */
118       #else
119         #error not ALSA 0.9.x
120       #endif
121     ],
122     have_alsa_0_9=yes)
124     AC_TRY_COMPILE([
125       #include "confdefs.h"
126       #ifdef HAVE_SYS_ASOUNDLIB_H
127       #include <sys/asoundlib.h>
128       #endif
129       #ifdef HAVE_ALSA_ASOUNDLIB_H
130       #include <alsa/asoundlib.h>
131       #endif
132     ],[
133       #if (SND_LIB_MAJOR == 1)
134         /* we have ALSA 1.x */
135       #else
136         #error not ALSA 1.x
137       #endif
138     ],
139     have_alsa_1=yes)
140   fi
141   AC_LANG_RESTORE
143   if test "x$have_alsa_0_9" = xyes || test "x$have_alsa_1" = xyes; then
144     # for kmix/ and akode/
145     LIBASOUND="-lasound"
146     AC_DEFINE(HAVE_LIBASOUND2, 1, [Define if you have libasound.so.2 (required for ALSA 0.9.x/1.x support)])
148     # for arts/
149     ARTS_LIBASOUND="-lasound"
150     AC_DEFINE(HAVE_ARTS_LIBASOUND2, 1, [Define if you have libasound.so.2 (required for ALSA 0.9.x/1.x support)])
151   fi
153   if test "x$have_alsa_0_5" = xyes; then
154     # for arts/
155     ARTS_LIBASOUND="-lasound"
156     AC_DEFINE(HAVE_ARTS_LIBASOUND, 1, [Define if you have libasound.so.1 (required for ALSA 0.5.x support)])
157   fi
159   AC_SUBST(LIBASOUND)
160   AC_SUBST(ARTS_LIBASOUND)
163 AC_ARG_WITH(alsa,
164   [AC_HELP_STRING(--with-alsa,
165     [enable support for ALSA @<:@default=check@:>@])],
166   [], with_alsa=check)
168 have_alsa=no
169 if test "x$with_alsa" != xno; then
170   KDE_CHECK_ALSA
172   if test "x$with_alsa" != xcheck && test "x$have_alsa" != xyes; then
173     AC_MSG_ERROR([--with-alsa was given, but test for ALSA failed])
174   fi
177 AM_CONDITIONAL(include_kttsd_alsaplayer, [test "x$have_alsa" = "xyes"])
179 dnl ================================================================================
181 dnl Check for aKode library.  Note: As of about 16 Jul 2005, it got moved
182 dnl from kdemultimedia to kdesupport.
184 AC_DEFUN([KDE_CHECK_AKODE],
186   AC_PATH_PROG(AKODE_CONFIG, akode-config, [no], [$PATH:$prefix/bin])
188   if test "x$AKODE_CONFIG" != xno; then
189     AC_DEFINE(HAVE_AKODE, 1, [define if you have aKodelib installed])
190     akode_includes=`$AKODE_CONFIG --cflags`
191     akode_libs=`$AKODE_CONFIG --libs`
192     have_akode=yes
193   else
194     akode_includes=""
195     akode_libs=""
196     have_akode=no
197   fi
199   AC_SUBST(akode_includes)
200   AC_SUBST(akode_libs)
203 AC_ARG_WITH(akode,
204     [AC_HELP_STRING([--with-akode],
205         [enable the aKode decoder @<:@default=no@:>@])],
206     [], with_akode=no)
208 have_akode=no
209 if test "x$with_akode" != xno; then
210   KDE_CHECK_AKODE
212   if test "x$with_akode" != xcheck && test "x$have_akode" != xyes; then
213     AC_MSG_ERROR([--with-akode was given, but test for aKode failed])
214   fi
217 AM_CONDITIONAL(include_kttsd_akodeplayer, [test "x$have_akode" = "xyes"])
219 dnl ================================================================================
221 dnl Check whether to include sys/time.h and time.h, or just sys/time.h.
222 dnl Defines TIME_WITH_SYS_TIME and HAVE_SYS_TIME_H, which are used in
223 dnl alsaplayer.cpp.
225 AC_HEADER_TIME
226 AC_CHECK_HEADERS(sys/time.h)
228 dnl ================================================================================
230 dnl See if the latest kspeech.h is installed and if not, compile against
231 dnl kttsd/compat directory.
233 if test "$KTTS_KSPEECH_DIR" = ""; then
234     KDE_CHECK_HEADER(kspeech.h, ktts_have_kspeech_h=yes, ktts_have_kspeech_h=no)
235     have_latest_kspeech=no
236     if test "x$ktts_have_kspeech_h" = xyes; then
237         AC_MSG_CHECKING([whether installed kspeech.h is latest version])
238         ktts_save_cppflags=$CPPFLAGS
239         AC_LANG_SAVE
240         CPPFLAGS="$all_includes $CPPFLAGS"
241         AC_LANG_CPLUSPLUS
242         AC_TRY_COMPILE(
243             [#include <kspeech.h>],
244             [
245             if (4 == KSpeech::mtHtml);
246             ],
247             have_latest_kspeech=yes,
248             have_latest_kspeech=no)
249         AC_MSG_RESULT($have_latest_kspeech)
250         CPPFLAGS=$ktts_save_cppflags
251         AC_LANG_RESTORE
252     fi
253     if test "x$have_latest_kspeech" = xyes; then
254         KTTS_KSPEECH_DIR='$(kde_includes)'
255         KTTS_KSPEECH_INCLUDE=""
256         KTTS_INTERFACES_DIR=""
257     else
258         KTTS_KSPEECH_DIR='$(top_srcdir)/kttsd/compat/interfaces/kspeech'
259         KTTS_KSPEECH_INCLUDE='-I$(top_srcdir)/kttsd/compat/interfaces/kspeech'
260         KTTS_INTERFACES_DIR="interfaces"
261         AC_MSG_WARN([Latest kspeech.h not installed. Compiling using kttsd/compat directory.])
262     fi
264     AC_SUBST(KTTS_KSPEECH_DIR)
265     AC_SUBST(KTTS_KSPEECH_INCLUDE)
266     AC_SUBST(KTTS_INTERFACES_DIR)
269 dnl ================================================================================
271 # --- Check for KDE < 3.5 ---
272 # If so, install icons.
274 AC_MSG_CHECKING([for KDE version])
276 AC_LANG_SAVE
277 AC_LANG_CPLUSPLUS
278 kdeversion_save_CXXFLAGS="$CXXFLAGS"
279 kdeversion_save_LIBS="$LIBS"
280 LIBS="$LIBS $X_EXTRA_LIBS"
281 CXXFLAGS="$CXXFLAGS $all_includes"
283 AC_COMPILE_IFELSE([
284 #include <kdeversion.h>
285 #if ! ( KDE_IS_VERSION( 3, 4, 90 ) )
286 #error KDE 3.4
287 #endif
289     KTTS_ICONS_DIR=""
291     KTTS_ICONS_DIR="icons"
294 CXXFLAGS="$kdeversion_save_CXXFLAGS"
295 LIBS="$kdeversion_save_LIBS"
296 AC_LANG_RESTORE
298 if test "$KTTS_ICONS_DIR" = ""; then
299     AC_MSG_RESULT([KDE 3.4.x or less])
300 else
301     AC_MSG_RESULT([KDE 3.5 or later])
304 AC_SUBST(KTTS_ICONS_DIR)