bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Don't use $(CC) for the -std=gnu11 flag


From: Christian Biesinger
Subject: [PATCH] Don't use $(CC) for the -std=gnu11 flag
Date: Mon, 18 Nov 2019 15:45:05 -0600

Currently, the std-gnu11 module uses $(CC) to store the
compiler flag to enable C11. This has the downside that
if someone uses make CC=foo, the flag will be overridden.

Instead, this patch uses its own variable that it then
uses in AM_CFLAGS, similar to lib-symbol-visibility.

2019-11-18  Christian Biesinger  <address@hidden>

        * m4/std-gnu11.m4: Store -std= flag in C_VERSION_FLAG.
        * modules/std-gnu11: Add C_VERSION_FLAG to AM_CFLAGS.
---
 m4/std-gnu11.m4   | 3 ++-
 modules/std-gnu11 | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4
index 23e7f75f1..746d1e004 100644
--- a/m4/std-gnu11.m4
+++ b/m4/std-gnu11.m4
@@ -189,7 +189,8 @@ case "x$ac_cv_prog_cc_$1" in
     AC_MSG_RESULT([unsupported]) ;;
   *)
     ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1"
-    CC=$CC$ac_prog_cc_stdc_options
+    C_VERSION_FLAG=$C_VERSION_FLAG$ac_prog_cc_stdc_options
+    AC_SUBST(C_VERSION_FLAG)
     AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
 esac
 AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
diff --git a/modules/std-gnu11 b/modules/std-gnu11
index 26c71153e..0a20ec6f8 100644
--- a/modules/std-gnu11
+++ b/modules/std-gnu11
@@ -9,6 +9,7 @@ Depends-on:
 configure.ac:
 
 Makefile.am:
+AM_CFLAGS += $(C_VERSION_FLAG)
 
 Include:
 
-- 
2.24.0.432.g9d3f5f5b63-goog




reply via email to

[Prev in Thread] Current Thread [Next in Thread]