[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make special accommodation for cl in _AC_PROG_CC_G
From: |
Braden McDaniel |
Subject: |
Re: Make special accommodation for cl in _AC_PROG_CC_G |
Date: |
Tue, 12 Aug 2003 09:20:27 -0400 |
On Fri, 2003-07-18 at 00:10, Paul Eggert wrote:
> Braden McDaniel <address@hidden> writes:
>
> > > Maybe some other strategy would be more general. Like checking that
> > > adding -g both works and doesn't output any extra messages, or
> > > something like that.
> >
> > I think finding out what "extra" is would be extremely difficult, if not
> > impossible, to do in a general way.
>
> No, it's easy.
>
> 1. Compile without -g. Save the output. E.g., without_g=`cc -g foo.c`.
> 2. Compile with -g. Save the output. E.g., with_g=`cc foo.c`.
> 3. Compare the two. E.g., if test "x$without_g" = "x$with_g"; then ....
Alright... Here's a patch that does that.
--
Braden McDaniel e-mail: <address@hidden>
<http://endoframe.com> Jabber: <address@hidden>
Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.181
diff -u -r1.181 c.m4
--- lib/autoconf/c.m4 7 Jul 2003 07:41:07 -0000 1.181
+++ lib/autoconf/c.m4 9 Aug 2003 21:41:26 -0000
@@ -487,25 +487,37 @@
# plays around with CFLAGS (such as to build both debugging and normal
# versions of a library), tasteless as that idea is.
m4_define([_AC_PROG_CC_G],
-[ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
+[AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g,
+[ac_save_CFLAGS=$CFLAGS
+AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+rm -f conftest.$ac_objext
+CFLAGS=
+eval $ac_compile &> conftest.out
+ac_compile_without_g=`cat conftest.out`
+rm -f conftest.$ac_objext conftest.out
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])])
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
+eval $ac_compile &> conftest.out
+ac_compile_with_g=`cat conftest.out`
+rm -f conftest.$ac_objext conftest.out conftest.$ac_ext
+CFLAGS=$ac_save_CFLAGS
+if test "x$ac_compile_without_g" = "x$ac_compile_with_g"; then
+ ac_cv_prog_cc_g=yes
else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
+ ac_cv_prog_cc_g=no
+fi])
+if test -z "$CFLAGS"; then
+ if test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
else
- CFLAGS=
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
fi
fi[]dnl
])# _AC_PROG_CC_G
- Re: Make special accommodation for cl in _AC_PROG_CC_G,
Braden McDaniel <=