From 1844bebd3a4df913e9bc873d39d5190e4ca14a56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <funman@videolan.org>
Date: Mon, 18 Mar 2013 17:49:19 +0100
Subject: [PATCH] Look for inet_ntop/inet_pton in ws2_32

---
 configure.ac                          | 12 +++++++++++-
 modules/services_discovery/Modules.am |  5 ++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 994705048ca5..b820683379ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -514,7 +514,7 @@ need_libc=false
 dnl Check for usual libc functions
 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
 AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale])
-AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r inet_pton lldiv localtime_r nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp])
+AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lldiv localtime_r nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp])
 AC_CHECK_FUNCS(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
 ])
@@ -590,6 +590,16 @@ AC_SEARCH_LIBS([getaddrinfo], [nsl], [
   ])
 ],, [${SOCKET_LIBS}])
 
+LIBS="${LIBS} ${SOCKET_LIBS}"
+AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([#ifdef WIN32
+        #include <ws2tcpip.h>
+        #else
+        #include <arpa/inet.h>
+        #endif], [
+        char dst[[sizeof(struct in_addr)]];
+        inet_pton(AF_INET, "127.0.0.1", dst);
+    ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
 VLC_RESTORE_FLAGS
 
diff --git a/modules/services_discovery/Modules.am b/modules/services_discovery/Modules.am
index b4f30503871c..241eb684a17c 100644
--- a/modules/services_discovery/Modules.am
+++ b/modules/services_discovery/Modules.am
@@ -1,10 +1,13 @@
-SOURCES_sap = sap.c
 SOURCES_upnp = upnp.cpp upnp.hpp
 SOURCES_bonjour = bonjour.c
 SOURCES_podcast = podcast.c
 SOURCES_mtp = mtp.c
 SOURCES_mediadirs = mediadirs.c
 
+libsap_plugin_la_SOURCES = sap.c
+libsap_plugin_la_CFLAGS = $(AM_CFLAGS) $(CFLAGS_sap)
+libsap_plugin_la_LIBADD = $(AM_LIBADD) $(LIBS_sap) $(SOCKET_LIBS)
+
 libpulselist_plugin_la_SOURCES = \
 	../audio_output/vlcpulse.c ../audio_output/vlcpulse.h \
 	pulse.c
-- 
GitLab