[Top][All Lists]

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

Re: /lib/cpp again

From: Akim Demaille
Subject: Re: /lib/cpp again
Date: 06 Jul 2001 10:46:29 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

>>>>> "Tom" == Tom Tromey <address@hidden> writes:

Tom> This macro runs the compiler via depcomp to determine the
Tom> dependency tracking.  So it needs to know that the compiler has
Tom> been set.  However, if I understand correctly, we know that the
Tom> compiler has been set because this macro is called implicitly via
Tom> redefinition magic.  

That's correct.

Tom> If that is the case then I think your patch is ok if you add a
Tom> comment explaining this...

How about this?

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * m4/depend.m4 (AM_DEPENDENCIES): Don't define `depcpp' which is
        not used.
        Do not require the corresponding AC_PROG_CC as AC_PROG_CC is
        actually modified to require AM_DEPENDENCIES.
        Rename `confdir' as `conftest.dir' so that the configure trap
        remove it.

Index: m4/depend.m4
RCS file: /cvs/automake/automake/m4/depend.m4,v
retrieving revision 1.17
diff -u -u -r1.17 depend.m4
--- m4/depend.m4 2001/05/18 00:00:32 1.17
+++ m4/depend.m4 2001/07/06 08:36:09
@@ -1,41 +1,36 @@
-# serial 3
+# serial 4                                             -*- Autoconf -*-
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
 # C support machinery.  Also note that it means that autoscan, seeing
 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
 # ---------------------
 # See how the compiler implements dependency checking.
 # NAME is "CC", "CXX" or "OBJC".
 # We try a few techniques and use that to set a single cache variable.
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
-ifelse([$1], CC,
-       [AC_REQUIRE([AC_PROG_][CC])dnl
-       [$1], CXX, [AC_REQUIRE([AC_PROG_][CXX])dnl
-       [$1], OBJC, [am_compiler_list='gcc3 gcc'
-       [$1], GCJ,  [am_compiler_list='gcc3 gcc'
-       [AC_REQUIRE([AC_PROG_][$1])dnl
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc']
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
 AC_CACHE_CHECK([dependency style of $depcc],
@@ -45,15 +40,15 @@
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
-  mkdir confdir
+  mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
-  cp "$am_depcomp" confdir
-  cd confdir
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
   if test "$am_compiler_list" = ""; then
-     am_compiler_list="`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`"
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
   for depmode in $am_compiler_list; do
     # We need to recreate these files for each test, as the compiler may
@@ -62,7 +57,7 @@
     echo '#include "conftest.h"' > conftest.c
     echo 'int i;' > conftest.h
-    case "$depmode" in
+    case $depmode in
       # after this tag, mechanisms are not by side-effect, so they'll
       # only be used when explicitly requested
@@ -77,18 +72,18 @@
     # We check with `-c' and `-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
     # handle `-M -o', and we need to detect this.
-    if depmode="$depmode" \
+    if depmode=$depmode \
        source=conftest.c object=conftest.o \
        depfile=conftest.Po tmpdepfile=conftest.TPo \
        $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
        grep conftest.h conftest.Po > /dev/null 2>&1; then
-      am_cv_$1_dependencies_compiler_type="$depmode"
+      am_cv_$1_dependencies_compiler_type=$depmode
   cd ..
-  rm -rf confdir
+  rm -rf conftest.dir

reply via email to

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