@@ -7256,6 +7256,18 @@ After calling this macro you can check whether the C compiler has been
72567256set 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+
72597271If using the GNU C compiler, set shell variable @code{GCC} to
72607272@samp{yes}. If output variable @code{CFLAGS} was not already set, set
72617273it 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
93179284checking for gcc... gcc
9318- checking for C compiler default output file name... a.out
93199285checking 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
93219287checking for suffix of executables...
9288+ checking whether we are cross compiling... no
93229289checking for suffix of object files... o
93239290checking whether we are using the GNU C compiler... yes
93249291checking 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
93279294OK
93289295@end example
93299296
@@ -18637,7 +18604,8 @@ The default executable, produced by @samp{cc foo.c}, can be
1863718604The 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
1863918606name @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
1864118609practice. Typically the C compiler is invoked from makefiles that use
1864218610@samp{$(CC)}, so the value of the @samp{CC} make variable selects the
1864318611compiler name.
@@ -21606,28 +21574,25 @@ objects are ordinary.
2160621574
2160721575Even when accessing objects defined with a volatile type,
2160821576the 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
2161021578handler reads any nonlocal object, or writes to any nonlocal object
2161121579whose 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
2162221585Some C implementations allow memory-access optimizations within each
2162321586translation unit, such that actual behavior agrees with the behavior
2162421587required by the standard only when calling a function in some other
2162521588translation 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
2162721590implementations, objects referred to by signal handlers ``would require
2162821591explicit specification of @code{volatile} storage, as well as other
2162921592implementation-defined restrictions.'' But unfortunately even for this
2163021593special 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
2163221597GNU Compiler Collection (GCC)}, for some
2163321598restrictions imposed by GCC. @xref{Defining Handlers, ,
@@ -23656,6 +23621,16 @@ Replaced by @code{AC_TYPE_PID_T} (@pxref{AC_TYPE_PID_T}).
2365623621Replaced 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}
2366123636Now done by @code{AC_PROG_CC} (@pxref{AC_PROG_CC}).
@@ -25939,19 +25914,19 @@ $ @kbd{cat configure.ac}
2593925914AC_INIT([Example], [1.0], [bug-example@@example.org])
2594025915AC_CHECK_HEADERS([pi.h])
2594125916$ @kbd{autoconf -Wall}
25942- $ @kbd{./configure}
25917+ $ @kbd{./configure CPPFLAGS='-I.' }
2594325918checking for gcc... gcc
25944- checking for C compiler default output file name... a.out
2594525919checking 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
2594725921checking for suffix of executables...
25922+ checking whether we are cross compiling... no
2594825923checking for suffix of object files... o
2594925924checking whether we are using the GNU C compiler... yes
2595025925checking 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
2595525930checking for ANSI C header files... yes
2595625931checking for sys/types.h... yes
2595725932checking for sys/stat.h... yes
@@ -25969,10 +25944,10 @@ configure: WARNING: pi.h: check for missing prerequisite headers?
2596925944configure: WARNING: pi.h: see the Autoconf documentation
2597025945configure: WARNING: pi.h: section "Present But Cannot Be Compiled"
2597125946configure: WARNING: pi.h: proceeding with the compiler's result
25972- configure: WARNING: ## -------------------------------------- ##
25947+ configure: WARNING: ## --------------------------------------- ##
2597325948configure: 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.' }
2599225967checking for gcc... gcc
25993- checking for C compiler default output... a.out
2599425968checking 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
2599625970checking for suffix of executables...
25971+ checking whether we are cross compiling... no
2599725972checking for suffix of object files... o
2599825973checking whether we are using the GNU C compiler... yes
2599925974checking 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
2600125976checking for number.h... yes
2600225977checking for pi.h... yes
2600325978@end example
0 commit comments