1 # Copyright (C) 2002-2011 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
3 dnl Require autoconf version
6 AC_INIT([libsamplerate],[0.1.9],[erikd@mega-nerd.com],
7 [libsamplerate],[http://www.mega-nerd.com/libsamplerate/])
9 # Put config stuff in Cfg.
10 AC_CONFIG_AUX_DIR(Cfg)
12 AC_CONFIG_SRCDIR([src/samplerate.c])
13 AC_CANONICAL_TARGET([])
15 AC_CONFIG_MACRO_DIR([M4])
16 AC_CONFIG_HEADERS([src/config.h])
18 AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)
19 AM_SILENT_RULES([yes])
21 dnl Add parameters for aclocal
22 AC_SUBST(ACLOCAL_AMFLAGS, "-I M4")
31 # Do not check for F77.
32 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
40 #------------------------------------------------------------------------------------
41 # Rules for library version information:
43 # 1. Start with version information of `0:0:0' for each libtool library.
44 # 2. Update the version information only immediately before a public release of
45 # your software. More frequent updates are unnecessary, and only guarantee
46 # that the current interface number gets larger faster.
47 # 3. If the library source code has changed at all since the last update, then
48 # increment revision (`c:r:a' becomes `c:r+1:a').
49 # 4. If any interfaces have been added, removed, or changed since the last update,
50 # increment current, and set revision to 0.
51 # 5. If any interfaces have been added since the last public release, then increment
53 # 6. If any interfaces have been removed since the last public release, then set age
56 SHARED_VERSION_INFO="1:8:1"
66 if test "x-$build_os-$host_os-$target_os" = x-mingw32-mingw32-mingw32 ; then
67 AC_CHECK_PROG(DLLTOOL, dlltool, dlltool)
68 AC_CHECK_PROG(DLLWRAP, dllwrap, dllwrap)
69 AC_CHECK_PROG(PEXPORTS, pexports, pexports)
74 AC_CHECK_HEADERS(stdint.h sys/times.h)
76 #====================================================================================
77 # Couple of initializations here. Fill in real values later.
81 #====================================================================================
82 # Finished checking, handle options.
84 AC_ARG_ENABLE(gcc-werror,
85 AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]),
86 ac_arg_gcc_werror=yes, ac_arg_gcc_werror=no)
88 AC_ARG_ENABLE(gcc-pipe,
89 AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option ]),
90 ac_arg_gcc_pipe="N", ac_arg_gcc_pipe="Y")
92 AC_ARG_ENABLE(gcc-opt,
93 AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations ]),
94 ac_arg_gcc_opt="N", ac_arg_gcc_opt="Y")
97 AC_HELP_STRING([--disable-fftw], [disable usage of FFTW ]),
98 ac_arg_fftw="N", ac_arg_fftw="Y")
100 AC_ARG_ENABLE(cpu-clip,
101 AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]),
102 ac_arg_cpu_clip="N", ac_arg_cpu_clip="Y")
104 #====================================================================================
105 # Check types and their sizes.
107 AC_CHECK_SIZEOF(int,0)
108 AC_CHECK_SIZEOF(long,0)
109 AC_CHECK_SIZEOF(float,4)
110 AC_CHECK_SIZEOF(double,8)
112 #====================================================================================
113 # Determine endian-ness of target processor.
117 AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
118 [Target processor is big endian.])
119 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
120 [Target processor is little endian.])
122 #====================================================================================
123 # Check for functions.
125 AC_CHECK_FUNCS(malloc calloc free memcpy memmove alarm signal)
127 AC_CHECK_LIB([m],floor)
128 AC_CHECK_FUNCS(floor ceil fmod)
130 AC_CHECK_SIGNAL(SIGALRM)
134 # AC_C99_FUNC_LLRINT Don't need this (yet?).
136 case "x$ac_cv_c99_lrint$ac_cv_c99_lrintf" in
140 AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
141 AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
145 #====================================================================================
146 # Determine if the processor can do clipping on float to int conversions.
148 if test x$ac_arg_cpu_clip = "xY" ; then
151 echo "checking processor clipping capabilities... disabled"
152 ac_cv_c_clip_positive=0
153 ac_cv_c_clip_negative=0
156 AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
157 [Target processor clips on positive float to int conversion.])
158 AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
159 [Target processor clips on negative float to int conversion.])
161 #====================================================================================
162 # Check for libsndfile which is required for the test and example programs.
164 AC_ARG_ENABLE(sndfile,
165 AC_HELP_STRING([--disable-sndfile], [disable support for sndfile (default=autodetect)]),
166 [ enable_sndfile=$enableval ], [ enable_sndfile=yes ])
168 # Check for pkg-config outside the if statement.
171 if test "x$enable_sndfile" = "xyes"; then
172 PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.6, ac_cv_sndfile=1, ac_cv_sndfile=0)
177 AC_DEFINE_UNQUOTED([HAVE_SNDFILE],$ac_cv_sndfile,[Set to 1 if you have libsndfile.])
179 if test x$ac_cv_sndfile = x1 ; then
187 #====================================================================================
192 if test x$enable_alsa != xno ; then
193 AC_CHECK_HEADERS(alsa/asoundlib.h)
194 if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
200 #====================================================================================
201 # Check for libfftw3 which is required for the test and example programs.
203 if test $ac_arg_fftw = "Y" ; then
204 PKG_CHECK_MODULES(FFTW3, fftw3 >= 0.15.0, ac_cv_fftw3=1, ac_cv_fftw3=0)
205 AC_DEFINE_UNQUOTED([HAVE_FFTW3],$ac_cv_fftw3,[Set to 1 if you have libfftw3.])
207 if test x$ac_cv_fftw3 = x1 ; then
213 if test x$ac_cv_fftw3 != xyes ; then
218 #====================================================================================
221 if test $ac_cv_c_compiler_gnu = yes ; then
222 CFLAGS="$CFLAGS -std=gnu99 -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wpointer-arith"
223 # -Wundef -Wbad-function-cast -Wmissing-declarations -Wconversion -Winline"
224 if test "$ac_arg_gcc_opt" = "N" ; then
225 temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
227 AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
230 # Disable -Wall for Apple Darwin/Rhapsody.
231 # System headers on these systems are broken.
234 temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall//"`
238 linux*|kfreebsd*-gnu*|gnu*)
239 SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
244 if test x$ac_arg_gcc_pipe != "xN" ; then
245 CFLAGS="$CFLAGS -pipe"
248 if test x$ac_arg_gcc_werror = "xyes" ; then
249 CFLAGS="-Werror $CFLAGS"
252 AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
253 GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
254 AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
257 #====================================================================================
258 # Find known target OS.
260 OS_SPECIFIC_INCLUDES=""
265 OS_SPECIFIC_INCLUDES="-fpascal-strings -I/Developer/Headers/FlatCarbon"
266 OS_SPECIFIC_LINKS="-framework CoreAudio"
269 OS_SPECIFIC_LINKS="-lwinmm"
273 OS_SPECIFIC_INCLUDES=""
278 htmldocdir=$prefix/share/doc/libsamplerate0-dev/html
280 if test $prefix = "NONE" ; then
281 htmldocdir=/usr/local/share/doc/libsamplerate0-dev/html
283 htmldocdir=$prefix/share/doc/libsamplerate0-dev/html
286 #====================================================================================
287 # Now use the information from the checking stage.
289 AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
293 AC_SUBST(SHLIB_VERSION_ARG)
294 AC_SUBST(SHARED_VERSION_INFO)
295 AC_SUBST(OS_SPECIFIC_INCLUDES)
296 AC_SUBST(OS_SPECIFIC_LINKS)
298 AC_SUBST(COMPILER_IS_GCC)
299 AC_SUBST(GCC_MAJOR_VERSION)
302 AC_SUBST(FFTW3_CFLAGS)
305 AC_SUBST(HAVE_SNDFILE)
306 AC_SUBST(SNDFILE_CFLAGS)
307 AC_SUBST(SNDFILE_LIBS)
311 AC_CONFIG_FILES([Makefile M4/Makefile src/Version_script \
312 Win32/Makefile Win32/Makefile.mingw \
313 src/Makefile examples/Makefile tests/Makefile doc/Makefile \
314 libsamplerate.spec samplerate.pc])
317 #====================================================================================
320 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=-
322 Configuration summary :
324 Version : ..................... ${VERSION}
326 Host CPU : .................... ${host_cpu}
327 Host Vendor : ................. ${host_vendor}
328 Host OS : ..................... ${host_os}
331 if test x$ac_cv_c_compiler_gnu = xyes ; then
333 echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
334 echo " GCC major version : ........... ${GCC_MAJOR_VERSION}"
338 Extra tools required for testing and examples :
340 Have FFTW : ................... ${ac_cv_fftw3}])
342 AC_MSG_RESULT([ Have libsndfile : ............. ${ac_cv_sndfile}])
343 AC_MSG_RESULT([ Have ALSA : ................... ${ac_cv_header_alsa_asoundlib_h}
346 AC_MSG_RESULT([ Installation directories :
348 Library directory : ........... ${prefix}/lib
349 Program directory : ........... ${prefix}/bin
350 Pkgconfig directory : ......... ${prefix}/lib/pkgconfig
353 if test x$prefix != "x/usr" ; then
354 echo "Compiling some other packages against ${PACKAGE} may require "
355 echo -e "the addition of \"${prefix}/lib/pkgconfig\" to the "
356 echo -e "PKG_CONFIG_PATH environment variable.\n"