sunaudio: fix input buffer overrun
[sox.git] / configure.ac
blob910e71d13bcad4bffa1cb80db0e4c7edfeb3912b
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)
183 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=distro], [Provide distribution name]))
184 if test "x$with_distro" != "x"; then
185   DISTRO="$with_distro"
186   AC_SUBST(DISTRO)
187   AC_DEFINE(HAVE_DISTRO, 1, [1 if DISTRO is defined])
188   have_distro=yes
189 else
190   DISTRO="not specified!"
192 AM_CONDITIONAL(HAVE_DISTRO, test x$have_distro = xyes)
194 dnl Check for system dependent features.
195 AC_C_BIGENDIAN
196 AC_C_INLINE
198 dnl Checks for header files.
199 AC_HEADER_STDC
200 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)
202 dnl Checks for library functions.
203 AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen sigaction)
205 dnl Check if math library is needed.
206 AC_SEARCH_LIBS([pow], [m])
207 AC_SEARCH_LIBS([lrint], [m])
208 AC_CHECK_FUNCS([lrint])
210 dnl Large File Support
211 AC_SYS_LARGEFILE
212 AC_FUNC_FSEEKO
214 dnl Allow libtool to be silenced
215 AC_MSG_CHECKING([whether libtool should be silenced])
216 AC_ARG_ENABLE(silent-libtool,
217     AS_HELP_STRING([--disable-silent-libtool], [Verbose libtool]),,enable_silent_libtool=yes)
218 AC_MSG_RESULT($enable_silent_libtool)
219 if test "$enable_silent_libtool" = "yes"; then
220     LIBTOOLFLAGS=--silent
222 AC_SUBST(LIBTOOLFLAGS)
224 dnl Check if ltdl should be enabled.
225 using_win32_ltdl="no"
226 if test "$using_libltdl" != "no"; then
227   case $target in
228     *mingw*)
229     AC_DEFINE([HAVE_WIN32_LTDL_H], 1, [Define to 1 to use internal win32 ltdl])
230     LIBLTDL=""
231     using_win32_ltdl="yes"
232     ;;
233     *)
234      AC_CHECK_HEADERS(ltdl.h,
235                      AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
236                                   using_libltdl=no), using_libltdl=no)
237     ;;
238   esac
240 if test "$using_libltdl" = yes; then
241   AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
243 AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes -a x$using_win32_ltdl = xno)
244 AM_CONDITIONAL(HAVE_WIN32_LTDL, test x$using_win32_ltdl = xyes)
245 AC_SUBST(LIBLTDL)
248 dnl Check for OpenMP
249 AC_OPENMP
250 CFLAGS="$CFLAGS $OPENMP_CFLAGS"
253 dnl Check for magic library
254 AC_ARG_WITH(magic,
255     AS_HELP_STRING([--without-magic],
256         [Don't try to use magic]))
257 using_magic=no
258 if test "$with_magic" != "no"; then
259     using_magic=yes
260     AC_CHECK_HEADER(magic.h,
261         [AC_CHECK_LIB(magic, magic_open, MAGIC_LIBS="-lmagic",using_magic=no)],
262         using_magic=no)
263     if test "$with_magic" = "yes" -a "$using_magic" = "no"; then
264         AC_MSG_FAILURE([cannot find magic])
265     fi
267 if test "$using_magic" = yes; then
268    AC_DEFINE(HAVE_MAGIC, 1, [Define to 1 if you have magic.])
270 AM_CONDITIONAL(HAVE_MAGIC, test x$using_magic = xyes)
271 AC_SUBST(MAGIC_LIBS)
275 dnl Check for png libraries
276 AC_ARG_WITH(png,
277     AS_HELP_STRING([--without-png],
278         [Don't try to use png]))
279 using_png=no
280 if test "$with_png" != "no"; then
281     AC_CHECK_HEADERS(png.h libpng/png.h,using_png=yes)
282     if test "$using_png" = "yes"; then
283         AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz", 
284                      [AC_CHECK_LIB(png12, png_set_rows, 
285                       PNG_LIBS="$PNG_LIBS -lpng12 -lz", 
286                       using_png=no, -lz)], -lz)
287     fi
288     if test "$with_png" = "yes" -a "$using_png" = "no"; then
289         AC_MSG_FAILURE([cannot find png])
290     fi
292 if test "$using_png" = yes; then
293    AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have PNG.])
295 AM_CONDITIONAL(HAVE_PNG, test x$using_png = xyes)
296 AC_SUBST(PNG_LIBS)
300 dnl Test for LADSPA
301 AC_ARG_WITH(ladspa,
302     AS_HELP_STRING([--without-ladspa], [Don't try to use LADSPA]))
303 using_ladspa=no
304 if test "$with_ladspa" != "no" -a "$using_libltdl" = "yes"; then
305     using_ladspa=yes
306     AC_DEFINE(HAVE_LADSPA_H, 1, [1 if should enable LADSPA])
308 LADSPA_PATH=${libdir}/ladspa
309 AC_ARG_WITH(ladspa-path,
310     AS_HELP_STRING([--with-ladspa-path], [Default search path for LADSPA plugins]))
311 AC_SUBST(LADSPA_PATH)
315 dnl Check for MAD libraries
316 AC_ARG_WITH(mad,
317     AS_HELP_STRING([--without-mad],
318         [Don't try to use MAD (MP3 Audio Decoder)]))
319 using_mad=no
320 if test "$with_mad" != "no"; then
321     using_mad=yes
322     AC_CHECK_HEADERS(mad.h,, using_mad=no)
323     AC_MSG_CHECKING([whether to dlopen mad])
324     AC_ARG_ENABLE(dl_mad,
325       AS_HELP_STRING([--enable-dl-mad], [Dlopen mad instead of linking in.]),
326       enable_dl_mad=$enableval, enable_dl_mad=no)
327     AC_MSG_RESULT($enable_dl_mad)
328     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
329       AC_DEFINE(DL_MAD, 1, [Define to dlopen() mad.])
330     else
331       enable_dl_mad="no"
332       AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
333       if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
334         AC_MSG_FAILURE([cannot find libmad])
335       fi
336     fi
341 dnl Check for id3tag libraries
342 AC_ARG_WITH(id3tag,
343     AS_HELP_STRING([--without-id3tag],
344         [Don't try to use id3tag]))
345 using_id3tag=no
346 if test "$with_id3tag" != "no"; then
347     using_id3tag=yes
348     AC_CHECK_HEADER(id3tag.h,
349         [AC_CHECK_LIB(id3tag, id3_file_open, MP3_LIBS="$MP3_LIBS -lid3tag -lz",using_id3tag=no, -lz)],
350         using_id3tag=no)
351     if test "$with_id3tag" = "yes" -a "$using_id3tag" = "no"; then
352         AC_MSG_FAILURE([cannot find id3tag])
353     fi
355 if test "$using_id3tag" = yes; then
356    AC_DEFINE(HAVE_ID3TAG, 1, [Define to 1 if you have id3tag.])
358 AM_CONDITIONAL(HAVE_ID3TAG, test x$using_id3tag = xyes)
362 dnl Check for LAME library.
363 AC_ARG_WITH(lame,
364     AS_HELP_STRING([--without-lame],
365         [Don't try to use LAME (LAME Ain't an MP3 Encoder)]))
366 using_lame=no
367 if test "$with_lame" != "no"; then
368     using_lame=yes
369     AC_MSG_CHECKING([whether to dlopen lame])
370     AC_ARG_ENABLE(dl_lame,
371       AS_HELP_STRING([--enable-dl-lame], [Dlopen lame instead of linking in.]),
372       enable_dl_lame=$enableval, enable_dl_lame=no)
373     AC_MSG_RESULT($enable_dl_lame)
374     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
375       AC_DEFINE(DL_LAME, 1, [Define to dlopen() lame.])
376     else
377       enable_dl_lame="no"
378       AC_CHECK_HEADERS(lame/lame.h,,
379         [AC_CHECK_HEADERS(lame.h, [], using_lame=no)])
380       AC_CHECK_LIB(mp3lame, lame_get_lametag_frame, MP3_LIBS="$MP3_LIBS -lmp3lame", using_lame=no)
381       AC_CHECK_LIB(mp3lame, id3tag_set_fieldvalue, using_lame=$using_lame)
382       if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
383         AC_DEFINE(HAVE_LAME_ID3TAG, 1, [Define to 1 if lame supports optional ID3 tags.])
384       fi
385       if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
386         AC_MSG_FAILURE([cannot find LAME])
387       fi
388     fi
393 dnl Check for Twolame library
394 AC_ARG_WITH(twolame,
395     AS_HELP_STRING([--without-twolame],
396         [Don't try to use Twolame (MP2 Audio Encoder)]))
397 using_twolame=no
398 if test "$with_twolame" != "no"; then
399     using_twolame=yes
400     AC_CHECK_HEADERS(twolame.h,, using_twolame=no)
401     AC_MSG_CHECKING([whether to dlopen twolame])
402     AC_ARG_ENABLE(dl_twolame,
403       AS_HELP_STRING([--enable-dl-twolame], [Dlopen twolame instead of linking in.]),
404       enable_dl_twolame=$enableval, enable_dl_twolame=no)
405     AC_MSG_RESULT($enable_dl_twolame)
406     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_twolame" = "xyes"; then
407       AC_DEFINE(DL_TWOLAME, 1, [Define to dlopen() libtwolame.])
408     else
409       enable_dl_twolame="no"
410       AC_CHECK_LIB(twolame, twolame_init, MP3_LIBS="$MP3_LIBS -ltwolame",using_twolame=no)
411       if test "$with_twolame" = "yes" -a "$using_twolame" = "no"; then
412         AC_MSG_FAILURE([cannot find libtwolame])
413       fi
414     fi
417 # Check for libgsm
418 found_libgsm=yes
419 AC_CHECK_HEADERS(gsm/gsm.h, ,
420     [AC_CHECK_HEADERS(gsm.h, ,found_libgsm=no)])
421     AC_CHECK_LIB(gsm, gsm_create, GSM_LIBS="$GSM_LIBS -lgsm", found_libgsm=no)
425 # Check for liblpc10
426 found_liblpc10=yes
427 AC_CHECK_HEADERS(lpc10.h, ,
428     [AC_CHECK_HEADERS(lpc10.h, ,found_liblpc10=no)])
429     AC_CHECK_LIB(lpc10, create_lpc10_encoder_state, LPC10_LIBS="$LPC10_LIBS -llpc10", found_liblpc10=no)
430 if test "$found_liblpc10" = yes; then
431     AC_DEFINE(EXTERNAL_LPC10, 1, [Define if you are using an external LPC10 library])
432 else
433     LIBLPC10_LIBADD=../lpc10/liblpc10.la
435 AM_CONDITIONAL(EXTERNAL_LPC10, test x$found_liblpc10 = xyes)
436 AC_SUBST(LIBLPC10_LIBADD)
440 # Check for Ogg Vorbis
441 AC_OPTIONAL_FORMAT(oggvorbis, OGG_VORBIS, [AC_CHECK_HEADER(vorbis/codec.h,
442   [AC_CHECK_LIB(ogg, ogg_packet_clear, OGG_VORBIS_LIBS="$OGG_VORBIS_LIBS -logg", using_oggvorbis=no)
443   AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, OGG_VORBIS_LIBS="-lvorbis $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
444   AC_CHECK_LIB(vorbisfile, ov_clear, OGG_VORBIS_LIBS="-lvorbisfile $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
445   AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr, OGG_VORBIS_LIBS="-lvorbisenc $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)],
446   using_oggvorbis=no)])
448 # Check for Opus
449 AC_OPTIONAL_FORMAT(opus, OPUS,
450   [PKG_CHECK_MODULES(OPUS, [opusfile], [], using_opus=no)],
451   using_opus=no)
454 dnl Check for FLAC library
455 AC_OPTIONAL_FORMAT(flac, FLAC,
456     [PKG_CHECK_MODULES([FLAC], [flac], [], [using_flac=no])])
459 dnl When enable_dl_amrbw, do not let add libraries to be linked in
460 dnl since they will be dlopen()'ed instead.
461 ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
462 tmp_using_amrwb=$opt_default
463 AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
464                  [AC_CHECK_LIB(opencore-amrwb, D_IF_init, 
465                   AMRWB_LIBS="$AMRWB_LIBS -lopencore-amrwb", tmp_using_amrwb=no)],
466                   [AC_CHECK_HEADERS(amrwb/dec.h, 
467                    [AC_CHECK_LIB(amrwb, D_IF_init, 
468                     AMRWB_LIBS="$AMRWB_LIBS -lamrwb",tmp_using_amrwb=no)], 
469                     tmp_using_amrwb=no)])
470 AC_ARG_ENABLE(dl_amrwb,
471               AS_HELP_STRING([--enable-dl-amrwb], 
472                              [Dlopen amrbw instead of linking in.]),
473                              enable_dl_amrwb=$enableval, enable_dl_amrwb=no)
474 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then
475   AC_DEFINE(DL_AMRWB, 1, [Define to dlopen() amrwb.]) 
476   dnl When enable_dl_amrwb, do not let SOX_PATH_AMRWB add libraries
477   dnl to be linked in (since they will be dlopen()'ed instead).
478   AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"
479   dnl Force to using regardless if headers or libraries were found.
480   tmp_using_amrwb=yes
481 else
482   enable_dl_amrwb="no"
484 AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
486 dnl When enable_dl_amrnb, do not let add libraries to be linked in
487 dnl since they will be dlopen()'ed instead.
488 ac_sox_save_AMRNB_LIBS="$AMRNB_LIBS"
489 tmp_using_amrnb=$opt_default
490 AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h, 
491                  [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init, 
492                   AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
493                   [AC_CHECK_HEADER(amrnb/sp_dec.h, 
494                    [AC_CHECK_LIB(amrnb, Decoder_Interface_init, 
495                     AMRNB_LIBS="$AMRNB_LIBS -lamrnb", tmp_using_amrnb=no)], 
496                     tmp_using_amrnb=no)])
497 AC_ARG_ENABLE(dl_amrnb,
498               AS_HELP_STRING([--enable-dl-amrnb], 
499                              [Dlopen amrnb instead of linking in.]),
500                              enable_dl_amrnb=$enableval, enable_dl_amrnb=no)
501 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then
502   AC_DEFINE(DL_AMRNB, 1, [Define to dlopen() amrnb.]) 
503   dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
504   dnl to be linked in (since they will be dlopen()'ed instead).
505   AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
506   dnl Force to using regardless if headers or libraries were found.
507   tmp_using_amrnb=yes
508 else
509   enable_dl_amrnb="no"
511 AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
514 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)])
518 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)])
522 AC_OPTIONAL_FORMAT(coreaudio, COREAUDIO, [AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [COREAUDIO_LIBS="$COREAUDIO_LIBS -Wl,-framework,CoreAudio"], using_coreaudio=no)])
526 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)])
530 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)])
534 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)])
537 AC_OPTIONAL_FORMAT(waveaudio, WAVEAUDIO, [AC_CHECK_HEADER(mmsystem.h, [WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"], using_waveaudio=no, [[#include <windows.h>]])])
539 dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
540 dnl to be linked in (since they will be dlopen()'ed instead).
541 ac_sox_save_SNDFILE_LIBS="$SNDFILE_LIBS"
542 SOX_PATH_SNDFILE(tmp_using_sndfile=$opt_default, tmp_using_sndfile=no)
543 AC_ARG_ENABLE(dl_sndfile,
544               AS_HELP_STRING([--enable-dl-sndfile], 
545                              [Dlopen sndfile instead of linking in.]),
546                              enable_dl_sndfile=$enableval, enable_dl_sndfile=no)
547 if test "x$tmp_using_sndfile" = "xyes"; then
548   if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
549     AC_DEFINE(DL_SNDFILE, 1, [Define to dlopen() sndfile.]) 
550     dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
551     dnl to be linked in (since they will be dlopen()'ed instead).
552     SNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
553   else
554     enable_dl_sndfile="no"
555   fi
557 AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [using_sndfile=$tmp_using_sndfile])
561 AC_OPTIONAL_FORMAT(oss, OSS, [AC_CHECK_HEADERS(sys/soundcard.h,, using_oss=no)])
565 AC_OPTIONAL_FORMAT(sunaudio, SUN_AUDIO, [AC_CHECK_HEADERS(sys/audioio.h,,
566       [AC_CHECK_HEADERS(sun/audioio.h,, using_sunaudio=no)])])
570 # MP2/MP3 format depends on libmad || LAME || twolame
571 AC_OPTIONAL_FORMAT(mp3, MP3, [
572   if test "$using_mad" != yes -a "$using_lame" != yes -a "$using_twolame" != yes; then
573     using_mp3=no
574   fi])
578 # GSM format depends on libgsm
579 AC_OPTIONAL_FORMAT(gsm, GSM, [using_gsm=$found_libgsm])
583 # LPC10 format depends on liblpc10
584 # No need to check; LPC10 is always found
585 AC_OPTIONAL_FORMAT(lpc10, LPC10)
589 dnl Check if we want to disable all symlinks
590 AC_MSG_CHECKING([whether to enable symlinks])
591 AC_ARG_ENABLE(symlinks,
592     AS_HELP_STRING([--disable-symlinks], [Don't make any symlinks to sox.]),,enable_symlinks=yes)
593 AC_MSG_RESULT($enable_symlinks)
595 enable_playrec_symlinks=no
596 if test "$enable_symlinks" = "yes"; then
597   SYMLINKS=yes
598   if test "" \
599       -o "$using_alsa" = yes \
600       -o "$using_ao" = yes \
601       -o "$using_coreaudio" = yes \
602       -o "$using_oss" = yes \
603       -o "$using_pulseaudio" = yes \
604       -o "$using_sndio" = yes \
605     ; then
606     PLAYRECLINKS=yes
607     enable_playrec_symlinks=yes
608   fi
610 AC_SUBST(SYMLINKS)
611 AC_SUBST(PLAYRECLINKS)
613 AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
615 dnl Generate output files.
616 AC_CONFIG_FILES(Makefile src/Makefile lpc10/Makefile sox.pc)
617 AC_OUTPUT
619 if test "$using_lpc10" != "no"; then
620   if test "$found_liblpc10" = "yes"; then
621     lpc10_option="(external)"
622   else
623     lpc10_option="(in-tree)"
624   fi
627 if test "$using_pkgconfig" = "no"; then
628   pkgconfig_option="disabled"
629 else
630   pkgconfig_option="$with_pkgconfigdir"
633 # Report configuration.
634 echo
635 echo "BUILD OPTIONS"
636 echo "Debugging build............$enable_debug"
637 echo "Distro name ...............$DISTRO"
638 echo "Dynamic loading support....$using_libltdl"
639 echo "Pkg-config location........$pkgconfig_option"
640 echo "Play and rec symlinks......$enable_playrec_symlinks"
641 echo "Symlinks enabled...........$enable_symlinks"
642 echo
643 echo "OPTIONAL DEVICE DRIVERS"
644 echo "ao (Xiph)..................$using_ao"
645 echo "alsa (Linux)...............$using_alsa"
646 echo "coreaudio (Mac OS X).......$using_coreaudio"
647 echo "sndio (OpenBSD)............$using_sndio"
648 echo "oss........................$using_oss"
649 echo "pulseaudio.................$using_pulseaudio"
650 echo "sunaudio...................$using_sunaudio"
651 echo "waveaudio (MS-Windows).....$using_waveaudio"
652 echo
653 echo "OPTIONAL FILE FORMATS"
654 echo "amrnb......................$using_amrnb"
655 if test "x$using_amrnb" = "xyes"; then
656 echo " dlopen amrnb..............$enable_dl_amrnb"
658 echo "amrwb......................$using_amrwb"
659 if test "x$using_amrwb" = "xyes"; then
660 echo " dlopen amrwb..............$enable_dl_amrwb"
662 echo "flac.......................$using_flac"
663 echo "gsm........................$using_gsm"
664 echo "lpc10......................$using_lpc10 $lpc10_option"
665 echo "mp2/mp3....................$using_mp3"
666 echo " id3tag....................$using_id3tag"
667 echo " lame......................$using_lame"
668 if test "x$using_lame" = "xyes"; then
669 if test "x$enable_dl_lame" != "xyes"; then
670 echo " lame id3tag...............$ac_cv_lib_mp3lame_id3tag_set_fieldvalue"
672 echo " dlopen lame...............$enable_dl_lame"
674 echo " mad.......................$using_mad"
675 if test "x$using_mad" = "xyes"; then
676 echo " dlopen mad................$enable_dl_mad"
678 echo " twolame...................$using_twolame"
679 if test "x$using_twolame" = "xyes"; then
680 echo " dlopen twolame............$enable_dl_twolame"
682 echo "oggvorbis..................$using_oggvorbis"
683 echo "opus.......................$using_opus"
684 echo "sndfile....................$using_sndfile"
685 if test "x$using_sndfile" = "xyes"; then
686 echo " dlopen sndfile............$enable_dl_sndfile"
688 echo "wavpack....................$using_wavpack"
689 echo
690 echo "OTHER OPTIONS"
691 echo "ladspa effects.............$using_ladspa"
692 echo "magic support..............$using_magic"
693 echo "png support................$using_png"
694 if test "x$OPENMP_CFLAGS" = "x"; then
695 echo "OpenMP support.............no"
696 else
697 echo "OpenMP support.............yes, $OPENMP_CFLAGS"
699 echo
700 echo "Configure finished.  Do 'make -s && make install' to compile and install SoX."
701 echo