diff --git a/configure.ac b/configure.ac
index 49556a3c..155d99d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@ m4_ifndef([m4_esyscmd_s], [m4_define([m4_chomp_all], [m4_format([[%.*s]], m4_bre
m4_ifndef([m4_esyscmd_s], [m4_define([m4_esyscmd_s], [m4_chomp_all(m4_esyscmd([$1]))])])
AC_PREREQ([2.63])
AC_INIT([ebusd], m4_esyscmd_s([cat VERSION]), [ebusd@ebusd.eu], [ebusd], [https://github.com/john30/ebusd])
+AC_GNU_SOURCE
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([m4])
diff --git a/src/lib/utils/log.cpp b/src/lib/utils/log.cpp
index 2190c1b6..51b8c856 100644
--- a/src/lib/utils/log.cpp
+++ b/src/lib/utils/log.cpp
@@ -16,7 +16,9 @@
* along with this program. If not, see .
*/
-#define _GNU_SOURCE
+#ifdef HAVE_CONFIG_H
+# include
+#endif
#include "lib/utils/log.h"
#include
diff --git a/src/lib/utils/thread.cpp b/src/lib/utils/thread.cpp
index 8df01504..bc428d8c 100644
--- a/src/lib/utils/thread.cpp
+++ b/src/lib/utils/thread.cpp
@@ -20,10 +20,6 @@
# include
#endif
-#ifdef HAVE_PTHREAD_SETNAME_NP
-# define _GNU_SOURCE
-#endif
-
#include "lib/utils/thread.h"
#include "lib/utils/clock.h"