Instead of using #define _GNU_SOURCE in some source files which causes problems
when building with musl as more files need the define, simply use
AC_USE_SYSTEM_EXTENSIONS in configure.ac to get it defined globally.
Signed-off-by: Ross Burton <ross.burton(a)intel.com>
---
configure.ac | 1 +
gdhcp/client.c | 1 -
plugins/tist.c | 1 -
src/backtrace.c | 1 -
src/inet.c | 1 -
src/log.c | 1 -
src/nostats.c | 5 ++++-
src/ntp.c | 1 -
src/resolver.c | 1 -
src/rfkill.c | 1 -
src/stats.c | 1 -
src/timezone.c | 1 -
tools/stats-tool.c | 1 -
tools/tap-test.c | 1 -
tools/wispr.c | 1 -
vpn/plugins/vpn.c | 1 -
16 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
index 39745f76..11e63e66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@ AC_SUBST(abs_top_srcdir)
AC_SUBST(abs_top_builddir)
AC_LANG_C
+AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AM_PROG_CC_C_O
diff --git a/gdhcp/client.c b/gdhcp/client.c
index eb8ed5df..aab74378 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
diff --git a/plugins/tist.c b/plugins/tist.c
index ad5ef79e..cc2800a1 100644
--- a/plugins/tist.c
+++ b/plugins/tist.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
diff --git a/src/backtrace.c b/src/backtrace.c
index e8d7f432..bede6698 100644
--- a/src/backtrace.c
+++ b/src/backtrace.c
@@ -24,7 +24,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
diff --git a/src/inet.c b/src/inet.c
index 8337949d..0d3f0d21 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -25,7 +25,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
diff --git a/src/log.c b/src/log.c
index 5deaff83..dd48a45c 100644
--- a/src/log.c
+++ b/src/log.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <stdarg.h>
diff --git a/src/nostats.c b/src/nostats.c
index 3d0dc793..aedc2c06 100644
--- a/src/nostats.c
+++ b/src/nostats.c
@@ -19,7 +19,10 @@
*
*/
-#define _GNU_SOURCE
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <errno.h>
#include "connman.h"
diff --git a/src/ntp.c b/src/ntp.c
index db2ad01f..807431a4 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/resolver.c b/src/resolver.c
index 76f0a8e1..10121aa5 100644
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/src/rfkill.c b/src/rfkill.c
index d9bed4d2..b2514c41 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/src/stats.c b/src/stats.c
index b9205a99..6f7ce208 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <errno.h>
#include <sys/mman.h>
#include <sys/types.h>
diff --git a/src/timezone.c b/src/timezone.c
index e346b11a..8e912670 100644
--- a/src/timezone.c
+++ b/src/timezone.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
diff --git a/tools/stats-tool.c b/tools/stats-tool.c
index efa39de2..5695048f 100644
--- a/tools/stats-tool.c
+++ b/tools/stats-tool.c
@@ -22,7 +22,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/tools/tap-test.c b/tools/tap-test.c
index fdc098aa..57917f51 100644
--- a/tools/tap-test.c
+++ b/tools/tap-test.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/wispr.c b/tools/wispr.c
index d5f9341f..e56dfc16 100644
--- a/tools/wispr.c
+++ b/tools/wispr.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
index 94272f53..acede747 100644
--- a/vpn/plugins/vpn.c
+++ b/vpn/plugins/vpn.c
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#define _GNU_SOURCE
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
--
2.11.0