Hi Ralf,

Ralf Wildenhues wrote:
> 
> Harald, please consider *providing more and useful information* if you
> want help.  I for one can't read your mind, and almost every first post
> of yours leaves me wanting for a crystal ball as to what has gone wrong.
> This makes me for one be less and less enthusiastic about replying.
> With newbies, or people where I do not know whether they are newbies or
> not, one cannot expect more, at least the first couple of times they
> post.  But you bee given hints before.  This is no service hotline.
> I heartily recommend reading this (available in several languages):
> http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
> 
> We have now again wasted 5 messages without getting to the point of the
> problem you encounter: I still have no clue what's going wrong on your
> side, and I bet you aren't happy about the situation either.
> 

Sorry for not being more precise.

Here is a sample.

        #configure.ac:
        AC_INIT(package,version)
        AC_CONFIG_AUX_DIR([.])
        AC_CANONICAL_HOST
        AM_INIT_AUTOMAKE([foreign subdir-objects no-define])

        AC_PROG_CC
        AC_PROG_CPP
        AC_AIX
        AC_ISC_POSIX
        AC_MINIX
        AC_PROG_INSTALL
        AC_PROG_CXX
        AC_PROG_CXXCPP
        AC_PROG_RANLIB
        AC_HEADER_STDC
        AM_PROG_CC_C_O
        AM_PROG_LEX
        AC_PROG_YACC

        AC_CONFIG_FILES([Makefile])
        AC_OUTPUT



        #Makefile.am:
        noinst_PROGRAMS = hello
        hello_SOURCES = hello.cxx


Autoconf is 2.59, plus Stepan's patch for c.m4, see attachment
Automake is 1.9.6
platform is Linux
build platform is Windows, using MSVC 7.1.

The patch provided by Stepan some months ago fixes
AM_PROG_CC_C_O for Windows and MSVC, i.e. configure recognizes
that -c -o doesn't work as expected for Bill Gates' compiler.
Looking into the generated Makefile I see

        CC = /somedir/compile cl.exe

The compile script is necessary for both C and C++ code. But
it is not copied by Automake. Nor does it set CXX accordingly.
in the Makefile.

The patch I had sent was an attempt to workaround the problem,
but it is not sufficient. Any help would be highly appreciated.


Regards

Harri
--- Begin Message ---
Hello,

On Fri, Jul 01, 2005 at 10:14:28AM +0200, Harald Dunkel wrote:
> It seems that AC_PROG_CC_C_O does not work with Microsoft's
> Visual C++ 13.10.3077.
[...]
>       cl -c -o somedir/conftest.obj conftest.c
> or
>       cl -c -o xyz.obj conftest.c
> 
> do not work as expected. cl silently ignores the -o
> option if there is a -c.

the patch attached to this mail (relative to current autoconf CVS)
should fix it.

OK to commit?

> How can I tell autoconf to not use -c and -o together,
> regardless what the test said?

Do I guess correctly that you in fact use AM_PROG_CC_C?
Then the following hack should work:

AC_PROG_CC_C_O
eval ac_cv_prog_cc_${ac_cc}_c_o=no
AM_PROG_CC_C_O

(The configure output still says that -c -o works, and NO_MINUS_C_MINUS_O
is not defined in your config.h, but it doesn't matter.)

Have a nice day,
        Stepan
2005-07-01  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autoconf/c.m4 (AC_PROG_CC_C_O): Use conf$$.o instead of
        conftest.o, to see whether the compiler really obeys; rm the
        object file before the test.
        * lib/autoconf/fortran.m4 (_AC_PROG_FC_C_O): Likewise.

Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.201
diff -u -r1.201 c.m4
--- lib/autoconf/c.m4   24 May 2005 07:29:57 -0000      1.201
+++ lib/autoconf/c.m4   1 Jul 2005 10:43:07 -0000
@@ -585,17 +585,19 @@
 # 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'
+ac_try='$CC -c conftest.$ac_ext -o conf$[$].$ac_objext >&AS_MESSAGE_LOG_FD'
+rm -f conf$[$]*
 if AC_TRY_EVAL(ac_try) &&
-   test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try);
+   test -f conf$[$].$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'
+      ac_try='cc -c conftest.$ac_ext -o conf$[$].$ac_objext 
>&AS_MESSAGE_LOG_FD'
+      rm -f conf$[$]*
       if AC_TRY_EVAL(ac_try) &&
-        test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try);
+        test -f conf$[$].$ac_objext && AC_TRY_EVAL(ac_try);
       then
        # cc works too.
        :
@@ -608,7 +610,7 @@
 else
   eval ac_cv_prog_cc_${ac_cc}_c_o=no
 fi
-rm -f conftest*
+rm -f conftest* conf$[$]*
 ])dnl
 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
   AC_MSG_RESULT([yes])
Index: lib/autoconf/fortran.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v
retrieving revision 1.194
diff -u -r1.194 fortran.m4
--- lib/autoconf/fortran.m4     30 Jun 2005 12:59:15 -0000      1.194
+++ lib/autoconf/fortran.m4     1 Jul 2005 10:43:07 -0000
@@ -461,15 +461,16 @@
 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
 # We test twice because some compilers refuse to overwrite an existing
 # `.o' file with `-o', although they will create one.
-ac_try='$[]_AC_FC[] $[]_AC_LANG_PREFIX[]FLAGS -c conftest.$ac_ext -o 
conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+ac_try='$[]_AC_FC[] $[]_AC_LANG_PREFIX[]FLAGS -c conftest.$ac_ext -o 
conf$[$].$ac_objext >&AS_MESSAGE_LOG_FD'
+rm -f conf$[$]*
 if AC_TRY_EVAL(ac_try) &&
-     test -f conftest.$ac_objext &&
+     test -f conf$[$].$ac_objext &&
      AC_TRY_EVAL(ac_try); then
   ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o=yes
 else
   ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o=no
 fi
-rm -f conftest*])
+rm -f conftest* conf$[$]*])
 if test $ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o = no; then
   AC_DEFINE([]_AC_FC[]_NO_MINUS_C_MINUS_O, 1,
             [Define to 1 if your Fortran compiler doesn't accept

--- End Message ---

Reply via email to