From 18533eb24fb83af9209fb504cb3af154de5557e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Anthony=20L=C3=A9onard?=
 <anthony.leonard@savoirfairelinux.com>
Date: Fri, 7 Oct 2016 19:40:28 +0000
Subject: [PATCH] build: fix daemon build for mingw32 when restbed is needed.

Fix compilations options problem when building
for mingw32.
 * configure.ac: Removed some LDFLAGS preventing test for
   librestbed to work. Also added -lws2_32 as restbed needs
   it.
 * src/Makefile.am: LDFLAGS removed from configure.ac are
   included here.

Change-Id: Ie6256663778eb1376d4ae7930cbc94e7a240c714
---
 configure.ac    | 3 ++-
 src/Makefile.am | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 16f2bf4295..d4ede1d0cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +78,8 @@ case "${host_os}" in
     AC_DEFINE([WIN32_LEAN_AND_MEAN],[1], [Define to limit the scope of <windows.h>.])
 
     CPPFLAGS+="-D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -D__USE_MINGW_ANSI_STDIO=1"
-    LDFLAGS+="-no-undefined -avoid-version -Wl,--nxcompat -Wl,--dynamicbase"
+    LDFLAGS+="-Wl,--nxcompat -Wl,--dynamicbase"
+    LIBS+=" -lws2_32"
     ac_default_prefix="`pwd`/_win32"
     DESTDIR="`pwd`/_win32/"
     AC_SUBST(WINDOWS_ARCH)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6db024c779..c9e4bf7773 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,6 +57,10 @@ libring_la_LDFLAGS = \
 		@ZLIB_LIBS@ \
 		$(PCRE_LIBS)
 
+if HAVE_WIN32
+libring_la_LDFLAGS += -no-undefined -avoid-version
+endif
+
 if HAVE_OSX
 #FIXME necessary for -lintl
 libring_la_LDFLAGS += -L/usr/local/opt/gettext/lib
-- 
GitLab