This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[libstdc++] Re: Surprising behavior of AM_CONDITIONAL
- From: Phil Edwards <phil at jaj dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 9 Jun 2003 10:54:34 -0400
- Subject: [libstdc++] Re: Surprising behavior of AM_CONDITIONAL
- References: <20030605181701.GA23876@disaster.jaj.com> <d9u1b4xpin.fsf@cs.umn.edu> <20030605203019.GA25435@disaster.jaj.com> <d9smqokz4o.fsf@cs.umn.edu> <20030605212207.GA25880@disaster.jaj.com>
On Thu, Jun 05, 2003 at 05:22:07PM -0400, Phil Edwards wrote:
> On Thu, Jun 05, 2003 at 04:12:07PM -0500, Raja R Harinath wrote:
> > In principle, even with this feature, your other suggestion of moving
> > all AM_CONDITIONALs to the toplevel seems better, even though you
> > lose some locality of reference.
>
> Upon investigation, only three of the AM_CONDITIONAL statements are in
> paths that aren't unconditionally traversed. So it's not as bad as I feared.
> I'm testing a patch now.
And here it is. Tested by targeting mips-elf from x86-linux; this gets
the number of v3 testsuite failures down from freaking insane to merely
ridiculous, by fixing (e.g.) all the wchar-related misdiagnoses.
2003-06-09 Phil Edwards <pme@gcc.gnu.org>
* acinclude.m4: Move all AM_CONDITIONAL calls out.
(GLIBCPP_CONFIGURE): Set defaults for variables used in AM_CONDITIONAL
statements.
* configure.in: Centralize AM_CONDITIONALs so that they are always
run. Make use of GLIBCPP_IS_CROSS_COMPILING.
* aclocal.m4, configure: Regenerated.
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.240
diff -u -3 -p -r1.240 acinclude.m4
--- acinclude.m4 5 Jun 2003 22:22:07 -0000 1.240
+++ acinclude.m4 9 Jun 2003 14:50:42 -0000
@@ -202,6 +202,18 @@ AC_DEFUN(GLIBCPP_CONFIGURE, [
*) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
esac
+ # Set up safe default values for all subsequent AM_CONDITIONAL tests.
+ need_libmath=no
+ enable_wchar_t=no
+ #enable_debug=no
+ #need_libio=no
+ #need_wlibio=no
+ #glibcpp_pch_comp=no
+ #enable_cheaders=c
+ #c_compatibility=no
+ enable_abi_check=no
+ #enable_symvers=no
+
# Find platform-specific directories containing configuration info. In
# addition to possibly modifying the same flags, it also sets up symlinks.
GLIBCPP_CHECK_HOST
@@ -849,7 +861,9 @@ dnl Define USE_COMPLEX_LONG_DOUBLE etc i
dnl
dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
- dnl Check for complex versions of math functions of platform.
+ dnl Check for complex versions of math functions of platform. This will
+ dnl always pass if libm is available, and fail if it isn't. If it is
+ dnl available, we assume we'll need it later, so add it to LIBS.
AC_CHECK_LIB(m, main)
AC_REPLACE_MATHFUNCS(nan copysignf)
@@ -869,7 +883,6 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPP
need_libmath=yes
fi
AC_SUBST(LIBMATHOBJS)
- AM_CONDITIONAL(GLIBCPP_BUILD_LIBMATH, test "$need_libmath" = yes)
])
@@ -896,7 +909,6 @@ dnl
dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
dnl Wide characters disabled by default.
- enable_wchar_t=no
dnl Test wchar.h for mbstate_t, which is needed for char_traits and
dnl others even if wchar_t support is not on.
@@ -995,7 +1007,6 @@ AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT,
fi
AC_MSG_CHECKING([for enabled wchar_t specializations])
AC_MSG_RESULT($enable_wchar_t)
- AM_CONDITIONAL(GLIBCPP_TEST_WCHAR_T, test "$enable_wchar_t" = yes)
])
@@ -2132,15 +2143,11 @@ AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
baseline_file="${glibcpp_srcdir}/config/abi/${abi_baseline_triplet}/baseline_symbols.txt"
AC_SUBST(baseline_file)
+ dnl XXX move to configure.host?
case "$target" in
*-*-cygwin* ) enable_abi_check=no ;;
* ) enable_abi_check=yes ;;
esac
-
- # Don't do ABI checking unless native.
- AM_CONDITIONAL(GLIBCPP_BUILD_ABI_CHECK,
- test x"$build" = x"$host" && test -z "$with_cross_host" \
- && test "$enable_abi_check" = yes )
])
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.in,v
retrieving revision 1.126
diff -u -3 -p -r1.126 configure.in
--- configure.in 23 May 2003 02:31:07 -0000 1.126
+++ configure.in 9 Jun 2003 14:50:43 -0000
@@ -81,7 +81,7 @@ fi
if test x"$build" != x"$host"; then
# We are being configured with some form of cross compiler.
- GLIBCPP_IS_CROSS_COMPILING=1
+ GLIBCPP_IS_CROSS_COMPILING=true
# This lets us hard-code the functionality we know we'll have in the cross
# target environment. "Let" is a sugar-coated word placed on an especially
@@ -401,7 +401,7 @@ else
# We are being configured natively. We can do more elaborate tests
# that include AC_TRY_COMPILE now, as the linker is assumed to be
# working.
- GLIBCPP_IS_CROSS_COMPILING=0
+ GLIBCPP_IS_CROSS_COMPILING=false
CANADIAN=no
# Check for available headers.
@@ -447,9 +447,17 @@ ATOMICITY_INC_SRCDIR=config/${ATOMICITYH
AC_SUBST(OS_INC_SRCDIR)
AC_SUBST(ATOMICITY_INC_SRCDIR)
-# Set up cross-compile flags
-AC_SUBST(GLIBCPP_IS_CROSS_COMPILING) dnl Unused so far.
+# Set up cross-compile flags and all AM_CONDITIONALs.
+AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
+dnl from GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT:
+AM_CONDITIONAL(GLIBCPP_BUILD_LIBMATH, test "$need_libmath" = yes)
+dnl from GLIBCPP_CHECK_WCHAR_T_SUPPORT:
+AM_CONDITIONAL(GLIBCPP_TEST_WCHAR_T, test "$enable_wchar_t" = yes)
+dnl from GLIBCPP_CONFIGURE_TESTSUITE:
+# Don't do ABI checking unless native.
+AM_CONDITIONAL(GLIBCPP_BUILD_ABI_CHECK,
+ ${GLIBCPP_IS_CROSS_COMPILING} && test "$enable_abi_check" = yes )
AC_CACHE_SAVE