From d09679a6633c9c430c4ca0a258717b57b90a6622 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Wed, 2 Dec 2020 02:15:43 +0100 Subject: [PATCH] Support MSYS2/mingw-w64 --- configure.ac | 8 +++++++- src/Makefile.am | 12 +++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 4ddc06e9..c0037420 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AM_INIT_AUTOMAKE([foreign subdir-objects]) AC_PROG_CXX AC_PROG_CC AC_PROG_CC_C99 -LT_INIT([disable-static]) +LT_INIT([disable-static win32-dll]) AC_CONFIG_HEADERS([include/config.h]) @@ -38,6 +38,10 @@ case $host_os in AC_MSG_RESULT([Darwin/OSX]) have_darwin=yes ;; + *mingw*) + AC_MSG_RESULT([MinGW-w64]) + have_mingw=yes + ;; *) AC_MSG_RESULT([ $host_os ? ... let us try]) ;; @@ -80,6 +84,8 @@ if test x$have_cpuflags = xyes; then fi fi +AM_CONDITIONAL([HAVE_MINGW], [test x$have_mingw = xyes]) + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([float.h inttypes.h limits.h stdlib.h string.h]) diff --git a/src/Makefile.am b/src/Makefile.am index db6b5319..7d397c46 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -336,23 +336,29 @@ xfade0r_la_SOURCES = mixer2/xfade0r/xfade0r.cpp AM_CPPFLAGS = -I@top_srcdir@/include -Waddress -Wtype-limits -Wsign-compare AM_CFLAGS = -I@top_srcdir@/include -Waddress -Wtype-limits -Wsign-compare AM_CXXFLAGS = -I@top_srcdir@/include -Waddress -Wtype-limits -Wsign-compare -AM_LDFLAGS = -module -avoid-version -lm -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static plugindir = @libdir@/frei0r-1 +if HAVE_MINGW +SO_EXT = .dll +AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined +else +SO_EXT = .so +AM_LDFLAGS = -module -avoid-version -lm -export-dynamic +endif install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) mkdir -p $(DESTDIR)/$(plugindir) list='$(plugin_LTLIBRARIES)'; \ for file in $$list; do \ - sofile=`basename $$file .la`.so; \ + sofile=`basename $$file .la`$(SO_EXT); \ $(INSTALL_PROGRAM) .libs/$$sofile $(DESTDIR)/$(plugindir); \ done uninstall-pluginLTLIBRARIES: list='$(plugin_LTLIBRARIES)'; \ for file in $$list; do \ - sofile=`basename $$file .la`.so; \ + sofile=`basename $$file .la`$(SO_EXT); \ rm -f $(DESTDIR)/$(plugindir)/$$sofile; \ done