bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH] Don't use $(CC) for the -std=gnu11 flag
@ 2019-11-18 21:45 Christian Biesinger
  2019-11-18 22:15 ` Bruno Haible
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Biesinger @ 2019-11-18 21:45 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Christian Biesinger

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  <cbiesinger@google.com>

	* 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-18 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 21:45 [PATCH] Don't use $(CC) for the -std=gnu11 flag Christian Biesinger
2019-11-18 22:15 ` Bruno Haible
2019-11-18 22:38   ` Christian Biesinger

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 read-only IMAP folder(s) and NNTP newsgroup(s).