Skip to content

Commit 27eb3ae

Browse files
committed
AC_PROG_CC_C89, AC_PROG_CC_C99: now obsolete; defer to AC_PROG_CC
* NEWS: * doc/autoconf.texi (C Compiler, Running the Preprocessor) (Limitations of Usual Tools, Present But Cannot Be Compiled) (Obsolete Macros): Document the changes described below. * lib/autoconf/c.m4 (_AC_PROG_CC_FORCE_VERSION): Remove. (AC_PROG_CC_C89, AC_PROG_CC_C99, AC_PROG_CC_STDC): Just do AC_PROG_CC, but mark as obsolete. This replaces my recent ill-advised attempt to let AC_PROG_CC_C89 and AC_PROG_CC_C99 downgrade the version of C supported. * doc/autoconf.texi (Limitations of Usual Tools, Volatile Objects): Document C11 more accurately. In some cases this involves removing some details about 'volatile', alas, since C11 changed this stuff. Again.
1 parent 5266122 commit 27eb3ae

File tree

3 files changed

+65
-109
lines changed

3 files changed

+65
-109
lines changed

NEWS

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ GNU Autoconf NEWS - User visible changes.
1111
** Macros
1212

1313
- AC_PROG_CC now prefers C11 if available, falling back on C99 and
14-
then on C89 as before. (There is no AC_PROG_CC_C11 macro, as no
15-
need for one has been identified.)
14+
then on C89 as before.
1615

17-
- It is now documented that AC_PROG_CC_C89 and AC_PROG_CC_C99
18-
interfere with each other and with AC_PROG_CC. Applications should
19-
normally use AC_PROG_CC.
16+
- AC_PROG_CC_STDC, AC_PROG_CC_C89, AC_PROG_CC_C99 have been marked as obsolete.
17+
Applications should use AC_PROG_CC.
2018

2119
- AC_FUNC_VFORK now checks for the signal-handling bug in Solaris 2.4 'vfork'.
2220
Formerly, it ignored this bug, so that Emacs could use some tricky

doc/autoconf.texi

Lines changed: 50 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -7256,6 +7256,18 @@ After calling this macro you can check whether the C compiler has been
72567256
set to accept Standard C; if not, the shell variable
72577257
@code{ac_cv_prog_cc_stdc} is set to @samp{no}.
72587258

7259+
When attempting to add compiler options, prefer extended functionality
7260+
modes over strict conformance modes. Test for C11 support by checking
7261+
for @code{_Alignas}, @code{_Alignof}, @code{_Noreturn},
7262+
@code{_Static_assert}, UTF-8 string literals, duplicate @code{typedef}s,
7263+
and anonymous structures and unions. Test for C99 support by checking
7264+
for @code{_Bool}, @code{//} comments, flexible array members,
7265+
@code{inline}, signed and unsigned @code{long long int}, mixed code and
7266+
declarations, named initialization of structs, @code{restrict},
7267+
@code{va_copy}, varargs macros, variable declarations in @code{for}
7268+
loops, and variable length arrays. Test for C89 support by checking for
7269+
function prototypes.
7270+
72597271
If using the GNU C compiler, set shell variable @code{GCC} to
72607272
@samp{yes}. If output variable @code{CFLAGS} was not already set, set
72617273
it to @option{-g -O2} for the GNU C compiler (@option{-O2} on systems
@@ -7323,51 +7335,6 @@ features. To check for characteristics not listed here, use
73237335
@code{AC_COMPILE_IFELSE} (@pxref{Running the Compiler}) or
73247336
@code{AC_RUN_IFELSE} (@pxref{Runtime}).
73257337

7326-
@defmac AC_PROG_CC_C89
7327-
@acindex{PROG_CC_C89}
7328-
@caindex prog_cc_c89
7329-
If the C compiler is not in ANSI C89 (ISO C90) mode by
7330-
default, try to add an option to output variable @code{CC} to make it
7331-
so. This macro tries various options that select ANSI C89 on
7332-
some system or another, preferring extended functionality modes over
7333-
strict conformance modes. It considers the compiler to be in
7334-
ANSI C89 mode if it handles function prototypes correctly.
7335-
7336-
After calling this macro you can check whether the C compiler has been
7337-
set to accept ANSI C89; if not, the shell variable
7338-
@code{ac_cv_prog_cc_c89} is set to @samp{no}.
7339-
7340-
This macro is rarely needed. It should be used only if your application
7341-
requires C89 and will not work in later C versions. Typical applications
7342-
should use @code{AC_PROG_CC} instead.
7343-
@end defmac
7344-
7345-
@defmac AC_PROG_CC_C99
7346-
@acindex{PROG_CC_C99}
7347-
@caindex prog_cc_c99
7348-
If the C compiler is not in C99 mode by default, try to add an
7349-
option to output variable @code{CC} to make it so. This macro tries
7350-
various options that select C99 on some system or another, preferring
7351-
extended functionality modes over strict conformance modes. It
7352-
considers the compiler to be in C99 mode if it handles @code{_Bool},
7353-
@code{//} comments, flexible array members, @code{inline}, signed and
7354-
unsigned @code{long long int}, mixed code and declarations, named
7355-
initialization of structs,
7356-
@code{restrict}, @code{va_copy}, varargs macros, variable declarations
7357-
in @code{for} loops, and variable length arrays.
7358-
7359-
After calling this macro you can check whether the C compiler has been
7360-
set to accept C99; if not, the shell variable
7361-
@code{ac_cv_prog_cc_c99} is set to @samp{no}.
7362-
7363-
This macro is rarely needed. It should be used only if your application
7364-
requires C99 and will not work in later C versions. Typical applications
7365-
should use @code{AC_PROG_CC} instead.
7366-
7367-
There is no @code{AC_PROG_CC_C11} macro, as no need for one has been
7368-
identified.
7369-
@end defmac
7370-
73717338
@defmac AC_C_BACKSLASH_A
73727339
@acindex{C_BACKSLASH_A}
73737340
@cvindex HAVE_C_BACKSLASH_A
@@ -9311,19 +9278,19 @@ AC_PREPROC_IFELSE(
93119278
@end example
93129279

93139280
@noindent
9314-
results in:
9281+
might result in:
93159282

93169283
@example
93179284
checking for gcc... gcc
9318-
checking for C compiler default output file name... a.out
93199285
checking whether the C compiler works... yes
9320-
checking whether we are cross compiling... no
9286+
checking for C compiler default output file name... a.out
93219287
checking for suffix of executables...
9288+
checking whether we are cross compiling... no
93229289
checking for suffix of object files... o
93239290
checking whether we are using the GNU C compiler... yes
93249291
checking whether gcc accepts -g... yes
9325-
checking for gcc option to accept ISO C89... none needed
9326-
checking how to run the C preprocessor... gcc -E
9292+
checking for gcc option to accept ISO C11... -std=gnu11
9293+
checking how to run the C preprocessor... gcc -std=gnu11 -E
93279294
OK
93289295
@end example
93299296

@@ -18637,7 +18604,8 @@ The default executable, produced by @samp{cc foo.c}, can be
1863718604
The C compiler's traditional name is @command{cc}, but other names like
1863818605
@command{gcc} are common. Posix 1003.1-2001 and 1003.1-2008 specify the
1863918606
name @command{c99}, but older Posix editions specified
18640-
@command{c89} and anyway these standard names are rarely used in
18607+
@command{c89}, future POSIX standards will likely specify
18608+
@command{c11}, and anyway these standard names are rarely used in
1864118609
practice. Typically the C compiler is invoked from makefiles that use
1864218610
@samp{$(CC)}, so the value of the @samp{CC} make variable selects the
1864318611
compiler name.
@@ -21606,28 +21574,25 @@ objects are ordinary.
2160621574

2160721575
Even when accessing objects defined with a volatile type,
2160821576
the C standard allows only
21609-
extremely limited signal handlers: the behavior is undefined if a signal
21577+
extremely limited signal handlers: in C99 the behavior is undefined if a signal
2161021578
handler reads any nonlocal object, or writes to any nonlocal object
2161121579
whose type is not @code{sig_atomic_t volatile}, or calls any standard
21612-
library function other than @code{abort}, @code{signal}, and (if C99 or later)
21580+
library function other than @code{abort}, @code{signal}, and
2161321581
@code{_Exit}. Hence C compilers need not worry about a signal handler
21614-
disturbing ordinary computation, unless the computation accesses a
21615-
@code{sig_atomic_t volatile} lvalue that is not a local variable.
21616-
(There is an obscure exception for accesses via a pointer to a volatile
21617-
character, since it may point into part of a @code{sig_atomic_t
21618-
volatile} object.) Posix
21619-
adds to the list of library functions callable from a portable signal
21620-
handler, but otherwise is like the C standard in this area.
21582+
disturbing ordinary computation. C11 and Posix allow some additional
21583+
behavior in a portable signal handler, but are still quite restrictive.
2162121584

2162221585
Some C implementations allow memory-access optimizations within each
2162321586
translation unit, such that actual behavior agrees with the behavior
2162421587
required by the standard only when calling a function in some other
2162521588
translation unit, and a signal handler acts like it was called from a
21626-
different translation unit. The C standard hints that in these
21589+
different translation unit. The C99 standard hints that in these
2162721590
implementations, objects referred to by signal handlers ``would require
2162821591
explicit specification of @code{volatile} storage, as well as other
2162921592
implementation-defined restrictions.'' But unfortunately even for this
2163021593
special case these other restrictions are often not documented well.
21594+
This area was significantly changed in C11, and eventually implementations
21595+
will probably head in the C11 direction, but this will take some time.
2163121596
@xref{Volatiles, , When is a Volatile Object Accessed?, gcc, Using the
2163221597
GNU Compiler Collection (GCC)}, for some
2163321598
restrictions imposed by GCC. @xref{Defining Handlers, ,
@@ -23656,6 +23621,16 @@ Replaced by @code{AC_TYPE_PID_T} (@pxref{AC_TYPE_PID_T}).
2365623621
Replaced by @code{AC_PREFIX_PROGRAM} (@pxref{AC_PREFIX_PROGRAM}).
2365723622
@end defmac
2365823623

23624+
@defmac AC_PROG_CC_C89
23625+
@acindex{PROG_CC_C89}
23626+
Now done by @code{AC_PROG_CC} (@pxref{AC_PROG_CC}).
23627+
@end defmac
23628+
23629+
@defmac AC_PROG_CC_C99
23630+
@acindex{PROG_CC_C99}
23631+
Now done by @code{AC_PROG_CC} (@pxref{AC_PROG_CC}).
23632+
@end defmac
23633+
2365923634
@defmac AC_PROG_CC_STDC
2366023635
@acindex{PROG_CC_STDC}
2366123636
Now done by @code{AC_PROG_CC} (@pxref{AC_PROG_CC}).
@@ -25939,19 +25914,19 @@ $ @kbd{cat configure.ac}
2593925914
AC_INIT([Example], [1.0], [bug-example@@example.org])
2594025915
AC_CHECK_HEADERS([pi.h])
2594125916
$ @kbd{autoconf -Wall}
25942-
$ @kbd{./configure}
25917+
$ @kbd{./configure CPPFLAGS='-I.'}
2594325918
checking for gcc... gcc
25944-
checking for C compiler default output file name... a.out
2594525919
checking whether the C compiler works... yes
25946-
checking whether we are cross compiling... no
25920+
checking for C compiler default output file name... a.out
2594725921
checking for suffix of executables...
25922+
checking whether we are cross compiling... no
2594825923
checking for suffix of object files... o
2594925924
checking whether we are using the GNU C compiler... yes
2595025925
checking whether gcc accepts -g... yes
25951-
checking for gcc option to accept ISO C89... none needed
25952-
checking how to run the C preprocessor... gcc -E
25953-
checking for grep that handles long lines and -e... grep
25954-
checking for egrep... grep -E
25926+
checking for gcc option to accept ISO C11... -std=gnu11
25927+
checking how to run the C preprocessor... gcc -std=gnu11 -E
25928+
checking for grep that handles long lines and -e... /usr/bin/grep
25929+
checking for egrep... /usr/bin/grep -E
2595525930
checking for ANSI C header files... yes
2595625931
checking for sys/types.h... yes
2595725932
checking for sys/stat.h... yes
@@ -25969,10 +25944,10 @@ configure: WARNING: pi.h: check for missing prerequisite headers?
2596925944
configure: WARNING: pi.h: see the Autoconf documentation
2597025945
configure: WARNING: pi.h: section "Present But Cannot Be Compiled"
2597125946
configure: WARNING: pi.h: proceeding with the compiler's result
25972-
configure: WARNING: ## -------------------------------------- ##
25947+
configure: WARNING: ## --------------------------------------- ##
2597325948
configure: WARNING: ## Report this to bug-example@@example.org ##
25974-
configure: WARNING: ## -------------------------------------- ##
25975-
checking for pi.h... yes
25949+
configure: WARNING: ## --------------------------------------- ##
25950+
checking for pi.h... no
2597625951
@end smallexample
2597725952

2597825953
@noindent
@@ -25988,16 +25963,16 @@ AC_CHECK_HEADERS([number.h pi.h], [], [],
2598825963
#endif
2598925964
]])
2599025965
$ @kbd{autoconf -Wall}
25991-
$ @kbd{./configure}
25966+
$ @kbd{./configure CPPFLAGS='-I.'}
2599225967
checking for gcc... gcc
25993-
checking for C compiler default output... a.out
2599425968
checking whether the C compiler works... yes
25995-
checking whether we are cross compiling... no
25969+
checking for C compiler default output file name... a.out
2599625970
checking for suffix of executables...
25971+
checking whether we are cross compiling... no
2599725972
checking for suffix of object files... o
2599825973
checking whether we are using the GNU C compiler... yes
2599925974
checking whether gcc accepts -g... yes
26000-
checking for gcc option to accept ANSI C... none needed
25975+
checking for gcc option to accept ISO C11... -std=gnu11
2600125976
checking for number.h... yes
2600225977
checking for pi.h... yes
2600325978
@end example

lib/autoconf/c.m4

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,43 +1437,26 @@ dnl with extended modes being tried first.
14371437
])# _AC_PROG_CC_C11
14381438

14391439

1440-
# _AC_PROG_CC_FORCE_VERSION(LOWER-VERSION, UPPER-VERSION)
1441-
# -------------------------------------------------------
1442-
# Require a compiler for a particular version of C, either C89 or C99.
1443-
# LOWER-VERSION uses lower-case c, UPPER-VERSION uses upper-case.
1444-
AC_DEFUN([_AC_PROG_CC_FORCE_VERSION],
1445-
[ AC_REQUIRE([AC_PROG_CC])dnl
1446-
if test $ac_prog_cc_stdc != $1; then
1447-
ac_save_std_CC=$CC
1448-
if test -n "$ac_prog_cc_stdc_options"; then
1449-
CC=`expr "X$CC" : 'X\(.*\)'"$ac_prog_cc_stdc_options"
1450-
``expr "X$CC" : ".*$ac_prog_cc_stdc_options"'\(.*\)'
1451-
`
1452-
fi
1453-
_AC_PROG_CC_$2(
1454-
[ac_prog_cc_stdc=$1
1455-
ac_cv_prog_cc_stdc=$ac_cv_prog_cc_$1],
1456-
[CC=$ac_save_std_CC
1457-
AC_MSG_WARN([$2 compiler not available; falling back on $CC])])
1458-
fi
1459-
])
1460-
14611440
# AC_PROG_CC_C89
14621441
# --------------
1463-
AC_DEFUN([AC_PROG_CC_C89], [_AC_PROG_CC_FORCE_VERSION([c89], [C89])])
1442+
AC_DEFUN([AC_PROG_CC_C89],
1443+
[ AC_REQUIRE([AC_PROG_CC])dnl
1444+
m4_warn([obsolete], [$0 is obsolete; use AC_PROG_CC])
1445+
])
14641446

14651447
# AC_PROG_CC_C99
14661448
# --------------
1467-
AC_DEFUN([AC_PROG_CC_C99], [_AC_PROG_CC_FORCE_VERSION([c99], [C99])])
1468-
1469-
# There is no AC_PROG_CC_C11, as we have not identified a need for it.
1470-
# Applications should use AC_PROG_CC instead.
1471-
1449+
AC_DEFUN([AC_PROG_CC_C99],
1450+
[ AC_REQUIRE([AC_PROG_CC])dnl
1451+
m4_warn([obsolete], [$0 is obsolete; use AC_PROG_CC])
1452+
])
14721453

14731454
# AC_PROG_CC_STDC
14741455
# ---------------
1475-
# This has been folded into AC_PROG_CC.
1476-
AU_ALIAS([AC_PROG_CC_STDC], [AC_PROG_CC])
1456+
AC_DEFUN([AC_PROG_CC_STDC],
1457+
[ AC_REQUIRE([AC_PROG_CC])dnl
1458+
m4_warn([obsolete], [$0 is obsolete; use AC_PROG_CC])
1459+
])
14771460

14781461

14791462
# AC_C_BACKSLASH_A

0 commit comments

Comments
 (0)