build: delete msvc project files
[sox.git] / configure.ac
blob75525bfd52f44d96f3a4b50bde9364bc35187eb5
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.62)
5 AC_INIT(SoX, 14.4.3git, sox-devel@lists.sourceforge.net)
7 AC_CONFIG_MACRO_DIR([m4])
9 dnl Find target architecture
10 AC_CANONICAL_TARGET
12 AM_INIT_AUTOMAKE
13 AM_SILENT_RULES([yes])
15 dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
16 AC_CONFIG_HEADERS([src/soxconfig.h])
18 dnl Check we have the right srcdir
19 AC_CONFIG_SRCDIR(sox.1)
21 dnl Checks for programs.
22 AC_PROG_CC
23 AM_PROG_CC_C_O
24 AC_PROG_INSTALL
25 AC_PROG_LN_S
27 AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
29 dnl Increase version when binary compatibility with previous version is broken
30 SHLIB_VERSION=3:0:0
31 AC_SUBST(SHLIB_VERSION)
33 AC_ARG_WITH(libltdl,
34     AS_HELP_STRING([--without-libltdl],
35         [Don't try to use libltdl for external dynamic library support]),
36     with_libltdl=$withval, with_libltdl=default)
38 if test "$with_libltdl" = "default"; then
39     dnl Default to no libltdl support when building only static libraries
40     if test "$enable_shared" != "no"; then
41         using_libltdl=yes
42     else
43         using_libltdl=no
44     fi
45     with_libltdl="yes"
46 else
47     using_libltdl=$with_libltdl
50 LT_INIT([dlopen win32-dll])
51 AC_SUBST(LIBTOOL_DEPS)
53 AC_ARG_WITH(dyn-default,AS_HELP_STRING([--with-dyn-default],[Default to loading optional formats dynamically]),opt_default=dyn,opt_default=yes)
55 AC_ARG_WITH(pkgconfigdir,
56     AS_HELP_STRING([--with-pkgconfigdir],
57                    [location to install .pc files or "no" to disable (default=$(libdir)/pkgconfig)]))
59 m4_ifndef([PKG_PROG_PKG_CONFIG], with_pkgconfigdir="no")
61 using_pkgconfig=no
62 if test "$with_pkgconfigdir" != "no"; then
63     if test "$with_pkgconfigdir" = ""; then
64         with_pkgconfigdir="\$(libdir)/pkgconfig"
65     fi
66     using_pkgconfig="yes"
67     PKG_PROG_PKG_CONFIG
69 AM_CONDITIONAL(HAVE_PKGCONFIG, test x$using_pkgconfig = xyes)
70 AC_SUBST(PKGCONFIGDIR, $with_pkgconfigdir)
72 using_win32_glob="no"
73 case $target in
74   *mingw*)
75   using_win32_glob="yes"
76    ;;
77 esac
78 if test "$using_win32_glob" = yes; then
79    AC_DEFINE([HAVE_WIN32_GLOB_H], 1, [Define to 1 to use win32 glob])
81 AM_CONDITIONAL(HAVE_WIN32_GLOB, test x$using_win32_glob = xyes)
83 dnl Debugging
84 AC_MSG_CHECKING([whether to make a debug build])
85 AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [make a debug build]))
86 AC_MSG_RESULT($enable_debug)
87 if test "$enable_debug" = "yes"; then
88     CFLAGS="-g"
89     if test "$GCC" = "yes"; then
90         CFLAGS="$CFLAGS -ggdb"
91     fi
92 else
93     enable_debug=no
96 # -fstack-protector
97 AC_ARG_ENABLE([stack-protector],
98     [AS_HELP_STRING([--disable-stack-protector],
99         [Disable GCC's/libc's stack-smashing protection])],
100     [case "${enableval}" in
101          yes) enable_ssp=yes ;;
102           no) enable_ssp=no ;;
103            *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
104      esac],
105     [enable_ssp=yes])
107 if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
108     AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
109     enable_ssp=no
112 if test x"$enable_ssp" = x"yes"; then
113     # Check for broken ssp in libc: http://www.avahi.org/ticket/105
114     # libc's brokenness will get in the way regardless of whether -lssp is
115     # provided, but provide it anyway (otherwise non-libc ssp would wrongly
116     # break here)
118     # Get -lssp if it exists
119     GCC_STACK_PROTECT_LIB
121     AC_MSG_CHECKING([whether stack-smashing protection is available])
122     ssp_old_cflags="$CFLAGS"
123     ssp_old_ldflags="$LDFLAGS"
124     CFLAGS="$CFLAGS -Werror -fstack-protector-all -fPIC"
125     LDFLAGS="$LDFLAGS -Wl,-z,defs"
126     cat confdefs.h > conftest.c
127     cat >>conftest.c <<_ACEOF
128 void test_broken_ssp(c)
129     const char *c;
131     char arr[[123]], *p; /* beware of possible double-braces if copying this */
132     for (p = arr; *c; ++p) {
133         *p = *c;
134         ++c;
135     }
137 _ACEOF
138     rm -f conftest.o
140     if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
141         AC_MSG_RESULT([yes])
142         AC_MSG_CHECKING([whether stack-smashing protection is buggy])
143         if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
144             AC_MSG_RESULT([no])
145         else
146             AC_MSG_RESULT([yes])
147             enable_ssp=no
148         fi
149     else
150         AC_MSG_RESULT([no])
151     fi
153     rm -f conftest.c conftest.o conftest.so
155     CFLAGS="$ssp_old_cflags"
156     LDFLAGS="$ssp_old_ldflags"
159 if test x"$enable_ssp" = x"yes"; then
160     # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
161     GCC_STACK_PROTECT_CC
163     # XXX: Update the enable_ssp value now for output later?
166 dnl Extra CFLAGS if we have gcc
167 if test "$GCC" = "yes"; then
169     AC_MSG_CHECKING([gcc version])
170     gccver=`$CC -dumpversion`
171     AC_MSG_RESULT($gccver)
173     CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
175     dnl Define stricter policy on GNU/Linux, all symbols must be resolved
176     case $target in
177       *linux* | *solaris*)
178         LDFLAGS="$LDFLAGS -Wl,-z,defs"
179         ;;
180       *os2* | *cygwin* | *mingw*)
181         APP_LDFLAGS="-no-undefined"
182         ;;
183     esac
185 AC_SUBST(APP_LDFLAGS)
186 AC_SUBST(WARN_CFLAGS)
188 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=distro], [Provide distribution name]))
189 if test "x$with_distro" != "x"; then
190   DISTRO="$with_distro"
191   AC_SUBST(DISTRO)
192   AC_DEFINE(HAVE_DISTRO, 1, [1 if DISTRO is defined])
193   have_distro=yes
194 else
195   DISTRO="not specified!"
197 AM_CONDITIONAL(HAVE_DISTRO, test x$have_distro = xyes)
199 dnl Check for system dependent features.
200 AC_C_BIGENDIAN
201 AC_C_INLINE
203 dnl Checks for header files.
204 AC_HEADER_STDC
205 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)
207 dnl Checks for library functions.
208 AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen sigaction)
210 dnl Check if math library is needed.
211 AC_SEARCH_LIBS([pow], [m])
212 AC_SEARCH_LIBS([lrint], [m])
213 AC_CHECK_FUNCS([lrint])
215 dnl Large File Support
216 AC_SYS_LARGEFILE
217 AC_FUNC_FSEEKO
218 if test "$ac_cv_sys_file_offset_bits" = "64"; then
219   dnl This is either a 64-bit platform or a 32-bit platform
220   dnl that supports large files.
221   dnl There are to many broken glibc+kernel's out there that
222   dnl detect 64-bit off_t on 32-bit system and require
223   dnl _LARGEFILE_SOURCE to make fseeko() go into 64-bit mode.
224   dnl Force defining _LARGEFILE_SOURCE always.  My assumption
225   dnl is its harmlessly ignored on 64-bit platforms and platforms
226   dnl that chose other solutions.
227   AC_MSG_NOTICE(Forcing _LARGEFILE_SOURCE to be safe since off_t is 64 bits)
228   AC_DEFINE(_LARGEFILE_SOURCE, 1)
231 dnl Allow libtool to be silenced
232 AC_MSG_CHECKING([whether libtool should be silenced])
233 AC_ARG_ENABLE(silent-libtool,
234     AS_HELP_STRING([--disable-silent-libtool], [Verbose libtool]),,enable_silent_libtool=yes)
235 AC_MSG_RESULT($enable_silent_libtool)
236 if test "$enable_silent_libtool" = "yes"; then
237     LIBTOOLFLAGS=--silent
239 AC_SUBST(LIBTOOLFLAGS)
241 dnl Check if ltdl should be enabled.
242 using_win32_ltdl="no"
243 if test "$using_libltdl" != "no"; then
244   case $target in
245     *mingw*)
246     AC_DEFINE([HAVE_WIN32_LTDL_H], 1, [Define to 1 to use internal win32 ltdl])
247     LIBLTDL=""
248     using_win32_ltdl="yes"
249     ;;
250     *)
251      AC_CHECK_HEADERS(ltdl.h,
252                      AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
253                                   using_libltdl=no), using_libltdl=no)
254     ;;
255   esac
257 if test "$using_libltdl" = yes; then
258   AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
260 AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes -a x$using_win32_ltdl = xno)
261 AM_CONDITIONAL(HAVE_WIN32_LTDL, test x$using_win32_ltdl = xyes)
262 AC_SUBST(LIBLTDL)
265 dnl Check for OpenMP
266 AC_OPENMP
267 if test "x$OPENMP_CFLAGS" != "x"; then  dnl Old libtool workaround start
268   AC_MSG_CHECKING([for libtool version])
269   lt_version="`grep '^VERSION' $srcdir/ltmain.sh | sed -e 's/VERSION\=//g;s/ .*//g;s/"//g'`"
270   AS_VERSION_COMPARE([$lt_version], [2.4],
271     [AS_IF([test "$GCC" = "yes"],
272        [AC_MSG_RESULT([$lt_version, needs OpenMP linker workaround])
273         GOMP_LIBS="-lgomp"],
274        [AC_MSG_RESULT([$lt_version and not GCC, deactivating OpenMP])
275         OPENMP_CFLAGS=""])],
276     [AC_MSG_RESULT([$lt_version, OK])],
277     [AC_MSG_RESULT([$lt_version, OK])])
279 AC_SUBST(GOMP_LIBS)  dnl Old libtool workaround end.
280                      dnl Only necessary if libtool version < 2.4, as older
281                      dnl versions don't pass on "-fopenmp" to the linker.
282                      dnl One day, replace with LT_PREREQ([2.4]) above.
283 CFLAGS="$CFLAGS $OPENMP_CFLAGS"
286 dnl Check for magic library
287 AC_ARG_WITH(magic,
288     AS_HELP_STRING([--without-magic],
289         [Don't try to use magic]))
290 using_magic=no
291 if test "$with_magic" != "no"; then
292     using_magic=yes
293     AC_CHECK_HEADER(magic.h,
294         [AC_CHECK_LIB(magic, magic_open, MAGIC_LIBS="-lmagic",using_magic=no)],
295         using_magic=no)
296     if test "$with_magic" = "yes" -a "$using_magic" = "no"; then
297         AC_MSG_FAILURE([cannot find magic])
298     fi
300 if test "$using_magic" = yes; then
301    AC_DEFINE(HAVE_MAGIC, 1, [Define to 1 if you have magic.])
303 AM_CONDITIONAL(HAVE_MAGIC, test x$using_magic = xyes)
304 AC_SUBST(MAGIC_LIBS)
308 dnl Check for png libraries
309 AC_ARG_WITH(png,
310     AS_HELP_STRING([--without-png],
311         [Don't try to use png]))
312 using_png=no
313 if test "$with_png" != "no"; then
314     AC_CHECK_HEADERS(png.h libpng/png.h,using_png=yes)
315     if test "$using_png" = "yes"; then
316         AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz", 
317                      [AC_CHECK_LIB(png12, png_set_rows, 
318                       PNG_LIBS="$PNG_LIBS -lpng12 -lz", 
319                       using_png=no, -lz)], -lz)
320     fi
321     if test "$with_png" = "yes" -a "$using_png" = "no"; then
322         AC_MSG_FAILURE([cannot find png])
323     fi
325 if test "$using_png" = yes; then
326    AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have PNG.])
328 AM_CONDITIONAL(HAVE_PNG, test x$using_png = xyes)
329 AC_SUBST(PNG_LIBS)
333 dnl Test for LADSPA
334 AC_ARG_WITH(ladspa,
335     AS_HELP_STRING([--without-ladspa], [Don't try to use LADSPA]))
336 using_ladspa=no
337 if test "$with_ladspa" != "no" -a "$using_libltdl" = "yes"; then
338     using_ladspa=yes
339     AC_DEFINE(HAVE_LADSPA_H, 1, [1 if should enable LADSPA])
341 LADSPA_PATH=${libdir}/ladspa
342 AC_ARG_WITH(ladspa-path,
343     AS_HELP_STRING([--with-ladspa-path], [Default search path for LADSPA plugins]))
344 AC_SUBST(LADSPA_PATH)
348 dnl Check for MAD libraries
349 AC_ARG_WITH(mad,
350     AS_HELP_STRING([--without-mad],
351         [Don't try to use MAD (MP3 Audio Decoder)]))
352 using_mad=no
353 if test "$with_mad" != "no"; then
354     using_mad=yes
355     AC_CHECK_HEADERS(mad.h,, using_mad=no)
356     AC_MSG_CHECKING([whether to dlopen mad])
357     AC_ARG_ENABLE(dl_mad,
358       AS_HELP_STRING([--enable-dl-mad], [Dlopen mad instead of linking in.]),
359       enable_dl_mad=$enableval, enable_dl_mad=no)
360     AC_MSG_RESULT($enable_dl_mad)
361     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
362       AC_DEFINE(DL_MAD, 1, [Define to dlopen() mad.])
363     else
364       enable_dl_mad="no"
365       AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
366       if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
367         AC_MSG_FAILURE([cannot find libmad])
368       fi
369     fi
374 dnl Check for id3tag libraries
375 AC_ARG_WITH(id3tag,
376     AS_HELP_STRING([--without-id3tag],
377         [Don't try to use id3tag]))
378 using_id3tag=no
379 if test "$with_id3tag" != "no"; then
380     using_id3tag=yes
381     AC_CHECK_HEADER(id3tag.h,
382         [AC_CHECK_LIB(id3tag, id3_file_open, MP3_LIBS="$MP3_LIBS -lid3tag -lz",using_id3tag=no, -lz)],
383         using_id3tag=no)
384     if test "$with_id3tag" = "yes" -a "$using_id3tag" = "no"; then
385         AC_MSG_FAILURE([cannot find id3tag])
386     fi
388 if test "$using_id3tag" = yes; then
389    AC_DEFINE(HAVE_ID3TAG, 1, [Define to 1 if you have id3tag.])
391 AM_CONDITIONAL(HAVE_ID3TAG, test x$using_id3tag = xyes)
395 dnl Check for LAME library.
396 AC_ARG_WITH(lame,
397     AS_HELP_STRING([--without-lame],
398         [Don't try to use LAME (LAME Ain't an MP3 Encoder)]))
399 using_lame=no
400 if test "$with_lame" != "no"; then
401     using_lame=yes
402     AC_MSG_CHECKING([whether to dlopen lame])
403     AC_ARG_ENABLE(dl_lame,
404       AS_HELP_STRING([--enable-dl-lame], [Dlopen lame instead of linking in.]),
405       enable_dl_lame=$enableval, enable_dl_lame=no)
406     AC_MSG_RESULT($enable_dl_lame)
407     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
408       AC_DEFINE(DL_LAME, 1, [Define to dlopen() lame.])
409     else
410       enable_dl_lame="no"
411       AC_CHECK_HEADERS(lame/lame.h,,
412         [AC_CHECK_HEADERS(lame.h, [], using_lame=no)])
413       AC_CHECK_LIB(mp3lame, lame_get_lametag_frame, MP3_LIBS="$MP3_LIBS -lmp3lame", using_lame=no)
414       AC_CHECK_LIB(mp3lame, id3tag_set_fieldvalue, using_lame=$using_lame)
415       if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
416         AC_DEFINE(HAVE_LAME_ID3TAG, 1, [Define to 1 if lame supports optional ID3 tags.])
417       fi
418       if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
419         AC_MSG_FAILURE([cannot find LAME])
420       fi
421     fi
426 dnl Check for Twolame library
427 AC_ARG_WITH(twolame,
428     AS_HELP_STRING([--without-twolame],
429         [Don't try to use Twolame (MP2 Audio Encoder)]))
430 using_twolame=no
431 if test "$with_twolame" != "no"; then
432     using_twolame=yes
433     AC_CHECK_HEADERS(twolame.h,, using_twolame=no)
434     AC_MSG_CHECKING([whether to dlopen twolame])
435     AC_ARG_ENABLE(dl_twolame,
436       AS_HELP_STRING([--enable-dl-twolame], [Dlopen twolame instead of linking in.]),
437       enable_dl_twolame=$enableval, enable_dl_twolame=no)
438     AC_MSG_RESULT($enable_dl_twolame)
439     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_twolame" = "xyes"; then
440       AC_DEFINE(DL_TWOLAME, 1, [Define to dlopen() libtwolame.])
441     else
442       enable_dl_twolame="no"
443       AC_CHECK_LIB(twolame, twolame_init, MP3_LIBS="$MP3_LIBS -ltwolame",using_twolame=no)
444       if test "$with_twolame" = "yes" -a "$using_twolame" = "no"; then
445         AC_MSG_FAILURE([cannot find libtwolame])
446       fi
447     fi
450 # Check for libgsm
451 found_libgsm=yes
452 AC_CHECK_HEADERS(gsm/gsm.h, ,
453     [AC_CHECK_HEADERS(gsm.h, ,found_libgsm=no)])
454     AC_CHECK_LIB(gsm, gsm_create, GSM_LIBS="$GSM_LIBS -lgsm", found_libgsm=no)
455 if test "$found_libgsm" = yes; then
456     AC_DEFINE(EXTERNAL_GSM, 1, [Define if you are using an external GSM library])
457 else
458     LIBGSM_LIBADD=../libgsm/libgsm.la
460 AM_CONDITIONAL(EXTERNAL_GSM, test x$found_libgsm = xyes)
461 AC_SUBST(LIBGSM_LIBADD)
465 # Check for liblpc10
466 found_liblpc10=yes
467 AC_CHECK_HEADERS(lpc10.h, ,
468     [AC_CHECK_HEADERS(lpc10.h, ,found_liblpc10=no)])
469     AC_CHECK_LIB(lpc10, create_lpc10_encoder_state, LPC10_LIBS="$LPC10_LIBS -llpc10", found_liblpc10=no)
470 if test "$found_liblpc10" = yes; then
471     AC_DEFINE(EXTERNAL_LPC10, 1, [Define if you are using an external LPC10 library])
472 else
473     LIBLPC10_LIBADD=../lpc10/liblpc10.la
475 AM_CONDITIONAL(EXTERNAL_LPC10, test x$found_liblpc10 = xyes)
476 AC_SUBST(LIBLPC10_LIBADD)
480 # Check for Ogg Vorbis
481 AC_OPTIONAL_FORMAT(oggvorbis, OGG_VORBIS, [AC_CHECK_HEADER(vorbis/codec.h,
482   [AC_CHECK_LIB(ogg, ogg_packet_clear, OGG_VORBIS_LIBS="$OGG_VORBIS_LIBS -logg", using_oggvorbis=no)
483   AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, OGG_VORBIS_LIBS="-lvorbis $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
484   AC_CHECK_LIB(vorbisfile, ov_clear, OGG_VORBIS_LIBS="-lvorbisfile $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
485   AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr, OGG_VORBIS_LIBS="-lvorbisenc $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)],
486   using_oggvorbis=no)])
488 # Check for Opus
489 AC_OPTIONAL_FORMAT(opus, OPUS,
490   [PKG_CHECK_MODULES(OPUS, [opusfile], [], using_opus=no)],
491   using_opus=no)
492 if test "$GCC" = "yes"; then
493   OPUS_CFLAGS="$OPUS_CFLAGS -Wno-long-long"
497 # Check for FLAC libraries
498 #  Note passing in OGG_VORBIS_LIBS.  That is because FLAC has optional
499 #  support for OGG and if OGG libraries are found on this
500 #  system then its highly likely to be compiled into FLAC
501 #  and will require these at link time.
502 case $target in
503   *mingw*)
504   FLAC_LIBS="-lwsock32"
505   ;;
506 esac
507 AC_OPTIONAL_FORMAT(flac, FLAC, [AC_CHECK_HEADER(FLAC/all.h, [AC_CHECK_DECL(FLAC_API_VERSION_CURRENT, [AC_CHECK_LIB(FLAC, FLAC__stream_encoder_new, FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_VORBIS_LIBS",using_flac=no, $FLAC_LIBS $OGG_VORBIS_LIBS)], using_flac=no, [#include <FLAC/all.h>])], using_flac=no)], using_flac=no)
510 dnl When enable_dl_amrbw, do not let add libraries to be linked in
511 dnl since they will be dlopen()'ed instead.
512 ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
513 tmp_using_amrwb=$opt_default
514 AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
515                  [AC_CHECK_LIB(opencore-amrwb, D_IF_init, 
516                   AMRWB_LIBS="$AMRWB_LIBS -lopencore-amrwb", tmp_using_amrwb=no)],
517                   [AC_CHECK_HEADERS(amrwb/dec.h, 
518                    [AC_CHECK_LIB(amrwb, D_IF_init, 
519                     AMRWB_LIBS="$AMRWB_LIBS -lamrwb",tmp_using_amrwb=no)], 
520                     tmp_using_amrwb=no)])
521 AC_ARG_ENABLE(dl_amrwb,
522               AS_HELP_STRING([--enable-dl-amrwb], 
523                              [Dlopen amrbw instead of linking in.]),
524                              enable_dl_amrwb=$enableval, enable_dl_amrwb=no)
525 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then
526   AC_DEFINE(DL_AMRWB, 1, [Define to dlopen() amrwb.]) 
527   dnl When enable_dl_amrwb, do not let SOX_PATH_AMRWB add libraries
528   dnl to be linked in (since they will be dlopen()'ed instead).
529   AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"
530   dnl Force to using regardless if headers or libraries were found.
531   tmp_using_amrwb=yes
532 else
533   enable_dl_amrwb="no"
535 AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
537 dnl When enable_dl_amrnb, do not let add libraries to be linked in
538 dnl since they will be dlopen()'ed instead.
539 ac_sox_save_AMRNB_LIBS="$AMRNB_LIBS"
540 tmp_using_amrnb=$opt_default
541 AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h, 
542                  [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init, 
543                   AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
544                   [AC_CHECK_HEADER(amrnb/sp_dec.h, 
545                    [AC_CHECK_LIB(amrnb, Decoder_Interface_init, 
546                     AMRNB_LIBS="$AMRNB_LIBS -lamrnb", tmp_using_amrnb=no)], 
547                     tmp_using_amrnb=no)])
548 AC_ARG_ENABLE(dl_amrnb,
549               AS_HELP_STRING([--enable-dl-amrnb], 
550                              [Dlopen amrnb instead of linking in.]),
551                              enable_dl_amrnb=$enableval, enable_dl_amrnb=no)
552 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then
553   AC_DEFINE(DL_AMRNB, 1, [Define to dlopen() amrnb.]) 
554   dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
555   dnl to be linked in (since they will be dlopen()'ed instead).
556   AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
557   dnl Force to using regardless if headers or libraries were found.
558   tmp_using_amrnb=yes
559 else
560   enable_dl_amrnb="no"
562 AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
565 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)])
569 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)])
573 AC_OPTIONAL_FORMAT(coreaudio, COREAUDIO, [AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [COREAUDIO_LIBS="$COREAUDIO_LIBS -Wl,-framework,CoreAudio"], using_coreaudio=no)])
577 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)])
581 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)])
585 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)])
588 AC_OPTIONAL_FORMAT(waveaudio, WAVEAUDIO, [AC_CHECK_HEADER(mmsystem.h, [WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"], using_waveaudio=no, [[#include <windows.h>]])])
590 dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
591 dnl to be linked in (since they will be dlopen()'ed instead).
592 ac_sox_save_SNDFILE_LIBS="$SNDFILE_LIBS"
593 SOX_PATH_SNDFILE(tmp_using_sndfile=$opt_default, tmp_using_sndfile=no)
594 AC_ARG_ENABLE(dl_sndfile,
595               AS_HELP_STRING([--enable-dl-sndfile], 
596                              [Dlopen sndfile instead of linking in.]),
597                              enable_dl_sndfile=$enableval, enable_dl_sndfile=no)
598 if test "x$using_sndfile" = "xyes"; then
599   if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
600     AC_DEFINE(DL_SNDFILE, 1, [Define to dlopen() sndfile.]) 
601     dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
602     dnl to be linked in (since they will be dlopen()'ed instead).
603     SNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
604   else
605     enable_dl_sndfile="no"
606   fi
608 AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [using_sndfile=$tmp_using_sndfile])
612 AC_OPTIONAL_FORMAT(oss, OSS, [AC_CHECK_HEADERS(sys/soundcard.h,, using_oss=no)])
616 AC_OPTIONAL_FORMAT(sunaudio, SUN_AUDIO, [AC_CHECK_HEADERS(sys/audioio.h,,
617       [AC_CHECK_HEADERS(sun/audioio.h,, using_sunaudio=no)])])
621 # MP2/MP3 format depends on libmad || LAME || twolame
622 AC_OPTIONAL_FORMAT(mp3, MP3, [
623   if test "$using_mad" != yes -a "$using_lame" != yes -a "$using_twolame" != yes; then
624     using_mp3=no
625   fi])
629 # GSM format depends on libgsm
630 # No need to check; GSM is always found
631 AC_OPTIONAL_FORMAT(gsm, GSM)
635 # LPC10 format depends on liblpc10
636 # No need to check; LPC10 is always found
637 AC_OPTIONAL_FORMAT(lpc10, LPC10)
641 dnl Check if we want to disable all symlinks
642 AC_MSG_CHECKING([whether to enable symlinks])
643 AC_ARG_ENABLE(symlinks,
644     AS_HELP_STRING([--disable-symlinks], [Don't make any symlinks to sox.]),,enable_symlinks=yes)
645 AC_MSG_RESULT($enable_symlinks)
647 enable_playrec_symlinks=no
648 if test "$enable_symlinks" = "yes"; then
649   SYMLINKS=yes
650   if test "" \
651       -o "$using_alsa" = yes \
652       -o "$using_ao" = yes \
653       -o "$using_coreaudio" = yes \
654       -o "$using_oss" = yes \
655       -o "$using_pulseaudio" = yes \
656       -o "$using_sndio" = yes \
657     ; then
658     PLAYRECLINKS=yes
659     enable_playrec_symlinks=yes
660   fi
662 AC_SUBST(SYMLINKS)
663 AC_SUBST(PLAYRECLINKS)
665 AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
667 dnl Generate output files.
668 AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile lpc10/Makefile sox.pc)
669 AC_OUTPUT
671 if test "$using_gsm" != "no"; then
672   if test "$found_libgsm" = "yes"; then
673     gsm_option="(external)"
674   else
675     gsm_option="(in-tree)"
676   fi
679 if test "$using_lpc10" != "no"; then
680   if test "$found_liblpc10" = "yes"; then
681     lpc10_option="(external)"
682   else
683     lpc10_option="(in-tree)"
684   fi
687 if test "$using_pkgconfig" = "no"; then
688   pkgconfig_option="disabled"
689 else
690   pkgconfig_option="$with_pkgconfigdir"
693 # Report configuration.
694 echo
695 echo "BUILD OPTIONS"
696 echo "Debugging build............$enable_debug"
697 echo "Distro name ...............$DISTRO"
698 echo "Dynamic loading support....$using_libltdl"
699 echo "Pkg-config location........$pkgconfig_option"
700 echo "Play and rec symlinks......$enable_playrec_symlinks"
701 echo "Symlinks enabled...........$enable_symlinks"
702 echo
703 echo "OPTIONAL DEVICE DRIVERS"
704 echo "ao (Xiph)..................$using_ao"
705 echo "alsa (Linux)...............$using_alsa"
706 echo "coreaudio (Mac OS X).......$using_coreaudio"
707 echo "sndio (OpenBSD)............$using_sndio"
708 echo "oss........................$using_oss"
709 echo "pulseaudio.................$using_pulseaudio"
710 echo "sunaudio...................$using_sunaudio"
711 echo "waveaudio (MS-Windows).....$using_waveaudio"
712 echo
713 echo "OPTIONAL FILE FORMATS"
714 echo "amrnb......................$using_amrnb"
715 if test "x$using_amrnb" = "xyes"; then
716 echo " dlopen amrnb..............$enable_dl_amrnb"
718 echo "amrwb......................$using_amrwb"
719 if test "x$using_amrwb" = "xyes"; then
720 echo " dlopen amrwb..............$enable_dl_amrwb"
722 echo "flac.......................$using_flac"
723 echo "gsm........................$using_gsm $gsm_option"
724 echo "lpc10......................$using_lpc10 $lpc10_option"
725 echo "mp2/mp3....................$using_mp3"
726 echo " id3tag....................$using_id3tag"
727 echo " lame......................$using_lame"
728 if test "x$using_lame" = "xyes"; then
729 if test "x$enable_dl_lame" != "xyes"; then
730 echo " lame id3tag...............$ac_cv_lib_mp3lame_id3tag_set_fieldvalue"
732 echo " dlopen lame...............$enable_dl_lame"
734 echo " mad.......................$using_mad"
735 if test "x$using_mad" = "xyes"; then
736 echo " dlopen mad................$enable_dl_mad"
738 echo " twolame...................$using_twolame"
739 if test "x$using_twolame" = "xyes"; then
740 echo " dlopen twolame............$enable_dl_twolame"
742 echo "oggvorbis..................$using_oggvorbis"
743 echo "opus.......................$using_opus"
744 echo "sndfile....................$using_sndfile"
745 if test "x$using_sndfile" = "xyes"; then
746 echo " dlopen sndfile............$enable_dl_sndfile"
748 echo "wavpack....................$using_wavpack"
749 echo
750 echo "OTHER OPTIONS"
751 echo "ladspa effects.............$using_ladspa"
752 echo "magic support..............$using_magic"
753 echo "png support................$using_png"
754 if test "x$OPENMP_CFLAGS" = "x"; then
755 echo "OpenMP support.............no"
756 else
757 echo "OpenMP support.............yes, $OPENMP_CFLAGS"
759 echo
760 echo "Configure finished.  Do 'make -s && make install' to compile and install SoX."
761 echo