aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2023-06-12 19:53:57 +0200
committerGitHub <noreply@github.com>2023-06-12 19:53:57 +0200
commit4e284b5e40f08e708af9ddeb9ca04d9642636dcd (patch)
treec7c88630531d073682d476e1af3cdbaddf3779f9
parent8ea0eaa0d0c4a3be05f67ef7fa1d22c2579cf7d1 (diff)
Set _DEFAULT_SOURCE and _GNU_SOURCE globally. (#2010)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--configure.ac2
-rw-r--r--example/ndpiReader.c3
-rw-r--r--src/lib/ndpi_classify.c2
-rw-r--r--src/lib/third_party/src/roaring.c3
-rw-r--r--tests/performance/gcrypt.c2
-rw-r--r--tests/unit/unit.c3
6 files changed, 2 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index ff4bae88f..c7f72a596 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,8 @@ AC_ARG_WITH(nbpf-path, AS_HELP_STRING([--with-nbpf-path], [nBPF library custom p
AC_ARG_WITH(lto-and-gold-linker, AS_HELP_STRING([--with-lto-and-gold-linker], [Build with LTO and Gold linker]))
AC_ARG_ENABLE(debug-build, AS_HELP_STRING([--enable-debug-build], [Enable debug build (`-g` flag)]),[enable_debugbuild=$enableval],[enable_debugbuild=no])
+NDPI_CFLAGS="${NDPI_CFLAGS} -D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1"
+
AS_IF([test "x$enable_fuzztargets" = "xyes"], [
BUILD_FUZZTARGETS=1
NDPI_CFLAGS="${NDPI_CFLAGS} -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 19f53d176..f7482ca65 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -21,9 +21,6 @@
#include "ndpi_config.h"
#ifdef __linux__
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <sched.h>
#endif
diff --git a/src/lib/ndpi_classify.c b/src/lib/ndpi_classify.c
index 3dba2207e..538eb2b82 100644
--- a/src/lib/ndpi_classify.c
+++ b/src/lib/ndpi_classify.c
@@ -41,8 +41,6 @@
*
*/
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <ctype.h>
// #include <sys/time.h>
diff --git a/src/lib/third_party/src/roaring.c b/src/lib/third_party/src/roaring.c
index ab95ab6e8..f8ee417da 100644
--- a/src/lib/third_party/src/roaring.c
+++ b/src/lib/third_party/src/roaring.c
@@ -81,9 +81,6 @@
#ifndef INCLUDE_PORTABILITY_H_
#define INCLUDE_PORTABILITY_H_
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif // _GNU_SOURCE
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS 1
#endif // __STDC_FORMAT_MACROS
diff --git a/tests/performance/gcrypt.c b/tests/performance/gcrypt.c
index febc18f1b..e6f59060b 100644
--- a/tests/performance/gcrypt.c
+++ b/tests/performance/gcrypt.c
@@ -1,5 +1,3 @@
-#define _DEFAULT_SOURCE
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/tests/unit/unit.c b/tests/unit/unit.c
index 5212c768e..37ed1315d 100644
--- a/tests/unit/unit.c
+++ b/tests/unit/unit.c
@@ -19,9 +19,6 @@
*/
#ifdef __linux__
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <sched.h>
#endif /* linux */