if test "x$HAVE_PTP" = "xyes"; then
AC_DEFINE(HAVE_PTP, 1, [PTP support available])
+AC_MSG_CHECKING([for SIOCGIFCONF, SIOCGIFFLAGS and SIOCGIFHWADDR])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <sys/ioctl.h>
+ #include <net/if.h>
+ ]],
+ [[
+ struct ifreq ifr;
+ struct ifconf ifc;
+ ioctl(0, SIOCGIFCONF, &ifc);
+ ioctl(0, SIOCGIFFLAGS, &ifr);
+ ioctl(0, SIOCGIFHWADDR, &ifr);
+ int dummy = ifr.ifr_hwaddr.sa_data[0];
+ ]])], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SIOCGIFCONF_SIOCGIFFLAGS_SIOCGIFHWADDR, 1, [SIOCGIFCONF, SIOCGIFFLAGS and SIOCGIFHWADDR is available])
+ ], [
+ AC_MSG_RESULT(no)
+])
+
+AC_MSG_CHECKING([for getifaddrs() and AF_LINK])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <ifaddrs.h>
+ #include <net/if.h>
+ #include <net/if_dl.h>
+ ]],
+ [[
+ struct ifaddrs *ifaddr;
+ getifaddrs(&ifaddr);
+ int dummy = (ifaddr->ifa_flags & IFF_LOOPBACK) && ifaddr->ifa_addr->sa_family != AF_LINK;
+ ]])], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETIFADDRS_AF_LINK, 1, [getifaddrs() and AF_LINK is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+
AC_MSG_CHECKING([how to install gst-ptp-helper])
if test "x$with_ptp_helper_permissions" = "xauto"; then
if test "x$gst_ptp_have_cap" = "xyes" -a "x$SETCAP" != "xno"; then
#include <netinet/in.h>
#include <string.h>
-#ifdef __APPLE__
+#ifdef HAVE_GETIFADDRS_AF_LINK
#include <ifaddrs.h>
#include <net/if_dl.h>
#endif
/* Probe all non-loopback interfaces */
if (!ifaces) {
-#ifndef __APPLE__
+#if defined(HAVE_SIOCGIFCONF_SIOCGIFFLAGS_SIOCGIFHWADDR)
struct ifreq ifr;
struct ifconf ifc;
gchar buf[8192];
ifaces = probed_ifaces;
}
}
-#else
+#elif defined(HAVE_GETIFADDRS_AF_LINK)
struct ifaddrs *ifaddr, *ifa;
if (getifaddrs (&ifaddr) != -1) {
g_ptr_array_add (arr, NULL);
ifaces = probed_ifaces = (gchar **) g_ptr_array_free (arr, FALSE);
}
+#else
+#warning "Implement something to list all network interfaces"
#endif
}
if (clock_id == (guint64) - 1) {
gboolean success = FALSE;
-#ifndef __APPLE__
+#if defined(HAVE_SIOCGIFCONF_SIOCGIFFLAGS_SIOCGIFHWADDR)
struct ifreq ifr;
if (ifaces) {
}
}
}
-#else
+#elif defined(HAVE_GETIFADDRS_AF_LINK)
struct ifaddrs *ifaddr, *ifa;
if (getifaddrs (&ifaddr) != -1) {
freeifaddrs (ifaddr);
}
+#else
+#warning "Implement something to get MAC addresses of network interfaces"
#endif
if (!success) {