shithub: libsamplerate

Download patch

ref: 9abcafee6a6e860bc8f543bf6d603e82112d5fd3
parent: 12b9ed8a9cab550f29a784b774412822a5f61305
author: Erik de Castro Lopo <erikd@miles>
date: Wed Sep 29 10:21:10 EDT 2004

Update win32 build to use FFTW3 for test programs.

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-09-30  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac Win32/Makefile.mingw.in
+    More support for compiling on Win32 using MinGW. Now uses FFTW3.
+
+    * examples/audio_out.c
+    Remove include of <mmreg.h> on win32.
+
 2004-09-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac Win32/Makefile.mingw.in
--- a/Win32/Makefile.mingw.in
+++ b/Win32/Makefile.mingw.in
@@ -1,5 +1,10 @@
-TARGETS = libsamplerate.dll sndfile-resample.exe varispeed-play.exe
+# MinGW specific Makefile for libsamplerate.
 
+@SET_MAKE@
+
+PROGRAMS = sndfile-resample.exe
+TARGETS = libsamplerate.dll $(PROGRAMS) varispeed-play.exe samplerate.pc
+
 AR = @AR@
 CC = @CC@
 CFLAGS = @CFLAGS@ -Isrc
@@ -9,10 +14,13 @@
 CXX = @CXX@
 DLLTOOL = @DLLTOOL@
 DLLWRAP = @DLLWRAP@
+FFTW3_CFLAGS = @FFTW3_CFLAGS@
+FFTW3_LIBS = @FFTW3_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = ${INSTALL} -m 644
+install_sh = @install_sh@
 LDFLAGS = @LDFLAGS@
 LN_S = @LN_S@
-OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
-OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
 PEXPORTS = @PEXPORTS@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -21,9 +29,22 @@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 RANLIB = @RANLIB@
+SNDFILE_CFLAGS = -std=c99 @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
 STRIP = @STRIP@
 
 #====================================================================
+# Target directories.
+
+bindir = @bindir@
+exec_prefix = @exec_prefix@
+htmldocdir = @htmldocdir@
+includedir = @includedir@
+libdir = @libdir@
+pkgconfigdir = @libdir@/pkgconfig
+prefix = @prefix@
+
+#====================================================================
 # Targets
 
 all : $(TARGETS)
@@ -31,6 +52,24 @@
 clean :
 	rm -f  $(TARGETS) *.del *.lib src/*.o tests/*.o tests/*.exe
 
+install : $(TARGETS)
+	$(install_sh) -c libsamplerate.dll $(libdir)
+	$(install_sh) -c samplerate.pc $(pkgconfigdir)
+	@for prog in $(PROGRAMS); do \
+		echo "installing ... $$prog" ; \
+		$(install_sh) -c "$$prog" $(bindir) ; \
+		done;
+	$(install_sh) -c src/samplerate.h $(includedir)
+ 
+uninstall :
+	rm -f $(libdir)/libsamplerate.dll
+	rm -f $(pkgconfigdir)/samplerate.pc
+	@for prog in $(PROGRAMS); do \
+		echo "removing ... $(bindir)/$$prog" ; \
+		rm -f $(bindir)/"$$prog" ; \
+		done;
+	rm -f $(includedir)/samplerate.h
+
 #====================================================================
 
 LINK_OBJS = \
@@ -43,12 +82,21 @@
 	$(DLLWRAP) --def Win32/libsamplerate.def $(LINK_OBJS) --output-lib libsamplerate.lib -o libsamplerate.dll
 	$(STRIP) libsamplerate.dll
 
-sndfile-resample.exe : examples/sndfile-resample.o libsamplerate.lib
-	$(CC) $+ -o $@
+sndfile-resample.exe : examples/sndfile-resample.c libsamplerate.lib
+	$(CC) $(CFLAGS) $(SNDFILE_CFLAGS) $+ $(SNDFILE_LIBS) -o $@
 
-varispeed-play.exe : examples/varispeed-play.o libsamplerate.lib
-	$(CC) $+ -lwinmm -o $@
+varispeed-play.exe : examples/varispeed-play.c examples/audio_out.o libsamplerate.lib
+	$(CC) $(CFLAGS) $(SNDFILE_CFLAGS) $+ $(SNDFILE_LIBS) -lwinmm -o $@
 
+examples/audio_out.o : examples/audio_out.c
+	$(CC) $(CFLAGS) $(SNDFILE_CFLAGS) -c $+ -o $@
+
+samplerate.pc : samplerate.pc.in config.status
+	@./config.status $@
+
+config.status :
+	./configure
+
 #====================================================================
 # Testing programs.
 
@@ -79,29 +127,29 @@
 #====================================================================
 # Test programs.
 
-tests/misc_test.exe : tests/misc_test.o tests/util.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/misc_test.exe : tests/misc_test.c tests/util.c libsamplerate.lib
+	$(CC) $(CFLAGS) $+ -o $@
 
-tests/termination_test.exe : tests/termination_test.o tests/util.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/termination_test.exe : tests/termination_test.c tests/util.c libsamplerate.lib
+	$(CC) $(CFLAGS) $+ -o $@
 
-tests/simple_test.exe : tests/simple_test.o tests/util.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/simple_test.exe : tests/simple_test.c tests/util.c libsamplerate.lib
+	$(CC) $(CFLAGS) $+ -o $@
 
-tests/callback_test.exe : tests/callback_test.o tests/util.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/callback_test.exe : tests/callback_test.c tests/util.c libsamplerate.lib
+	$(CC) $(CFLAGS) $+ -o $@
 
-tests/reset_test.exe : tests/reset_test.o tests/util.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/reset_test.exe : tests/reset_test.c tests/util.c libsamplerate.lib
+	$(CC) $(CFLAGS) $+ -o $@
 
-tests/multi_channel_test.exe : tests/multi_channel_test.o tests/util.o tests/calc_snr.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/float_short_test.exe : tests/float_short_test.c tests/util.c libsamplerate.lib
+	$(CC) $(CFLAGS) $+ -o $@
 
-tests/float_short_test.exe : tests/float_short_test.o tests/util.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/multi_channel_test.exe : tests/multi_channel_test.c tests/util.c tests/calc_snr.c libsamplerate.lib
+	$(CC) $(CFLAGS) $(FFTW3_CFLAGS) $+ $(FFTW3_LIBS) -o $@
 
-tests/snr_bw_test.exe : tests/snr_bw_test.o tests/util.o tests/calc_snr.o libsamplerate.lib
-	$(CC) $+ -o $@
+tests/snr_bw_test.exe : tests/snr_bw_test.c tests/util.c tests/calc_snr.c libsamplerate.lib
+	$(CC) $(CFLAGS) $(FFTW3_CFLAGS) $+ $(FFTW3_LIBS) -o $@
 
 # End of Makefile
 #====================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@
 AC_INIT
 AC_CONFIG_SRCDIR([src/samplerate.c])
 AC_CANONICAL_TARGET([])
-AM_INIT_AUTOMAKE(libsamplerate,0.1.2)
+AM_INIT_AUTOMAKE(libsamplerate,0.1.3pre1)
 AM_CONFIG_HEADER(src/config.h)
 
 #------------------------------------------------------------------------------------
@@ -218,6 +218,7 @@
 # Find known target OS.
 
 OS_SPECIFIC_INCLUDES=""
+os_is_win32=0
 
 case "$target_os" in
 	darwin* | rhapsody*)
@@ -226,6 +227,7 @@
 		;;
 	mingw32*)
 		OS_SPECIFIC_LINKS="-lwinmm"
+		os_is_win32=1
 		;;
 	*)
 		OS_SPECIFIC_INCLUDES=""
@@ -239,7 +241,7 @@
 # Need to make examples directory before tests directory.
 subdirs="src doc examples tests"
 
-AC_DEFINE([OS_IS_WIN32],0, [Set to 1 if compiling for Win32])
+AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
 
 AC_SUBST(subdirs)
 AC_SUBST(SHLIB_VERSION_ARG)
@@ -267,21 +269,7 @@
 AC_OUTPUT
 
 #====================================================================================
-# Special case for MinGW32.
 
-if test "x-$build_os-$host_os-$target_os" = x-mingw32-mingw32-mingw32 ; then
-	cp -f Win32/Makefile.mingw Makefile
-	echo
-	echo "Now run \"make\" and \"make check\"."
-	echo
-	echo "There is no automatic install script on this platform."
-	echo
-	
-	exit 0
-	fi
-
-#====================================================================================
-
 AC_MSG_RESULT([
 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=-
 
@@ -313,6 +301,12 @@
     Program directory : ........... ${prefix}/bin
     Pkgconfig directory : ......... ${prefix}/lib/pkgconfig
 ])
+
+if test "x-$build_os-$host_os-$target_os" = x-mingw32-mingw32-mingw32 ; then
+	echo "Using a Win32 specific Makefile."
+	cp -f Win32/Makefile.mingw Makefile
+	exit 0
+	fi
 
 if test x$prefix != "x/usr" ; then
 	echo "Compiling some other packages against ${PACKAGE} may require "