shithub: libsamplerate

Download patch

ref: 8ef3d1e6dc0c162ebb1e901a7902e46590e5801f
parent: 850e9c3f80019188c12df4e3c829e9514b7dadfa
author: Erik de Castro Lopo <erikd@coltrane>
date: Sat Sep 11 22:12:42 EDT 2004

Preliminary support for compiling with MinGW.

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * configure.ac Win32/Makefile.mingw.in
+    Add preliminary support for compiling on Win32 using MinGW.
+	Bump version to 0.1.2.
+
 2004-09-10  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/util.h tests/*.c
@@ -13,7 +19,7 @@
 2004-08-27  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/src_sinc.c
-    Fix typos in converter name strings. Thanks to Tom Szilagyi for find them.
+    Fix typos in converter name strings. Thanks to Tom Szilagyi for finding them.
 
 2004-07-18  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
--- /dev/null
+++ b/Win32/Makefile.mingw.in
@@ -1,0 +1,107 @@
+TARGETS = libsamplerate.dll sndfile-resample.exe varispeed-play.exe
+
+AR = @AR@
+CC = @CC@
+CFLAGS = @CFLAGS@ -Isrc
+COMPILER_IS_GCC = @COMPILER_IS_GCC@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+DLLTOOL = @DLLTOOL@
+DLLWRAP = @DLLWRAP@
+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@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+
+#====================================================================
+# Targets
+
+all : $(TARGETS)
+
+clean :
+	rm -f  $(TARGETS) *.del *.lib src/*.o tests/*.o tests/*.exe
+
+#====================================================================
+
+LINK_OBJS = \
+	src/src_linear.o \
+	src/src_sinc.o \
+	src/src_zoh.o \
+	src/samplerate.o
+
+libsamplerate.dll libsamplerate.lib : $(LINK_OBJS)
+	$(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 $@
+
+varispeed-play.exe : examples/varispeed-play.o libsamplerate.lib
+	$(CC) $+ -lwinmm -o $@
+
+#====================================================================
+# Testing programs.
+
+TEST_PROGS = \
+     tests/misc_test.exe \
+     tests/termination_test.exe \
+     tests/simple_test.exe \
+	 tests/callback_test.exe \
+     tests/reset_test.exe \
+     tests/multi_channel_test.exe \
+	 tests/float_short_test.exe \
+     tests/snr_bw_test.exe
+
+
+check : $(TEST_PROGS)
+	tests/misc_test.exe
+	tests/termination_test.exe
+	tests/simple_test.exe
+	tests/callback_test.exe
+	tests/reset_test.exe
+	tests/multi_channel_test.exe
+	tests/float_short_test.exe
+	tests/snr_bw_test.exe
+	@echo ----------------------------------------------------------------------
+	@echo libsamplerate passed all tests
+	@echo ----------------------------------------------------------------------
+
+#====================================================================
+# Test programs.
+
+tests/misc_test.exe : tests/misc_test.o tests/util.o libsamplerate.lib
+	$(CC) $+ -o $@
+
+tests/termination_test.exe : tests/termination_test.o tests/util.o libsamplerate.lib
+	$(CC) $+ -o $@
+
+tests/simple_test.exe : tests/simple_test.o tests/util.o libsamplerate.lib
+	$(CC) $+ -o $@
+
+tests/callback_test.exe : tests/callback_test.o tests/util.o libsamplerate.lib
+	$(CC) $+ -o $@
+
+tests/reset_test.exe : tests/reset_test.o tests/util.o libsamplerate.lib
+	$(CC) $+ -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.o tests/util.o libsamplerate.lib
+	$(CC) $+ -o $@
+
+tests/snr_bw_test.exe : tests/snr_bw_test.o tests/util.o tests/calc_snr.o libsamplerate.lib
+	$(CC) $+ -o $@
+
+# End of Makefile
+#====================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,12 @@
 AC_PROG_LIBTOOL
 AM_PROG_LIBTOOL
 
+if test "x-$build_os-$host_os-$target_os" = x-mingw32-mingw32-mingw32 ; then
+	AC_CHECK_PROG(DLLTOOL, dlltool, dlltool)
+	AC_CHECK_PROG(DLLWRAP, dllwrap, dllwrap)
+	AC_CHECK_PROG(PEXPORTS, pexports, pexports)
+	fi
+
 AC_HEADER_STDC
 
 AC_CHECK_HEADERS(stdint.h sys/times.h)
@@ -210,17 +216,8 @@
 		OS_SPECIFIC_INCLUDES="-fpascal-strings -I/Developer/Headers/FlatCarbon"
 		OS_SPECIFIC_LINKS="-framework CoreAudio"
 		;;
-	mingw32msvc)
-		AC_CHECK_HEADERS(mmreg.h)
-		if test "x$ac_cv_header_mmreg_h" = xno ; then
-			AC_MSG_WARN([[******************************************************************]])
-			AC_MSG_WARN([[*** Can't find mmreg.h which means that we can't build one of     ]])
-			AC_MSG_WARN([[*** the example programs. The library can however be built.       ]])
-			AC_MSG_WARN([[*** To correct this, you can grab the mmreg.h file from the       ]])
-			AC_MSG_WARN([[*** WINE project (http://www.winehq.com/) and placing it in a     ]])
-			AC_MSG_WARN([[*** directory where the cross compiler can find it.               ]])
-			AC_MSG_WARN([[******************************************************************]])
-			fi
+	mingw32*)
+		OS_SPECIFIC_LINKS="-lwinmm"
 		;;
 	*)
 		OS_SPECIFIC_INCLUDES=""
@@ -256,10 +253,24 @@
 AC_SUBST(SNDFILE_CFLAGS)
 AC_SUBST(SNDFILE_LIBS)
 
-AC_CONFIG_FILES([Makefile src/Version_script Win32/Makefile \
+AC_CONFIG_FILES([Makefile src/Version_script Win32/Makefile Win32/Makefile.mingw \
 			src/Makefile examples/Makefile tests/Makefile doc/Makefile \
 			libsamplerate.spec samplerate.pc])
 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
 
 #====================================================================================