Chris@41: # Copyright (C) 2002-2011 Erik de Castro Lopo (erikd AT mega-nerd DOT com). Chris@41: Chris@41: dnl Require autoconf version Chris@41: AC_PREREQ(2.57) Chris@41: Chris@41: AC_INIT([libsamplerate],[0.1.9],[erikd@mega-nerd.com], Chris@41: [libsamplerate],[http://www.mega-nerd.com/libsamplerate/]) Chris@41: Chris@41: # Put config stuff in Cfg. Chris@41: AC_CONFIG_AUX_DIR(Cfg) Chris@41: Chris@41: AC_CONFIG_SRCDIR([src/samplerate.c]) Chris@41: AC_CANONICAL_TARGET([]) Chris@41: Chris@41: AC_CONFIG_MACRO_DIR([M4]) Chris@41: AC_CONFIG_HEADERS([src/config.h]) Chris@41: Chris@41: AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION) Chris@41: AM_SILENT_RULES([yes]) Chris@41: Chris@41: dnl Add parameters for aclocal Chris@41: AC_SUBST(ACLOCAL_AMFLAGS, "-I M4") Chris@41: Chris@41: AC_LANG([C]) Chris@41: Chris@41: AC_PROG_CC Chris@41: AM_PROG_CC_C_O Chris@41: AC_PROG_CXX Chris@41: AC_PROG_SED Chris@41: Chris@41: # Do not check for F77. Chris@41: define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl Chris@41: Chris@41: AM_PROG_LIBTOOL Chris@41: LT_PROG_RC Chris@41: Chris@41: AC_PROG_INSTALL Chris@41: AC_PROG_LN_S Chris@41: Chris@41: #------------------------------------------------------------------------------------ Chris@41: # Rules for library version information: Chris@41: # Chris@41: # 1. Start with version information of `0:0:0' for each libtool library. Chris@41: # 2. Update the version information only immediately before a public release of Chris@41: # your software. More frequent updates are unnecessary, and only guarantee Chris@41: # that the current interface number gets larger faster. Chris@41: # 3. If the library source code has changed at all since the last update, then Chris@41: # increment revision (`c:r:a' becomes `c:r+1:a'). Chris@41: # 4. If any interfaces have been added, removed, or changed since the last update, Chris@41: # increment current, and set revision to 0. Chris@41: # 5. If any interfaces have been added since the last public release, then increment Chris@41: # age. Chris@41: # 6. If any interfaces have been removed since the last public release, then set age Chris@41: # to 0. Chris@41: Chris@41: SHARED_VERSION_INFO="1:8:1" Chris@41: Chris@41: Chris@41: Chris@41: Chris@41: Chris@41: AC_PROG_MAKE_SET Chris@41: AC_PROG_LN_S Chris@41: AC_PROG_MKDIR_P Chris@41: Chris@41: if test "x-$build_os-$host_os-$target_os" = x-mingw32-mingw32-mingw32 ; then Chris@41: AC_CHECK_PROG(DLLTOOL, dlltool, dlltool) Chris@41: AC_CHECK_PROG(DLLWRAP, dllwrap, dllwrap) Chris@41: AC_CHECK_PROG(PEXPORTS, pexports, pexports) Chris@41: fi Chris@41: Chris@41: AC_HEADER_STDC Chris@41: Chris@41: AC_CHECK_HEADERS(stdint.h sys/times.h) Chris@41: Chris@41: #==================================================================================== Chris@41: # Couple of initializations here. Fill in real values later. Chris@41: Chris@41: SHLIB_VERSION_ARG="" Chris@41: Chris@41: #==================================================================================== Chris@41: # Finished checking, handle options. Chris@41: Chris@41: AC_ARG_ENABLE(gcc-werror, Chris@41: AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]), Chris@41: ac_arg_gcc_werror=yes, ac_arg_gcc_werror=no) Chris@41: Chris@41: AC_ARG_ENABLE(gcc-pipe, Chris@41: AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option ]), Chris@41: ac_arg_gcc_pipe="N", ac_arg_gcc_pipe="Y") Chris@41: Chris@41: AC_ARG_ENABLE(gcc-opt, Chris@41: AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations ]), Chris@41: ac_arg_gcc_opt="N", ac_arg_gcc_opt="Y") Chris@41: Chris@41: AC_ARG_ENABLE(fftw, Chris@41: AC_HELP_STRING([--disable-fftw], [disable usage of FFTW ]), Chris@41: ac_arg_fftw="N", ac_arg_fftw="Y") Chris@41: Chris@41: AC_ARG_ENABLE(cpu-clip, Chris@41: AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]), Chris@41: ac_arg_cpu_clip="N", ac_arg_cpu_clip="Y") Chris@41: Chris@41: #==================================================================================== Chris@41: # Check types and their sizes. Chris@41: Chris@41: AC_CHECK_SIZEOF(int,0) Chris@41: AC_CHECK_SIZEOF(long,0) Chris@41: AC_CHECK_SIZEOF(float,4) Chris@41: AC_CHECK_SIZEOF(double,8) Chris@41: Chris@41: #==================================================================================== Chris@41: # Determine endian-ness of target processor. Chris@41: Chris@41: AC_C_FIND_ENDIAN Chris@41: Chris@41: AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian}, Chris@41: [Target processor is big endian.]) Chris@41: AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian}, Chris@41: [Target processor is little endian.]) Chris@41: Chris@41: #==================================================================================== Chris@41: # Check for functions. Chris@41: Chris@41: AC_CHECK_FUNCS(malloc calloc free memcpy memmove alarm signal) Chris@41: Chris@41: AC_CHECK_LIB([m],floor) Chris@41: AC_CHECK_FUNCS(floor ceil fmod) Chris@41: Chris@41: AC_CHECK_SIGNAL(SIGALRM) Chris@41: Chris@41: AC_C99_FUNC_LRINT Chris@41: AC_C99_FUNC_LRINTF Chris@41: # AC_C99_FUNC_LLRINT Don't need this (yet?). Chris@41: Chris@41: case "x$ac_cv_c99_lrint$ac_cv_c99_lrintf" in Chris@41: xyesyes) Chris@41: ;; Chris@41: *) Chris@41: AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]]) Chris@41: AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]]) Chris@41: ;; Chris@41: esac Chris@41: Chris@41: #==================================================================================== Chris@41: # Determine if the processor can do clipping on float to int conversions. Chris@41: Chris@41: if test x$ac_arg_cpu_clip = "xY" ; then Chris@41: AC_C_CLIP_MODE Chris@41: else Chris@41: echo "checking processor clipping capabilities... disabled" Chris@41: ac_cv_c_clip_positive=0 Chris@41: ac_cv_c_clip_negative=0 Chris@41: fi Chris@41: Chris@41: AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive}, Chris@41: [Target processor clips on positive float to int conversion.]) Chris@41: AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative}, Chris@41: [Target processor clips on negative float to int conversion.]) Chris@41: Chris@41: #==================================================================================== Chris@41: # Check for libsndfile which is required for the test and example programs. Chris@41: Chris@41: AC_ARG_ENABLE(sndfile, Chris@41: AC_HELP_STRING([--disable-sndfile], [disable support for sndfile (default=autodetect)]), Chris@41: [ enable_sndfile=$enableval ], [ enable_sndfile=yes ]) Chris@41: Chris@41: # Check for pkg-config outside the if statement. Chris@41: PKG_PROG_PKG_CONFIG Chris@41: Chris@41: if test "x$enable_sndfile" = "xyes"; then Chris@41: PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.6, ac_cv_sndfile=1, ac_cv_sndfile=0) Chris@41: else Chris@41: ac_cv_sndfile=0 Chris@41: fi Chris@41: Chris@41: AC_DEFINE_UNQUOTED([HAVE_SNDFILE],$ac_cv_sndfile,[Set to 1 if you have libsndfile.]) Chris@41: Chris@41: if test x$ac_cv_sndfile = x1 ; then Chris@41: ac_cv_sndfile=yes Chris@41: HAVE_SNDFILE=1 Chris@41: else Chris@41: ac_cv_sndfile=no Chris@41: HAVE_SNDFILE=0 Chris@41: fi Chris@41: Chris@41: #==================================================================================== Chris@41: # Check for ALSA. Chris@41: Chris@41: ALSA_LIBS="" Chris@41: Chris@41: if test x$enable_alsa != xno ; then Chris@41: AC_CHECK_HEADERS(alsa/asoundlib.h) Chris@41: if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then Chris@41: ALSA_LIBS="-lasound" Chris@41: enable_alsa=yes Chris@41: fi Chris@41: fi Chris@41: Chris@41: #==================================================================================== Chris@41: # Check for libfftw3 which is required for the test and example programs. Chris@41: Chris@41: if test $ac_arg_fftw = "Y" ; then Chris@41: PKG_CHECK_MODULES(FFTW3, fftw3 >= 0.15.0, ac_cv_fftw3=1, ac_cv_fftw3=0) Chris@41: AC_DEFINE_UNQUOTED([HAVE_FFTW3],$ac_cv_fftw3,[Set to 1 if you have libfftw3.]) Chris@41: Chris@41: if test x$ac_cv_fftw3 = x1 ; then Chris@41: ac_cv_fftw3=yes Chris@41: HAVE_FFTW3=1 Chris@41: fi Chris@41: fi Chris@41: Chris@41: if test x$ac_cv_fftw3 != xyes ; then Chris@41: ac_cv_fftw3=no Chris@41: HAVE_FFTW3=0 Chris@41: fi Chris@41: Chris@41: #==================================================================================== Chris@41: # GCC stuff. Chris@41: Chris@41: if test $ac_cv_c_compiler_gnu = yes ; then Chris@41: CFLAGS="$CFLAGS -std=gnu99 -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wpointer-arith" Chris@41: # -Wundef -Wbad-function-cast -Wmissing-declarations -Wconversion -Winline" Chris@41: if test "$ac_arg_gcc_opt" = "N" ; then Chris@41: temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"` Chris@41: CFLAGS=$temp_CFLAGS Chris@41: AC_MSG_WARN([[*** Compiler optimisations switched off. ***]]) Chris@41: fi Chris@41: Chris@41: # Disable -Wall for Apple Darwin/Rhapsody. Chris@41: # System headers on these systems are broken. Chris@41: case "$target_os" in Chris@41: darwin* | rhapsody*) Chris@41: temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall//"` Chris@41: CFLAGS=$temp_CFLAGS Chris@41: ;; Chris@41: Chris@41: linux*|kfreebsd*-gnu*|gnu*) Chris@41: SHLIB_VERSION_ARG="-Wl,--version-script=Version_script" Chris@41: ;; Chris@41: *) Chris@41: ;; Chris@41: esac Chris@41: if test x$ac_arg_gcc_pipe != "xN" ; then Chris@41: CFLAGS="$CFLAGS -pipe" Chris@41: fi Chris@41: Chris@41: if test x$ac_arg_gcc_werror = "xyes" ; then Chris@41: CFLAGS="-Werror $CFLAGS" Chris@41: fi Chris@41: Chris@41: AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.]) Chris@41: GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"` Chris@41: AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.]) Chris@41: fi Chris@41: Chris@41: #==================================================================================== Chris@41: # Find known target OS. Chris@41: Chris@41: OS_SPECIFIC_INCLUDES="" Chris@41: os_is_win32=0 Chris@41: Chris@41: case "$target_os" in Chris@41: darwin* | rhapsody*) Chris@41: OS_SPECIFIC_INCLUDES="-fpascal-strings -I/Developer/Headers/FlatCarbon" Chris@41: OS_SPECIFIC_LINKS="-framework CoreAudio" Chris@41: ;; Chris@41: mingw32*) Chris@41: OS_SPECIFIC_LINKS="-lwinmm" Chris@41: os_is_win32=1 Chris@41: ;; Chris@41: *) Chris@41: OS_SPECIFIC_INCLUDES="" Chris@41: OS_SPECIFIC_LINKS="" Chris@41: ;; Chris@41: esac Chris@41: Chris@41: htmldocdir=$prefix/share/doc/libsamplerate0-dev/html Chris@41: Chris@41: if test $prefix = "NONE" ; then Chris@41: htmldocdir=/usr/local/share/doc/libsamplerate0-dev/html Chris@41: else Chris@41: htmldocdir=$prefix/share/doc/libsamplerate0-dev/html Chris@41: fi Chris@41: Chris@41: #==================================================================================== Chris@41: # Now use the information from the checking stage. Chris@41: Chris@41: AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32]) Chris@41: Chris@41: AC_SUBST(htmldocdir) Chris@41: Chris@41: AC_SUBST(SHLIB_VERSION_ARG) Chris@41: AC_SUBST(SHARED_VERSION_INFO) Chris@41: AC_SUBST(OS_SPECIFIC_INCLUDES) Chris@41: AC_SUBST(OS_SPECIFIC_LINKS) Chris@41: Chris@41: AC_SUBST(COMPILER_IS_GCC) Chris@41: AC_SUBST(GCC_MAJOR_VERSION) Chris@41: Chris@41: AC_SUBST(HAVE_FFTW3) Chris@41: AC_SUBST(FFTW3_CFLAGS) Chris@41: AC_SUBST(FFTW3_LIBS) Chris@41: Chris@41: AC_SUBST(HAVE_SNDFILE) Chris@41: AC_SUBST(SNDFILE_CFLAGS) Chris@41: AC_SUBST(SNDFILE_LIBS) Chris@41: Chris@41: AC_SUBST(ALSA_LIBS) Chris@41: Chris@41: AC_CONFIG_FILES([Makefile M4/Makefile src/Version_script \ Chris@41: Win32/Makefile Win32/Makefile.mingw \ Chris@41: src/Makefile examples/Makefile tests/Makefile doc/Makefile \ Chris@41: libsamplerate.spec samplerate.pc]) Chris@41: AC_OUTPUT Chris@41: Chris@41: #==================================================================================== Chris@41: Chris@41: AC_MSG_RESULT([ Chris@41: -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=- Chris@41: Chris@41: Configuration summary : Chris@41: Chris@41: Version : ..................... ${VERSION} Chris@41: Chris@41: Host CPU : .................... ${host_cpu} Chris@41: Host Vendor : ................. ${host_vendor} Chris@41: Host OS : ..................... ${host_os} Chris@41: ]) Chris@41: Chris@41: if test x$ac_cv_c_compiler_gnu = xyes ; then Chris@41: echo -e " Tools :\n" Chris@41: echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}" Chris@41: echo " GCC major version : ........... ${GCC_MAJOR_VERSION}" Chris@41: fi Chris@41: Chris@41: AC_MSG_RESULT([ Chris@41: Extra tools required for testing and examples : Chris@41: Chris@41: Have FFTW : ................... ${ac_cv_fftw3}]) Chris@41: Chris@41: AC_MSG_RESULT([ Have libsndfile : ............. ${ac_cv_sndfile}]) Chris@41: AC_MSG_RESULT([ Have ALSA : ................... ${ac_cv_header_alsa_asoundlib_h} Chris@41: ]) Chris@41: Chris@41: AC_MSG_RESULT([ Installation directories : Chris@41: Chris@41: Library directory : ........... ${prefix}/lib Chris@41: Program directory : ........... ${prefix}/bin Chris@41: Pkgconfig directory : ......... ${prefix}/lib/pkgconfig Chris@41: ]) Chris@41: Chris@41: if test x$prefix != "x/usr" ; then Chris@41: echo "Compiling some other packages against ${PACKAGE} may require " Chris@41: echo -e "the addition of \"${prefix}/lib/pkgconfig\" to the " Chris@41: echo -e "PKG_CONFIG_PATH environment variable.\n" Chris@41: fi Chris@41: