This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix 2.64 fopen glitch, disable option checking (was: [PATCH 4/N] The big bump)


Suggested patch to avoid the 2.64 glitch, and to disable option checking
in the top level.  This patch could be applied right now, as with 2.59,
all it does is add white space to the toplevel configure script.

With 2.64 and up, the AC_DISABLE_OPTION_CHECKING avoids warnings about
 --enable-*, --disable-*, --with-* and --without-*
switches passed in by the user and unknown to the toplevel configure
script.  Note that with this patch, subdirectory configure scripts may
still warn about unknown switches.  We could easily avoid that across
the whole tree by letting just the toplevel pass
--disable-option-checking to each sub configure script invoked, e.g.,
by adding it to $baseargs in configure.ac.  Do you want that?  If yes,
OK to just squash it in with this patch?  (2.59 scripts will ignore
the argument.)

With exactly 2.64, this patch changes the AC_PROG_{CC,CXX,FC,F77}
expansions used throughout the tree to avoid trying out fopen in the
test for whether the compiler works and we don't cross compile.  The
diff for the toplevel configure script looks like this:

| --- b/configure
| +++ a/configure
| @@ -3897,12 +3897,10 @@ done
|  
|  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|  /* end confdefs.h.  */
| -#include <stdio.h>
| +
|  int
|  main ()
|  {
| -FILE *f = fopen ("conftest.out", "w");
| - return ferror (f) || fclose (f) != 0;
|  
|    ;
|    return 0;

This change ought to fix build for AVR and RTEMS and maybe other
embedded architectures that do not provide a hosted C implementation
by default; OTOH, it re-opens a small bug for hybrid systems like
BlueGene in that configure falsely assumes non-cross-compiling there
unless you pass both --build and --host correctly.

See these threads for the corresponding bug reports and discussions:
<http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/6839>
<http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/6656>

Wrt. also overriding the things for the other languages, I'm not sure
that's ever necessary, but it can't hurt to play safe here.

OK to commit to GCC and src right away?

Thanks,
Ralf

Disable option checking in the toplevel, avoid 2.64 fopen glitch.

ChangeLog:
2009-08-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* configure.ac: Call AC_DISABLE_OPTION_CHECKING.
	* configure: Regenerate.

config/ChangeLog:
2009-08-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* override.m4 (AC_DISABLE_OPTION_CHECKING): Define to be
	empty if not defined, to avoid error with 2.59.
	(_AC_LANG_IO_PROGRAM): When the Autoconf version is exactly
	2.64, avoid per-language instances to drop fopen from test
	program.

diff --git a/config/override.m4 b/config/override.m4
index bf112db..a10146f 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -58,6 +58,19 @@ m4_define([AC_INIT], m4_defn([AC_INIT])[
 _GCC_AUTOCONF_VERSION_CHECK
 ])
 
+
+dnl Turn AC_DISABLE_OPTION_CHECKING into a no-op if not defined.
+m4_ifndef([AC_DISABLE_OPTION_CHECKING],
+  [m4_define([AC_DISABLE_OPTION_CHECKING])])
+
+
+dnl Fix 2.64 cross compile detection for AVR and RTEMS
+dnl by not trying to compile fopen.
+m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64],
+  [m4_foreach([_GCC_LANG], [C, C++, Fortran, Fortran 77],
+     [m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])])
+
+
 m4_version_prereq([2.60],, [
 dnl We use $ac_pwd in some of the overrides below; ensure its definition
 m4_divert_push([PARSE_ARGS])dnl
diff --git a/configure.ac b/configure.ac
index dcd9ced..2e07713 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,7 @@ m4_include(config/proginstall.m4)
 
 AC_INIT(move-if-change)
 AC_PREREQ(2.59)
+AC_DISABLE_OPTION_CHECKING
 
 progname=$0
 # if PWD already has a value, it is probably wrong.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]