From: Vincent Bernat Date: Sat, 12 Apr 2014 10:34:28 +0000 (+0200) Subject: configure: make some flags conditional X-Git-Tag: 0.7.8~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3dc1eb8ca263281baa58d824cfb0b06a75c78002;p=thirdparty%2Flldpd.git configure: make some flags conditional Use of _XOPEN_SOURCE is quite dangerous. --- diff --git a/configure.ac b/configure.ac index 968c3c84..c312d237 100644 --- a/configure.ac +++ b/configure.ac @@ -84,14 +84,7 @@ 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=500]) dnl HP-UX -AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE_EXTENDED]) dnl HP-UX +lldp_CFLAGS_OS AC_CACHE_SAVE diff --git a/m4/os.m4 b/m4/os.m4 index 584e9d56..f5765d5f 100644 --- a/m4/os.m4 +++ b/m4/os.m4 @@ -31,3 +31,20 @@ AC_DEFUN([lldp_CHECK_OS], [ fi AC_MSG_RESULT([yes ($os)]) ]) + +# Enable some additional CFLAGS depending on the OS +AC_DEFUN([lldp_CFLAGS_OS], [ + # Most of what we want can be enabled nowadays with _GNU_SOURCE + AX_CFLAGS_GCC_OPTION([-D_GNU_SOURCE]) dnl GNU systems (asprintf, ...) + + case $host_os in + solaris*) + AX_CFLAGS_GCC_OPTION([-D__EXTENSIONS__]) dnl (CMSG_*) + AX_CFLAGS_GCC_OPTION([-D_XPG4_2]) dnl (CMSG_*) + ;; + hpux*) + AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE=500]) dnl HP-UX + AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE_EXTENDED]) dnl HP-UX + ;; + esac +])