trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Makefile: Use -std=gnu99 if -std=gnu11 is not supported.
@ 2016-02-08 20:24 Vinson Lee
  0 siblings, 0 replies; only message in thread
From: Vinson Lee @ 2016-02-08 20:24 UTC (permalink / raw)
  To: trinity

-std=gnu11 is not available with gcc < 4.7.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 Makefile |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index a47e248..9fbdb94 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,9 @@ endif
 CC := $(CROSS_COMPILE)$(CC)
 LD := $(CROSS_COMPILE)$(LD)
 
-CFLAGS += -Wall -Wextra -g -O2 -I. -Iinclude/ -Wimplicit -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__linux__ -std=gnu11
+CFLAGS += -Wall -Wextra -g -O2 -I. -Iinclude/ -Wimplicit -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__linux__
+
+CFLAGS += $(shell if $(CC) -std=gnu11 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-std=gnu11"; else echo "-std=gnu99"; fi)
 
 # Only enabled during development, and on gcc 4.9+
 CPP_MAJOR := $(shell $(CPP) -dumpversion 2>&1 | cut -d'.' -f1)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-08 20:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 20:24 [PATCH] Makefile: Use -std=gnu99 if -std=gnu11 is not supported Vinson Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).