]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Remove explicit uses of _GNU_SOURCE.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 27 Mar 2016 02:22:40 +0000 (02:22 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 12 Jun 2016 11:00:50 +0000 (13:00 +0200)
The best way to add these flags is to use the autoconf helper
AC_USE_SYSTEM_EXTENSIONS. This macro adds defines to config.h, so we
must include config.h (via para.h) before anything else. The two files
for which this matters are fixed by moving the include directive for
para.h to the top.

The AC_USE_SYSTEM_EXTENSIONS macro was introduced in Autoconf 2.60,
which was released ten years ago. The existing AC_PREREQ([2.61])
check in configure.ac makes sure the macro is defined.

configure.ac
net.c
string.c

index 360d76c6e2bf64365a50afedc2645d3844ed46b5..953a9d213e5402055d1c22407daae60a292675e0 100644 (file)
@@ -65,6 +65,7 @@ AC_DEFUN([LIB_SUBST_FLAGS], [
        AC_SUBST($1_ldflags)
 ])
 
        AC_SUBST($1_ldflags)
 ])
 
+AC_USE_SYSTEM_EXTENSIONS
 AC_C_BIGENDIAN()
 
 AC_PATH_PROG([GENGETOPT], [gengetopt])
 AC_C_BIGENDIAN()
 
 AC_PATH_PROG([GENGETOPT], [gengetopt])
@@ -197,7 +198,6 @@ AC_SUBST(nsl_ldflags)
 ########################################################################### ucred
 AC_MSG_CHECKING(for struct ucred)
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 ########################################################################### ucred
 AC_MSG_CHECKING(for struct ucred)
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-       #define _GNU_SOURCE
        #include <sys/types.h>
        #include <sys/socket.h>
 ]], [[
        #include <sys/types.h>
        #include <sys/socket.h>
 ]], [[
diff --git a/net.c b/net.c
index 42418e5f20d9e168eb0af5c7da9c2d1ffa1c2127..1b142a3cd4a25b87fe2e31c86caaf32e4be5f51e 100644 (file)
--- a/net.c
+++ b/net.c
@@ -6,11 +6,7 @@
 
 /** \file net.c Networking-related helper functions. */
 
 
 /** \file net.c Networking-related helper functions. */
 
-/*
- * Since glibc 2.8, the _GNU_SOURCE feature test macro must be defined in order
- * to obtain the definition of the ucred structure.
- */
-#define _GNU_SOURCE
+#include "para.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -32,7 +28,6 @@
 
 #include <regex.h>
 
 
 #include <regex.h>
 
-#include "para.h"
 #include "error.h"
 #include "net.h"
 #include "string.h"
 #include "error.h"
 #include "net.h"
 #include "string.h"
index e731bb496b4b0d0f2f5a7dac417cbbeab7b9f3f6..86e775387a9a7d5b1c0f429a99255ba621024d30 100644 (file)
--- a/string.c
+++ b/string.c
@@ -6,19 +6,16 @@
 
 /** \file string.c Memory allocation and string handling functions. */
 
 
 /** \file string.c Memory allocation and string handling functions. */
 
-#define _GNU_SOURCE
+#include "para.h"
 
 #include <pwd.h>
 #include <sys/utsname.h> /* uname() */
 
 #include <pwd.h>
 #include <sys/utsname.h> /* uname() */
-
 #include <string.h>
 #include <regex.h>
 #include <string.h>
 #include <regex.h>
-
 #include <langinfo.h>
 #include <wchar.h>
 #include <wctype.h>
 
 #include <langinfo.h>
 #include <wchar.h>
 #include <wctype.h>
 
-#include "para.h"
 #include "string.h"
 #include "error.h"
 
 #include "string.h"
 #include "error.h"