From b7ab605c0923e0bd60be5db78e28f6614c27443e Mon Sep 17 00:00:00 2001 From: texniq Date: Sun, 15 Nov 2015 02:33:29 +0300 Subject: [PATCH] Windows build --- configure.ac | 19 ++++++++++++++----- examples/Makefile.am | 10 +++++----- lib/Makefile.am | 13 ++++++++----- tests/Makefile.am | 6 +++--- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 9eee55c..39e7bfa 100644 --- a/configure.ac +++ b/configure.ac @@ -34,16 +34,25 @@ AS_IF([test "x$enable_build_tests" = "xyes"], [ AM_CONDITIONAL(BUILD_TESTS, test "x$enable_build_tests" = "xyes") - - -PKG_CHECK_MODULES(LIBUUID, [uuid]) - PKG_CHECK_MODULES(OPENSSL, [openssl]) PKG_CHECK_MODULES(LIBTDATA, [libtdata >= 0.2.2]) PKG_CHECK_MODULES(LIBSEXPR, [libsexpr >= 1.3.1]) -AM_CONDITIONAL(BUILD_WIN32, test "x$enable_win32_build" = "xyes") +case $host_os in + linux*) WIN32=no + LINUX=yes + PKG_CHECK_MODULES(LIBUUID, [uuid]);; + mingw*) WIN32=yes + LINUX=no;; + msys*) WIN32=yes + LINUX=no;; +esac + + +AM_CONDITIONAL(COND_WIN32, test x$WIN32=xyes) + +dnl AM_CONDITIONAL(BUILD_WIN32, test "x$enable_win32_build" = "xyes") AC_OUTPUT([ diff --git a/examples/Makefile.am b/examples/Makefile.am index 9a5ae8e..beaf196 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -10,15 +10,15 @@ AM_CPPFLAGS = \ AM_CFLAGS = -Wall -g -if !BUILD_WIN32 +if !COND_WIN32 LIBS += $(ZOFFICE_LIBS) -endif !BUILD_WIN32 +endif !COND_WIN32 libsntl = ../lib/.libs/libsntl.la -if !BUILD_WIN32 +if !COND_WIN32 bin_PROGRAMS = sntlc sntld gentest @@ -34,7 +34,7 @@ gentest_SOURCES = gentest.c gentest_LDADD = $(LIBTDATA_LIBS) $(LIBSEXPR_LIBS) $(OPENSSL_LIBS) \ $(LIBUUID_LIBS) $(libsntl) -else BUILD_WIN32 +else COND_WIN32 bin_PROGRAMS = sntlc @@ -42,7 +42,7 @@ sntlc_SOURCES = sntlc.c sntlc_LDADD = $(LIBTDATA_LIBS) $(LIBSEXPR_LIBS) $(OPENSSL_LIBS) \ $(LIBUUID_LIBS) $(libsntl) -lws2_32 -endif BUILD_WIN32 +endif COND_WIN32 #zsyncd_LDFLAGS = \ # -Wl,--export-dynamic diff --git a/lib/Makefile.am b/lib/Makefile.am index febba3d..73b5f6a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -18,13 +18,16 @@ libsxmp_la_SOURCES = \ libsxmp_la_LDFLAGS = -libsxmp_la_LIBADD = -lpthread -lcrypto $(LIBTDATA_LIBS) $(LIBSEXPR_LIBS) $(OPENSSL_LIBS) +libsxmp_la_LIBADD = -lpthread -lcrypto $(OPENSSL_LIBS) + +if COND_WIN32 + +libtdata_la_LDFLAGS = -no-undefined +libsxmp_la_LIBADD += -lmman -luuid /mingw64/lib/libsexpr.a /mingw64/lib/libtdata.a -if BUILD_WIN32 -libsxmp_la_LIBADD += -luuid else -libsxmp_la_LIBADD += $(LIBUUID_LIBS) -endif !BUILD_WIN32 +libsxmp_la_LIBADD += $(LIBTDATA_LIBS) $(LIBSEXPR_LIBS) $(LIBUUID_LIBS) +endif !COND_WIN32 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsxmp.pc diff --git a/tests/Makefile.am b/tests/Makefile.am index 295ff01..6a35c76 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ AM_CFLAGS = -Wall -g # where to find libsntl libsntl = ../lib/.libs/libsntl.la -if !BUILD_WIN32 +if !COND_WIN32 bin_PROGRAMS = lv2sd lv2sc lv2ftpd lv2ftpc @@ -34,7 +34,7 @@ lv2ftpc_LDADD = $(LIBTDATA_LIBS) $(LIBSEXPR_LIBS) $(OPENSSL_LIBS) \ $(LIBUUID_LIBS) $(libsntl) -lpthread -else BUILD_WIN32 +else COND_WIN32 bin_PROGRAMS = lv2sc @@ -42,5 +42,5 @@ lv2sc_SOURCES = lv2sc.c lv2sc_LDADD = $(LIBTDATA_LIBS) $(LIBSEXPR_LIBS) $(OPENSSL_LIBS) \ $(LIBUUID_LIBS) $(libsntl) -lws2_32 -endif BUILD_WIN32 +endif COND_WIN32