[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get autoconf to respect CC="gcc -std=c89"?
From: |
Niels Möller |
Subject: |
Re: How to get autoconf to respect CC="gcc -std=c89"? |
Date: |
Fri, 06 Oct 2023 20:11:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (berkeley-unix) |
Niels Möller <nisse@lysator.liu.se> writes:
> "Zack Weinberg" <zack@owlfolio.org> writes:
>
>> This is currently not possible, but you are not the only person who has
>> asked for it to be made possible, and it's on our near-future list.
>> However, none of the core Autoconf developers currently have time to work
>> on it. Might you be willing to put some time into it?
>
> I can have a look; I would hope it's not too difficult (I'm familiar
> with m4 and sh programming, but not with autoconf-specifics, like how
> AC_REQUIRE/AC_PROVIDE really works). I think this is the right piece of
> code that needs a bit of configurability, in lib/autoconf/c.m4:
>
> AC_DEFUN([_AC_PROG_CC_STDC_EDITION],
> [ac_prog_cc_stdc=no
> m4_map([_AC_PROG_CC_STDC_EDITION_TRY], [[11], [99], [89]])])
Below is an initial patch, it seems to work with a little manual
testing, and it does the simplest thing I could come up with. No idea
how proper tests should be done. Cc:ing autoconf-patches, since
README-hacking says that's the right forum.
Is this on the right track?
Regards,
/Niels
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 77ff1af8..83eb4bea 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1561,6 +1561,14 @@ m4_define([_AC_C_C11_OPTIONS], [
-std=gnu11
])
+AC_DEFUN([AC_C_STANDARD_VERSION], [
+ m4_ifdef([_AC_C_STANDARD_VERSION_LIST],
+ [m4_fatal([AC_PROG_C_STANDARD_VERSION should only be used once], 1)])
+ m4_define([_AC_C_STANDARD_VERSION_LIST],
+ m4_if([$1], [c89], 89, [$1], [c99], 99, [$1], [c11], 11,
+ [$1], [], [m4_fatal([C language revision not specified], 1)],
+ [m4_fatal([Unknown C language revision $1], 1)]))
+])
# _AC_PROG_CC_STDC_EDITION_TRY(EDITION)
# -------------------------------------
@@ -1623,7 +1631,9 @@ AS_IF([test "x$ac_cv_prog_cc_c$1" = xno],
# variable ac_prog_cc_stdc to indicate the edition.
AC_DEFUN([_AC_PROG_CC_STDC_EDITION],
[ac_prog_cc_stdc=no
-m4_map([_AC_PROG_CC_STDC_EDITION_TRY], [[11], [99], [89]])])
+m4_ifndef([_AC_C_STANDARD_VERSION_LIST],
+ [m4_define([_AC_C_STANDARD_VERSION_LIST], [[11], [99], [89]])])
+m4_map([_AC_PROG_CC_STDC_EDITION_TRY], [_AC_C_STANDARD_VERSION_LIST])])
# _AC_PROG_CC_C89(ACTION-IF-SUPPORTED, ACTION-IF-NOT-SUPPORTED)
--
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
- Re: How to get autoconf to respect CC="gcc -std=c89"?,
Niels Möller <=
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Paul Eggert, 2023/10/06
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Niels Möller, 2023/10/07
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Paul Eggert, 2023/10/07
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Niels Möller, 2023/10/08
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Jacob Bachmeyer, 2023/10/08
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Nick Bowler, 2023/10/09
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Niels Möller, 2023/10/11
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Zack Weinberg, 2023/10/11
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Niels Möller, 2023/10/11
- Re: How to get autoconf to respect CC="gcc -std=c89"?, Jacob Bachmeyer, 2023/10/08