File: configure.ac

package info (click to toggle)
libfishsound 0.7.0-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 2,328 kB
  • ctags: 703
  • sloc: sh: 7,963; ansic: 3,210; makefile: 296
file content (459 lines) | stat: -rw-r--r-- 12,728 bytes parent folder | download | duplicates (2)
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/libfishsound/fishsound.c])

AC_PREREQ(2.53)

AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE(libfishsound, 0.7.0)
AM_CONFIG_HEADER(config.h)

SHARED_VERSION_INFO="2:0:1"
SHLIB_VERSION_ARG=""

# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET

AC_C_CONST
AC_C_BIGENDIAN

dnl Add parameters for aclocal
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")

# Check for doxygen
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
if test $HAVE_DOXYGEN = "false"; then
             AC_MSG_WARN([*** doxygen not found, docs will not be built])
fi

# Check for valgrind
VALGRIND_ENVIRONMENT=""
ac_enable_valgrind=no
AC_ARG_ENABLE(valgrind-testing,
     [  --enable-valgrind-testing     enable running of tests inside Valgrind ],     [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )

if test "x${ac_enable_valgrind}" = xyes ; then
  if test "x${enable_shared}" = xyes ; then
    VALGRIND_ENVIRONMENT="libtool --mode=execute "
  fi

  AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
  if test "x$HAVE_VALGRIND" = xyes ; then
    VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
    AC_SUBST(VALGRIND_ENVIRONMENT)
    TESTS_INFO="Type 'make check' to run test suite. Tests will be run under:
  ${VALGRIND_ENVIRONMENT}"
  else
    TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
  fi
else
  TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)"
fi

dnl Overall configuration success flag
fishsound_config_ok=yes

fishsound_examples=""

dnl
dnl  Configuration option for building of experimental code.
dnl
  
ac_enable_experimental=no
AC_ARG_ENABLE(experimental,
     [  --enable-experimental   enable building of experimental code ],
     [ ac_enable_experimental=yes ])

if test "x${ac_enable_experimental}" = xyes ; then
    AC_DEFINE(FS_EXPERIMENTAL, [], [Define to build experimental code])
fi

dnl
dnl  Configuration option for building of decoding support.
dnl
  
ac_enable_decode=yes
AC_ARG_ENABLE(decode,
     [  --disable-decode        disable building of decoding support ],
     [ ac_enable_decode=no ], [ ac_enable_decode=yes] )

if test "x${ac_enable_decode}" = xyes ; then
    AC_DEFINE(FS_DECODE, [1], [Build decoding support])
else
    AC_DEFINE(FS_DECODE, [0], [Do not build decoding support])
fi
AM_CONDITIONAL(FS_DECODE, [test "x${ac_enable_decode}" = "xyes"])

dnl
dnl  Configuration option for building of encoding support.
dnl
  
ac_enable_encode=yes
AC_ARG_ENABLE(encode,
     [  --disable-encode        disable building of encoding support ],
     [ ac_enable_encode=no ], [ ac_enable_encode=yes] )

if test "x${ac_enable_encode}" = xyes ; then
    AC_DEFINE(FS_ENCODE, [1], [Build encoding support])
else
    AC_DEFINE(FS_ENCODE, [0], [Do not build encoding support])
fi
AM_CONDITIONAL(FS_ENCODE, [test "x${ac_enable_encode}" = "xyes"])

dnl
dnl  Check decode/encode option sanity
dnl
if test "x${ac_enable_decode}" = xno && test "x${ac_enable_encode}" = xno ; then
  AC_MSG_ERROR([
***
*** You have attempted to explicitly disable both encoding and decoding.
***
*** If you want a fish that does nothing, try kfishd:
***
***   http://www.verge.net.au/~horms/junk/
***
*** or buy a dead one from your local pet store.
***
])
fi

dnl
dnl  Detect vorbis
dnl

HAVE_VORBIS=no
HAVE_VORBISENC=no
VORBIS_SUPPORT=no

ac_enable_vorbis=yes
AC_ARG_ENABLE(vorbis,
     [  --disable-vorbis        enable building of Vorbis codec support ],
     [ ac_enable_vorbis=no ], [ ac_enable_vorbis=yes] )

if test "x${ac_enable_vorbis}" = xyes ; then
  AC_CHECK_LIB(vorbis, vorbis_info_init, HAVE_VORBIS="maybe", , [-lm -logg])
  if test "x$HAVE_VORBIS" = xmaybe; then
    AC_CHECK_HEADER(vorbis/codec.h, HAVE_VORBIS="yes", HAVE_VORBIS="no")
  fi
  if test "x$HAVE_VORBIS" = xyes ; then
    AC_DEFINE(HAVE_VORBIS, [1], [Define to 1 if you have libvorbis])
  else
    AC_DEFINE(HAVE_VORBIS, [0], [Define to 1 if you have libvorbis])
  fi

  if test "x${ac_enable_encode}" = xyes ; then
    AC_CHECK_LIB(vorbisenc, vorbis_encode_init, HAVE_VORBISENC="maybe", ,
                 [-lm -logg -lvorbis])
    if test "x$HAVE_VORBISENC" = xmaybe ; then
      AC_CHECK_HEADER(vorbis/vorbisenc.h, HAVE_VORBISENC="yes",
                      HAVE_VORBISENC="no")
    fi
    if test "x$HAVE_VORBISENC" = xyes ; then
      AC_DEFINE(HAVE_VORBISENC, [1], [Define to 1 if you have libvorbisenc])
    else
      AC_DEFINE(HAVE_VORBISENC, [0], [Define to 1 if you have libvorbisenc])
    fi
  else
    AC_DEFINE(HAVE_VORBISENC, [0], [Define to 1 if you have libvorbisenc])
  fi

  if test "x$HAVE_VORBIS" = "xyes" && test "x$HAVE_VORBISENC" = "xyes" ; then
    VORBIS_LIBS="-lvorbisenc -lvorbis -logg -lm"
    AC_SUBST(VORBIS_LIBS)
    VORBIS_SUPPORT="yes"
  elif test "x$HAVE_VORBIS" = xyes ; then
    VORBIS_LIBS="-lvorbis -logg -lm"
    AC_SUBST(VORBIS_LIBS)
    VORBIS_SUPPORT="decode only"
  fi
else
  AC_DEFINE(HAVE_VORBIS, [0], [Define to 1 if you have libvorbis])
  AC_DEFINE(HAVE_VORBISENC, [0], [Define to 1 if you have libvorbisenc])
  VORBIS_SUPPORT="disabled"
fi
AM_CONDITIONAL(HAVE_VORBIS, [test "x$HAVE_VORBIS" = "xyes"])
AM_CONDITIONAL(HAVE_VORBISENC, [test "x$HAVE_VORBISENC" = "xyes"])

dnl
dnl  Detect speex
dnl

HAVE_SPEEX=no
HAVE_SPEEX_1_1=no
SPEEX_SUPPORT=no

ac_enable_speex=yes
AC_ARG_ENABLE(speex,
     [  --disable-speex         enable building of Speex codec support ],
     [ ac_enable_speex=no ], [ ac_enable_speex=yes] )

if test "x${ac_enable_speex}" = xyes ; then
  PKG_CHECK_MODULES(SPEEX, speex, HAVE_SPEEX="yes", HAVE_SPEEX="no")

  if test "x$HAVE_SPEEX" = "xno" ; then
    AC_CHECK_LIB(speex, speex_encoder_init, HAVE_SPEEX="maybe", , [-lm])
    if test "x$HAVE_SPEEX" = xmaybe; then
      AC_CHECK_HEADER(speex.h, HAVE_SPEEX="yes", HAVE_SPEEX="no", [])
    fi
    if test "x$HAVE_SPEEX" = "xyes" ; then
      SPEEX_CFLAGS=""
      SPEEX_LIBS="-lspeex -lm"
    fi
  fi

  if test "x$HAVE_SPEEX" = xyes ; then

    saved_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $SPEEX_CFLAGS"

    dnl Test for libspeex 1.1.x
    AC_CHECK_LIB(speex, speex_preprocess, HAVE_SPEEX_1_1="maybe", ,
      [$SPEEX_LIBS])
    if test "x$HAVE_SPEEX_1_1" = xmaybe; then
      AC_CHECK_HEADER([speex/speex_preprocess.h], HAVE_SPEEX_1_1="yes",
        HAVE_SPEEX_1_1="no")
    fi
    if test "x$HAVE_SPEEX_1_1" = xyes ; then
      AC_DEFINE(HAVE_SPEEX_1_1, [1], [Define to 1 if you have libspeex 1.1.x])
      SPEEX_SUPPORT="yes (1.1.x)"
    else
      AC_DEFINE(HAVE_SPEEX_1_1, [0], [Define to 1 if you have libspeex 1.1.x]) 
      SPEEX_SUPPORT="yes (1.0.x)"
    fi

    CFLAGS="$saved_CFLAGS"

    AC_DEFINE(HAVE_SPEEX, [1], [Define to 1 if you have libspeex])
    AC_SUBST(SPEEX_CFLAGS)
    AC_SUBST(SPEEX_LIBS)
  else
    AC_DEFINE(HAVE_SPEEX, [0], [Define to 1 if you have libspeex])
  fi
else
  AC_DEFINE(HAVE_SPEEX, [0], [Define to 1 if you have libspeex])
  SPEEX_SUPPORT=disabled
fi
AM_CONDITIONAL(HAVE_SPEEX, [test "x$HAVE_SPEEX" = "xyes"])

dnl
dnl  Check codec disabling sanity
dnl
if test "x${ac_enable_vorbis}" = xno && test "x${ac_enable_speex}" = xno ; then
  AC_MSG_ERROR([
***
*** You have attempted to explicitly disable both Vorbis and Speex support.
***
*** If you want a fish that does nothing, try kfishd:
***
***   http://www.verge.net.au/~horms/junk/
***
*** or buy a live one and let it watch television.
***
])
fi

dnl
dnl Set overall configuration success to no if neither vorbis or speex found
dnl
if test "x$HAVE_VORBIS" = "xno" && test "x$HAVE_SPEEX" = "xno"; then
  fishsound_config_ok=no
fi

dnl
dnl Example programs
dnl

dnl
dnl  Detect oggz
dnl

PKG_CHECK_MODULES(OGGZ, oggz >= 0.5.40,
                  HAVE_OGGZ="yes", HAVE_OGGZ="no")

if test "$HAVE_OGGZ" = "yes" ; then
  AC_DEFINE(HAVE_OGGZ, [], [Define if have liboggz])
  AC_SUBST(OGGZ_LIBS)
else
  AC_CHECK_LIB(oggz, oggz_open, OGGZ_LIBS="maybe")
  if test "$OGGZ_LIBS" = "maybe" ; then  
    AC_MSG_ERROR([
***
*** liboggz-0.5.20 or greater seems to exist on your system, however
*** the pkg-config tool cannot find its build information.
***
*** Please set your PKG_CONFIG_PATH environment variable to include the
*** directory in which oggz.pc was installed. For example, oggz.pc
*** is installed in /usr/local/lib/pkgconfig by default; if that is the
*** case do:
***
***     export PKG_CONFIG_PATH="\$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
***
*** then run this ./configure again. If you configured liboggz with a
*** different --prefix option, replace /usr/local above with that prefix.
***
])
  fi
fi
AM_CONDITIONAL(HAVE_OGGZ, [test "x$HAVE_OGGZ" = "xyes"])

dnl
dnl Detect libsndfile1
dnl

PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.0,
                  HAVE_LIBSNDFILE1="yes", HAVE_LIBSNDFILE1="no")

if test "x$HAVE_LIBSNDFILE1" = xyes ; then
  AC_DEFINE(HAVE_LIBSNDFILE1, [], [Define if have libsndfile])
  AC_SUBST(SNDFILE_CFLAGS)
  AC_SUBST(SNDFILE_LIBS)
fi
AM_CONDITIONAL(HAVE_LIBSNDFILE1, [test "x$HAVE_LIBSNDFILE1" = "xyes"])


dnl
dnl  Configuration tests complete -- provide summary of results.
dnl

if test $fishsound_config_ok = no ; then

AC_MSG_RESULT([
**************************************************************

*** $PACKAGE $VERSION: Automatic configuration FAILED.

*** The file config.log has full details.

*** The following required libraries are missing or
*** misconfigured on your system:
])

if test "x$HAVE_VORBIS" != xyes ; then
    AC_MSG_RESULT(
[*** libvorbis, available from  http://www.vorbis.com/])
fi
if test "x$HAVE_VORBIS" = xmaybe ; then
    AC_MSG_RESULT(
[      Development files missing: The libvorbis and libvorbisenc library
      binaries seem to be installed, but building of a test program failed.
])
fi

if test "x$HAVE_SPEEX" != xyes ; then
    AC_MSG_RESULT(
[*** libspeex, available from  http://www.speex.org/])
fi
if test "x$HAVE_SPEEX" = xmaybe ; then
    AC_MSG_RESULT(
[      Development files missing: The libspeex library binary seems to be
      installed, but building of a test program failed.
])
fi

AC_MSG_RESULT(
[*** If you install the required libraries from source, you
*** need to inform the dynamic linker of their location. If
*** you install them in a system-wide directory such as
*** /usr/local (the default), you must ensure that
*** /usr/local/lib is listed in /etc/ld.so.conf, then run
*** ldconfig to update the dynamic linking system.
*** Alternatively, you can set your LD_LIBRARY_PATH environment
*** variable to include the library installation directory.
])


AC_MSG_RESULT(
[**************************************************************
])


AC_MSG_ERROR([
***
*** After fixing the above problems, you must run ./configure again.
***
]) 

else

AC_SUBST(SHLIB_VERSION_ARG)
AC_SUBST(SHARED_VERSION_INFO)

if test "x$HAVE_OGGZ" = xyes ; then
  fishsound_examples="fishsound-identify"

  if test "x$HAVE_LIBSNDFILE1" = xyes ; then
    if test "x${ac_enable_decode}" = xyes ; then
      fishsound_examples="$fishsound_examples fishsound-decode"
    fi
    if test "x${ac_enable_encode}" = xyes ; then
      fishsound_examples="$fishsound_examples fishsound-encode"
    fi
  else
    fishsound_examples="$fishsound_examples (fishsound-decode and fishsound-encode require libsndfile)"
  fi
else
  fishsound_examples="(none; liboggz and libsndfile required)"
fi

AC_OUTPUT([
Makefile
doc/Makefile
doc/Doxyfile
include/Makefile
include/fishsound/Makefile
src/Makefile
src/libfishsound/Version_script
src/libfishsound/Makefile
src/tests/Makefile
src/examples/Makefile
fishsound.pc
])

AS_AC_EXPAND(LIBDIR, ${libdir})
AS_AC_EXPAND(INCLUDEDIR, ${includedir})
AS_AC_EXPAND(BINDIR, ${bindir})
AS_AC_EXPAND(DOCDIR, ${datadir}/doc)

AC_MSG_RESULT([
------------------------------------------------------------------------
  $PACKAGE $VERSION:  Automatic configuration OK.

  General configuration:

    Experimental code: ........... ${ac_enable_experimental}
    Decoding support: ............ ${ac_enable_decode}
    Encoding support: ............ ${ac_enable_encode}

  Library configuration (./src/libfishsound):

    Vorbis support: .............. $VORBIS_SUPPORT
    Speex support: ............... $SPEEX_SUPPORT

  Example programs (./src/examples):

    $fishsound_examples

  Installation paths:

    libfishsound: ................ ${LIBDIR}
    C header files: .............. ${INCLUDEDIR}/fishsound
    Documentation: ............... ${DOCDIR}/$PACKAGE

  Building:

    Type 'make' to compile $PACKAGE.

    Type 'make install' to install $PACKAGE.

    ${TESTS_INFO}

  Example programs will be built but not installed.
------------------------------------------------------------------------
])

fi