Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

net/if.h check fails on some darwin versions #327

Copy link
Copy link

Description

@jmroot
Issue body actions

The autoconf manual mentions a portability issue with checking for net/if.h: https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Header-Portability.html

Specifically, sys/socket.h must be included first. On some darwin versions, AC_INCLUDES_DEFAULT happens to take care of this, but on other versions, net/if.h is not found currently, leading to build failure.

This seems to fix the problem, using the recommended check from the autoconf manual:

--- configure.ac.orig	2020-10-08 17:24:21.000000000 +1100
+++ configure.ac	2020-10-15 05:10:19.000000000 +1100
@@ -399,7 +399,21 @@
 PKG_PROG_PKG_CONFIG
 
 # Checks for header files.
-AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h netinet/tcp.h sys/param.h sys/select.h sys/socket.h sys/un.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h endian.h sys/endian.h libkern/OSByteOrder.h sys/ipc.h sys/shm.h ifaddrs.h net/if.h],,, [AC_INCLUDES_DEFAULT])
+AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h netinet/tcp.h sys/param.h sys/select.h sys/socket.h sys/un.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h endian.h sys/endian.h libkern/OSByteOrder.h sys/ipc.h sys/shm.h ifaddrs.h],,, [AC_INCLUDES_DEFAULT])
+AC_CHECK_HEADERS([net/if.h], [], [],
+          [#include <stdio.h>
+          #ifdef STDC_HEADERS
+          # include <stdlib.h>
+          # include <stddef.h>
+          #else
+          # ifdef HAVE_STDLIB_H
+          #  include <stdlib.h>
+          # endif
+          #endif
+          #ifdef HAVE_SYS_SOCKET_H
+          # include <sys/socket.h>
+          #endif
+          ])
 
 # Check for Apple header. This uncovers TARGET_OS_IPHONE, TARGET_OS_TV or TARGET_OS_WATCH
 AC_CHECK_HEADERS([TargetConditionals.h])
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.