From 24b8d79f889500e857d4b7d0fba68f53a7e486bd Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 2 Apr 2014 17:10:08 +0200 Subject: [PATCH] build: use __EXTENSIONS__ and _XOPEN_SOURCE_EXTENDED everywhere It is needed for Solaris and HP-UX. It doesn't seem to harm other platforms. Let's hope that the autoconf test will catch problems. Otherwise, we can still conditionally use them. --- configure.ac | 9 ++++++++- src/daemon/privsep_io.c | 4 ---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 4ccd6ba3..779d79bb 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,6 @@ AX_CFLAGS_GCC_OPTION([-Winline]) AX_CFLAGS_GCC_OPTION([-fstack-protector]) AX_CFLAGS_GCC_OPTION([-fno-omit-frame-pointer]) AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2]) -AX_CFLAGS_GCC_OPTION([-D_GNU_SOURCE=1]) AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter]) AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers]) AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later @@ -86,6 +85,14 @@ AX_LDFLAGS_OPTION([-Wl,-z,now]) # OS lldp_CHECK_OS +# Additional OS dependents compiler flags. If they cause problem, we +# can enable them for some OS only. +AX_CFLAGS_GCC_OPTION([-D_GNU_SOURCE]) dnl GNU systems (asprintf, ...) +AX_CFLAGS_GCC_OPTION([-D__EXTENSIONS__]) dnl Solaris (CMSG_*) +AX_CFLAGS_GCC_OPTION([-D_XPG4_2]) dnl Solaris (CMSG_*) +AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE]) dnl HP-UX +AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE_EXTENDED]) dnl HP-UX + AC_CACHE_SAVE # Checks for header files. diff --git a/src/daemon/privsep_io.c b/src/daemon/privsep_io.c index 1fc8b74c..39a66be8 100644 --- a/src/daemon/privsep_io.c +++ b/src/daemon/privsep_io.c @@ -1,9 +1,5 @@ /* -*- mode: c; c-file-style: "openbsd" -*- */ -/* The following are needed by Solaris. The first to get CMSG_* and the second - * to keep net/if.h working */ -#define _XPG4_2 -#define __EXTENSIONS__ #include "lldpd.h" #include -- 2.39.5