On 17 Jun 2000, Alexandre Oliva wrote:
> On Jun 16, 2000, Mo DeJong <[EMAIL PROTECTED]> wrote:
>
> > I like that wc -c a lot better, we can just do this. Of course
> > this depends on the output format of wc, is it going to
> > be the same everywhere?
>
> I'm not even sure `wc -c' will be available everywhere :-(
> I still think using cmp is the best solution.
Ok, how about this patch? It uses cmp instead of wc.
I like this approach because we do not depend on
the output format of the wc program.
Mo DeJong
Red Hat Inc
Index: aclang.m4
===================================================================
RCS file: /cvs/autoconf/aclang.m4,v
retrieving revision 1.34
diff -u -r1.34 aclang.m4
--- aclang.m4 2000/06/09 11:14:05 1.34
+++ aclang.m4 2000/06/18 03:54:54
@@ -604,13 +609,27 @@
# _AC_PROG_CC_G
# ------------
+# There is no dependable way to check to see if a compiler
+# supports a given flag. In the case of the -g flag, we can
+# test to see if -g adds debug info the the object file by
+# seeing if the produced object file get bigger when the
+# -g option is passed in to the compiler.
define([_AC_PROG_CC_G],
[AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
[echo 'void f(){}' >conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
+# First, make sure an object file is generated
+AC_TRY_COMMAND(${CC-cc} -c conftest.c)
+if test ! -s conftest.${ac_objext} ; then
+ AC_MSG_ERROR([Compiler did not produce an object file with -c flag])
+fi
+mv conftest.${ac_objext} conftest_smaller.${ac_objext}
+# Run the compiler with the -g flag
+AC_TRY_COMMAND(${CC-cc} -c -g conftest.c)
+# If the files are exactly the same, -g does not insert debug symbols
+if AC_TRY_COMMAND(cmp conftest_smaller.${ac_objext}
conftest.${ac_objext} >&AC_FD_LOG) ; then
ac_cv_prog_cc_g=no
+else
+ ac_cv_prog_cc_g=yes
fi
rm -f conftest*
])])# _AC_PROG_CC_G