From ebcbb4d84e9207662d2bfc4e7fdf668d95caffd3 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh78@gmail.com>
Date: Mon, 1 Jan 2018 23:30:02 +0900
Subject: [PATCH] configure: check and define if_nametoindex() on OS/2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes the following compilation breakge on OS/2.

-----
  CC       network/udp.lo
network/udp.c: In function 'net_SetMcastOut':
network/udp.c:259:17: error: implicit declaration of function 'if_nametoindex'; did you mean 'if_nameindex'? [-Werror=implicit-function-declaration]
     int scope = if_nametoindex (iface);
                 ^~~~~~~~~~~~~~
                 if_nameindex
-----

Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
---
 configure.ac         | 1 +
 include/vlc_fixups.h | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 9181f3854b46..030832e3e3e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -290,6 +290,7 @@ case "${host_os}" in
     LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild -Zhigh-mem"
     AC_LIBOBJ([freeaddrinfo])
     AC_LIBOBJ([gai_strerror])
+    AC_CHECK_FUNCS([if_nametoindex])
     ;;
   *nacl*)
     SYS=nacl
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 6175a539bd84..0791aba4d6f2 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -602,6 +602,10 @@ static const struct in6_addr in6addr_any =
 # ifndef EPROTO
 #  define EPROTO (ELAST + 1)
 # endif
+
+# ifndef HAVE_IF_NAMETOINDEX
+#  define if_nametoindex(name)  atoi(name)
+# endif
 #endif
 
 /* math.h */
-- 
GitLab