From e38017f8ce131d8cffbd56ac3d2b5cba6091abe5 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 14 Feb 2024 00:47:43 +0100 Subject: Define _GNU_SOURCE when using Glibc --- make.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/make.c b/make.c index 0a97ff0..2008b21 100644 --- a/make.c +++ b/make.c @@ -9,6 +9,10 @@ #include #include +#if __has_include() +# include +#endif + #include "cbs.h" #define WARN \ @@ -17,8 +21,12 @@ "-Wno-parentheses", /* if (x = foo()) */ \ "-Wno-pointer-sign" /* char ↔ char8_t */ -#define CC "cc" -#define CFLAGS WARN, "-std=c2x" +#define CC "cc" +#ifdef __GNUC__ +# define CFLAGS WARN, "-std=c2x", "-D_GNU_SOURCE" +#else +# define CFLAGS WARN, "-std=c2x" +#endif #define CFLAGS_DBG CFLAGS, "-Og", "-ggdb3", "-DDEBUG=1" #ifdef __APPLE__ # define CFLAGS_RLS CFLAGS, "-O3" -- cgit v1.2.3