Re: AC_PROG_CC_C_O doesn't work with VC++

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

 



Hello.

On Wed, Oct 26, 2005 at 09:11:09PM +0200, Eli Zaretskii wrote:
> > the problem is this: ./configure runs
> > 	$CC -c -o conftst2.$ac_objext conftest.c
> > and then checks whether the compiler created conftst2.$ac_objext or
> > conftest$ac_objext
> > 
> > If it were "conftest2.$ac_objext" instead, and someone run
> > 	bash ./configure
> > in a DJGPP environment, the check might not work.
> 
> It _will_ work, even on 8+3 filesystems. [detailed explanation snipped]

No, the check doesn't _work_.  It just _passes_ by shere good luck.

If $CC were not able to handle -c -o correctly, and created
conftest.$ac_objext instead of conftest2.$ac_objext, ./configure
would still think that $CC handles -c -o correctly.

I committed the patch attached to this mail.

Have a nice day,
	Stepan Kasal
2005-10-27  Stepan Kasal  <kasal@xxxxxx>

	* lib/autoconf/c.m4 (AC_PROG_CC_C_O): "conftst2" -> "conftest2"
	* 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.206
diff -u -r1.206 c.m4
--- lib/autoconf/c.m4	25 Oct 2005 07:55:31 -0000	1.206
+++ lib/autoconf/c.m4	27 Oct 2005 06:10:49 -0000
@@ -576,24 +576,25 @@
 		      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([])])
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files conftst2.*"
 # 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 conftst2.$ac_objext >&AS_MESSAGE_LOG_FD'
-rm -f conftst2.*
+# (On an 8+3 filesystem, conftest2.* is not distinguishable from conftest.*,
+# thus the test always passes; but if the ./configure scripts are ever run
+# on good old DOS, it has to be with DJGPP, thus with gcc.)
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
+rm -f conftest2.*
 if AC_TRY_EVAL(ac_try) &&
-   test -f conftst2.$ac_objext && AC_TRY_EVAL(ac_try);
+   test -f conftest2.$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 conftst2.$ac_objext >&AS_MESSAGE_LOG_FD'
-      rm -f conftst2.*
+      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
+      rm -f conftest2.*
       if AC_TRY_EVAL(ac_try) &&
-	 test -f conftst2.$ac_objext && AC_TRY_EVAL(ac_try);
+	 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
       then
 	# cc works too.
 	:
@@ -606,8 +607,7 @@
 else
   eval ac_cv_prog_cc_${ac_cc}_c_o=no
 fi
-rm -f conftest* conftst2.*
-ac_clean_files=$ac_clean_files_save
+rm -f conftest*
 ])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.197
diff -u -r1.197 fortran.m4
--- lib/autoconf/fortran.m4	25 Oct 2005 07:55:31 -0000	1.197
+++ lib/autoconf/fortran.m4	27 Oct 2005 06:10:50 -0000
@@ -459,22 +459,18 @@
 AC_CACHE_CHECK([whether $[]_AC_FC[] understands -c and -o together],
                [ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o],
 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files conftst2.*"
 # 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 conftst2.$ac_objext >&AS_MESSAGE_LOG_FD'
-rm -f conftst2.*
+ac_try='$[]_AC_FC[] $[]_AC_LANG_PREFIX[]FLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
+rm -f conftest2.*
 if AC_TRY_EVAL(ac_try) &&
-     test -f conftst2.$ac_objext &&
+     test -f conftest2.$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* conftst2.*
-ac_clean_files=$ac_clean_files_save
-])
+rm -f conftest*])
 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
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux