wav: prettify read_samples() function
[sox.git] / configure.ac
blob0be9333d08c2c5be98a3bb021efac35be990b50b
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.62)
4 LT_PREREQ(2.4)
6 AC_INIT(SoX, 14.4.3git, sox-devel@lists.sourceforge.net)
8 AC_CONFIG_MACRO_DIR([m4])
10 dnl Find target architecture
11 AC_CANONICAL_TARGET
13 AM_INIT_AUTOMAKE
14 AM_SILENT_RULES([yes])
16 dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
17 AC_CONFIG_HEADERS([src/soxconfig.h])
19 dnl Check we have the right srcdir
20 AC_CONFIG_SRCDIR(sox.1)
22 dnl Checks for programs.
23 AC_PROG_CC
24 AM_PROG_CC_C_O
25 AC_PROG_INSTALL
26 AC_PROG_LN_S
28 AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
30 dnl Increase version when binary compatibility with previous version is broken
31 SHLIB_VERSION=3:0:0
32 AC_SUBST(SHLIB_VERSION)
34 AC_ARG_WITH(libltdl,
35     AS_HELP_STRING([--without-libltdl],
36         [Don't try to use libltdl for external dynamic library support]),
37     with_libltdl=$withval, with_libltdl=default)
39 if test "$with_libltdl" = "default"; then
40     dnl Default to no libltdl support when building only static libraries
41     if test "$enable_shared" != "no"; then
42         using_libltdl=yes
43     else
44         using_libltdl=no
45     fi
46     with_libltdl="yes"
47 else
48     using_libltdl=$with_libltdl
51 LT_INIT([dlopen win32-dll])
52 AC_SUBST(LIBTOOL_DEPS)
54 AC_ARG_WITH(dyn-default,AS_HELP_STRING([--with-dyn-default],[Default to loading optional formats dynamically]),opt_default=dyn,opt_default=yes)
56 AC_ARG_WITH(pkgconfigdir,
57     AS_HELP_STRING([--with-pkgconfigdir],
58                    [location to install .pc files or "no" to disable (default=$(libdir)/pkgconfig)]))
60 m4_ifndef([PKG_PROG_PKG_CONFIG], with_pkgconfigdir="no")
62 using_pkgconfig=no
63 if test "$with_pkgconfigdir" != "no"; then
64     if test "$with_pkgconfigdir" = ""; then
65         with_pkgconfigdir="\$(libdir)/pkgconfig"
66     fi
67     using_pkgconfig="yes"
68     PKG_PROG_PKG_CONFIG
70 AM_CONDITIONAL(HAVE_PKGCONFIG, test x$using_pkgconfig = xyes)
71 AC_SUBST(PKGCONFIGDIR, $with_pkgconfigdir)
73 using_win32_glob="no"
74 case $target in
75   *mingw*)
76   using_win32_glob="yes"
77    ;;
78 esac
79 if test "$using_win32_glob" = yes; then
80    AC_DEFINE([HAVE_WIN32_GLOB_H], 1, [Define to 1 to use win32 glob])
82 AM_CONDITIONAL(HAVE_WIN32_GLOB, test x$using_win32_glob = xyes)
84 dnl Debugging
85 AC_MSG_CHECKING([whether to make a debug build])
86 AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [make a debug build]))
87 AC_MSG_RESULT($enable_debug)
88 if test "$enable_debug" = "yes"; then
89     CFLAGS="-g"
90     if test "$GCC" = "yes"; then
91         CFLAGS="$CFLAGS -ggdb"
92     fi
93 else
94     enable_debug=no
97 # -fstack-protector
98 AC_ARG_ENABLE([stack-protector],
99     [AS_HELP_STRING([--disable-stack-protector],
100         [Disable GCC's/libc's stack-smashing protection])],
101     [case "${enableval}" in
102          yes) enable_ssp=yes ;;
103           no) enable_ssp=no ;;
104            *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
105      esac],
106     [enable_ssp=yes])
108 if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
109     AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
110     enable_ssp=no
113 if test x"$enable_ssp" = x"yes"; then
114     # Check for broken ssp in libc: http://www.avahi.org/ticket/105
115     # libc's brokenness will get in the way regardless of whether -lssp is
116     # provided, but provide it anyway (otherwise non-libc ssp would wrongly
117     # break here)
119     # Get -lssp if it exists
120     GCC_STACK_PROTECT_LIB
122     AC_MSG_CHECKING([whether stack-smashing protection is available])
123     ssp_old_cflags="$CFLAGS"
124     ssp_old_ldflags="$LDFLAGS"
125     CFLAGS="$CFLAGS -Werror -fstack-protector-all -fPIC"
126     LDFLAGS="$LDFLAGS -Wl,-z,defs"
127     cat confdefs.h > conftest.c
128     cat >>conftest.c <<_ACEOF
129 void test_broken_ssp(c)
130     const char *c;
132     char arr[[123]], *p; /* beware of possible double-braces if copying this */
133     for (p = arr; *c; ++p) {
134         *p = *c;
135         ++c;
136     }
138 _ACEOF
139     rm -f conftest.o
141     if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
142         AC_MSG_RESULT([yes])
143         AC_MSG_CHECKING([whether stack-smashing protection is buggy])
144         if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
145             AC_MSG_RESULT([no])
146         else
147             AC_MSG_RESULT([yes])
148             enable_ssp=no
149         fi
150     else
151         AC_MSG_RESULT([no])
152     fi
154     rm -f conftest.c conftest.o conftest.so
156     CFLAGS="$ssp_old_cflags"
157     LDFLAGS="$ssp_old_ldflags"
160 if test x"$enable_ssp" = x"yes"; then
161     # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
162     GCC_STACK_PROTECT_CC
164     # XXX: Update the enable_ssp value now for output later?
167 dnl Extra CFLAGS if we have gcc
168 if test "$GCC" = "yes"; then
169     CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
171     dnl Define stricter policy on GNU/Linux, all symbols must be resolved
172     case $target in
173       *linux* | *solaris*)
174         LDFLAGS="$LDFLAGS -Wl,-z,defs"
175         ;;
176       *os2* | *cygwin* | *mingw*)
177         APP_LDFLAGS="-no-undefined"
178         ;;
179     esac
181 AC_SUBST(APP_LDFLAGS)
182 AC_SUBST(WARN_CFLAGS)
184 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=distro], [Provide distribution name]))
185 if test "x$with_distro" != "x"; then
186   DISTRO="$with_distro"
187   AC_SUBST(DISTRO)
188   AC_DEFINE(HAVE_DISTRO, 1, [1 if DISTRO is defined])
189   have_distro=yes
190 else
191   DISTRO="not specified!"
193 AM_CONDITIONAL(HAVE_DISTRO, test x$have_distro = xyes)
195 dnl Check for system dependent features.
196 AC_C_BIGENDIAN
197 AC_C_INLINE
199 dnl Checks for header files.
200 AC_HEADER_STDC
201 AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/ioctl.h sys/stat.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h termios.h glob.h fenv.h)
203 dnl Checks for library functions.
204 AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen sigaction)
206 dnl Check if math library is needed.
207 AC_SEARCH_LIBS([pow], [m])
208 AC_SEARCH_LIBS([lrint], [m])
209 AC_CHECK_FUNCS([lrint])
211 dnl Large File Support
212 AC_SYS_LARGEFILE
213 AC_FUNC_FSEEKO
215 dnl Allow libtool to be silenced
216 AC_MSG_CHECKING([whether libtool should be silenced])
217 AC_ARG_ENABLE(silent-libtool,
218     AS_HELP_STRING([--disable-silent-libtool], [Verbose libtool]),,enable_silent_libtool=yes)
219 AC_MSG_RESULT($enable_silent_libtool)
220 if test "$enable_silent_libtool" = "yes"; then
221     LIBTOOLFLAGS=--silent
223 AC_SUBST(LIBTOOLFLAGS)
225 dnl Check if ltdl should be enabled.
226 using_win32_ltdl="no"
227 if test "$using_libltdl" != "no"; then
228   case $target in
229     *mingw*)
230     AC_DEFINE([HAVE_WIN32_LTDL_H], 1, [Define to 1 to use internal win32 ltdl])
231     LIBLTDL=""
232     using_win32_ltdl="yes"
233     ;;
234     *)
235      AC_CHECK_HEADERS(ltdl.h,
236                      AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
237                                   using_libltdl=no), using_libltdl=no)
238     ;;
239   esac
241 if test "$using_libltdl" = yes; then
242   AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
244 AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes -a x$using_win32_ltdl = xno)
245 AM_CONDITIONAL(HAVE_WIN32_LTDL, test x$using_win32_ltdl = xyes)
246 AC_SUBST(LIBLTDL)
249 dnl Check for OpenMP
250 AC_OPENMP
251 CFLAGS="$CFLAGS $OPENMP_CFLAGS"
254 dnl Check for magic library
255 AC_ARG_WITH(magic,
256     AS_HELP_STRING([--without-magic],
257         [Don't try to use magic]))
258 using_magic=no
259 if test "$with_magic" != "no"; then
260     using_magic=yes
261     AC_CHECK_HEADER(magic.h,
262         [AC_CHECK_LIB(magic, magic_open, MAGIC_LIBS="-lmagic",using_magic=no)],
263         using_magic=no)
264     if test "$with_magic" = "yes" -a "$using_magic" = "no"; then
265         AC_MSG_FAILURE([cannot find magic])
266     fi
268 if test "$using_magic" = yes; then
269    AC_DEFINE(HAVE_MAGIC, 1, [Define to 1 if you have magic.])
271 AM_CONDITIONAL(HAVE_MAGIC, test x$using_magic = xyes)
272 AC_SUBST(MAGIC_LIBS)
276 dnl Check for png libraries
277 AC_ARG_WITH(png,
278     AS_HELP_STRING([--without-png],
279         [Don't try to use png]))
280 using_png=no
281 if test "$with_png" != "no"; then
282     AC_CHECK_HEADERS(png.h libpng/png.h,using_png=yes)
283     if test "$using_png" = "yes"; then
284         AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz", 
285                      [AC_CHECK_LIB(png12, png_set_rows, 
286                       PNG_LIBS="$PNG_LIBS -lpng12 -lz", 
287                       using_png=no, -lz)], -lz)
288     fi
289     if test "$with_png" = "yes" -a "$using_png" = "no"; then
290         AC_MSG_FAILURE([cannot find png])
291     fi
293 if test "$using_png" = yes; then
294    AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have PNG.])
296 AM_CONDITIONAL(HAVE_PNG, test x$using_png = xyes)
297 AC_SUBST(PNG_LIBS)
301 dnl Test for LADSPA
302 AC_ARG_WITH(ladspa,
303     AS_HELP_STRING([--without-ladspa], [Don't try to use LADSPA]))
304 using_ladspa=no
305 if test "$with_ladspa" != "no" -a "$using_libltdl" = "yes"; then
306     using_ladspa=yes
307     AC_DEFINE(HAVE_LADSPA_H, 1, [1 if should enable LADSPA])
309 LADSPA_PATH=${libdir}/ladspa
310 AC_ARG_WITH(ladspa-path,
311     AS_HELP_STRING([--with-ladspa-path], [Default search path for LADSPA plugins]))
312 AC_SUBST(LADSPA_PATH)
316 dnl Check for MAD libraries
317 AC_ARG_WITH(mad,
318     AS_HELP_STRING([--without-mad],
319         [Don't try to use MAD (MP3 Audio Decoder)]))
320 using_mad=no
321 if test "$with_mad" != "no"; then
322     using_mad=yes
323     AC_CHECK_HEADERS(mad.h,, using_mad=no)
324     AC_MSG_CHECKING([whether to dlopen mad])
325     AC_ARG_ENABLE(dl_mad,
326       AS_HELP_STRING([--enable-dl-mad], [Dlopen mad instead of linking in.]),
327       enable_dl_mad=$enableval, enable_dl_mad=no)
328     AC_MSG_RESULT($enable_dl_mad)
329     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
330       AC_DEFINE(DL_MAD, 1, [Define to dlopen() mad.])
331     else
332       enable_dl_mad="no"
333       AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
334       if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
335         AC_MSG_FAILURE([cannot find libmad])
336       fi
337     fi
342 dnl Check for id3tag libraries
343 AC_ARG_WITH(id3tag,
344     AS_HELP_STRING([--without-id3tag],
345         [Don't try to use id3tag]))
346 using_id3tag=no
347 if test "$with_id3tag" != "no"; then
348     using_id3tag=yes
349     AC_CHECK_HEADER(id3tag.h,
350         [AC_CHECK_LIB(id3tag, id3_file_open, MP3_LIBS="$MP3_LIBS -lid3tag -lz",using_id3tag=no, -lz)],
351         using_id3tag=no)
352     if test "$with_id3tag" = "yes" -a "$using_id3tag" = "no"; then
353         AC_MSG_FAILURE([cannot find id3tag])
354     fi
356 if test "$using_id3tag" = yes; then
357    AC_DEFINE(HAVE_ID3TAG, 1, [Define to 1 if you have id3tag.])
359 AM_CONDITIONAL(HAVE_ID3TAG, test x$using_id3tag = xyes)
363 dnl Check for LAME library.
364 AC_ARG_WITH(lame,
365     AS_HELP_STRING([--without-lame],
366         [Don't try to use LAME (LAME Ain't an MP3 Encoder)]))
367 using_lame=no
368 if test "$with_lame" != "no"; then
369     using_lame=yes
370     AC_MSG_CHECKING([whether to dlopen lame])
371     AC_ARG_ENABLE(dl_lame,
372       AS_HELP_STRING([--enable-dl-lame], [Dlopen lame instead of linking in.]),
373       enable_dl_lame=$enableval, enable_dl_lame=no)
374     AC_MSG_RESULT($enable_dl_lame)
375     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
376       AC_DEFINE(DL_LAME, 1, [Define to dlopen() lame.])
377     else
378       enable_dl_lame="no"
379       AC_CHECK_HEADERS(lame/lame.h,,
380         [AC_CHECK_HEADERS(lame.h, [], using_lame=no)])
381       AC_CHECK_LIB(mp3lame, lame_get_lametag_frame, MP3_LIBS="$MP3_LIBS -lmp3lame", using_lame=no)
382       AC_CHECK_LIB(mp3lame, id3tag_set_fieldvalue, using_lame=$using_lame)
383       if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
384         AC_DEFINE(HAVE_LAME_ID3TAG, 1, [Define to 1 if lame supports optional ID3 tags.])
385       fi
386       if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
387         AC_MSG_FAILURE([cannot find LAME])
388       fi
389     fi
394 dnl Check for Twolame library
395 AC_ARG_WITH(twolame,
396     AS_HELP_STRING([--without-twolame],
397         [Don't try to use Twolame (MP2 Audio Encoder)]))
398 using_twolame=no
399 if test "$with_twolame" != "no"; then
400     using_twolame=yes
401     AC_CHECK_HEADERS(twolame.h,, using_twolame=no)
402     AC_MSG_CHECKING([whether to dlopen twolame])
403     AC_ARG_ENABLE(dl_twolame,
404       AS_HELP_STRING([--enable-dl-twolame], [Dlopen twolame instead of linking in.]),
405       enable_dl_twolame=$enableval, enable_dl_twolame=no)
406     AC_MSG_RESULT($enable_dl_twolame)
407     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_twolame" = "xyes"; then
408       AC_DEFINE(DL_TWOLAME, 1, [Define to dlopen() libtwolame.])
409     else
410       enable_dl_twolame="no"
411       AC_CHECK_LIB(twolame, twolame_init, MP3_LIBS="$MP3_LIBS -ltwolame",using_twolame=no)
412       if test "$with_twolame" = "yes" -a "$using_twolame" = "no"; then
413         AC_MSG_FAILURE([cannot find libtwolame])
414       fi
415     fi
418 # Check for libgsm
419 found_libgsm=yes
420 AC_CHECK_HEADERS(gsm/gsm.h, ,
421     [AC_CHECK_HEADERS(gsm.h, ,found_libgsm=no)])
422     AC_CHECK_LIB(gsm, gsm_create, GSM_LIBS="$GSM_LIBS -lgsm", found_libgsm=no)
423 if test "$found_libgsm" = yes; then
424     AC_DEFINE(EXTERNAL_GSM, 1, [Define if you are using an external GSM library])
425 else
426     LIBGSM_LIBADD=../libgsm/libgsm.la
428 AM_CONDITIONAL(EXTERNAL_GSM, test x$found_libgsm = xyes)
429 AC_SUBST(LIBGSM_LIBADD)
433 # Check for liblpc10
434 found_liblpc10=yes
435 AC_CHECK_HEADERS(lpc10.h, ,
436     [AC_CHECK_HEADERS(lpc10.h, ,found_liblpc10=no)])
437     AC_CHECK_LIB(lpc10, create_lpc10_encoder_state, LPC10_LIBS="$LPC10_LIBS -llpc10", found_liblpc10=no)
438 if test "$found_liblpc10" = yes; then
439     AC_DEFINE(EXTERNAL_LPC10, 1, [Define if you are using an external LPC10 library])
440 else
441     LIBLPC10_LIBADD=../lpc10/liblpc10.la
443 AM_CONDITIONAL(EXTERNAL_LPC10, test x$found_liblpc10 = xyes)
444 AC_SUBST(LIBLPC10_LIBADD)
448 # Check for Ogg Vorbis
449 AC_OPTIONAL_FORMAT(oggvorbis, OGG_VORBIS, [AC_CHECK_HEADER(vorbis/codec.h,
450   [AC_CHECK_LIB(ogg, ogg_packet_clear, OGG_VORBIS_LIBS="$OGG_VORBIS_LIBS -logg", using_oggvorbis=no)
451   AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, OGG_VORBIS_LIBS="-lvorbis $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
452   AC_CHECK_LIB(vorbisfile, ov_clear, OGG_VORBIS_LIBS="-lvorbisfile $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
453   AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr, OGG_VORBIS_LIBS="-lvorbisenc $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)],
454   using_oggvorbis=no)])
456 # Check for Opus
457 AC_OPTIONAL_FORMAT(opus, OPUS,
458   [PKG_CHECK_MODULES(OPUS, [opusfile], [], using_opus=no)],
459   using_opus=no)
462 dnl Check for FLAC library
463 AC_OPTIONAL_FORMAT(flac, FLAC,
464     [PKG_CHECK_MODULES([FLAC], [flac], [], [using_flac=no])])
467 dnl When enable_dl_amrbw, do not let add libraries to be linked in
468 dnl since they will be dlopen()'ed instead.
469 ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
470 tmp_using_amrwb=$opt_default
471 AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
472                  [AC_CHECK_LIB(opencore-amrwb, D_IF_init, 
473                   AMRWB_LIBS="$AMRWB_LIBS -lopencore-amrwb", tmp_using_amrwb=no)],
474                   [AC_CHECK_HEADERS(amrwb/dec.h, 
475                    [AC_CHECK_LIB(amrwb, D_IF_init, 
476                     AMRWB_LIBS="$AMRWB_LIBS -lamrwb",tmp_using_amrwb=no)], 
477                     tmp_using_amrwb=no)])
478 AC_ARG_ENABLE(dl_amrwb,
479               AS_HELP_STRING([--enable-dl-amrwb], 
480                              [Dlopen amrbw instead of linking in.]),
481                              enable_dl_amrwb=$enableval, enable_dl_amrwb=no)
482 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then
483   AC_DEFINE(DL_AMRWB, 1, [Define to dlopen() amrwb.]) 
484   dnl When enable_dl_amrwb, do not let SOX_PATH_AMRWB add libraries
485   dnl to be linked in (since they will be dlopen()'ed instead).
486   AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"
487   dnl Force to using regardless if headers or libraries were found.
488   tmp_using_amrwb=yes
489 else
490   enable_dl_amrwb="no"
492 AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
494 dnl When enable_dl_amrnb, do not let add libraries to be linked in
495 dnl since they will be dlopen()'ed instead.
496 ac_sox_save_AMRNB_LIBS="$AMRNB_LIBS"
497 tmp_using_amrnb=$opt_default
498 AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h, 
499                  [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init, 
500                   AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
501                   [AC_CHECK_HEADER(amrnb/sp_dec.h, 
502                    [AC_CHECK_LIB(amrnb, Decoder_Interface_init, 
503                     AMRNB_LIBS="$AMRNB_LIBS -lamrnb", tmp_using_amrnb=no)], 
504                     tmp_using_amrnb=no)])
505 AC_ARG_ENABLE(dl_amrnb,
506               AS_HELP_STRING([--enable-dl-amrnb], 
507                              [Dlopen amrnb instead of linking in.]),
508                              enable_dl_amrnb=$enableval, enable_dl_amrnb=no)
509 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then
510   AC_DEFINE(DL_AMRNB, 1, [Define to dlopen() amrnb.]) 
511   dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
512   dnl to be linked in (since they will be dlopen()'ed instead).
513   AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
514   dnl Force to using regardless if headers or libraries were found.
515   tmp_using_amrnb=yes
516 else
517   enable_dl_amrnb="no"
519 AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
522 AC_OPTIONAL_FORMAT(wavpack, WAVPACK, [AC_CHECK_HEADER(wavpack/wavpack.h, [AC_CHECK_LIB(wavpack, WavpackGetSampleRate, WAVPACK_LIBS="$WAVPACK_LIBS -lwavpack",using_wavpack=no)], using_wavpack=no)])
526 AC_OPTIONAL_FORMAT(sndio, SNDIO, [AC_CHECK_HEADER(sndio.h, [AC_CHECK_LIB(sndio, sio_open, SNDIO_LIBS="$SNDIO_LIBS -lsndio",using_sndio=no)], using_sndio=no)])
530 AC_OPTIONAL_FORMAT(coreaudio, COREAUDIO, [AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [COREAUDIO_LIBS="$COREAUDIO_LIBS -Wl,-framework,CoreAudio"], using_coreaudio=no)])
534 AC_OPTIONAL_FORMAT(alsa, ALSA, [AC_CHECK_HEADER(alsa/asoundlib.h, [AC_CHECK_LIB(asound, snd_pcm_open, ALSA_LIBS="$ALSA_LIBS -lasound",using_alsa=no)], using_alsa=no)])
538 AC_OPTIONAL_FORMAT(ao, AO, [AC_CHECK_HEADER(ao/ao.h, [AC_CHECK_LIB(ao, ao_play, AO_LIBS="$AO_LIBS -lao",using_ao=no)], using_ao=no)])
542 AC_OPTIONAL_FORMAT(pulseaudio, PULSEAUDIO, [AC_CHECK_HEADER(pulse/simple.h, [AC_CHECK_LIB(pulse, pa_simple_new, PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS -lpulse -lpulse-simple",using_pulseaudio=no,"-lpulse-simple")], using_pulseaudio=no)])
545 AC_OPTIONAL_FORMAT(waveaudio, WAVEAUDIO, [AC_CHECK_HEADER(mmsystem.h, [WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"], using_waveaudio=no, [[#include <windows.h>]])])
547 dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
548 dnl to be linked in (since they will be dlopen()'ed instead).
549 ac_sox_save_SNDFILE_LIBS="$SNDFILE_LIBS"
550 SOX_PATH_SNDFILE(tmp_using_sndfile=$opt_default, tmp_using_sndfile=no)
551 AC_ARG_ENABLE(dl_sndfile,
552               AS_HELP_STRING([--enable-dl-sndfile], 
553                              [Dlopen sndfile instead of linking in.]),
554                              enable_dl_sndfile=$enableval, enable_dl_sndfile=no)
555 if test "x$using_sndfile" = "xyes"; then
556   if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
557     AC_DEFINE(DL_SNDFILE, 1, [Define to dlopen() sndfile.]) 
558     dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
559     dnl to be linked in (since they will be dlopen()'ed instead).
560     SNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
561   else
562     enable_dl_sndfile="no"
563   fi
565 AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [using_sndfile=$tmp_using_sndfile])
569 AC_OPTIONAL_FORMAT(oss, OSS, [AC_CHECK_HEADERS(sys/soundcard.h,, using_oss=no)])
573 AC_OPTIONAL_FORMAT(sunaudio, SUN_AUDIO, [AC_CHECK_HEADERS(sys/audioio.h,,
574       [AC_CHECK_HEADERS(sun/audioio.h,, using_sunaudio=no)])])
578 # MP2/MP3 format depends on libmad || LAME || twolame
579 AC_OPTIONAL_FORMAT(mp3, MP3, [
580   if test "$using_mad" != yes -a "$using_lame" != yes -a "$using_twolame" != yes; then
581     using_mp3=no
582   fi])
586 # GSM format depends on libgsm
587 # No need to check; GSM is always found
588 AC_OPTIONAL_FORMAT(gsm, GSM)
592 # LPC10 format depends on liblpc10
593 # No need to check; LPC10 is always found
594 AC_OPTIONAL_FORMAT(lpc10, LPC10)
598 dnl Check if we want to disable all symlinks
599 AC_MSG_CHECKING([whether to enable symlinks])
600 AC_ARG_ENABLE(symlinks,
601     AS_HELP_STRING([--disable-symlinks], [Don't make any symlinks to sox.]),,enable_symlinks=yes)
602 AC_MSG_RESULT($enable_symlinks)
604 enable_playrec_symlinks=no
605 if test "$enable_symlinks" = "yes"; then
606   SYMLINKS=yes
607   if test "" \
608       -o "$using_alsa" = yes \
609       -o "$using_ao" = yes \
610       -o "$using_coreaudio" = yes \
611       -o "$using_oss" = yes \
612       -o "$using_pulseaudio" = yes \
613       -o "$using_sndio" = yes \
614     ; then
615     PLAYRECLINKS=yes
616     enable_playrec_symlinks=yes
617   fi
619 AC_SUBST(SYMLINKS)
620 AC_SUBST(PLAYRECLINKS)
622 AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
624 dnl Generate output files.
625 AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile lpc10/Makefile sox.pc)
626 AC_OUTPUT
628 if test "$using_gsm" != "no"; then
629   if test "$found_libgsm" = "yes"; then
630     gsm_option="(external)"
631   else
632     gsm_option="(in-tree)"
633   fi
636 if test "$using_lpc10" != "no"; then
637   if test "$found_liblpc10" = "yes"; then
638     lpc10_option="(external)"
639   else
640     lpc10_option="(in-tree)"
641   fi
644 if test "$using_pkgconfig" = "no"; then
645   pkgconfig_option="disabled"
646 else
647   pkgconfig_option="$with_pkgconfigdir"
650 # Report configuration.
651 echo
652 echo "BUILD OPTIONS"
653 echo "Debugging build............$enable_debug"
654 echo "Distro name ...............$DISTRO"
655 echo "Dynamic loading support....$using_libltdl"
656 echo "Pkg-config location........$pkgconfig_option"
657 echo "Play and rec symlinks......$enable_playrec_symlinks"
658 echo "Symlinks enabled...........$enable_symlinks"
659 echo
660 echo "OPTIONAL DEVICE DRIVERS"
661 echo "ao (Xiph)..................$using_ao"
662 echo "alsa (Linux)...............$using_alsa"
663 echo "coreaudio (Mac OS X).......$using_coreaudio"
664 echo "sndio (OpenBSD)............$using_sndio"
665 echo "oss........................$using_oss"
666 echo "pulseaudio.................$using_pulseaudio"
667 echo "sunaudio...................$using_sunaudio"
668 echo "waveaudio (MS-Windows).....$using_waveaudio"
669 echo
670 echo "OPTIONAL FILE FORMATS"
671 echo "amrnb......................$using_amrnb"
672 if test "x$using_amrnb" = "xyes"; then
673 echo " dlopen amrnb..............$enable_dl_amrnb"
675 echo "amrwb......................$using_amrwb"
676 if test "x$using_amrwb" = "xyes"; then
677 echo " dlopen amrwb..............$enable_dl_amrwb"
679 echo "flac.......................$using_flac"
680 echo "gsm........................$using_gsm $gsm_option"
681 echo "lpc10......................$using_lpc10 $lpc10_option"
682 echo "mp2/mp3....................$using_mp3"
683 echo " id3tag....................$using_id3tag"
684 echo " lame......................$using_lame"
685 if test "x$using_lame" = "xyes"; then
686 if test "x$enable_dl_lame" != "xyes"; then
687 echo " lame id3tag...............$ac_cv_lib_mp3lame_id3tag_set_fieldvalue"
689 echo " dlopen lame...............$enable_dl_lame"
691 echo " mad.......................$using_mad"
692 if test "x$using_mad" = "xyes"; then
693 echo " dlopen mad................$enable_dl_mad"
695 echo " twolame...................$using_twolame"
696 if test "x$using_twolame" = "xyes"; then
697 echo " dlopen twolame............$enable_dl_twolame"
699 echo "oggvorbis..................$using_oggvorbis"
700 echo "opus.......................$using_opus"
701 echo "sndfile....................$using_sndfile"
702 if test "x$using_sndfile" = "xyes"; then
703 echo " dlopen sndfile............$enable_dl_sndfile"
705 echo "wavpack....................$using_wavpack"
706 echo
707 echo "OTHER OPTIONS"
708 echo "ladspa effects.............$using_ladspa"
709 echo "magic support..............$using_magic"
710 echo "png support................$using_png"
711 if test "x$OPENMP_CFLAGS" = "x"; then
712 echo "OpenMP support.............no"
713 else
714 echo "OpenMP support.............yes, $OPENMP_CFLAGS"
716 echo
717 echo "Configure finished.  Do 'make -s && make install' to compile and install SoX."
718 echo