[go: up one dir, main page]

File: configure.ac

package info (click to toggle)
imms 3.1.0~rc8-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,228 kB
  • ctags: 1,243
  • sloc: cpp: 7,839; ansic: 1,845; xml: 252; sh: 189; makefile: 140
file content (411 lines) | stat: -rw-r--r-- 13,278 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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
#
# IMMS: Intelligent Multimedia Management System
# Copyright (C) 2001-2009 Michael Grigoriev
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
#
AC_INIT([IMMS],[3.1.0-rc8],[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_COMPILE([#include <stdlib.h>],[
  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])
else
    AC_MSG_RESULT([yes])
    AC_DEFINE(INITSTATE_USABLE,, [initstate_r is usable])
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_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

PKG_CHECK_MODULES([pcre], [libpcre], [], [with_pcre=no])
if test "$with_pcre" = "no"; then
    AC_MSG_ERROR([PCRE required and missing.])
else
    LIBS="$LIBS $pcre_LIBS"
    CPPFLAGS="$CPPFLAGS $pcre_CFLAGS"
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)])
    
    if test "$have_torch" = "no"; then
        AC_MSG_WARN([******************************************************]);
        AC_MSG_WARN("torch >= 3.0 required for analyzer and missing");
        AC_MSG_WARN("Acoustic analysis engine will not be built");
        AC_MSG_WARN([******************************************************]);
        enable_analyzer=no
        LIBS=$saved_libs
    else
        AC_DEFINE(WITH_TORCH,, [libtorch support])
    fi
fi

AC_CHECK_TOOL(OBJCOPY, objcopy)
if test "x$OBJCOPY" = "x"; then
    AC_MSG_ERROR("objcopy from GNU binutils >= 2.11.90 not found")
fi
AC_CHECK_TOOL(OBJDUMP, objdump)
dnl extract target and architecture if objdump was found
if test "x$OBJDUMP" = "x"; then :; else
    AC_MSG_CHECKING(for object target)
    octarget=`$OBJDUMP --info | sed -ne '2p'` # extract first target
    AC_MSG_RESULT($octarget)
    AC_MSG_CHECKING(for object architecture)
    ocarch=`$OBJDUMP --info | sed -ne '4p'` # extract corresponding arch
    AC_MSG_RESULT($ocarch)
fi
AC_SUBST(OBJCOPYTARGET, $octarget)
AC_SUBST(OBJCOPYARCH, $ocarch)

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 "$with_xmms" != "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

PKG_CHECK_MODULES(audacious, [audacious >= 1.4.0], [], [with_audacious=no])
PKG_CHECK_MODULES(dbus_glib, [dbus-glib-1 >= 0.70], [], [with_audacious=no])

LIBS="$audacious_LIBS $dbus_glib_LIBS"
CPPFLAGS="$audacious_CFLAGS $dbus_glib_CFLAGS"

AC_CHECK_HEADERS(audacious/plugin.h,, [with_audacious=no])
AC_CHECK_HEADERS(audacious/auddrct.h,, [with_audacious=no])

if test "$with_audacious" != "no"; then
    AC_MSG_CHECKING([for audacious_drct_playqueue_add in -laudacious])
    AC_TRY_LINK([#include <audacious/auddrct.h>
                 #include <audacious/plugin.h>
                 SIMPLE_GENERAL_PLUGIN(0, 0);],
                [audacious_drct_playqueue_add(0)],
                [AC_MSG_RESULT(yes)],
                [with_audacious="no"
                 AC_MSG_RESULT(no)]);
fi

if test "$with_audacious" = "no"; then
    AC_MSG_WARN([Not building audacious plugin])
else 
    AC_APPEND(PLUGINS, libaudaciousimms.so)
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