diff --git a/src/Makefile.am b/src/Makefile.am
index aadef98efefb8f67089258a19b5b5ea447241d0f..70533020974bb02eb2601d6c4adc52ba1df5bf22 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@ noinst_PROGRAMS = unittests unittests-xfr zscanner-tool
 noinst_LTLIBRARIES = libknot.la libknotd.la libknots.la libzscanner.la
 
 # $(YACC) will generate header file
-AM_CFLAGS = -Wall -Ilibknot -DSYSCONFDIR='"$(sysconfdir)"' -DSBINDIR='"$(sbindir)"'
+AM_CFLAGS = -std=gnu99 -D_GNU_SOURCE -Wall -Ilibknot -DSYSCONFDIR='"$(sysconfdir)"' -DSBINDIR='"$(sbindir)"'
 AM_YFLAGS = -d
 libknotd_la_YFLAGS = -pcf_ -d
 libknotd_la_LFLAGS = # TODO: reentrant parser, prefix
diff --git a/src/common/fdset.c b/src/common/fdset.c
index 36584b6946bf49f95c951783adf6e5c5a072673b..f7d2705692f333946c657a1b2c5ce1ab3677c31a 100644
--- a/src/common/fdset.c
+++ b/src/common/fdset.c
@@ -14,10 +14,6 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE /* Required for RTLD_DEFAULT. */
-#endif
-
 #include <dlfcn.h>
 #include <string.h>
 #include <stdio.h>
diff --git a/src/knot/server/udp-handler.c b/src/knot/server/udp-handler.c
index 1ef8f4e8a6734e9e8873bcc94344b6d91eeb4178..a189b370abf4fb3cbbd17c16551a1df7d5e8e6d9 100644
--- a/src/knot/server/udp-handler.c
+++ b/src/knot/server/udp-handler.c
@@ -14,10 +14,6 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE /* Required for RTLD_DEFAULT. */
-#endif
-
 #include <dlfcn.h>
 #include <config.h>
 #include <time.h>
diff --git a/src/zscanner/test/tests.c b/src/zscanner/test/tests.c
index 887307c64ecc1a38786d1df547b405a3535ddf3e..103bf114c8cca58b8c03d040334fe712a3c66d32 100644
--- a/src/zscanner/test/tests.c
+++ b/src/zscanner/test/tests.c
@@ -14,11 +14,6 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-// strptime under Linux
-#define _XOPEN_SOURCE
-// OpenBSD requires following to disable warning
-#define _XOPEN_SOURCE_EXTENDED 1
-
 #include "zscanner/test/tests.h"
 
 #include <inttypes.h>			// PRIu64