shithub: libsamplerate

Download patch

ref: 1939c772176acadcf7012703b0b378aebb1b8cb7
parent: f8f7d9d188749351510b3cae36d9d4a8e0384d87
author: Erik de Castro Lopo <[email protected]>
date: Tue Jan 27 05:07:11 EST 2004

Move from FFTW2 to FFTW3 for test programs.
Also remove src/config.h.in from archive.

--- a/configure.ac
+++ b/configure.ac
@@ -144,9 +144,9 @@
 		# AC_C99_FUNC_LLRINT  Don't need this (yet?).
 
 		if test x$ac_cv_c99_lrint = xno || test x$ac_cv_c99_lrintf = xno ; then
-	AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
-	AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
-	fi
+			AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
+			AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
+			fi
 		;;
 	esac
 
@@ -172,52 +172,31 @@
 
 PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.6, ac_cv_sndfile=1, ac_cv_sndfile=0)
 
-AC_DEFINE_UNQUOTED([HAVE_SNDFILE],${ac_cv_sndfile},
-			[Set to 1 if you have libsndfile.])
+AC_DEFINE_UNQUOTED([HAVE_SNDFILE],$ac_cv_sndfile,[Set to 1 if you have libsndfile.])
 
 if test x$ac_cv_sndfile = x1 ; then
 	ac_cv_sndfile=yes
+	HAVE_SNDFILE=1
 else
 	ac_cv_sndfile=no
+	HAVE_SNDFILE=0
 	fi
 
 #====================================================================================
-# Check for libfftw and librfftw which are required for the test programs.
+# Check for libfftw3 which is required for the test and example programs.
 
-# Save $LIBS for later.
-src_save_LIBS=$LIBS
+PKG_CHECK_MODULES(FFTW3, fftw3 >= 0.15.0, ac_cv_fftw3=1, ac_cv_fftw3=0)
 
-AC_CHECK_HEADER(fftw.h,
-	AC_CHECK_LIB([fftw], fftw_create_plan, , AC_MSG_WARN([*** Could not find libfftw. Test programs cannot be run.])),
-	AC_MSG_WARN([*** Header file fftw.h not found. Test programs cannot be run.])
-	)
+AC_DEFINE_UNQUOTED([HAVE_FFTW3],$ac_cv_fftw3,[Set to 1 if you have libfftw3.])
 
-AC_CHECK_HEADER(rfftw.h,
-	AC_CHECK_LIB([rfftw], rfftw_create_plan, , AC_MSG_WARN([*** Could not find librfftw. Test programs cannot be run.])),
-	AC_MSG_WARN([*** Header file rfftw.h not found. Test programs cannot be run.])
-	)
-
-# The above checks add libfftw and librfftw to $LIBS, so remove them and
-# create a separate FFTW_LIBS variable.
-
-if test "x$src_save_LIBS" = x ; then
-	FFTW_LIBS=$LIBS
+if test x$ac_cv_fftw3 = x1 ; then
+	ac_cv_fftw3=yes
+	HAVE_FFTW3=1
 else
-	FFTW_LIBS=`echo $LIBS | sed "s/${src_save_LIBS}//"`
+	ac_cv_fftw3=no
+	HAVE_FFTW3=0
 	fi
 
-# Restore $LIBS
-LIBS=$src_save_LIBS
-
-HAVE_FFTW=0
-ac_cv_have_fftw=no
-if test x$ac_cv_lib_fftw_fftw_create_plan = xyes ; then
-	if test x$ac_cv_lib_rfftw_rfftw_create_plan = xyes ; then
-		HAVE_FFTW=1
-		ac_cv_have_fftw=yes
-		fi
-	fi
-
 #====================================================================================
 # Find known target OS.
 
@@ -252,10 +231,13 @@
 AC_SUBST(GCC_MAJOR_VERSION)
 AC_SUBST(ENABLE_DEBUG)
 
-AC_SUBST(HAVE_FFTW)
-AC_SUBST(FFTW_LIBS)
+AC_SUBST(HAVE_FFTW3)
+AC_SUBST(FFTW3_CFLAGS)
+AC_SUBST(FFTW3_LIBS)
+
 AC_SUBST(EFENCE_LIB)
 
+AC_SUBST(HAVE_SNDFILE)
 AC_SUBST(SNDFILE_CFLAGS)
 AC_SUBST(SNDFILE_LIBS)
 
@@ -285,12 +267,12 @@
 AC_MSG_RESULT([
   Extra tools required for testing and examples :
 
-    Have FFTW : ................... ${ac_cv_have_fftw}])
+    Have FFTW : ................... ${ac_cv_fftw3}])
 
-if test x$ac_cv_have_fftw = xno ; then
+if test x$ac_cv_fftw3 = xno ; then
 	echo
 	echo "      * FFTW is available from http://www.fftw.org/ or if you "
-	echo "      * are using Debian : \"apt-get install fftw2 fftw-dev\""
+	echo "      * are using Debian : \"apt-get install fftw3 fftw3-dev\""
 	echo
 	fi
 
--- a/src/config.h.in
+++ /dev/null
@@ -1,130 +1,0 @@
-/* src/config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Set to 1 if the compile is GNU GCC. */
-#undef COMPILER_IS_GCC
-
-/* Target processor clips on negative float to int conversion. */
-#undef CPU_CLIPS_NEGATIVE
-
-/* Target processor clips on positive float to int conversion. */
-#undef CPU_CLIPS_POSITIVE
-
-/* Set to 1 to enable debugging. */
-#undef ENABLE_DEBUG
-
-/* Major version of GCC or 3 otherwise. */
-#undef GCC_MAJOR_VERSION
-
-/* Define to 1 if you have the `calloc' function. */
-#undef HAVE_CALLOC
-
-/* Define to 1 if you have the `ceil' function. */
-#undef HAVE_CEIL
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the `floor' function. */
-#undef HAVE_FLOOR
-
-/* Define to 1 if you have the `fmod' function. */
-#undef HAVE_FMOD
-
-/* Define to 1 if you have the `free' function. */
-#undef HAVE_FREE
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `efence' library (-lefence). */
-#undef HAVE_LIBEFENCE
-
-/* Define to 1 if you have the `fftw' library (-lfftw). */
-#undef HAVE_LIBFFTW
-
-/* Define to 1 if you have the `m' library (-lm). */
-#undef HAVE_LIBM
-
-/* Define to 1 if you have the `rfftw' library (-lrfftw). */
-#undef HAVE_LIBRFFTW
-
-/* Define if you have C99's lrint function. */
-#undef HAVE_LRINT
-
-/* Define if you have C99's lrintf function. */
-#undef HAVE_LRINTF
-
-/* Define to 1 if you have the `malloc' function. */
-#undef HAVE_MALLOC
-
-/* Define to 1 if you have the `memcpy' function. */
-#undef HAVE_MEMCPY
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Set to 1 if you have libsndfile. */
-#undef HAVE_SNDFILE
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Set to 1 if compiling for Win32 */
-#undef OS_IS_WIN32
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* The size of a `double', as computed by sizeof. */
-#undef SIZEOF_DOUBLE
-
-/* The size of a `float', as computed by sizeof. */
-#undef SIZEOF_FLOAT
-
-/* The size of a `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
-/* The size of a `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,12 +21,15 @@
 reset_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la $(EFENCE_LIB)
 
 multi_channel_test_SOURCES = multi_channel_test.c util.c calc_snr.c
-multi_channel_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la $(FFTW_LIBS) $(EFENCE_LIB)
+multi_channel_test_CFLAGS = @FFTW3_CFLAGS@
+multi_channel_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la $(FFTW3_LIBS) $(EFENCE_LIB)
 
 snr_bw_test_SOURCES = snr_bw_test.c calc_snr.c util.c util.h
-snr_bw_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la $(FFTW_LIBS) $(EFENCE_LIB)
+snr_bw_test_CFLAGS = @FFTW3_CFLAGS@
+snr_bw_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la $(FFTW3_LIBS) $(EFENCE_LIB)
 
 callback_test_SOURCES = callback_test.c util.c util.h
+callback_test_CFLAGS = @FFTW3_CFLAGS@
 callback_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la $(EFENCE_LIB)
 
 float_short_test_SOURCES = float_short_test.c util.c util.h
@@ -35,8 +38,8 @@
 # This program is for evaluating other sample rate converters.
 
 src_evaluate_SOURCES = src-evaluate.c calc_snr.c util.c
-src_evaluate_CFLAGS = @SNDFILE_CFLAGS@
-src_evaluate_LDADD = $(SNDFILE_LIBS) $(FFTW_LIBS)
+src_evaluate_CFLAGS = @SNDFILE_CFLAGS@ @FFTW3_CFLAGS@
+src_evaluate_LDADD = $(SNDFILE_LIBS) $(FFTW3_LIBS)
 
 #===============================================================================
 
--- a/tests/snr_bw_test.c
+++ b/tests/snr_bw_test.c
@@ -24,7 +24,7 @@
 
 #include "config.h"
 
-#if (HAVE_LIBFFTW && HAVE_LIBRFFTW)
+#if (HAVE_FFTW3)
 
 #include <samplerate.h>
 
@@ -407,7 +407,7 @@
 	return 200.0 * freq ;
 } /* bandwidth_test */
 
-#else /* (HAVE_LIBFFTW && HAVE_LIBRFFTW) == 0 */
+#else /* (HAVE_FFTW3) == 0 */
 
 /* Alternative main function when librfftw is not available. */