autoconf-patches
[Top][All Lists]
Advanced

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

Re: Do autotools support free Microsoft compiler?


From: Paul Eggert
Subject: Re: Do autotools support free Microsoft compiler?
Date: Tue, 20 Apr 2004 13:19:58 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Braden McDaniel <address@hidden> writes:

> autoconf, basically. autoconf's check for whether it can use -g is
> busted, but the effect of this is just a benign warning from the
> compiler. (I have a patch for this that I submitted to
> autoconf-patches many months ago; but it was ignored.)

Sorry, I dropped the ball on that.  I didn't like your patch, but
didn't have time to compose a better one at the time.  I just took the
time, installed the following patch instead.  Please try CVS Autoconf
on your compiler installation to see whether this approach works for
you.

2004-04-20  Paul Eggert  <address@hidden>

        * lib/autoconf/c.m4 (_AC_PROG_CC_G, _AC_PROG_CXX_G): Don't
        consider -g to work if it generates warnings when plain compiles
        don't.  Problem reported by Braden McDaniel in:
        http://mail.gnu.org/archive/html/autoconf-patches/2003-07/msg00014.html

--- c.m4.~1.185.~       2004-04-19 10:10:00 -0700
+++ c.m4        2004-04-20 12:49:07 -0700
@@ -501,13 +501,25 @@ AC_LANG_POP(C)dnl
 # Check whether -g works, even if CFLAGS is set, in case the package
 # plays around with CFLAGS (such as to build both debugging and normal
 # versions of a library), tasteless as that idea is.
+# Don't consider -g to work if it generates warnings when plain compiles don't.
 m4_define([_AC_PROG_CC_G],
 [ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
 AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g,
-              [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes],
-                                                       [ac_cv_prog_cc_g=no])])
+  [ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+     [ac_cv_prog_cc_g=yes],
+     [CFLAGS=""
+      _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+        [],
+        [ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+          [ac_cv_prog_cc_g=yes])])])
+   ac_c_werror_flag=$ac_save_c_werror_flag])
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
@@ -710,14 +722,25 @@ AC_LANG_POP(C++)dnl
 # Check whether -g works, even if CXXFLAGS is set, in case the package
 # plays around with CXXFLAGS (such as to build both debugging and
 # normal versions of a library), tasteless as that idea is.
+# Don't consider -g to work if it generates warnings when plain compiles don't.
 m4_define([_AC_PROG_CXX_G],
 [ac_test_CXXFLAGS=${CXXFLAGS+set}
 ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="-g"
 AC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g,
-              [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
-                                  [ac_cv_prog_cxx_g=yes],
-                                  [ac_cv_prog_cxx_g=no])])
+  [ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+     [ac_cv_prog_cxx_g=yes],
+     [CXXFLAGS=""
+      _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+        [],
+        [ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+        CXXFLAGS="-g"
+        _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+          [ac_cv_prog_cxx_g=yes])])])
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag])
 if test "$ac_test_CXXFLAGS" = set; then
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then




reply via email to

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