diff --git a/configure.ac b/configure.ac index 08c73295..ef679128 100644 --- a/configure.ac +++ b/configure.ac @@ -67,6 +67,10 @@ AC_CONFIG_FILES(m4_normalize(m4_foreach_w(THIS_PLUGIN,AVAILABLE_NCP_PLUGINS,[src PLUGIN_SUBDIRS="[]m4_foreach_w(THIS_PLUGIN,AVAILABLE_NCP_PLUGINS,ncp-[]THIS_PLUGIN )" AC_SUBST(PLUGIN_SUBDIRS) +AC_USE_SYSTEM_EXTENSIONS +AC_GNU_SOURCE +CFLAGS="$CFLAGS -D_GNU_SOURCE" + AM_INIT_AUTOMAKE() AM_MAINTAINER_MODE diff --git a/src/util/nlpt-select.c b/src/util/nlpt-select.c index b8b1c600..ebd76199 100644 --- a/src/util/nlpt-select.c +++ b/src/util/nlpt-select.c @@ -24,8 +24,12 @@ #include #endif +#ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 1 // For the "fds_bits" member of "fd_set" +#ifndef __USE_XOPEN #define __USE_XOPEN 1 // This too +#endif // __USE_XOPEN +#endif // _XOPEN_SOURCE #include #include diff --git a/src/util/socket-utils.c b/src/util/socket-utils.c index 07f5b29e..3d7c9c49 100644 --- a/src/util/socket-utils.c +++ b/src/util/socket-utils.c @@ -21,8 +21,6 @@ #include #endif -#define _GNU_SOURCE 1 - #include "assert-macros.h" #include @@ -90,7 +88,7 @@ system_socket_table_close_alarm_(int sig) static const char message[] = "\nclose_super_socket: Unable to terminate child in a timely manner, watchdog fired\n"; // Can't use syslog here, write to stderr instead. - (void)write(STDERR_FILENO, message, sizeof(message) - 1); + ssize_t len = write(STDERR_FILENO, message, sizeof(message) - 1); _exit(EXIT_FAILURE); } diff --git a/src/util/string-utils.c b/src/util/string-utils.c index 2dc01a76..d86e085d 100644 --- a/src/util/string-utils.c +++ b/src/util/string-utils.c @@ -26,13 +26,15 @@ #endif #include -#include "string-utils.h" #include #include #include +#ifndef __USE_GNU #define __USE_GNU // Needed for `strcasestr` -#include +#endif + +#include "string-utils.h" void memcpyrev(void *dest_, const void *src_, size_t len)