bug-libtool
[Top][All Lists]
Advanced

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

Re: libtool-1.4.2 (finished analysis), autoconf-2.53 (bug)


From: Akim Demaille
Subject: Re: libtool-1.4.2 (finished analysis), autoconf-2.53 (bug)
Date: 29 Jul 2002 14:10:37 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

| Ok, the problem in ltmain.sh is this part:
|     # Calculate the filename of the output object if compiler does
|     # not support -o with -c
|     if test "$compiler_c_o" = no; then
|       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 
's%\.[^.]*$%%'`.${objext}
| 
| where 'output_obj' is errornously set
| to "foobar.lo" because "srcfile" is just the last
| argument passed to g++ (the second argument of
| "-MF .deps/foobar.PTlo" in this case).
| I think this is certainly a bug, 'srcfile' should
| not be set to everything, only to arguments that
| LOOK like a source file, and a "-c foo.ext" should
| take precendence over any other argument anyway.
| 
| The reason that this normally not occuring is because
| normally compiler_c_o is not set to 'yes', and here
| we see a bug of autoconf.  I have:
| 
| configure:5584: checking if gcc supports -c -o file.o
| configure:5606: g++ -c -g  -pipe  conftest.cc >&5
| Assembler messages:
| FATAL: can't create conftest.o: Permission denied
| configure:5628: result: no
| 
| Where the test is:
| 
| # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
| # that will create temporary files in the current directory regardless of
| # the output directory.  Thus, making CWD read-only will cause this test
| # to fail, enabling locking or at least warning the user not to do parallel
| # builds.
| chmod -w .
| save_CFLAGS="$CFLAGS"
| CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
| compiler_c_o=no
| if { (eval echo configure:5606: \"$ac_compile\") 1>&5; (eval $ac_compile) 
2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
| ...etc
| 
| The problem here is that autoconf sets CFLAGS while 'ac_compile'
| is using g++ (the C++ compiler), which ignores CFLAGS and uses CXXFLAGS.
| Hence this test fails...
| 
| The 'work around' that I was looking for is thus
| to temporarily set AC_LANG_C prior to this test.

I don't know what test you are referring to, Autoconf (CVS) has this:

# AC_PROG_CC_C_O
# --------------
AC_DEFUN([AC_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC])dnl
if test "x$CC" != xcc; then
  AC_MSG_CHECKING([whether $CC and cc understand -c and -o together])
else
  AC_MSG_CHECKING([whether cc understands -c and -o together])
fi
set dummy $CC; ac_cc=`echo $[2] |
                      sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
# Make sure it works both with $CC and with simple cc.
# We do the test twice because some compilers refuse to overwrite an
# existing .o file with -o, though they will create one.
ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
if AC_TRY_EVAL(ac_try) &&
   test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try);
then
  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
  if test "x$CC" != xcc; then
    # Test first that cc exists at all.
    if AC_TRY_COMMAND(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then
      ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
      if AC_TRY_EVAL(ac_try) &&
         test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try);
      then
        # cc works too.
        :
      else
        # cc exists but doesn't like -o.
        eval ac_cv_prog_cc_${ac_cc}_c_o=no
      fi
    fi
  fi
else
  eval ac_cv_prog_cc_${ac_cc}_c_o=no
fi
rm -f conftest*
])dnl
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
  AC_MSG_RESULT([yes])
else
  AC_MSG_RESULT([no])
  AC_DEFINE(NO_MINUS_C_MINUS_O, 1,
           [Define to 1 if your C compiler doesn't accept -c and -o together.])
fi
])# AC_PROG_CC_C_O


Autoconf *never* violates the user space with things like
save_CFLAGS.  This code is not ours.



reply via email to

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