1dnl Process this file with autoconf to produce a configure script.
2
3AC_PREREQ(2.62)
4LT_PREREQ(2.4)
5
6AC_INIT(SoX, 14.4.3git, sox-devel@lists.sourceforge.net)
7
8dnl Increase version when binary compatibility with previous version is broken
9SHLIB_VERSION=3:0:0
10AC_SUBST(SHLIB_VERSION)
11
12AC_CONFIG_MACRO_DIR([m4])
13AC_CONFIG_SRCDIR(sox.1)
14AC_CONFIG_HEADERS([src/soxconfig.h])
15
16AM_INIT_AUTOMAKE([subdir-objects])
17AM_SILENT_RULES([yes])
18
19LT_INIT([win32-dll])
20
21AC_ARG_WITH(distro,
22    AS_HELP_STRING([--with-distro=name], [Provide distribution name]),
23    AC_DEFINE_UNQUOTED(DISTRO, ["$with_distro"], [Distribution name])
24    SOX_REPORT([build], [distro name], [${with_distro:-unspecified}]))
25
26dnl Checks for programs.
27AC_PROG_CC
28AM_PROG_CC_C_O
29AC_PROG_INSTALL
30AC_PROG_LN_S
31
32PKG_PROG_PKG_CONFIG
33PKG_INSTALLDIR
34
35AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])
36AX_APPEND_COMPILE_FLAGS([-Wall -Wmissing-prototypes -Wstrict-prototypes])
37AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
38
39dnl Check for system dependent features.
40AC_C_BIGENDIAN
41AC_C_INLINE
42
43dnl Checks for header files.
44AC_HEADER_STDC
45AC_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
47dnl Checks for library functions.
48AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen sigaction)
49
50dnl Check if math library is needed.
51AC_SEARCH_LIBS([pow], [m])
52AC_SEARCH_LIBS([lrint], [m])
53AC_CHECK_FUNCS([lrint])
54
55dnl Large File Support
56AC_SYS_LARGEFILE
57AC_FUNC_FSEEKO
58
59dnl Check for OpenMP
60AC_OPENMP
61CFLAGS="$CFLAGS $OPENMP_CFLAGS"
62SOX_REPORT([other], [OpenMP], [${OPENMP_CFLAGS:-no}])
63
64if test "$ac_cv_header_glob_h" != yes; then
65    AC_CHECK_FUNC([FindFirstFileA], [
66        AC_DEFINE([HAVE_GLOB_H], [1], [Define if glob.h exists])
67        HAVE_WIN32_GLOB=yes])
68fi
69AM_CONDITIONAL(HAVE_WIN32_GLOB, test "$HAVE_WIN32_GLOB" = yes)
70
71SOX_WITH_LIB([libltdl], [ltdl.h], [ltdl], [lt_dlinit])
72
73SOX_WITH([ladspa], [Enable LADSPA plugin support],
74    [SOX_NEED_DL([${with_ladspa:+dyn}], [--with-ladspa])],
75    [AC_DEFINE([HAVE_LADSPA_H], [1], [Define if LADSPA support is enabled])
76     AS_CASE([$HAVE_LADSPA], [yes], [LADSPA_PATH='${libdir}/ladspa'],
77        [LADSPA_PATH=$HAVE_LADSPA])], [], [], [*], [$HAVE_LIBLTDL])
78AC_SUBST([LADSPA_PATH])
79SOX_REPORT([other], [LADSPA effect plugins], [$HAVE_LADSPA])
80
81dnl Various libraries
82
83SOX_WITH_LIB([magic], [magic.h], [magic], [magic_open])
84SOX_CHECK_LIB([ZLIB], [zlib.h], [z], [uncompress])
85SOX_WITH_LIB([png], [png.h], [png], [png_set_rows], [], [], [], [$ZLIB_LIBS])
86SOX_WITH_LIB([id3tag], [id3tag.h], [id3tag], [id3_file_open])
87SOX_WITH_LIB([libgsm], [gsm/gsm.h gsm.h], [gsm], [gsm_create])
88
89dnl Optional formats
90
91SOX_ENABLE([formats], [Default setting for optional formats],
92    [SOX_NEED_DL([$HAVE_FORMATS], [--enable-formats=dyn])], [], [], [], [dyn])
93
94SOX_DL_LIB([opencore-amrnb], [opencore-amrnb/interf_dec.h], [opencore-amrnb],
95    [Decoder_Interface_init])
96SOX_FMT_REQ([amrnb], [OPENCORE_AMRNB])
97
98SOX_DL_LIB([opencore-amrwb], [opencore-amrwb/dec_if.h], [opencore-amrwb],
99    [D_IF_init])
100SOX_DL_LIB([vo-amrwbenc], [vo-amrwbenc/enc_if.h], [vo-amrwbenc], [E_IF_init])
101SOX_FMT_REQ([amrwb], [OPENCORE_AMRWB VO_AMRWBENC])
102
103SOX_FMT_PKG([flac], [flac])
104SOX_FMT_REQ([gsm], [LIBGSM])
105
106SOX_CHECK_LIB([LIBLPC10], [lpc10.h], [lpc10], [create_lpc10_encoder_state],
107    [LPC10_LIBS="$LIBLPC10_LIBS"],
108    [LPC10_LIBS=../lpc10/liblpc10.la; LPC10_CFLAGS='-I${top_srcdir}/lpc10'])
109AM_CONDITIONAL([HAVE_LIBLPC10], [test $HAVE_LIBLPC10 = yes])
110SOX_FMT([lpc10])
111
112SOX_DL_LIB([mad], [mad.h], [mad], [mad_stream_buffer])
113SOX_DL_LIB([lame], [lame/lame.h lame.h], [mp3lame], [lame_init])
114SOX_DL_LIB([twolame], [twolame.h], [twolame], [twolame_init])
115SOX_FMT_REQ([mp3], [MAD LAME TWOLAME])
116
117SOX_FMT_PKG([oggvorbis], [ogg vorbis vorbisenc vorbisfile])
118SOX_FMT_PKG([opus], [opusfile])
119
120SOX_DL_LIB([libsndfile], [sndfile.h], [sndfile], [sf_open_virtual])
121SOX_FMT_REQ([sndfile], [LIBSNDFILE])
122
123SOX_FMT_LIB([wavpack], [wavpack/wavpack.h], [wavpack], [WavpackGetSampleRate])
124
125dnl Audio devices
126
127SOX_FMT_LIB([alsa], [alsa/asoundlib.h], [asound], [snd_pcm_open], [], [],
128    [devices])
129SOX_FMT_LIB([ao], [ao/ao.h], [ao], [ao_play], [], [], [devices])
130SOX_FMT_LIB([coreaudio], [CoreAudio/CoreAudio.h], [], [AudioDeviceStart], [],
131    [[-Wl,-framework,CoreAudio]], [devices])
132SOX_FMT_LIB([pulseaudio], [pulse/simple.h], [pulse], [pa_simple_new], [],
133    [-lpulse-simple], [devices])
134SOX_FMT_HEADERS([oss], [sys/soundcard.h], [SOUND_MIXER_MUTE], [], [devices])
135SOX_FMT_LIB([sndio], [sndio.h], [sndio], [sio_open], [], [], [devices])
136SOX_FMT_HEADERS([sunaudio], [sys/audioio.h sun/audioio.h],
137    [AUDIO_GETINFO], [], [devices])
138SOX_FMT_LIB([waveaudio], [mmsystem.h], [winmm], [waveOutOpen], [windows.h], [],
139    [devices])
140
141dnl Check if we want to create symlinks
142AC_ARG_ENABLE([symlinks],
143    AS_HELP_STRING([--enable-symlinks], [Create soxi/play/rec links (YES/no)]))
144AS_CASE([${enable_symlinks:=yes}], [yes], [
145    SYMLINKS=soxi
146    AS_IF([test -n "$sox_devices"], [SYMLINKS="$SYMLINKS play rec"])])
147AC_SUBST([SYMLINKS])
148SOX_REPORT([build], [symlinks], [${SYMLINKS:-none}])
149
150AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no")
151
152dnl Generate output files.
153AC_CONFIG_FILES(Makefile src/Makefile lpc10/Makefile sox.pc)
154AC_OUTPUT
155
156SOX_REPORT_SECTION([build],     [Build options:])
157SOX_REPORT_SECTION([with_libs], [Optional libraries:], [sort])
158SOX_REPORT_SECTION([formats],   [Optional formats:],   [sort])
159SOX_REPORT_SECTION([devices],   [Audio devices:],      [sort])
160SOX_REPORT_SECTION([other],     [Other options:])
161SOX_REPORT_PRINT
162
163echo
164echo "Configure finished.  Run 'make' to compile SoX."
165echo
166