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