Paul Eggert <eggert@cs.ucla.edu> writes:
This doesn't let you say "I want either c89 or c99, but not c11".
That's right, I tried only the very simplest thing. Providing a list
makes sense, thoguh. What should the interface be?
AC_C_STANDARD_VERSION([c99 c89])
looks reasonable to me; list in order of preference, and whitespace
separation. That's consistent with AC_PROG_CC. But that means that
AC_C_STANDARD_VERSION([c89 c99])
is a bit meaningless; if compiler has c89, that's what will be used, and
if it doesn't have c89, it won't have c99 either.
[...]
I considered trying this out, but then there's some impedance mismatch
between the whitespace separated list to AC_C_STANDARD_VERSION, and the
comma-separated list required by m4_map. Certainly doable, but what's
the easiest way to transform
[c99 c89]
into
[99, 89]
?
+ m4_ifdef([_AC_C_STANDARD_VERSION_LIST],
+ [m4_fatal([AC_PROG_C_STANDARD_VERSION should only be used once], 1)])
Why have this check?
I figured the user should get some error message if using
AC_C_STANDARD_VERSION too late, e.g., after some AC_FOO that implicitly
uses AC_PROG_CC, which will also trigger this check. Not sure of
m4_fatal is the right way to signals error to the user, though. (And
error message could be improved).