* Harald Dunkel wrote on Tue, Nov 15, 2005 at 05:12:33PM CET: > > Here is a sample. *snip*
Thank you! > 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. OK. The installation of the `compile' script has been fixed in CVS HEAD Automake. > 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. OK. In order to make this work for C++ code, both Autoconf and Automake have to be changed. > The patch I had sent was an attempt to workaround the problem, > but it is not sufficient. Any help would be highly appreciated. Well, here is a first stab at the Automake part only. I think I introduced a bug somewhere, because the compile script causes mv foo.o foo.o sometimes now. Also, interestingly, this should fix it for Fortran (F77 and FC); it's only C++ that is missing support from Autoconf. You will note that if you call AM_PROG_CXX_C_O, it will fail. (Yes, the automake.in part, documentation and tests are missing. This is just a first cut; patch against CVS HEAD Automake.) Cheers, Ralf * lib/compile: Handle extensions for C++ and Fortran. * m4/minuso.m4 (AM_PROG_CC_C_O): Rename to.. (AM_PROG_LANG_C_O): this, and factor out common functionality of (AM_PROG_CC_C_O, AM_PROG_CXX_C_O, AM_PROG_F77_C_O, AM_PROG_FC_C_O): ..these new macros. Index: lib/compile =================================================================== RCS file: /cvs/automake/automake/lib/compile,v retrieving revision 1.12 diff -u -r1.12 compile --- lib/compile 14 May 2005 20:28:50 -0000 1.12 +++ lib/compile 15 Nov 2005 22:40:18 -0000 @@ -79,7 +79,7 @@ ;; esac ;; - *.c) + *.[cCFSfFr] | *.cc | *.cpp | *.cxx | *.c++ | *.f90 | *.for ) cfile=$1 set x "$@" "$1" shift @@ -103,7 +103,9 @@ fi # Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` +cofile=`echo "$cfile" | sed -e 's|^.*[/\\]||' \ + -e 's/\.[cCFSfFr]$/.o/;s/\.cc$/.o/;s/\.cpp$/.o/;s/\.cxx$/.o/' \ + -e 's/\.c++$/.o/;s/\.f9[05]$/.o/;s/\.for$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name Index: m4/minuso.m4 =================================================================== RCS file: /cvs/automake/automake/m4/minuso.m4,v retrieving revision 1.9 diff -u -r1.9 minuso.m4 --- m4/minuso.m4 9 Jan 2005 14:46:21 -0000 1.9 +++ m4/minuso.m4 15 Nov 2005 22:40:18 -0000 @@ -6,29 +6,70 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 6 -# AM_PROG_CC_C_O -# -------------- -# Like AC_PROG_CC_C_O, but changed for automake. -AC_DEFUN([AM_PROG_CC_C_O], -[AC_REQUIRE([AC_PROG_CC_C_O])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +# AM_PROG_LANG_C_O(LANG) +# ---------------------- +# Like AC_PROG_]LANG[_C_O, but changed for automake. +AC_DEFUN([AM_PROG_LANG_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl +m4_pushdef([_AM_LANG], m4_tolower($1)) # FIXME: we rely on the cache variable name because # there is no other way. -set dummy $CC -ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` -if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then +set dummy [$]$1 +m4_if([$1], + [CC], [ac_cc=_`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`], + [ac_cc=]) +if eval "test \"`echo '$ac_cv_prog_[]_AM_LANG[]'${ac_cc}_c_o`\" != yes"; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" + $1="$am_aux_dir/compile [$]$1" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. -m4_define([AC_PROG_CC], - [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +m4_define([AC_PROG_][$1], + [m4_fatal([AC_PROG_]$1[ cannot be called after AM_PROG_]$1[_C_O])]) +m4_popdef([_AM_LANG])dnl +]) + + +# AM_PROG_CC_C_O +# -------------- +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_LANG_PUSH([C]) +AM_PROG_LANG_C_O([CC])dnl +AC_LANG_POP([C]) +]) + + +# AM_PROG_CXX_C_O +# --------------- +AC_DEFUN([AM_PROG_CXX_C_O], +[AC_REQUIRE([AC_PROG_CXX_C_O])dnl +AC_LANG_PUSH([C++]) +AM_PROG_LANG_C_O([CXX])dnl +AC_LANG_POP([C++]) +]) + +# AM_PROG_F77_C_O +# --------------- +AC_DEFUN([AM_PROG_F77_C_O], +[AC_REQUIRE([AC_PROG_F77_C_O])dnl +AC_LANG_PUSH([Fortran 77]) +AM_PROG_LANG_C_O([F77])dnl +AC_LANG_POP([Fortran 77]) +]) + +# AM_PROG_FC_C_O +# -------------- +AC_DEFUN([AM_PROG_FC_C_O], +[AC_REQUIRE([AC_PROG_FC_C_O])dnl +AC_LANG_PUSH([Fortran]) +AM_PROG_LANG_C_O([FC])dnl +AC_LANG_POP([Fortran]) ])