Re: autoconf will accept a nonexistent compiler as the second one checked

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

 



Hello,

On Mon, Mar 20, 2006 at 05:02:52PM +0100, Ralf Wildenhues wrote:
> * Martin Michlmayr wrote on Mon, Mar 20, 2006 at 02:15:34PM CET:
> > Well, I think in this case some more sanity checks are justified

yes, you are right, we should do the check ``whether FOO compiler works''
again for each language.

I prepared the following patch.  (Be sure to update your CVS checkout
before applying it.)

Have a nice fortnight,
	Stepan
2006-04-01  Stepan Kasal  <kasal@xxxxxx>

	* lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC): Call
	  _AC_COMPILER_EXEEXT instead of m4_expand_once([_AC_COMPILER_EXEEXT])
	* lib/autoconf/fortran.m4 (_AC_PROG_FC): Likewise.
	* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_TESTS): On subsequent
	  calls, for a new language, only check that the compiler works.
	(AC_NO_EXECUTABLES): Change the redefinition of
	  _AC_COMPILER_EXEEXT_TESTS so that on subsequent calls, it checks
	  that the new language's compiler works if ac_no_link=no, and
	  does nothing otherwise.

Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.215
diff -u -r1.215 c.m4
--- lib/autoconf/c.m4	1 Apr 2006 21:45:13 -0000	1.215
+++ lib/autoconf/c.m4	1 Apr 2006 22:03:25 -0000
@@ -547,7 +547,7 @@
 _AC_EVAL([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
 _AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
 
-m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+_AC_COMPILER_EXEEXT
 _AC_LANG_COMPILER_GNU
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 _AC_PROG_CC_G
@@ -782,7 +782,7 @@
 _AC_EVAL([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
 _AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
 
-m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+_AC_COMPILER_EXEEXT
 _AC_LANG_COMPILER_GNU
 GXX=`test $ac_compiler_gnu = yes && echo yes`
 _AC_PROG_CXX_G
@@ -951,7 +951,7 @@
 _AC_EVAL([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
 _AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
 
-m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+_AC_COMPILER_EXEEXT
 _AC_LANG_COMPILER_GNU
 GOBJC=`test $ac_compiler_gnu = yes && echo yes`
 _AC_PROG_OBJC_G
Index: lib/autoconf/fortran.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v
retrieving revision 1.203
diff -u -r1.203 fortran.m4
--- lib/autoconf/fortran.m4	1 Apr 2006 21:45:13 -0000	1.203
+++ lib/autoconf/fortran.m4	1 Apr 2006 22:03:26 -0000
@@ -369,7 +369,7 @@
 _AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
 rm -f a.out
 
-m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+_AC_COMPILER_EXEEXT
 # If we don't use `.F' as extension, the preprocessor is not run on the
 # input file.  (Note that this only needs to work for GNU compilers.)
 ac_save_ext=$ac_ext
Index: lib/autoconf/lang.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v
retrieving revision 1.176
diff -u -r1.176 lang.m4
--- lib/autoconf/lang.m4	1 Apr 2006 21:45:13 -0000	1.176
+++ lib/autoconf/lang.m4	1 Apr 2006 22:03:27 -0000
@@ -379,22 +379,25 @@
 AC_BEFORE([$0], [AC_LINK_IFELSE])
 
 m4_define([_AC_COMPILER_EXEEXT_TESTS],
-[if AC_TRY_EVAL(ac_link); then
-  ac_no_link=no
+[m4_expand_once([
+   if AC_TRY_EVAL(ac_link); then
+     ac_no_link=no
+   else
+     ac_no_link=yes
+     # Setting cross_compile will disable run tests; it will
+     # also disable AC_CHECK_FILE but that's generally
+     # correct if we can't link.
+     cross_compiling=yes
+     EXEEXT=
+     _AC_COMPILER_EXEEXT_CROSS
+   fi])
+if test $ac_no_link = no; then
   ]m4_defn([_AC_COMPILER_EXEEXT_TESTS])[
-else
-  ac_no_link=yes
-  # Setting cross_compile will disable run tests; it will
-  # also disable AC_CHECK_FILE but that's generally
-  # correct if we can't link.
-  cross_compiling=yes
-  EXEEXT=
-  _AC_COMPILER_EXEEXT_CROSS
 fi
 ])
 
 m4_define([AC_LINK_IFELSE],
-[if test x$ac_no_link = xyes; then
+[if test $ac_no_link = yes; then
   AC_MSG_ERROR([Link tests are not allowed after AC@&t@_NO_EXECUTABLES.])
 fi
 ]m4_defn([AC_LINK_IFELSE]))
@@ -566,8 +569,9 @@
 # This macro is modified by the AC_NO_EXECUTABLES hack.
 m4_define([_AC_COMPILER_EXEEXT_TESTS],
 [_AC_COMPILER_EXEEXT_DEFAULT
-_AC_COMPILER_EXEEXT_CROSS
-_AC_COMPILER_EXEEXT_O])
+ m4_expand_once([_AC_COMPILER_EXEEXT_CROSS
+   _AC_COMPILER_EXEEXT_O])
+])
 
 
 # _AC_COMPILER_EXEEXT
@@ -607,7 +611,7 @@
 
 ac_clean_files=$ac_clean_files_save
 
-_AC_COMPILER_OBJEXT
+m4_expand_once([_AC_COMPILER_OBJEXT])
 
 rm -f conftest.*
 ])# _AC_COMPILER_EXEEXT
_______________________________________________
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