File: configure.ac

package info (click to toggle)
imms 3.0.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 920 kB
  • ctags: 1,195
  • sloc: cpp: 7,224; ansic: 1,872; sh: 186; makefile: 127
file content (362 lines) | stat: -rw-r--r-- 11,399 bytes parent folder | download
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
361
362
AC_INIT([IMMS],[3.0.2],[mag@luminal.org])

AC_PREREQ([2.52g])

AC_REVISION($Id: configure.ac,v 1.30 2003/10/23 23:53:20 mag Exp $)

AC_CONFIG_SRCDIR(immscore/imms.cc)

AC_PREFIX_DEFAULT("/usr")

AC_DEFUN([AC_APPEND],
    [if test -z "$$1"; then
        $1="$2"
    else
        $1="$$1 $2"
    fi
])

AC_ARG_WITH(taglib,
            AC_HELP_STRING([--with-taglib],
                           [Tag support using TagLib]))

AC_ARG_WITH(id3lib,
            AC_HELP_STRING([--with-id3lib],
                           [Native MP3 tag support]))

AC_ARG_WITH(vorbis,
            AC_HELP_STRING([--with-vorbis],
                           [Native OGG/Vorbis tag support]))

AC_ARG_WITH(screensaver,
            AC_HELP_STRING([--with-screensaver],
                           [Use MIT ScreenSaver extension]))

AC_ARG_ENABLE(debug,
            AC_HELP_STRING([--enable-debug],
                           [Extra debug output]),
            [enable_debug=$enableval])

AC_ARG_ENABLE(queuecontrol,
            AC_HELP_STRING([--disable-queuecontrol],
                           [Don't use XMMS queue control functions]),
            [enable_queuecontrol=$enableval])

AC_ARG_ENABLE(analyzer,
            AC_HELP_STRING([--disable-analyzer],
                           [Disable acoustic song similarity analyzer]),
            [enable_analyzer=$enableval])

AC_ARG_ENABLE(immsremote,
            AC_HELP_STRING([--disable-immsremote],
                           [Disable building of immsremote]),
            [enable_immsremote=$enableval])

AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL

AC_LANG(C++)

AC_MSG_CHECKING([for --enable-debug])

XCPPFLAGS="-ggdb -O0 -DDEBUG"
if test "$enable_debug" != "yes"; then
    XCPPFLAGS="-O3"
    AC_MSG_RESULT([no])
else
    AC_MSG_RESULT([yes])
fi

AC_MSG_CHECKING([for usability of initstate_r])

AC_TRY_RUN([#include <stdlib.h>
int main()
{
  static struct random_data rand_data;
  static char rand_state[256];
  initstate_r(0, rand_state, sizeof(rand_state), &rand_data);
  exit(0);
}], initstate_r_works=yes,, ])

if test "$initstate_r_works" != "yes"; then
    AC_MSG_RESULT([no])
    AC_DEFINE(INITSTATE_BUG,, [initstate_r is buggy])
else
    AC_MSG_RESULT([yes])
fi

AC_CHECK_LIB(z, compress,, [with_zlib=no])
AC_CHECK_HEADERS(zlib.h,, [with_zlib=no])
if test "$with_zlib" = "no"; then
    AC_MSG_ERROR([zlib required and missing.])
fi

AC_CHECK_PROG(have_sqlites, sqlite, "yes", "no")
if test "$have_sqlites" = "yes"; then
    AC_CHECK_PROG(have_sqlites, sqlite3, "yes", "no")
fi
if test "$have_sqlites" = "no"; then
    AC_MSG_WARN([******************************************************]);
    AC_MSG_WARN([If you are upgrading from IMMS version <= 1.1]);
    AC_MSG_WARN([You need both sqlite and sqlite3 executables installed]);
    AC_MSG_WARN([******************************************************]);
fi

AC_CHECK_LIB(sqlite3, sqlite3_get_autocommit,, [with_sqlite=no])
AC_CHECK_HEADERS(sqlite3.h,, [with_sqlite=no])
if test "$with_sqlite" = "no"; then
    AC_MSG_ERROR([sqlite >= 3.2.2 required and missing.])
fi

AC_CHECK_LIB(pcre, pcre_compile,, [with_pcre=no])
AC_CHECK_HEADERS(pcre.h,, [with_pcre_1=no])
if test "$with_pcre_1" = "no"; then
    AC_CHECK_HEADERS(pcre/pcre.h,, [with_pcre=no])
fi
if test "$with_pcre" = "no"; then
    AC_MSG_ERROR([PCRE required and missing.])
fi

if test "$enable_analyzer" != "no"; then
    PKG_CHECK_MODULES([FFTW], [fftw3 >= 3.0],
                      [], [have_fftw=no])
    if test "$have_fftw" = "no"; then
        AC_MSG_WARN([******************************************************]);
        AC_MSG_WARN("fftw3 >= 3.0 required for analyzer and missing");
        AC_MSG_WARN("Acoustic analyzer will not be built");
        AC_MSG_WARN([******************************************************]);
        enable_analyzer=no
    fi
fi

if test "$enable_analyzer" != "no"; then
    AC_CHECK_HEADERS(torch/KMeans.h,, [have_torch=no])

    saved_libs="$LIBS"
    LIBS="$LIBS -ltorch"
    AC_MSG_CHECKING([libtorch usability])
    AC_TRY_LINK([#include <torch/KMeans.h> ],
                [Torch::KMeans kmeans(10, 5)],
        [AC_MSG_RESULT(yes)],
        [have_torch=no; AC_MSG_RESULT(no)])
    LIBS=$saved_libs
    
    if test "$have_torch" = "no"; then
        AC_MSG_WARN([******************************************************]);
        AC_MSG_WARN("torch >= 3.0 required for analyzer and missing");
        AC_MSG_WARN("Acoustic analyzer will not be built");
        AC_MSG_WARN([******************************************************]);
        enable_analyzer=no
    fi
fi

PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0],
                  [], [AC_MSG_ERROR([Required packages missing.])])

saved_cppflags="$CPPFLAGS"
saved_libs="$LIBS"

if test "$enable_analyzer" != "no"; then
    CPPFLAGS="`pkg-config fftw3 --cflags`"
    LIBS="`pkg-config fftw3 --libs`"
    AC_CHECK_HEADERS(fftw3.h,, [with_fftw=no])
    AC_CHECK_LIB(fftw3, fftw_plan_dft_r2c_1d,, [with_fftw=no])
    if test "$with_fftw" = "no"; then
        AC_MSG_WARN([******************************************************]);
        AC_MSG_WARN("fftw3 >= 3.0 required for analyzer and missing");
        AC_MSG_WARN("Acoustic analyzer will not be built");
        AC_MSG_WARN([******************************************************]);
        enable_analyzer=no
    fi
fi

CPPFLAGS="`pkg-config glib-2.0 --cflags`"
LIBS="`pkg-config glib-2.0 --libs`"
AC_CHECK_HEADERS(glib.h,, [with_glib=no])
AC_CHECK_LIB(glib-2.0, g_timeout_source_new,, [with_glib=no])
if test "$with_glib" = "no"; then
    AC_MSG_ERROR([glib 2.0 required and missing.])
fi

LIBS=$saved_libs
CPPFLAGS=$saved_cppflags

if test "$with_taglib" != "no"; then
    AC_CHECK_PROG(with_taglib, taglib-config, "yes", "no")
fi
if test "$with_taglib" != "no"; then
    AC_MSG_CHECKING([taglib usability])

    saved_libs="$LIBS"
    LIBS="$LIBS -ltag"
    CPPFLAGS=`taglib-config --cflags`

    AC_TRY_LINK([#include <tag.h>
                 #include <fileref.h>],
                [TagLib::FileRef f((TagLib::File*)0); f.tag()->title()],
        [TAGCPPFLAGS="$TAGCPPFLAGS `taglib-config --cflags`"
                                            AC_MSG_RESULT(yes)],
        [LIBS=$saved_libs; AC_MSG_RESULT(no)])
fi

CPPFLAGS=$saved_cppflags

if test "$with_taglib" = "yes"; then
    AC_DEFINE(WITH_TAGLIB,, [Tag support using TagLib])
else
    if test "$with_id3lib" != "no"; then
        AC_CHECK_LIB(id3, ID3Tag_New,, [with_id3lib=no])
        AC_CHECK_HEADERS(id3/tag.h,, [with_id3lib=no])
    fi
    if test "$with_id3lib" = "no"; then
        AC_MSG_WARN([id3lib is missing.])
    else
        AC_DEFINE(WITH_ID3LIB,, [Native mp3 tag support])
    fi

    if test "$with_vorbis" != "no"; then
        AC_CHECK_LIB(vorbis, vorbis_comment_query,, [with_vorbis=no])
        AC_CHECK_LIB(vorbisfile, ov_comment,, [with_vorbis=no])
        AC_CHECK_HEADERS(vorbis/codec.h vorbis/vorbisfile.h,,
                         [with_vorbis=no])
    fi
    if test "$with_vorbis" = "no"; then
        AC_MSG_WARN([Vorbis is missing.])
    else
        AC_DEFINE(WITH_VORBIS,, [Native Vorbis tag support])
    fi
fi

if test "$enable_analyzer" != "no"; then
    AC_CHECK_PROG(have_sox, sox, "yes", "no")
    if test "$have_sox" = "no"; then
        AC_MSG_WARN([******************************************************]);
        AC_MSG_WARN([To benefit from acoustic analysis features of IMMS],);
        AC_MSG_WARN([you need to install sox [http://sox.sourceforge.net/]]);
        AC_MSG_WARN([******************************************************]);
    fi
fi

if test "$with_screensaver" != "no"; then
    LDFLAGS="-L/usr/X11R6/lib"
    AC_CHECK_LIB(X11, XFlush,, [with_screensaver=no])
    AC_CHECK_LIB(Xext, XextFindDisplay,, [with_screensaver=no])
    AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,, [with_screensaver=no])
    AC_CHECK_HEADERS(X11/extensions/scrnsaver.h,,
                     [with_screensaver=no], [ #include <X11/Xlib.h>] )
fi
if test "$with_screensaver" = "no"; then
    AC_MSG_WARN([XScreenSaver is missing.])
else
    AC_DEFINE(WITH_XSCREENSAVER,, [XScreenSaver extension])
    AC_APPEND(LIBS, -L/usr/X11R6/lib)
fi

if test "$enable_immsremote" != "no"; then
    PKG_CHECK_MODULES([IMMSREMOTE], [libglade-2.0 >= 2.0 gtk+-2.0 >= 2.4],
                      [], [enable_immsremote=no])
    if test "$enable_immsremote" = "no"; then
        AC_MSG_WARN([******************************************************]);
        AC_MSG_WARN("immsremote will not be built");
        AC_MSG_WARN([******************************************************]);
        immsremote=no
    else
        AC_APPEND(OPTIONAL, immsremote)
    fi
fi

saved_cppflags="$CPPFLAGS"
saved_libs="$LIBS"

PLUGINS=""
AC_CHECK_PROG(with_xmms, xmms-config, "yes", "no")
if test "$xmms_config" != "no"; then
    CPPFLAGS=`xmms-config --cflags`
    AC_CHECK_HEADERS(glib.h,, [with_xmms=no]) # how to disable caching for this?
    AC_CHECK_HEADERS(gtk/gtk.h,, [with_xmms=no])
    AC_CHECK_HEADERS(xmms/plugin.h,, [with_xmms=no])
    AC_CHECK_HEADERS(xmms/xmmsctrl.h,, [with_xmms=no])
fi

xmms_enable_playqueue=$enable_queuecontrol
if test "$with_xmms" = "no"; then
    AC_MSG_WARN([Not building XMMS plugin])
else 
    if test "$xmms_enable_playqueue" != "no"; then
        AC_MSG_CHECKING([for xmms_remote_playqueue_add in -lxmms])
        saved_libs="$LIBS"
        LIBS="$LIBS -lxmms"
        AC_TRY_LINK([#include <xmms/xmmsctrl.h>],
                    [xmms_remote_playqueue_add(0, 0)],
                    [AC_MSG_RESULT(yes)],
                    [xmms_enable_playqueue="no"
                         AC_MSG_RESULT(no)]);
        LIBS="$saved_libs"
    fi
    if test "$xmms_enable_playqueue" = "no"; then
        AC_APPEND(PLUGINS, libxmmsimms.so)
    else
        AC_DEFINE(XMMS_HAVE_QUEUE_CONTROL,,
                  [XMMS provides functions to control the play queue])
        AC_APPEND(PLUGINS, libxmmsimms2.so)
    fi
fi

PKG_CHECK_MODULES(BMP, [bmp >= 0.9.7], [], [with_bmp=no])

LIBS=$BMP_LIBS
CPPFLAGS=$BMP_CFLAGS

AC_CHECK_HEADERS(bmp/plugin.h,, [with_bmp=no])
AC_CHECK_HEADERS(bmp/beepctrl.h,, [with_bmp=no])

bmp_enable_playqueue=$enable_queuecontrol
if test "$with_bmp" = "no"; then
    AC_MSG_WARN([Not building BMP plugin])
else 
    if test "$bmp_enable_playqueue" != "no"; then
        AC_MSG_CHECKING([for xmms_remote_playqueue_add in -lbeep])
        AC_TRY_LINK([#include <bmp/beepctrl.h>],
                    [xmms_remote_playqueue_add(0, 0)],
                    [AC_MSG_RESULT(yes)],
                    [bmp_enable_playqueue="no"
                         AC_MSG_RESULT(no)]);
    fi
    if test "$bmp_enable_playqueue" = "no"; then
        AC_APPEND(PLUGINS, libbmpimms.so)
    else
        AC_DEFINE(BMP_HAVE_QUEUE_CONTROL,,
                  [BMP provides functions to control the play queue])
        AC_APPEND(PLUGINS, libbmpimms2.so)
    fi
fi

if test "$enable_analyzer" != "no"; then
    AC_APPEND(OPTIONAL, analyzer)
    AC_DEFINE(ANALYZER_ENABLED,, [Analyzer enabled])
fi

LIBS=$saved_libs
CPPFLAGS=$saved_cppflags

AC_MSG_CHECKING([which plugins to build])
AC_MSG_RESULT($PLUGINS)

AC_MSG_CHECKING([which optional packages to build])
AC_MSG_RESULT($OPTIONAL)

AC_SUBST(CXX)
AC_SUBST(CC)
AC_SUBST(INSTALL)
AC_SUBST(XCPPFLAGS)
AC_SUBST(TAGCPPFLAGS)
AC_SUBST(LIBS)
AC_SUBST(PLUGINS)
AC_SUBST(OPTIONAL)

AC_CONFIG_FILES(vars.mk)
AC_CONFIG_HEADERS(immsconf.h)
AC_OUTPUT

touch immsconf.h