summaryrefslogtreecommitdiffstats
path: root/kttsd/configure.in.in
blob: 1a0398e4d7bd44f892187d320ee5ed25b1be3536 (plain)
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
#MIN_CONFIG(3.2)

### AM_INIT_AUTOMAKE(kttsd,0.2.0)

dnl ================================================================================

dnl Check for GStreamer >= 0.8.7

AC_ARG_WITH(gstreamer,
  [AC_HELP_STRING(--with-gstreamer,
    [enable support for GStreamer @<:@default=no@:>@])],
  [], with_gstreamer=no)

have_gst=no
if test "x$with_gstreamer" != xno; then
  # pkg-config seems to have a bug where it masks needed -L entries when it
  # shouldn't, so disable that.

  PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
  export PKG_CONFIG_ALLOW_SYSTEM_LIBS

  dnl start with 0.8
  GST_MAJORMINOR=0.8
  dnl Actually need 0.8.7, but plugins were version 0.8.5.  argh!
  GST_REQ=0.8.5

  PKG_CHECK_MODULES(GST, \
    gstreamer-$GST_MAJORMINOR >= $GST_REQ \
    gstreamer-control-$GST_MAJORMINOR >= $GST_REQ \
    gstreamer-libs-$GST_MAJORMINOR >= $GST_REQ,
    have_gst=yes, have_gst=no)

  if test "x$with_gstreamer" != xcheck && test "x$have_gst" != xyes; then
    AC_MSG_ERROR([--with-gstreamer was given, but test for GStreamer >= 0.8.5 failed])
  fi
fi

if test "x$have_gst" = "xno"; then
  GST_CFLAGS=""
  LDADD_GST=""
  LDFLAGS_GST=""
  AC_DEFINE(HAVE_GSTREAMER, 0, [have GStreamer])
else
  LDADD_GST=`$PKG_CONFIG --libs-only-l gstreamer-$GST_MAJORMINOR`
  LDFLAGS_GST=`$PKG_CONFIG --libs-only-other gstreamer-$GST_MAJORMINOR`

  # Append -L entries, since they are masked by --libs-only-l and
  # --libs-only-other
  LIBDIRS_GST=`$PKG_CONFIG --libs-only-L gstreamer-$GST_MAJORMINOR`
  LDADD_GST="$LDADD_GST $LIBDIRS_GST"

  AC_MSG_NOTICE([GStreamer version >= $GST_REQ found.])
  AC_DEFINE(HAVE_GSTREAMER, 1, [have GStreamer])

  if test "x$with_gstreamer" != xcheck && test "x$have_gst" != xyes; then
    AC_MSG_ERROR([--with-gstreamer was given, but test for GStreamer >= 0.8.7 failed])
  fi
fi

AC_SUBST(GST_CFLAGS)
AC_SUBST(LDADD_GST)
AC_SUBST(LDFLAGS_GST)

AM_CONDITIONAL(include_kttsd_gstplayer, [test "x$have_gst" = "xyes"])

dnl ================================================================================

dnl Do not compile artsplayer plugin if user specifies --without-arts

AM_CONDITIONAL(include_kttsd_artsplayer, [test "x$build_arts" = "xyes"])

dnl ================================================================================

dnl Check for ALSA.
dnl TODO: Don't know if 0.5 works or not.

AC_DEFUN([KDE_CHECK_ALSA],
[
  have_alsa=no

  KDE_CHECK_HEADERS([sys/asoundlib.h alsa/asoundlib.h],
    [have_alsa=yes])

  KDE_CHECK_LIB(asound, snd_seq_create_simple_port,
    [:], [have_alsa=no])

  AC_LANG_SAVE
  AC_LANG_C
  if test "x$have_alsa" = xyes; then
    AC_TRY_COMPILE([
      #include "confdefs.h"
      #ifdef HAVE_SYS_ASOUNDLIB_H
      #include <sys/asoundlib.h>
      #endif
      #ifdef HAVE_ALSA_ASOUNDLIB_H
      #include <alsa/asoundlib.h>
      #endif
    ],[
      #if (SND_LIB_MAJOR == 0) && (SND_LIB_MINOR == 5)
        /* we have ALSA 0.5.x */
      #else
        #error not ALSA 0.5.x
      #endif
    ],
    have_alsa_0_5=yes)

    AC_TRY_COMPILE([
      #include "confdefs.h"
      #ifdef HAVE_SYS_ASOUNDLIB_H
      #include <sys/asoundlib.h>
      #endif
      #ifdef HAVE_ALSA_ASOUNDLIB_H
      #include <alsa/asoundlib.h>
      #endif
    ],[
      #if (SND_LIB_MAJOR == 0) && (SND_LIB_MINOR == 9)
        /* we have ALSA 0.9.x */
      #else
        #error not ALSA 0.9.x
      #endif
    ],
    have_alsa_0_9=yes)

    AC_TRY_COMPILE([
      #include "confdefs.h"
      #ifdef HAVE_SYS_ASOUNDLIB_H
      #include <sys/asoundlib.h>
      #endif
      #ifdef HAVE_ALSA_ASOUNDLIB_H
      #include <alsa/asoundlib.h>
      #endif
    ],[
      #if (SND_LIB_MAJOR == 1)
        /* we have ALSA 1.x */
      #else
        #error not ALSA 1.x
      #endif
    ],
    have_alsa_1=yes)
  fi
  AC_LANG_RESTORE

  if test "x$have_alsa_0_9" = xyes || test "x$have_alsa_1" = xyes; then
    # for kmix/ and akode/
    LIBASOUND="-lasound"
    AC_DEFINE(HAVE_LIBASOUND2, 1, [Define if you have libasound.so.2 (required for ALSA 0.9.x/1.x support)])

    # for arts/
    ARTS_LIBASOUND="-lasound"
    AC_DEFINE(HAVE_ARTS_LIBASOUND2, 1, [Define if you have libasound.so.2 (required for ALSA 0.9.x/1.x support)])
  fi

  if test "x$have_alsa_0_5" = xyes; then
    # for arts/
    ARTS_LIBASOUND="-lasound"
    AC_DEFINE(HAVE_ARTS_LIBASOUND, 1, [Define if you have libasound.so.1 (required for ALSA 0.5.x support)])
  fi

  AC_SUBST(LIBASOUND)
  AC_SUBST(ARTS_LIBASOUND)
])

AC_ARG_WITH(alsa,
  [AC_HELP_STRING(--with-alsa,
    [enable support for ALSA @<:@default=check@:>@])],
  [], with_alsa=check)

have_alsa=no
if test "x$with_alsa" != xno; then
  KDE_CHECK_ALSA

  if test "x$with_alsa" != xcheck && test "x$have_alsa" != xyes; then
    AC_MSG_ERROR([--with-alsa was given, but test for ALSA failed])
  fi
fi

AM_CONDITIONAL(include_kttsd_alsaplayer, [test "x$have_alsa" = "xyes"])

dnl ================================================================================

dnl Check for aKode library.  Note: As of about 16 Jul 2005, it got moved
dnl from kdemultimedia to tdesupport.

AC_DEFUN([KDE_CHECK_AKODE],
[
  AC_PATH_PROG(AKODE_CONFIG, akode-config, [no], [$PATH:$prefix/bin])

  if test "x$AKODE_CONFIG" != xno; then
    AC_DEFINE(HAVE_AKODE, 1, [define if you have aKodelib installed])
    akode_includes=`$AKODE_CONFIG --cflags`
    akode_libs=`$AKODE_CONFIG --libs`
    have_akode=yes
  else
    akode_includes=""
    akode_libs=""
    have_akode=no
  fi

  AC_SUBST(akode_includes)
  AC_SUBST(akode_libs)
])

AC_ARG_WITH(akode,
    [AC_HELP_STRING([--with-akode],
        [enable the aKode decoder @<:@default=no@:>@])],
    [], with_akode=no)

have_akode=no
if test "x$with_akode" != xno; then
  KDE_CHECK_AKODE

  if test "x$with_akode" != xcheck && test "x$have_akode" != xyes; then
    AC_MSG_ERROR([--with-akode was given, but test for aKode failed])
  fi
fi

AM_CONDITIONAL(include_kttsd_akodeplayer, [test "x$have_akode" = "xyes"])

dnl ================================================================================

dnl Check whether to include sys/time.h and time.h, or just sys/time.h.
dnl Defines TIME_WITH_SYS_TIME and HAVE_SYS_TIME_H, which are used in
dnl alsaplayer.cpp.

AC_HEADER_TIME
AC_CHECK_HEADERS(sys/time.h)

dnl ================================================================================

dnl See if the latest kspeech.h is installed and if not, compile against
dnl kttsd/compat directory.

if test "$KTTS_KSPEECH_DIR" = ""; then
    KDE_CHECK_HEADER(kspeech.h, ktts_have_kspeech_h=yes, ktts_have_kspeech_h=no)
    have_latest_kspeech=no
    if test "x$ktts_have_kspeech_h" = xyes; then
        AC_MSG_CHECKING([whether installed kspeech.h is latest version])
        ktts_save_cppflags=$CPPFLAGS
        AC_LANG_SAVE
        CPPFLAGS="$all_includes $CPPFLAGS"
        AC_LANG_CPLUSPLUS
        AC_TRY_COMPILE(
            [#include <kspeech.h>],
            [
            if (4 == KSpeech::mtHtml);
            ],
            have_latest_kspeech=yes,
            have_latest_kspeech=no)
        AC_MSG_RESULT($have_latest_kspeech)
        CPPFLAGS=$ktts_save_cppflags
        AC_LANG_RESTORE
    fi
    if test "x$have_latest_kspeech" = xyes; then
        KTTS_KSPEECH_DIR='$(kde_includes)'
        KTTS_KSPEECH_INCLUDE=""
        KTTS_INTERFACES_DIR=""
    else
        KTTS_KSPEECH_DIR='$(top_srcdir)/kttsd/compat/interfaces/kspeech'
        KTTS_KSPEECH_INCLUDE='-I$(top_srcdir)/kttsd/compat/interfaces/kspeech'
        KTTS_INTERFACES_DIR="interfaces"
        AC_MSG_WARN([Latest kspeech.h not installed. Compiling using kttsd/compat directory.])
    fi

    AC_SUBST(KTTS_KSPEECH_DIR)
    AC_SUBST(KTTS_KSPEECH_INCLUDE)
    AC_SUBST(KTTS_INTERFACES_DIR)
fi

dnl ================================================================================

# --- Check for KDE < 3.5 ---
# If so, install icons.

AC_MSG_CHECKING([for KDE version])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
kdeversion_save_CXXFLAGS="$CXXFLAGS"
kdeversion_save_LIBS="$LIBS"
LIBS="$LIBS $X_EXTRA_LIBS"
CXXFLAGS="$CXXFLAGS $all_includes"

KTTS_ICONS_DIR="icons"

CXXFLAGS="$kdeversion_save_CXXFLAGS"
LIBS="$kdeversion_save_LIBS"
AC_LANG_RESTORE

if test "$KTTS_ICONS_DIR" = ""; then
    AC_MSG_RESULT([KDE 3.4.x or less])
else
    AC_MSG_RESULT([KDE 3.5 or later])
fi

AC_SUBST(KTTS_ICONS_DIR)