autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] AC_PROG_CC: exit with an error on non-C89 compiler


From: Adrian Bunk
Subject: [PATCH] AC_PROG_CC: exit with an error on non-C89 compiler
Date: Tue, 25 Sep 2012 15:25:05 +0300

It is already documented that autoconf users should no longer check
for C89-compilers, so it makes sense to handle that unlikely situation
with an error.

* lib/autoconf/c.m4: AC_MSG_ERROR on non-C89 compiler
* doc/autoconf.texi: document the change
* NEWS: likewise
---
 NEWS              |    4 ++++
 doc/autoconf.texi |   18 +++++++++++-------
 lib/autoconf/c.m4 |    3 +--
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 8b35cb8..5f5b16b 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,10 @@ GNU Autoconf NEWS - User visible changes.
 - AC_PROG_CC now prefers C11 if available, falling back on C99 and
   then on C89 as before.
 
+- AC_PROG_CC now exits with an error on pre-C89 compilers.
+  K&R C compilers are no longer of practical interest, and it was
+  already recommended to assume all compilers support C89.
+
 - AC_PROG_CC_STDC, AC_PROG_CC_C89, AC_PROG_CC_C99 have been marked as obsolete.
   Applications should use AC_PROG_CC.
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index d11c670..49f985d 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -7251,13 +7251,16 @@ If the C compiler cannot compile ISO Standard C 
(currently
 C11), try to add an option to output variable @code{CC} to make it work.
 If the compiler does not support C11, fall back to supporting
 ISO C99; if C99 does not work, fall back to ANSI C89 (ISO C90).
-When testing for ISO C versions, use GNU extensions if available.
-After calling this macro you can check whether the C compiler has been
-set to accept Standard C; if not, the shell variable
address@hidden is set to @samp{no}.
+If no Standard C compiler is found, configure exits with an error.
 
 When attempting to add compiler options, prefer extended functionality
-modes over strict conformance modes.
+modes (like GNU extensions) over strict conformance modes.
+
+After calling this macro you can check whether the C compiler has been
+set to accept Standard C; if not, the shell variable
address@hidden was set to @samp{no}.  This variable is
+obsolescent since AC_PROG_CC now exits with an error when no compiler
+accepting Standard C is found.
 
 Test for C11 support by checking
 for @code{_Alignas}, @code{_Alignof}, @code{_Noreturn},
@@ -7275,8 +7278,9 @@ has been set to accept C99; if not, the shell variable
 
 Test for C89 support by checking for function prototypes.  You can check
 whether the C compiler has been set to accept ANSI C89; if not, the shell
-variable @code{ac_cv_prog_cc_c89} is set to @samp{no}.
-
+variable @code{ac_cv_prog_cc_c89} was set to @samp{no}.  This variable is
+obsolescent since AC_PROG_CC now exits with an error when no compiler
+accepting ANSI C89 is found.
 
 If using the GNU C compiler, set shell variable @code{GCC} to
 @samp{yes}.  If output variable @code{CFLAGS} was not already set, set
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 808c104..4b49ae5 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -488,8 +488,7 @@ _AC_PROG_CC_C11([ac_prog_cc_stdc=c11
                    ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
      [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89
                       ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
-                     [ac_prog_cc_stdc=no
-                      ac_cv_prog_cc_stdc=no])])])
+                     [AC_MSG_ERROR([No ISO Standard C compiler found])])])])
 dnl
 AC_LANG_POP(C)dnl
 ])# AC_PROG_CC
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]