Niels Möller <nisse@xxxxxxxxxxxxxx> writes: > Updated patch below. How do we move this forward? I think we first need to settle the user-visible part, i.e., how AC_C_STANDARD_VERSION should work (and if that's a good name). Latest patch aims for the following, which seems reasonable to me: * Single argument, white-space separated list of C language versions, in order of preference. Known versions being c89, c99, c11 (upper- or lower-case). * Error on unknown version, error on empty (space-only) argument. * Error if used after AC_PROG_CC, or used multiple times. The effect is to test, in order, if the C compiler supports the given language version, or can be made to support it by adding additional flags to ${CC}. Default behavior is unchanged, and equivalent to AC_C_STANDARD_VERSION([c11 c99 c89]) I'd be happy to sign FSF copyright assignment forms, if required. Regards, /Niels > diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 > index 77ff1af8..adb718f3 100644 > --- a/lib/autoconf/c.m4 > +++ b/lib/autoconf/c.m4 > @@ -1561,6 +1561,26 @@ m4_define([_AC_C_C11_OPTIONS], [ > -std=gnu11 > ]) > > +# _AC_C_CHECK_STANDARD_VERSION > +# ---------------------------- > +# Translate C version c89, c99, c11 to just the numeric year, > +# and raise an error for unknown versions. > +AC_DEFUN([_AC_C_CHECK_STANDARD_VERSION], [dnl > +m4_case(m4_translit([$1], [C], [c]), [c89], 89, [c99], 99, [c11], 11, > +[m4_fatal([Unknown C language revision $1], 1)])dnl > +]) > + > +# AC_C_STANDARD_VERSION(VERSIONS) > +# ------------------------------- > +# Specifies a whitespace separated list of wanted C versions, in order > +# of preference, e.g., AC_C_STANDARD_VERSION([c99 c89]) > +AC_DEFUN([AC_C_STANDARD_VERSION], [ > + m4_ifdef([_AC_C_STANDARD_VERSION_LIST], > + [m4_fatal([AC_PROG_CC_STANDARD_EDITION used after AC_PROG_CC], 1)]) > + m4_ifblank([$1], [m4_fatal([C language revision not specified], 1)]) > + m4_define([_AC_C_STANDARD_VERSION_LIST], > + [m4_map_args_w([$1],[_AC_C_CHECK_STANDARD_VERSION(], [)], [,])]) > +]) > > # _AC_PROG_CC_STDC_EDITION_TRY(EDITION) > # ------------------------------------- > @@ -1623,7 +1643,8 @@ 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_define_default([_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.