autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_PROG_CC_C99


From: Noah Misch
Subject: Re: AC_PROG_CC_C99
Date: Tue, 4 Jan 2005 18:17:39 -0800
User-agent: Mutt/1.5.6i

On Tue, Jan 04, 2005 at 03:59:44PM -0800, Paul Eggert wrote:
> Noah Misch <address@hidden> writes:
> > will it work for AC_PROG_CC_C89 (via AC_PROG_CC) to add the
> > C89-tolerance option, and for AC_PROG_CC_99 to then try to add the
> > C99-tolerance option in addition?
> 
> Good question.  We'd rather have it do C99 from day one in that case,
> I suppose.  Roger?

I don't think that's necessary.  See the patch below, for example.

> mostly upwards compatible with C89.  I suspect that most compilers
> that can do either, will be in C99ish mode by default.

Not gcc (3.4.1).



2005-01-04  Noah Misch  <address@hidden>

        * lib/autoconf/c.m4 (_AC_PROG_CC_C99): Remove $ac_cv_prog_cc_c89 from
        $CC before testing the C99 flags.  If we do not add a flag for C99,
        restore the C89 flag when finished.

diff -urp -X dontdiff ac-clean/lib/autoconf/c.m4 ac-c89c99/lib/autoconf/c.m4
--- ac-clean/lib/autoconf/c.m4  2005-01-03 07:02:43.728681271 -0500
+++ ac-c89c99/lib/autoconf/c.m4 2005-01-04 21:07:02.679032816 -0500
@@ -913,7 +913,12 @@ AC_DEFUN([_AC_PROG_CC_C99],
 [AC_MSG_CHECKING([for $CC option to accept ISO C99])
 AC_CACHE_VAL(ac_cv_prog_cc_c99,
 [ac_cv_prog_cc_c99=no
-ac_save_CC=$CC
+# Temporarily remove any C89-related option.
+ac_save_CC_c89=$CC
+case "x$ac_cv_prog_cc_c89" in
+  x|xno) ac_save_CC=$CC ;;
+  *)     ac_save_CC=`echo "$CC" | sed "s| $ac_cv_prog_cc_c89||g"` ;;
+esac
 AC_LANG_CONFTEST([AC_LANG_PROGRAM(
 [[#include <stdarg.h>
 #include <stdbool.h>
@@ -1031,7 +1036,7 @@ done
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 case "x$ac_cv_prog_cc_c99" in
   x|xno)
-    CC="$ac_save_CC" ;;
+    CC="$ac_save_CC_c89" ;;
   *)
     CC="$ac_save_CC $ac_cv_prog_cc_c99" ;;
 esac




reply via email to

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