Browse Source

configure: Fix if_nametoindex detection

This fixes win32 builds
pull/62/head
Hugo Beauzée-Luyssen 9 years ago
parent
commit
34d979557e
  1. 10
      configure.ac
  2. 7
      include/vlc_fixups.h
  3. 1
      src/network/udp.c

10
configure.ac

@ -680,7 +680,15 @@ AC_LINK_IFELSE([
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])
AC_SEARCH_LIBS([if_nametoindex], [iphlpapi], [
AS_IF([test "$ac_cv_search_if_nametoindex" != "none required"], [
SOCKET_LIBS="$ac_cv_search_if_nametoindex $SOCKET_LIBS"
])
AC_DEFINE([HAVE_IF_NAMETOINDEX], [1], [Define to 1 if you have if_nametoindex function])
])
AC_CHECK_FUNCS([if_nameindex])
VLC_RESTORE_FLAGS
AC_SUBST(SOCKET_LIBS)

7
include/vlc_fixups.h

@ -411,13 +411,14 @@ struct if_nameindex
unsigned if_index;
char *if_name;
};
# ifndef HAVE_IF_NAMETOINDEX
# define if_nametoindex(name) atoi(name)
# endif
# define if_nameindex() (errno = ENOBUFS, NULL)
# define if_freenameindex(list) (void)0
#endif
#ifndef HAVE_IF_NAMETOINDEX
# define if_nametoindex(name) atoi(name)
#endif
#ifndef HAVE_STRUCT_TIMESPEC
struct timespec {
time_t tv_sec; /* Seconds */

1
src/network/udp.c

@ -41,6 +41,7 @@
#ifdef _WIN32
# undef EAFNOSUPPORT
# define EAFNOSUPPORT WSAEAFNOSUPPORT
# include <iphlpapi.h>
#else
# include <unistd.h>
# ifdef HAVE_NET_IF_H

Loading…
Cancel
Save