README.osx wasn't easily readable in Finder. Revert back to
[sox.git] / configure.ac
blobae249bc8d562b58044d1e7a6aca8db49449464e9
1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(SoX, 14.3.2, sox-devel@lists.sourceforge.net)
5 m4_ifdef([AC_CONFIG_MACRO_DIR], [AC_CONFIG_MACRO_DIR([m4])])
7 dnl Find target architecture
8 AC_CANONICAL_TARGET
10 AM_INIT_AUTOMAKE
12 dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
13 AM_CONFIG_HEADER(src/soxconfig.h)
15 dnl Check we have the right srcdir
16 AC_CONFIG_SRCDIR(sox.1)
18 dnl Checks for programs.
19 AC_PROG_CC
20 AM_PROG_CC_C_O
21 AC_PROG_INSTALL
22 AC_PROG_LN_S
24 dnl Increase version when binary compatibility with previous version is broken
25 SHLIB_VERSION=1:0:0
26 AC_SUBST(SHLIB_VERSION)
28 AC_ARG_WITH(libltdl,
29     AC_HELP_STRING([--without-libltdl],
30         [Don't try to use libltdl for external dynamic library support]),
31     with_libltdl=$withval, with_libltdl=default)
33 if test "$with_libltdl" = "default"; then
34     dnl Default to no libltdl support when building only static libraries
35     if test "$enable_shared" != "no"; then
36         using_libltdl=yes
37     else
38         using_libltdl=no
39     fi
40     with_libltdl="yes"
41 else
42     using_libltdl=$with_libltdl
45 AC_LIBTOOL_DLOPEN
46 case $target in
47   *cygwin* | *mingw*)
48   AC_LIBTOOL_WIN32_DLL
49   LDFLAGS="$LDFLAGS -no-undefined"
50    ;;
51 esac
52 AC_PROG_LIBTOOL
53 AC_SUBST(LIBTOOL_DEPS)
55 AC_ARG_WITH(dyn-default,AC_HELP_STRING([--with-dyn-default],[Default to loading optional formats dynamically]),opt_default=dyn,opt_default=yes)
57 AC_ARG_WITH(pkgconfigdir,
58     AC_HELP_STRING([--with-pkgconfigdir],
59                    [location to install .pc files or "no" to disable (default=$(libdir)/pkgconfig)]))
61 m4_ifndef([PKG_PROG_PKG_CONFIG], with_pkgconfigdir="no")
63 using_pkgconfig=no
64 if test "$with_pkgconfigdir" != "no"; then
65     if test "$with_pkgconfigdir" = ""; then
66         with_pkgconfigdir="\$(libdir)/pkgconfig"
67     fi
68     using_pkgconfig="yes"
69     PKG_PROG_PKG_CONFIG
71 AM_CONDITIONAL(HAVE_PKGCONFIG, test x$using_pkgconfig = xyes)
72 AC_SUBST(PKGCONFIGDIR, $with_pkgconfigdir)
74 using_win32_glob="no"
75 case $target in
76   *mingw*)
77   using_win32_glob="yes"
78    ;;
79 esac
80 if test "$using_win32_glob" = yes; then
81    AC_DEFINE([HAVE_WIN32_GLOB_H], 1, [Define to 1 to use win32 glob])
83 AM_CONDITIONAL(HAVE_WIN32_GLOB, test x$using_win32_glob = xyes)
85 dnl Debugging
86 AC_MSG_CHECKING([whether to make a debug build])
87 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [make a debug build]))
88 AC_MSG_RESULT($enable_debug)
89 if test "$enable_debug" = "yes"; then
90     CFLAGS="-g"
91     if test "$GCC" = "yes"; then
92         CFLAGS="$CFLAGS -ggdb"
93     fi
94 else
95     enable_debug=no
98 dnl Extra CFLAGS if we have gcc
99 if test "$GCC" = yes; then
101     dnl Detect gcc version.  Convert GCC version number to
102     dnl something easier to compare.
103     AC_MSG_CHECKING([gcc version])
104     gccver=`$CC -dumpversion`
105     gccnum1=`echo $gccver | cut -d . -f1`
106     gccnum2=`echo $gccver | cut -d . -f2`
107     gccver=`(expr $gccnum1 "*" 100 + $gccnum2) 2>/dev/null`
108     AC_MSG_RESULT($gccver)
110     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -Wall -W -Wmissing-prototypes -Wstrict-prototypes -pedantic"
111     if test "$gccver" -lt 403; then
112         WARN_CFLAGS="-Wconversion"
113     else
114         WARN_CFLAGS="-Wtraditional-conversion"
115     fi
116     dnl Define stricter policy on GNU/Linux, all symbols must be resolved
117     case $target in
118       *linux* | *solaris*)
119         LDFLAGS="$LDFLAGS -Wl,-z,defs"
120         ;;
121       *os2*)
122         APP_LDFLAGS="-no-undefined"
123         ;;
124     esac
126 AC_SUBST(APP_LDFLAGS)
127 AC_SUBST(WARN_CFLAGS)
129 AC_ARG_WITH(distro, AC_HELP_STRING([--with-distro=distro], [Provide distribution name]))
130 if test "x$with_distro" != "x"; then
131   DISTRO="$with_distro"
132   AC_SUBST(DISTRO)
133   AC_DEFINE(HAVE_DISTRO, 1, [1 if DISTRO is defined])
134   have_distro=yes
135 else
136   DISTRO="not specified!"
138 AM_CONDITIONAL(HAVE_DISTRO, test x$have_distro = xyes)
140 dnl Check for system dependent features.
141 AC_C_BIGENDIAN
142 AC_C_INLINE
144 dnl Checks for header files.
145 AC_HEADER_STDC
146 AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/stat.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h termios.h glob.h)
148 dnl Checks for library functions.
149 AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen)
151 dnl Check if math library is needed.
152 AC_CHECK_FUNC(pow)
153 if test "$ac_cv_func_pow" = no; then
154   AC_CHECK_LIB(m, pow)
157 dnl Large File Support
158 AC_SYS_LARGEFILE
159 AC_FUNC_FSEEKO
160 if test "$ac_cv_sys_file_offset_bits" = "64"; then
161   dnl This is either a 64-bit platform or a 32-bit platform
162   dnl that supports large files.
163   dnl There are to many broken glibc+kernel's out there that
164   dnl detect 64-bit off_t on 32-bit system and require
165   dnl _LARGEFILE_SOURCE to make fseeko() go into 64-bit mode.
166   dnl Force defining _LARGEFILE_SOURCE always.  My assumption
167   dnl is its harmlessly ignored on 64-bit platforms and platforms
168   dnl that chose other solutions.
169   AC_MSG_NOTICE(Forcing _LARGEFILE_SOURCE to be safe since off_t is 64 bits)
170   AC_DEFINE(_LARGEFILE_SOURCE, 1)
173 dnl Allow libtool to be silenced
174 AC_MSG_CHECKING([whether libtool should be silenced])
175 AC_ARG_ENABLE(silent-libtool,
176     AC_HELP_STRING([--disable-silent-libtool], [Verbose libtool]),,enable_silent_libtool=yes)
177 AC_MSG_RESULT($enable_silent_libtool)
178 if test "$enable_silent_libtool" = "yes"; then
179     LIBTOOLFLAGS=--silent
181 AC_SUBST(LIBTOOLFLAGS)
183 dnl Check if ltdl should be enabled.
184 using_win32_ltdl="no"
185 if test "$using_libltdl" != "no"; then
186   case $target in
187     *mingw*)
188     AC_DEFINE([HAVE_WIN32_LTDL_H], 1, [Define to 1 to use internal win32 ltdl])
189     LIBLTDL=""
190     using_win32_ltdl="yes"
191     ;;
192     *)
193      AC_CHECK_HEADERS(ltdl.h,
194                      AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
195                                   using_libltdl=no), using_libltdl=no)
196     ;;
197   esac
199 if test "$using_libltdl" = yes; then
200   AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
202 AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes -a x$using_win32_ltdl = xno)
203 AM_CONDITIONAL(HAVE_WIN32_LTDL, test x$using_win32_ltdl = xyes)
204 AC_SUBST(LIBLTDL)
207 dnl Check for GOMP library
208 AC_MSG_CHECKING([whether to use GOMP])
209 AC_ARG_ENABLE(gomp,
210     AC_HELP_STRING([--disable-gomp], [Don't use GOMP.]),,enable_gomp=yes)
211 AC_MSG_RESULT($enable_gomp)
212 if test "$enable_gomp" = "yes"; then
213     EXTRA_GOMP_LIBS=""  
214     case $target in
215       *mingw32*)
216       EXTRA_GOMP_LIBS="-lpthread"
217       ;;
218     esac
219     AC_CHECK_HEADERS(omp.h,
220                      AC_CHECK_LIB(gomp, omp_get_thread_num, GOMP_LIBS="$GOMP_LIBS -lgomp $EXTRA_GOMP_LIBS", enable_gomp=no, $EXTRA_GOMP_LIBS), enable_gomp=no)
222 if test "$enable_gomp" = yes; then
223    AC_DEFINE(HAVE_OPENMP, 1, [Define to 1 if you have GOMP.])
224    CFLAGS="$CFLAGS -fopenmp"
226 AM_CONDITIONAL(HAVE_OPENMP, test x$enable_gomp = xyes)
227 AC_SUBST(GOMP_LIBS)
231 dnl Check for magic library
232 AC_ARG_WITH(magic,
233     AC_HELP_STRING([--without-magic],
234         [Don't try to use magic]))
235 using_magic=no
236 if test "$with_magic" != "no"; then
237     using_magic=yes
238     AC_CHECK_HEADER(magic.h,
239         [AC_CHECK_LIB(magic, magic_open, MAGIC_LIBS="-lmagic",using_magic=no)],
240         using_magic=no)
241     if test "$with_magic" = "yes" -a "$using_magic" = "no"; then
242         AC_MSG_FAILURE([cannot find magic])
243     fi
245 if test "$using_magic" = yes; then
246    AC_DEFINE(HAVE_MAGIC, 1, [Define to 1 if you have magic.])
248 AM_CONDITIONAL(HAVE_MAGIC, test x$using_magic = xyes)
249 AC_SUBST(MAGIC_LIBS)
253 dnl Check for png libraries
254 AC_ARG_WITH(png,
255     AC_HELP_STRING([--without-png],
256         [Don't try to use png]))
257 using_png=no
258 if test "$with_png" != "no"; then
259     AC_CHECK_HEADERS(png.h libpng/png.h,using_png=yes)
260     if test "$using_png" = "yes"; then
261         AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz", 
262                      [AC_CHECK_LIB(png12, png_set_rows, 
263                       PNG_LIBS="$PNG_LIBS -lpng12 -lz", 
264                       using_png=no, -lz)], -lz)
265     fi
266     if test "$with_png" = "yes" -a "$using_png" = "no"; then
267         AC_MSG_FAILURE([cannot find png])
268     fi
270 if test "$using_png" = yes; then
271    AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have PNG.])
273 AM_CONDITIONAL(HAVE_PNG, test x$using_png = xyes)
274 AC_SUBST(PNG_LIBS)
278 dnl Test for LADSPA
279 AC_ARG_WITH(ladspa,
280     AC_HELP_STRING([--without-ladspa], [Don't try to use LADSPA]))
281 using_ladspa=no
282 if test "$with_ladspa" != "no" -a "$using_libltdl" = "yes"; then
283     using_ladspa=yes
284     AC_DEFINE(HAVE_LADSPA_H, 1, [1 if should enable LADSPA])
286 LADSPA_PATH=${libdir}/ladspa
287 AC_ARG_WITH(ladspa-path,
288     AC_HELP_STRING([--with-ladspa-path], [Default search path for LADSPA plugins]))
289 AC_SUBST(LADSPA_PATH)
293 dnl Check for MAD libraries
294 AC_ARG_WITH(mad,
295     AC_HELP_STRING([--without-mad],
296         [Don't try to use MAD (MP3 Audio Decoder)]))
297 using_mad=no
298 if test "$with_mad" != "no"; then
299     using_mad=yes
300     AC_CHECK_HEADERS(mad.h,, using_mad=no)
301     AC_MSG_CHECKING([whether to dlopen mad])
302     AC_ARG_ENABLE(dl_mad,
303       AC_HELP_STRING([--enable-dl-mad], [Dlopen mad instead of linking in.]),
304       enable_dl_mad=$enableval, enable_dl_mad=no)
305     AC_MSG_RESULT($enable_dl_mad)
306     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
307       AC_DEFINE(DL_MAD, 1, [Define to dlopen() mad.])
308     else
309       enable_dl_mad="no"
310       AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
311       if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
312         AC_MSG_FAILURE([cannot find libmad])
313       fi
314     fi
319 dnl Check for id3tag libraries
320 AC_ARG_WITH(id3tag,
321     AC_HELP_STRING([--without-id3tag],
322         [Don't try to use id3tag]))
323 using_id3tag=no
324 if test "$with_id3tag" != "no"; then
325     using_id3tag=yes
326     AC_CHECK_HEADER(id3tag.h,
327         [AC_CHECK_LIB(id3tag, id3_file_open, MP3_LIBS="$MP3_LIBS -lid3tag -lz",using_id3tag=no, -lz)],
328         using_id3tag=no)
329     if test "$with_id3tag" = "yes" -a "$using_id3tag" = "no"; then
330         AC_MSG_FAILURE([cannot find id3tag])
331     fi
333 if test "$using_id3tag" = yes; then
334    AC_DEFINE(HAVE_ID3TAG, 1, [Define to 1 if you have id3tag.])
336 AM_CONDITIONAL(HAVE_ID3TAG, test x$using_id3tag = xyes)
340 dnl Check for LAME library.
341 AC_ARG_WITH(lame,
342     AC_HELP_STRING([--without-lame],
343         [Don't try to use LAME (LAME Ain't an MP3 Encoder)]))
344 using_lame=no
345 if test "$with_lame" != "no"; then
346     using_lame=yes
347     AC_MSG_CHECKING([whether to dlopen lame])
348     AC_ARG_ENABLE(dl_lame,
349       AC_HELP_STRING([--enable-dl-lame], [Dlopen lame instead of linking in.]),
350       enable_dl_lame=$enableval, enable_dl_lame=no)
351     AC_MSG_RESULT($enable_dl_lame)
352     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
353       AC_DEFINE(DL_LAME, 1, [Define to dlopen() lame.])
354     else
355       enable_dl_lame="no"
356       AC_CHECK_HEADERS(lame/lame.h,,
357         [AC_CHECK_HEADERS(lame.h, using_lame=$using_lame, using_lame=no)])
358       AC_CHECK_LIB(mp3lame, lame_init, MP3_LIBS="$MP3_LIBS -lmp3lame",using_lame=no)
359       AC_CHECK_LIB(mp3lame, lame_get_lametag_frame,using_lame=$using_lame,using_lame=no)
360       if test "$ac_cv_lib_mp3lame_lame_get_lametag_frame" = yes; then
361         AC_DEFINE(HAVE_LAME_398, 1, [Define to 1 if you have lame 3.98 or greater.])
362       fi
363       AC_CHECK_LIB(mp3lame, id3tag_init,using_lame=$using_lame,using_lame=no)
364       if test "$ac_cv_lib_mp3lame_id3tag_init" = yes; then
365         AC_DEFINE(HAVE_LAME_ID3TAG, 1, [Define to 1 if lame supports optional ID3 tags.])
366       fi
367       AC_CHECK_LIB(mp3lame, id3tag_set_fieldvalue,using_lame=$using_lame,using_lame=no)
368       if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
369         AC_DEFINE(HAVE_LAME_398_ID3TAG, 1, [Define to 1 if lame 3.98 or newer ID3 tag support.])
370       fi
371       if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
372         AC_MSG_FAILURE([cannot find LAME])
373       fi
374     fi
377 # Check for libgsm
378 found_libgsm=yes
379 AC_CHECK_HEADERS(gsm/gsm.h, ,
380     [AC_CHECK_HEADERS(gsm.h, ,found_libgsm=no)])
381     AC_CHECK_LIB(gsm, gsm_create, GSM_LIBS="$GSM_LIBS -lgsm", found_libgsm=no)
382 if test "$found_libgsm" = yes; then
383     AC_DEFINE(EXTERNAL_GSM, 1, [Define if you are using an external GSM library])
384 else
385     LIBGSM_LIBADD=../libgsm/libgsm.la
387 AM_CONDITIONAL(EXTERNAL_GSM, test x$found_libgsm = xyes)
388 AC_SUBST(LIBGSM_LIBADD)
392 # Check for liblpc10
393 found_liblpc10=yes
394 AC_CHECK_HEADERS(lpc10.h, ,
395     [AC_CHECK_HEADERS(lpc10.h, ,found_liblpc10=no)])
396     AC_CHECK_LIB(lpc10, create_lpc10_encoder_state, LPC10_LIBS="$LPC10_LIBS -llpc10", found_liblpc10=no)
397 if test "$found_liblpc10" = yes; then
398     AC_DEFINE(EXTERNAL_LPC10, 1, [Define if you are using an external LPC10 library])
399 else
400     LIBLPC10_LIBADD=../lpc10/liblpc10.la
402 AM_CONDITIONAL(EXTERNAL_LPC10, test x$found_liblpc10 = xyes)
403 AC_SUBST(LIBLPC10_LIBADD)
407 # Check for Ogg Vorbis
408 AC_OPTIONAL_FORMAT(oggvorbis, OGG_VORBIS, [AC_CHECK_HEADER(vorbis/codec.h,
409   [AC_CHECK_LIB(ogg, ogg_packet_clear, OGG_VORBIS_LIBS="$OGG_VORBIS_LIBS -logg", using_oggvorbis=no)
410   AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, OGG_VORBIS_LIBS="-lvorbis $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
411   AC_CHECK_LIB(vorbisfile, ov_clear, OGG_VORBIS_LIBS="-lvorbisfile $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
412   AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr, OGG_VORBIS_LIBS="-lvorbisenc $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)],
413   using_oggvorbis=no)])
417 # Check for FLAC libraries
418 #  Note passing in OGG_VORBIS_LIBS.  That is because FLAC has optional
419 #  support for OGG and if OGG libraries are found on this
420 #  system then its highly likely to be compiled into FLAC
421 #  and will require these at link time.
422 case $target in
423   *mingw*)
424   FLAC_LIBS="-lwsock32"
425   ;;
426 esac
427 AC_OPTIONAL_FORMAT(flac, FLAC, [AC_CHECK_HEADER(FLAC/all.h, [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)])
430 dnl When enable_dl_amrbw, do not let add libraries to be linked in
431 dnl since they will be dlopen()'ed instead.
432 ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
433 tmp_using_amrwb=$opt_default
434 AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
435                  [AC_CHECK_LIB(opencore-amrwb, D_IF_init, 
436                   AMRWB_LIBS="$AMRWB_LIBS -lopencore-amrwb", tmp_using_amrwb=no)],
437                   [AC_CHECK_HEADERS(amrwb/dec.h, 
438                    [AC_CHECK_LIB(amrwb, D_IF_init, 
439                     AMRWB_LIBS="$AMRWB_LIBS -lamrwb",tmp_using_amrwb=no)], 
440                     tmp_using_amrwb=no)])
441 AC_ARG_ENABLE(dl_amrwb,
442               AC_HELP_STRING([--enable-dl-amrwb], 
443                              [Dlopen amrbw instead of linking in.]),
444                              enable_dl_amrwb=$enableval, enable_dl_amrwb=no)
445 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then
446   AC_DEFINE(DL_AMRWB, 1, [Define to dlopen() amrwb.]) 
447   dnl When enable_dl_amrwb, do not let SOX_PATH_AMRWB add libraries
448   dnl to be linked in (since they will be dlopen()'ed instead).
449   AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"
450   dnl Force to using regardless if headers or libraries were found.
451   tmp_using_amrwb=yes
452 else
453   enable_dl_amrwb="no"
455 AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
457 dnl When enable_dl_amrnb, do not let add libraries to be linked in
458 dnl since they will be dlopen()'ed instead.
459 ac_sox_save_AMRNB_LIBS="$AMRNB_LIBS"
460 tmp_using_amrnb=$opt_default
461 AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h, 
462                  [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init, 
463                   AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
464                   [AC_CHECK_HEADER(amrnb/sp_dec.h, 
465                    [AC_CHECK_LIB(amrnb, Decoder_Interface_init, 
466                     AMRNB_LIBS="$AMRNB_LIBS -lamrnb", tmp_using_amrnb=no)], 
467                     tmp_using_amrnb=no)])
468 AC_ARG_ENABLE(dl_amrnb,
469               AC_HELP_STRING([--enable-dl-amrnb], 
470                              [Dlopen amrnb instead of linking in.]),
471                              enable_dl_amrnb=$enableval, enable_dl_amrnb=no)
472 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then
473   AC_DEFINE(DL_AMRNB, 1, [Define to dlopen() amrnb.]) 
474   dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
475   dnl to be linked in (since they will be dlopen()'ed instead).
476   AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
477   dnl Force to using regardless if headers or libraries were found.
478   tmp_using_amrnb=yes
479 else
480   enable_dl_amrnb="no"
482 AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
485 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)])
489 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)])
493 AC_OPTIONAL_FORMAT(coreaudio, COREAUDIO, [AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [COREAUDIO_LIBS="$COREAUDIO_LIBS -Wl,-framework,CoreAudio"], using_coreaudio=no)])
497 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)])
501 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)])
505 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)])
508 AC_OPTIONAL_FORMAT(waveaudio, WAVEAUDIO, [AC_CHECK_HEADER(mmsystem.h, [WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"], using_waveaudio=no, [[#include <windows.h>]])])
510 dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
511 dnl to be linked in (since they will be dlopen()'ed instead).
512 ac_sox_save_SNDFILE_LIBS="$SNDFILE_LIBS"
513 SOX_PATH_SNDFILE(tmp_using_sndfile=$opt_default, tmp_using_sndfile=no)
514 AC_ARG_ENABLE(dl_sndfile,
515               AC_HELP_STRING([--enable-dl-sndfile], 
516                              [Dlopen sndfile instead of linking in.]),
517                              enable_dl_sndfile=$enableval, enable_dl_sndfile=no)
518 if test "x$using_sndfile" = "xyes"; then
519   if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
520     AC_DEFINE(DL_SNDFILE, 1, [Define to dlopen() sndfile.]) 
521     dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
522     dnl to be linked in (since they will be dlopen()'ed instead).
523     SNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
524   else
525     enable_dl_sndfile="no"
526   fi
528 AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [using_sndfile=$tmp_using_sndfile])
530 AC_OPTIONAL_FORMAT(ffmpeg, FFMPEG, [SOX_PATH_FFMPEG(, using_ffmpeg=no)])
534 AC_OPTIONAL_FORMAT(oss, OSS, [AC_CHECK_HEADERS(sys/soundcard.h,,
535       [AC_CHECK_HEADERS(machine/soundcard.h,
536           [AC_CHECK_LIB(ossaudio, _oss_ioctl, OSS_LIBS="$OSS_LIBS -lossaudio")],
537           using_oss=no)])])
541 AC_OPTIONAL_FORMAT(sunaudio, SUN_AUDIO, [AC_CHECK_HEADERS(sys/audioio.h,,
542       [AC_CHECK_HEADERS(sun/audioio.h,, using_sunaudio=no)])])
546 # MP3 format depends on libmad || LAME
547 AC_OPTIONAL_FORMAT(mp3, MP3, [
548   if test "$using_mad" != yes -a "$using_lame" != yes; then
549     using_mp3=no
550   fi])
554 # GSM format depends on libgsm
555 # No need to check; GSM is always found
556 AC_OPTIONAL_FORMAT(gsm, GSM)
560 # LPC10 format depends on liblpc10
561 # No need to check; LPC10 is always found
562 AC_OPTIONAL_FORMAT(lpc10, LPC10)
566 dnl Check if we want to disable all symlinks
567 AC_MSG_CHECKING([whether to enable symlinks])
568 AC_ARG_ENABLE(symlinks,
569     AC_HELP_STRING([--disable-symlinks], [Don't make any symlinks to sox.]),,enable_symlinks=yes)
570 AC_MSG_RESULT($enable_symlinks)
572 enable_playrec_symlinks=no
573 if test "$enable_symlinks" = "yes"; then
574   SYMLINKS=yes
575   if test false \
576       -o "$enable_alsa" = yes \
577       -o "$enable_ao" = yes \
578       -o "$enable_coreaudio" = yes \
579       -o "$enable_oss" = yes \
580       -o "$enable_pulseaudio" = yes \
581       -o "$enable_sndio" = yes \
582     ; then
583     PLAYRECLINKS=yes
584     enable_playrec_symlinks=yes
585   fi
587 AC_SUBST(SYMLINKS)
588 AC_SUBST(PLAYRECLINKS)
590 AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
592 dnl Generate output files.
593 AX_CREATE_STDINT_H(src/soxstdint.h)
594 AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile lpc10/Makefile msvc9/Makefile msvc10/Makefile sox.pc)
595 AC_OUTPUT
597 if test "$using_gsm" != "no"; then
598   if test "$found_libgsm" = "yes"; then
599     gsm_option="(external)"
600   else
601     gsm_option="(in-tree)"
602   fi
605 if test "$using_lpc10" != "no"; then
606   if test "$found_liblpc10" = "yes"; then
607     lpc10_option="(external)"
608   else
609     lpc10_option="(in-tree)"
610   fi
613 if test "$using_pkgconfig" = "no"; then
614   pkgconfig_option="disabled"
615 else
616   pkgconfig_option="$with_pkgconfigdir"
619 # Report configuration.
620 echo
621 echo "BUILD OPTIONS"
622 echo "Debugging build............$enable_debug"
623 echo "Distro name ...............$DISTRO"
624 echo "Dynamic loading support....$using_libltdl"
625 echo "Pkg-config location........$pkgconfig_option"
626 echo "Play and rec symlinks......$enable_playrec_symlinks"
627 echo "Symlinks enabled...........$enable_symlinks"
628 echo
629 echo "OPTIONAL DEVICE DRIVERS"
630 echo "ao (Xiph)..................$using_ao"
631 echo "alsa (Linux)...............$using_alsa"
632 echo "coreaudio (Mac OS X).......$using_coreaudio"
633 echo "sndio (OpenBSD)............$using_sndio"
634 echo "oss........................$using_oss"
635 echo "pulseaudio.................$using_pulseaudio"
636 echo "sunaudio...................$using_sunaudio"
637 echo "waveaudio (MS-Windows).....$using_waveaudio"
638 echo
639 echo "OPTIONAL FILE FORMATS"
640 echo "amrnb......................$using_amrnb"
641 if test "x$using_amrnb" = "xyes"; then
642 echo " dlopen amrnb..............$enable_dl_amrnb"
644 echo "amrwb......................$using_amrwb"
645 if test "x$using_amrwb" = "xyes"; then
646 echo " dlopen amrwb..............$enable_dl_amrwb"
648 echo "ffmpeg.....................$using_ffmpeg"
649 echo "flac.......................$using_flac"
650 echo "gsm........................$using_gsm $gsm_option"
651 echo "lpc10......................$using_lpc10 $lpc10_option"
652 echo "mp3........................$using_mp3"
653 echo " id3tag....................$using_id3tag"
654 echo " lame......................$using_lame"
655 if test "x$using_lame" = "xyes"; then
656 echo " dlopen lame...............$enable_dl_lame"
658 echo " mad.......................$using_mad"
659 if test "x$using_mad" = "xyes"; then
660 echo " dlopen mad................$enable_dl_mad"
662 echo "oggvorbis..................$using_oggvorbis"
663 echo "sndfile....................$using_sndfile"
664 if test "x$using_sndfile" = "xyes"; then
665 echo " dlopen sndfile............$enable_dl_sndfile"
667 echo "wavpack....................$using_wavpack"
668 echo
669 echo "OTHER OPTIONS"
670 echo "ladspa effects.............$using_ladspa"
671 echo "magic support..............$using_magic"
672 echo "png support................$using_png"
673 echo "GOMP support...............$enable_gomp"
674 echo
675 echo "Configure finished.  Do 'make -s && make install' to compile and install SoX."
676 echo