1 dnl Process this file with autoconf to produce a configure script.
6 AC_INIT(SoX, 14.4.3git, sox-devel@lists.sourceforge.net)
8 dnl Increase version when binary compatibility with previous version is broken
10 AC_SUBST(SHLIB_VERSION)
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_SRCDIR(sox.1)
14 AC_CONFIG_HEADERS([src/soxconfig.h])
16 AM_INIT_AUTOMAKE([subdir-objects])
17 AM_SILENT_RULES([yes])
22 AS_HELP_STRING([--with-distro=name], [Provide distribution name]),
23 AC_DEFINE_UNQUOTED(DISTRO, ["$with_distro"], [Distribution name]))
25 dnl Checks for programs.
34 AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])
35 AX_APPEND_COMPILE_FLAGS([-Wall -Wmissing-prototypes -Wstrict-prototypes])
36 AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
38 dnl Check for system dependent features.
42 dnl Checks for header files.
44 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)
46 dnl Checks for library functions.
47 AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen sigaction)
49 dnl Check if math library is needed.
50 AC_SEARCH_LIBS([pow], [m])
51 AC_SEARCH_LIBS([lrint], [m])
52 AC_CHECK_FUNCS([lrint])
54 dnl Large File Support
60 CFLAGS="$CFLAGS $OPENMP_CFLAGS"
62 if test "$ac_cv_header_glob_h" != yes; then
63 AC_CHECK_FUNC([FindFirstFileA], [
64 AC_DEFINE([HAVE_GLOB_H], [1], [Define if glob.h exists])
67 AM_CONDITIONAL(HAVE_WIN32_GLOB, test "$HAVE_WIN32_GLOB" = yes)
69 AC_ARG_WITH(dyn-default,AS_HELP_STRING([--with-dyn-default],[Default to loading optional formats dynamically]),opt_default=dyn,opt_default=yes)
72 AS_HELP_STRING([--without-libltdl],
73 [Don't try to use libltdl for external dynamic library support]),
74 with_libltdl=$withval, with_libltdl=default)
76 if test "$with_libltdl" = "default"; then
77 dnl Default to no libltdl support when building only static libraries
78 if test "$enable_shared" != "no"; then
85 using_libltdl=$with_libltdl
88 dnl Check if ltdl should be enabled.
89 if test "$using_libltdl" != "no"; then
90 AC_CHECK_HEADERS(ltdl.h,
91 AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
92 using_libltdl=no), using_libltdl=no)
94 if test "$using_libltdl" = yes; then
95 AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
97 AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes)
101 dnl Check for magic library
103 AS_HELP_STRING([--without-magic],
104 [Don't try to use magic]))
106 if test "$with_magic" != "no"; then
108 AC_CHECK_HEADER(magic.h,
109 [AC_CHECK_LIB(magic, magic_open, MAGIC_LIBS="-lmagic",using_magic=no)],
111 if test "$with_magic" = "yes" -a "$using_magic" = "no"; then
112 AC_MSG_FAILURE([cannot find magic])
115 if test "$using_magic" = yes; then
116 AC_DEFINE(HAVE_MAGIC, 1, [Define to 1 if you have magic.])
118 AM_CONDITIONAL(HAVE_MAGIC, test x$using_magic = xyes)
123 dnl Check for png libraries
125 AS_HELP_STRING([--without-png],
126 [Don't try to use png]))
128 if test "$with_png" != "no"; then
129 AC_CHECK_HEADERS(png.h libpng/png.h,using_png=yes)
130 if test "$using_png" = "yes"; then
131 AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz",
132 [AC_CHECK_LIB(png12, png_set_rows,
133 PNG_LIBS="$PNG_LIBS -lpng12 -lz",
134 using_png=no, -lz)], -lz)
136 if test "$with_png" = "yes" -a "$using_png" = "no"; then
137 AC_MSG_FAILURE([cannot find png])
140 if test "$using_png" = yes; then
141 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have PNG.])
143 AM_CONDITIONAL(HAVE_PNG, test x$using_png = xyes)
150 AS_HELP_STRING([--without-ladspa], [Don't try to use LADSPA]))
152 if test "$with_ladspa" != "no" -a "$using_libltdl" = "yes"; then
154 AC_DEFINE(HAVE_LADSPA_H, 1, [1 if should enable LADSPA])
156 LADSPA_PATH=${libdir}/ladspa
157 AC_ARG_WITH(ladspa-path,
158 AS_HELP_STRING([--with-ladspa-path], [Default search path for LADSPA plugins]))
159 AC_SUBST(LADSPA_PATH)
163 dnl Check for MAD libraries
165 AS_HELP_STRING([--without-mad],
166 [Don't try to use MAD (MP3 Audio Decoder)]))
168 if test "$with_mad" != "no"; then
170 AC_CHECK_HEADERS(mad.h,, using_mad=no)
171 AC_MSG_CHECKING([whether to dlopen mad])
172 AC_ARG_ENABLE(dl_mad,
173 AS_HELP_STRING([--enable-dl-mad], [Dlopen mad instead of linking in.]),
174 enable_dl_mad=$enableval, enable_dl_mad=no)
175 AC_MSG_RESULT($enable_dl_mad)
176 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
177 AC_DEFINE(DL_MAD, 1, [Define to dlopen() mad.])
180 AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
181 if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
182 AC_MSG_FAILURE([cannot find libmad])
189 dnl Check for id3tag libraries
191 AS_HELP_STRING([--without-id3tag],
192 [Don't try to use id3tag]))
194 if test "$with_id3tag" != "no"; then
196 AC_CHECK_HEADER(id3tag.h,
197 [AC_CHECK_LIB(id3tag, id3_file_open, MP3_LIBS="$MP3_LIBS -lid3tag -lz",using_id3tag=no, -lz)],
199 if test "$with_id3tag" = "yes" -a "$using_id3tag" = "no"; then
200 AC_MSG_FAILURE([cannot find id3tag])
203 if test "$using_id3tag" = yes; then
204 AC_DEFINE(HAVE_ID3TAG, 1, [Define to 1 if you have id3tag.])
206 AM_CONDITIONAL(HAVE_ID3TAG, test x$using_id3tag = xyes)
210 dnl Check for LAME library.
212 AS_HELP_STRING([--without-lame],
213 [Don't try to use LAME (LAME Ain't an MP3 Encoder)]))
215 if test "$with_lame" != "no"; then
217 AC_MSG_CHECKING([whether to dlopen lame])
218 AC_ARG_ENABLE(dl_lame,
219 AS_HELP_STRING([--enable-dl-lame], [Dlopen lame instead of linking in.]),
220 enable_dl_lame=$enableval, enable_dl_lame=no)
221 AC_MSG_RESULT($enable_dl_lame)
222 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
223 AC_DEFINE(DL_LAME, 1, [Define to dlopen() lame.])
226 AC_CHECK_HEADERS(lame/lame.h,,
227 [AC_CHECK_HEADERS(lame.h, [], using_lame=no)])
228 AC_CHECK_LIB(mp3lame, lame_get_lametag_frame, MP3_LIBS="$MP3_LIBS -lmp3lame", using_lame=no)
229 if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
230 AC_MSG_FAILURE([cannot find LAME])
237 dnl Check for Twolame library
239 AS_HELP_STRING([--without-twolame],
240 [Don't try to use Twolame (MP2 Audio Encoder)]))
242 if test "$with_twolame" != "no"; then
244 AC_CHECK_HEADERS(twolame.h,, using_twolame=no)
245 AC_MSG_CHECKING([whether to dlopen twolame])
246 AC_ARG_ENABLE(dl_twolame,
247 AS_HELP_STRING([--enable-dl-twolame], [Dlopen twolame instead of linking in.]),
248 enable_dl_twolame=$enableval, enable_dl_twolame=no)
249 AC_MSG_RESULT($enable_dl_twolame)
250 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_twolame" = "xyes"; then
251 AC_DEFINE(DL_TWOLAME, 1, [Define to dlopen() libtwolame.])
253 enable_dl_twolame="no"
254 AC_CHECK_LIB(twolame, twolame_init, MP3_LIBS="$MP3_LIBS -ltwolame",using_twolame=no)
255 if test "$with_twolame" = "yes" -a "$using_twolame" = "no"; then
256 AC_MSG_FAILURE([cannot find libtwolame])
263 AC_CHECK_HEADERS(gsm/gsm.h, ,
264 [AC_CHECK_HEADERS(gsm.h, , HAVE_LIBGSM=no)])
265 AC_CHECK_LIB(gsm, gsm_create, [
266 AC_DEFINE(HAVE_LIBGSM, 1, [Define if libgsm is available])
267 LIBGSM_LIBS="$LIBGSM_LIBS -lgsm"], HAVE_LIBGSM=no)
268 AC_SUBST(LIBGSM_LIBS)
274 AC_CHECK_HEADERS(lpc10.h, ,
275 [AC_CHECK_HEADERS(lpc10.h, ,found_liblpc10=no)])
276 AC_CHECK_LIB(lpc10, create_lpc10_encoder_state, LPC10_LIBS="$LPC10_LIBS -llpc10", found_liblpc10=no)
277 if test "$found_liblpc10" = yes; then
278 AC_DEFINE(HAVE_LIBLPC10, 1, [Define if you are using an external liblpc10])
280 LPC10_CFLAGS='-I${top_srcdir}/lpc10'
281 LPC10_LIBS=../lpc10/liblpc10.la
283 AM_CONDITIONAL(HAVE_LIBLPC10, test x$found_liblpc10 = xyes)
287 # Check for Ogg Vorbis
288 AC_OPTIONAL_FORMAT(oggvorbis, OGGVORBIS, [AC_CHECK_HEADER(vorbis/codec.h,
289 [AC_CHECK_LIB(ogg, ogg_packet_clear, OGGVORBIS_LIBS="$OGGVORBIS_LIBS -logg", using_oggvorbis=no)
290 AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, OGGVORBIS_LIBS="-lvorbis $OGGVORBIS_LIBS", using_oggvorbis=no, $OGGVORBIS_LIBS)
291 AC_CHECK_LIB(vorbisfile, ov_clear, OGGVORBIS_LIBS="-lvorbisfile $OGGVORBIS_LIBS", using_oggvorbis=no, $OGGVORBIS_LIBS)
292 AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr, OGGVORBIS_LIBS="-lvorbisenc $OGGVORBIS_LIBS", using_oggvorbis=no, $OGGVORBIS_LIBS)],
293 using_oggvorbis=no)])
296 AC_OPTIONAL_FORMAT(opus, OPUS,
297 [PKG_CHECK_MODULES(OPUS, [opusfile], [], using_opus=no)],
301 dnl Check for FLAC library
302 AC_OPTIONAL_FORMAT(flac, FLAC,
303 [PKG_CHECK_MODULES([FLAC], [flac], [], [using_flac=no])])
307 AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
308 [AC_CHECK_LIB(opencore-amrwb, D_IF_init,
309 [OPENCORE_AMRWB_LIBS="$OPENCORE_AMRWB_LIBS -lopencore-amrwb"; tmp_using_amrwb=$opt_default])])
310 AC_CHECK_HEADERS(vo-amrwbenc/enc_if.h,
311 [AC_CHECK_LIB(vo-amrwbenc, E_IF_init,
312 [VO_AMRWBENC_LIBS="$VO_AMRWBENC_LIBS -lvo-amrwbenc"; tmp_using_amrwb=$opt_default])])
313 AC_ARG_ENABLE(dl_opencore_amrwb,
314 AS_HELP_STRING([--enable-dl-opencore-amrwb],
315 [Dlopen opencore-amrbw instead of linking in.]))
316 AC_ARG_ENABLE(dl_vo_amrwbenc,
317 AS_HELP_STRING([--enable-dl-vo-amrwbenc],
318 [Dlopen vo-amrbwenc instead of linking in.]))
319 if test "$using_libltdl" != "yes"; then
320 enable_dl_opencore_amrwb=no
321 enable_dl_vo_amrwbenc=no
323 if test "$enable_dl_opencore_amrwb" = "yes"; then
324 AC_DEFINE(DL_OPENCORE_AMRWB, 1, [Define to dlopen() opencore-amrwb.])
326 AMRWB_LIBS="$AMRWB_LIBS $OPENCORE_AMRWB_LIBS"
328 if test "$enable_dl_vo_amrwbenc" = "yes"; then
329 AC_DEFINE(DL_VO_AMRWBENC, 1, [Define to dlopen() vo-amrwbenc.])
331 AMRWB_LIBS="$AMRWB_LIBS $VO_AMRWBENC_LIBS"
333 AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
335 dnl When enable_dl_amrnb, do not let add libraries to be linked in
336 dnl since they will be dlopen()'ed instead.
337 ac_sox_save_AMRNB_LIBS="$AMRNB_LIBS"
338 tmp_using_amrnb=$opt_default
339 AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h,
340 [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init,
341 AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
342 [tmp_using_amrnb=no])
343 AC_ARG_ENABLE(dl_opencore_amrnb,
344 AS_HELP_STRING([--enable-dl-opencore-amrnb],
345 [Dlopen opencore-amrnb instead of linking in.]))
346 if test "$using_libltdl" = "yes" -a "$enable_dl_opencore_amrnb" = "yes"; then
347 AC_DEFINE(DL_OPENCORE_AMRNB, 1, [Define to dlopen() opencore-amrnb.])
348 dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
349 dnl to be linked in (since they will be dlopen()'ed instead).
350 AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
351 dnl Force to using regardless if headers or libraries were found.
354 enable_dl_opencore_amrnb="no"
356 AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
359 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)])
363 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)])
367 AC_OPTIONAL_FORMAT(coreaudio, COREAUDIO, [AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [COREAUDIO_LIBS="$COREAUDIO_LIBS -Wl,-framework,CoreAudio"], using_coreaudio=no)])
371 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)])
375 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)])
379 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)])
382 AC_OPTIONAL_FORMAT(waveaudio, WAVEAUDIO, [AC_CHECK_HEADER(mmsystem.h, [WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"], using_waveaudio=no, [[#include <windows.h>]])])
384 dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
385 dnl to be linked in (since they will be dlopen()'ed instead).
386 ac_sox_save_SNDFILE_LIBS="$LIBSNDFILE_LIBS"
387 SOX_PATH_SNDFILE(tmp_using_sndfile=$opt_default, tmp_using_sndfile=no)
388 AC_ARG_ENABLE(dl_sndfile,
389 AS_HELP_STRING([--enable-dl-sndfile],
390 [Dlopen sndfile instead of linking in.]),
391 enable_dl_sndfile=$enableval, enable_dl_sndfile=no)
392 if test "x$tmp_using_sndfile" = "xyes"; then
393 if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
394 AC_DEFINE(DL_LIBSNDFILE, 1, [Define to dlopen() sndfile.])
395 dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
396 dnl to be linked in (since they will be dlopen()'ed instead).
397 LIBSNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
399 enable_dl_sndfile="no"
402 AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [using_sndfile=$tmp_using_sndfile])
406 AC_OPTIONAL_FORMAT(oss, OSS, [AC_CHECK_HEADERS(sys/soundcard.h,, using_oss=no)])
410 AC_OPTIONAL_FORMAT(sunaudio, SUNAUDIO, [AC_CHECK_HEADERS(sys/audioio.h,,
411 [AC_CHECK_HEADERS(sun/audioio.h,, using_sunaudio=no)])])
415 # MP2/MP3 format depends on libmad || LAME || twolame
416 AC_OPTIONAL_FORMAT(mp3, MP3, [
417 if test "$using_mad" != yes -a "$using_lame" != yes -a "$using_twolame" != yes; then
423 # GSM format depends on libgsm
424 AC_OPTIONAL_FORMAT(gsm, GSM, [using_gsm=$HAVE_LIBGSM])
428 # LPC10 format depends on liblpc10
429 # No need to check; LPC10 is always found
430 AC_OPTIONAL_FORMAT(lpc10, LPC10)
434 dnl Check if we want to disable all symlinks
435 AC_MSG_CHECKING([whether to enable symlinks])
436 AC_ARG_ENABLE(symlinks,
437 AS_HELP_STRING([--disable-symlinks], [Don't make any symlinks to sox.]),,enable_symlinks=yes)
438 AC_MSG_RESULT($enable_symlinks)
440 if test "$enable_symlinks" = "yes"; then
443 -o "$using_alsa" = yes \
444 -o "$using_ao" = yes \
445 -o "$using_coreaudio" = yes \
446 -o "$using_oss" = yes \
447 -o "$using_pulseaudio" = yes \
448 -o "$using_sndio" = yes \
449 -o "$using_sunaudio" = yes \
450 -o "$using_waveaudio" = yes \
452 SYMLINKS="$SYMLINKS play rec"
457 AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
459 dnl Generate output files.
460 AC_CONFIG_FILES(Makefile src/Makefile lpc10/Makefile sox.pc)
463 if test "$using_lpc10" != "no"; then
464 if test "$found_liblpc10" = "yes"; then
465 lpc10_option="(external)"
467 lpc10_option="(in-tree)"
471 # Report configuration.
474 echo "Distro name ...............${with_distro:-unspecified}"
475 echo "Dynamic loading support....$using_libltdl"
476 echo "Pkg-config location........$pkgconfigdir"
477 echo "Symlinks enabled...........${SYMLINKS:-no}"
479 echo "OPTIONAL DEVICE DRIVERS"
480 echo "ao (Xiph)..................$using_ao"
481 echo "alsa (Linux)...............$using_alsa"
482 echo "coreaudio (Mac OS X).......$using_coreaudio"
483 echo "sndio (OpenBSD)............$using_sndio"
484 echo "oss........................$using_oss"
485 echo "pulseaudio.................$using_pulseaudio"
486 echo "sunaudio...................$using_sunaudio"
487 echo "waveaudio (MS-Windows).....$using_waveaudio"
489 echo "OPTIONAL FILE FORMATS"
490 echo "amrnb......................$using_amrnb"
491 if test "x$using_amrnb" = "xyes"; then
492 echo " dlopen amrnb..............${enable_dl_opencore_amrnb:-no}"
494 echo "amrwb......................$using_amrwb"
495 if test "x$using_amrwb" = "xyes"; then
496 echo " dlopen opencore-amrwb.....${enable_dl_opencore_amrwb:-no}"
497 echo " dlopen vo-amrwbenc........${enable_dl_vo_amrwbenc:-no}"
499 echo "flac.......................$using_flac"
500 echo "gsm........................$using_gsm"
501 echo "lpc10......................$using_lpc10 $lpc10_option"
502 echo "mp2/mp3....................$using_mp3"
503 echo " id3tag....................$using_id3tag"
504 echo " lame......................$using_lame"
505 if test "x$using_lame" = "xyes"; then
506 echo " dlopen lame...............$enable_dl_lame"
508 echo " mad.......................$using_mad"
509 if test "x$using_mad" = "xyes"; then
510 echo " dlopen mad................$enable_dl_mad"
512 echo " twolame...................$using_twolame"
513 if test "x$using_twolame" = "xyes"; then
514 echo " dlopen twolame............$enable_dl_twolame"
516 echo "oggvorbis..................$using_oggvorbis"
517 echo "opus.......................$using_opus"
518 echo "sndfile....................$using_sndfile"
519 if test "x$using_sndfile" = "xyes"; then
520 echo " dlopen sndfile............$enable_dl_sndfile"
522 echo "wavpack....................$using_wavpack"
525 echo "ladspa effects.............$using_ladspa"
526 echo "magic support..............$using_magic"
527 echo "png support................$using_png"
528 if test "x$OPENMP_CFLAGS" = "x"; then
529 echo "OpenMP support.............no"
531 echo "OpenMP support.............yes, $OPENMP_CFLAGS"
534 echo "Configure finished. Do 'make -s && make install' to compile and install SoX."