public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Michael Frysinger <vapier@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] libgloss: move to ../config/multi.m4 for multilib logic
Date: Wed,  2 Feb 2022 04:28:16 +0000 (GMT)	[thread overview]
Message-ID: <20220202042816.7FB6A385C418@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8622002ffc71ff5777a7221232ba02c7a7e7d004

commit 8622002ffc71ff5777a7221232ba02c7a7e7d004
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Jan 23 23:24:52 2022 -0500

    libgloss: move to ../config/multi.m4 for multilib logic
    
    The current libgloss multilib logic is almost exactly the same as the
    config/multi.m4, and the differences should be minor, so switch over
    to that to delete custom logic on ourside.
    
    The insertions here look larger and that's because none of the scripts
    were declaring --enable-multilib explicitly even though they checked the
    flag and changed behavior.

Diff:
---
 libgloss/aarch64/aclocal.m4            |  1 +
 libgloss/aarch64/configure             | 69 +++++++++++++++++++++++++++---
 libgloss/aarch64/configure.ac          | 11 ++---
 libgloss/aarch64/cpu-init/aclocal.m4   |  1 +
 libgloss/aarch64/cpu-init/configure    | 69 +++++++++++++++++++++++++++---
 libgloss/aarch64/cpu-init/configure.ac | 11 ++---
 libgloss/aclocal.m4                    |  1 +
 libgloss/arm/aclocal.m4                |  1 +
 libgloss/arm/configure                 | 77 +++++++++++++++++++++++++++------
 libgloss/arm/configure.ac              | 21 ++-------
 libgloss/configure                     | 78 ++++++++++++++++++++++++++--------
 libgloss/configure.ac                  | 24 +----------
 libgloss/csky/aclocal.m4               |  1 +
 libgloss/csky/configure                | 70 +++++++++++++++++++++++++++---
 libgloss/csky/configure.ac             | 12 ++----
 libgloss/i386/aclocal.m4               |  1 +
 libgloss/i386/configure                | 69 +++++++++++++++++++++++++++---
 libgloss/i386/configure.ac             | 11 ++---
 libgloss/m68k/aclocal.m4               |  1 +
 libgloss/m68k/configure                | 70 +++++++++++++++++++++++++++---
 libgloss/m68k/configure.ac             | 12 ++----
 libgloss/mcore/aclocal.m4              |  1 +
 libgloss/mcore/configure               | 69 +++++++++++++++++++++++++++---
 libgloss/mcore/configure.ac            | 11 ++---
 libgloss/mips/aclocal.m4               |  1 +
 libgloss/mips/configure                | 69 +++++++++++++++++++++++++++---
 libgloss/mips/configure.ac             | 11 ++---
 libgloss/mn10200/aclocal.m4            |  1 +
 libgloss/mn10200/configure             | 71 +++++++++++++++++++++++++++----
 libgloss/mn10200/configure.ac          | 13 ++----
 libgloss/mn10300/aclocal.m4            |  1 +
 libgloss/mn10300/configure             | 74 +++++++++++++++++++++++++++-----
 libgloss/mn10300/configure.ac          | 16 ++-----
 libgloss/moxie/aclocal.m4              |  1 +
 libgloss/moxie/configure               | 69 +++++++++++++++++++++++++++---
 libgloss/moxie/configure.ac            | 11 ++---
 libgloss/sparc/aclocal.m4              |  1 +
 libgloss/sparc/configure               | 73 ++++++++++++++++++++++++++-----
 libgloss/sparc/configure.ac            | 11 ++---
 39 files changed, 868 insertions(+), 247 deletions(-)

diff --git a/libgloss/aarch64/aclocal.m4 b/libgloss/aarch64/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/aarch64/aclocal.m4
+++ b/libgloss/aarch64/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/aarch64/configure b/libgloss/aarch64/configure
index 723862766..969a00418 100755
--- a/libgloss/aarch64/configure
+++ b/libgloss/aarch64/configure
@@ -585,6 +585,7 @@ ac_unique_file="crt0.S"
 enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 subdirs
 host_makefile_frag_path
 objtype
@@ -663,6 +664,7 @@ ac_subst_files='host_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1290,6 +1292,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2561,6 +2564,44 @@ subdirs="$subdirs cpu-init"
 
 fi
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3277,12 +3318,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3293,6 +3342,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3849,7 +3899,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
diff --git a/libgloss/aarch64/configure.ac b/libgloss/aarch64/configure.ac
index 303e51359..b26f55eca 100644
--- a/libgloss/aarch64/configure.ac
+++ b/libgloss/aarch64/configure.ac
@@ -43,12 +43,7 @@ if test -d "${srcdir}/cpu-init"; then
   AC_SUBST(subdirs)
 fi
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
+AM_ENABLE_MULTILIB(, ../..)
+
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/libgloss/aarch64/cpu-init/aclocal.m4 b/libgloss/aarch64/cpu-init/aclocal.m4
index 5ca701920..ee5abac29 100644
--- a/libgloss/aarch64/cpu-init/aclocal.m4
+++ b/libgloss/aarch64/cpu-init/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../../config/depstand.m4])
 m4_include([../../../config/lead-dot.m4])
+m4_include([../../../config/multi.m4])
 m4_include([../../../config/override.m4])
 m4_include([../../acinclude.m4])
diff --git a/libgloss/aarch64/cpu-init/configure b/libgloss/aarch64/cpu-init/configure
index c8159716a..7b03053e4 100755
--- a/libgloss/aarch64/cpu-init/configure
+++ b/libgloss/aarch64/cpu-init/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="Makefile.in"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 host_makefile_frag_path
 CCASFLAGS
 CCAS
@@ -660,6 +661,7 @@ ac_subst_files='host_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1287,6 +1289,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2540,6 +2543,44 @@ host_makefile_frag_path=$host_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  fi
+else
+  multi_basedir="$srcdir/../../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3256,12 +3297,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3272,6 +3321,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3828,7 +3878,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
diff --git a/libgloss/aarch64/cpu-init/configure.ac b/libgloss/aarch64/cpu-init/configure.ac
index 91aa2211d..91f9c709a 100644
--- a/libgloss/aarch64/cpu-init/configure.ac
+++ b/libgloss/aarch64/cpu-init/configure.ac
@@ -28,12 +28,7 @@ host_makefile_frag_path=$host_makefile_frag
 AC_SUBST(host_makefile_frag_path)
 AC_SUBST_FILE(host_makefile_frag)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
+AM_ENABLE_MULTILIB(, ../../..)
+
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/libgloss/aclocal.m4 b/libgloss/aclocal.m4
index 3b8142a4b..6f7b7f7a7 100644
--- a/libgloss/aclocal.m4
+++ b/libgloss/aclocal.m4
@@ -1133,5 +1133,6 @@ AC_SUBST([am__untar])
 
 m4_include([../config/depstand.m4])
 m4_include([../config/lead-dot.m4])
+m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
 m4_include([acinclude.m4])
diff --git a/libgloss/arm/aclocal.m4 b/libgloss/arm/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/arm/aclocal.m4
+++ b/libgloss/arm/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/arm/configure b/libgloss/arm/configure
index bfa8bdb3d..8e3866b56 100755
--- a/libgloss/arm/configure
+++ b/libgloss/arm/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="redboot-crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 subdirs
 host_makefile_frag_path
 objtype
@@ -665,6 +666,7 @@ ac_user_opts='
 enable_option_checking
 enable_newlib_supplied_syscalls
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1293,6 +1295,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2587,6 +2590,44 @@ if test -d "${srcdir}/cpu-init"; then
 
 fi
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3303,18 +3344,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-  target=${target}
-  with_multisubdir=${with_multisubdir}
-  ac_configure_args="${ac_configure_args} --enable-multilib"
-  CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3326,6 +3369,7 @@ do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "cpu-init/Makefile") CONFIG_FILES="$CONFIG_FILES cpu-init/Makefile" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3882,8 +3926,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "cpu-init/Makefile":F) . ${srcdir}/../../config-ml.in ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
@@ -3922,4 +3972,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
diff --git a/libgloss/arm/configure.ac b/libgloss/arm/configure.ac
index 806020b04..2b98b5453 100644
--- a/libgloss/arm/configure.ac
+++ b/libgloss/arm/configure.ac
@@ -62,24 +62,11 @@ AC_SUBST_FILE(host_makefile_frag)
 # Configure cpu init plug-ins
 if test -d "${srcdir}/cpu-init"; then
   subdirs="${subdirs} cpu-init"
-  AC_CONFIG_FILES(cpu-init/Makefile,
-  . ${srcdir}/../../config-ml.in,
-  srcdir=${srcdir}
-  target=${target}
-  with_multisubdir=${with_multisubdir}
-  ac_configure_args="${ac_configure_args} --enable-multilib"
-  CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-  )
+  AC_CONFIG_FILES([cpu-init/Makefile])
   AC_SUBST(subdirs)
 fi
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
-AC_OUTPUT
+AM_ENABLE_MULTILIB(, ../..)
 
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libgloss/configure b/libgloss/configure
index d197679ac..3fc20d6a2 100755
--- a/libgloss/configure
+++ b/libgloss/configure
@@ -587,6 +587,7 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+multi_basedir
 target_makefile_frag_path
 host_makefile_frag_path
 CPP
@@ -697,6 +698,7 @@ ac_user_opts='
 enable_option_checking
 enable_silent_rules
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1345,6 +1347,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -4791,13 +4794,44 @@ target_makefile_frag_path=$target_makefile_frag
 
 
 
-if test "${multilib}" = "yes"; then
-  multilib_arg="--enable-multilib"
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
 else
-  multilib_arg=
+  multilib=yes
 fi
 
-# for now, only add multilibs for specific targets
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop.."
+  fi
+else
+  multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -5520,15 +5554,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-host=${host}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="--enable-multilib ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-CC="${CC}"
-LDFLAGS=${LDFLAGS}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -5578,6 +5617,7 @@ do
     "nios2/Makefile") CONFIG_FILES="$CONFIG_FILES nios2/Makefile" ;;
     "libnosys/Makefile") CONFIG_FILES="$CONFIG_FILES libnosys/Makefile" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -6306,10 +6346,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) if test -n "$CONFIG_FILES"; then
-  unset ac_file
-  . ${srcdir}/../config-ml.in
-fi ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
@@ -6493,5 +6537,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
-
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index c65a3655a..ac812c69b 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -330,27 +330,7 @@ target_makefile_frag_path=$target_makefile_frag
 AC_SUBST(target_makefile_frag_path)
 AC_SUBST_FILE(target_makefile_frag)
 
-if test "${multilib}" = "yes"; then
-  multilib_arg="--enable-multilib"
-else
-  multilib_arg=
-fi
+AM_ENABLE_MULTILIB(, ..)
 
-# for now, only add multilibs for specific targets
-AC_CONFIG_FILES([Makefile],
-[if test -n "$CONFIG_FILES"; then
-  unset ac_file
-  . ${srcdir}/../config-ml.in
-fi],
-srcdir=${srcdir}
-target=${target}
-host=${host}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="--enable-multilib ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-CC="${CC}"
-LDFLAGS=${LDFLAGS}
-)
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
-
-
diff --git a/libgloss/csky/aclocal.m4 b/libgloss/csky/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/csky/aclocal.m4
+++ b/libgloss/csky/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/csky/configure b/libgloss/csky/configure
index 672876a35..98ca17fa4 100755
--- a/libgloss/csky/configure
+++ b/libgloss/csky/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 target_makefile_frag_path
 host_makefile_frag_path
 DO
@@ -670,6 +671,7 @@ target_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1303,6 +1305,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -3577,6 +3580,44 @@ target_makefile_frag_path=$target_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -4293,12 +4334,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -4309,6 +4358,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -4865,7 +4915,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
@@ -4904,4 +4961,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
diff --git a/libgloss/csky/configure.ac b/libgloss/csky/configure.ac
index 0387ea46b..bb9a9195d 100644
--- a/libgloss/csky/configure.ac
+++ b/libgloss/csky/configure.ac
@@ -65,13 +65,7 @@ target_makefile_frag_path=$target_makefile_frag
 AC_SUBST(target_makefile_frag_path)
 AC_SUBST_FILE(target_makefile_frag)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
-AC_OUTPUT
+AM_ENABLE_MULTILIB(, ../..)
 
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libgloss/i386/aclocal.m4 b/libgloss/i386/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/i386/aclocal.m4
+++ b/libgloss/i386/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/i386/configure b/libgloss/i386/configure
index 81026b7de..9f9e02bdf 100755
--- a/libgloss/i386/configure
+++ b/libgloss/i386/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="cygmon-salib.c"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 host_makefile_frag_path
 CCASFLAGS
 CCAS
@@ -663,6 +664,7 @@ ac_subst_files='host_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1290,6 +1292,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2555,6 +2558,44 @@ host_makefile_frag_path=$host_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3271,12 +3312,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3287,6 +3336,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3843,7 +3893,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
diff --git a/libgloss/i386/configure.ac b/libgloss/i386/configure.ac
index 895e4476e..e03620770 100644
--- a/libgloss/i386/configure.ac
+++ b/libgloss/i386/configure.ac
@@ -53,12 +53,7 @@ host_makefile_frag_path=$host_makefile_frag
 AC_SUBST(host_makefile_frag_path)
 AC_SUBST_FILE(host_makefile_frag)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
+AM_ENABLE_MULTILIB(, ../..)
+
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/libgloss/m68k/aclocal.m4 b/libgloss/m68k/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/m68k/aclocal.m4
+++ b/libgloss/m68k/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/m68k/configure b/libgloss/m68k/configure
index 2b3e5682c..2a9d3f2ae 100755
--- a/libgloss/m68k/configure
+++ b/libgloss/m68k/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 target_makefile_frag_path
 host_makefile_frag_path
 DO
@@ -670,6 +671,7 @@ target_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1303,6 +1305,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -3577,6 +3580,44 @@ target_makefile_frag_path=$target_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -4293,12 +4334,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -4309,6 +4358,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -4865,7 +4915,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
@@ -4904,4 +4961,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
diff --git a/libgloss/m68k/configure.ac b/libgloss/m68k/configure.ac
index 53615ffc6..de35d7934 100644
--- a/libgloss/m68k/configure.ac
+++ b/libgloss/m68k/configure.ac
@@ -65,13 +65,7 @@ target_makefile_frag_path=$target_makefile_frag
 AC_SUBST(target_makefile_frag_path)
 AC_SUBST_FILE(target_makefile_frag)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
-AC_OUTPUT
+AM_ENABLE_MULTILIB(, ../..)
 
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libgloss/mcore/aclocal.m4 b/libgloss/mcore/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/mcore/aclocal.m4
+++ b/libgloss/mcore/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/mcore/configure b/libgloss/mcore/configure
index 62f9f6926..840f4a959 100755
--- a/libgloss/mcore/configure
+++ b/libgloss/mcore/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 host_makefile_frag_path
 bsp_prefix
 CCASFLAGS
@@ -661,6 +662,7 @@ ac_subst_files='host_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1288,6 +1290,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2552,6 +2555,44 @@ host_makefile_frag_path=$host_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3268,12 +3309,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3284,6 +3333,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3840,7 +3890,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
diff --git a/libgloss/mcore/configure.ac b/libgloss/mcore/configure.ac
index a314d4ee3..f6b3f0096 100644
--- a/libgloss/mcore/configure.ac
+++ b/libgloss/mcore/configure.ac
@@ -39,12 +39,7 @@ host_makefile_frag_path=$host_makefile_frag
 AC_SUBST(host_makefile_frag_path)
 AC_SUBST_FILE(host_makefile_frag)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
+AM_ENABLE_MULTILIB(, ../..)
+
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/libgloss/mips/aclocal.m4 b/libgloss/mips/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/mips/aclocal.m4
+++ b/libgloss/mips/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/mips/configure b/libgloss/mips/configure
index 2026f0aef..8b035f427 100755
--- a/libgloss/mips/configure
+++ b/libgloss/mips/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 pcrt0
 crt0
 bsp_list
@@ -668,6 +669,7 @@ target_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1295,6 +1297,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2604,6 +2607,44 @@ target_makefile_frag_path=$target_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3320,12 +3361,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3336,6 +3385,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3892,7 +3942,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
diff --git a/libgloss/mips/configure.ac b/libgloss/mips/configure.ac
index a609233a6..ca99c7287 100644
--- a/libgloss/mips/configure.ac
+++ b/libgloss/mips/configure.ac
@@ -97,12 +97,7 @@ AC_SUBST(bsp_list)
 AC_SUBST(crt0)
 AC_SUBST(pcrt0)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
+AM_ENABLE_MULTILIB(, ../..)
+
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/libgloss/mn10200/aclocal.m4 b/libgloss/mn10200/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/mn10200/aclocal.m4
+++ b/libgloss/mn10200/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/mn10200/configure b/libgloss/mn10200/configure
index 728c774fe..401064ff3 100755
--- a/libgloss/mn10200/configure
+++ b/libgloss/mn10200/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 part_specific_obj
 target_makefile_frag_path
 host_makefile_frag_path
@@ -663,6 +664,7 @@ target_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1290,6 +1292,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2554,6 +2557,44 @@ target_makefile_frag_path=$target_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3270,12 +3311,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3286,6 +3335,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3842,7 +3892,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
@@ -3881,5 +3938,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
-
diff --git a/libgloss/mn10200/configure.ac b/libgloss/mn10200/configure.ac
index 70dbd49d9..d5a0cc87a 100644
--- a/libgloss/mn10200/configure.ac
+++ b/libgloss/mn10200/configure.ac
@@ -52,14 +52,7 @@ AC_SUBST(target_makefile_frag_path)
 AC_SUBST_FILE(target_makefile_frag)
 AC_SUBST(part_specific_obj)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
-AC_OUTPUT
-
+AM_ENABLE_MULTILIB(, ../..)
 
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libgloss/mn10300/aclocal.m4 b/libgloss/mn10300/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/mn10300/aclocal.m4
+++ b/libgloss/mn10300/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/mn10300/configure b/libgloss/mn10300/configure
index 971885587..4ddb539fa 100755
--- a/libgloss/mn10300/configure
+++ b/libgloss/mn10300/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 bsp_list
 script_list
 part_specific_obj
@@ -665,6 +666,7 @@ target_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1292,6 +1294,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2565,6 +2568,44 @@ target_makefile_frag_path=$target_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3281,12 +3322,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3297,6 +3346,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3853,10 +3903,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) if test -n "$CONFIG_FILES"; then
-  unset ac_file
-  . ${srcdir}/../../config-ml.in
-fi ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
@@ -3895,5 +3949,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
-
diff --git a/libgloss/mn10300/configure.ac b/libgloss/mn10300/configure.ac
index 9526576b0..88af0f948 100644
--- a/libgloss/mn10300/configure.ac
+++ b/libgloss/mn10300/configure.ac
@@ -61,17 +61,7 @@ AC_SUBST(part_specific_obj)
 AC_SUBST(script_list)
 AC_SUBST(bsp_list)
 
-AC_CONFIG_FILES([Makefile],
-[if test -n "$CONFIG_FILES"; then
-  unset ac_file
-  . ${srcdir}/../../config-ml.in
-fi],
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
-AC_OUTPUT
-
+AM_ENABLE_MULTILIB(, ../..)
 
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libgloss/moxie/aclocal.m4 b/libgloss/moxie/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/moxie/aclocal.m4
+++ b/libgloss/moxie/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/moxie/configure b/libgloss/moxie/configure
index db77f070a..5ce3f34a5 100755
--- a/libgloss/moxie/configure
+++ b/libgloss/moxie/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="crt0.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 host_makefile_frag_path
 BUILD_CRT0_FALSE
 BUILD_CRT0_TRUE
@@ -662,6 +663,7 @@ ac_subst_files='host_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1289,6 +1291,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2557,6 +2560,44 @@ host_makefile_frag_path=$host_makefile_frag
 
 
 
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
@@ -3273,12 +3314,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3289,6 +3338,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3845,7 +3895,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "Makefile":F) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
diff --git a/libgloss/moxie/configure.ac b/libgloss/moxie/configure.ac
index baf66ef49..f09d72b77 100644
--- a/libgloss/moxie/configure.ac
+++ b/libgloss/moxie/configure.ac
@@ -44,12 +44,7 @@ host_makefile_frag_path=$host_makefile_frag
 AC_SUBST(host_makefile_frag_path)
 AC_SUBST_FILE(host_makefile_frag)
 
-AC_CONFIG_FILES(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
+AM_ENABLE_MULTILIB(, ../..)
+
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/libgloss/sparc/aclocal.m4 b/libgloss/sparc/aclocal.m4
index 24271f381..fab8217a4 100644
--- a/libgloss/sparc/aclocal.m4
+++ b/libgloss/sparc/aclocal.m4
@@ -379,5 +379,6 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 m4_include([../../config/depstand.m4])
 m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
 m4_include([../acinclude.m4])
diff --git a/libgloss/sparc/configure b/libgloss/sparc/configure
index d4da11635..1a1e6a01a 100755
--- a/libgloss/sparc/configure
+++ b/libgloss/sparc/configure
@@ -585,6 +585,7 @@ ac_unique_file="sparc-stub.c"
 enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+multi_basedir
 CYGMONLDSCRIPTTEMPL
 target_makefile_frag_path
 host_makefile_frag_path
@@ -666,6 +667,7 @@ target_makefile_frag'
 ac_user_opts='
 enable_option_checking
 enable_dependency_tracking
+enable_multilib
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1288,6 +1290,7 @@ Optional Features:
                           do not reject slow dependency extractors
   --disable-dependency-tracking
                           speeds up one-time build
+  --enable-multilib       build many library versions (default)
 
 Some influential environment variables:
   CCAS        assembler compiler command (defaults to CC)
@@ -2554,9 +2557,45 @@ target_makefile_frag_path=$target_makefile_frag
 
 
 
-ac_config_files="$ac_config_files Makefile"
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  fi
+else
+  multi_basedir="$srcdir/../.."
+fi
 
-ac_config_commands="$ac_config_commands default"
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
+ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -3272,12 +3311,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
 
 _ACEOF
 
@@ -3288,8 +3335,8 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -3845,7 +3892,14 @@ $as_echo X"$file" |
   done
 }
  ;;
-    "default":C) . ${srcdir}/../../config-ml.in ;;
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
 
   esac
 done # for ac_tag
@@ -4029,4 +4083,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
diff --git a/libgloss/sparc/configure.ac b/libgloss/sparc/configure.ac
index 9a9b987da..56049d5b9 100644
--- a/libgloss/sparc/configure.ac
+++ b/libgloss/sparc/configure.ac
@@ -58,12 +58,7 @@ AC_SUBST(target_makefile_frag_path)
 AC_SUBST_FILE(target_makefile_frag)
 AC_SUBST(CYGMONLDSCRIPTTEMPL)
 
-AC_OUTPUT(Makefile,
-. ${srcdir}/../../config-ml.in,
-srcdir=${srcdir}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${ac_configure_args} --enable-multilib"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-)
+AM_ENABLE_MULTILIB(, ../..)
 
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT


                 reply	other threads:[~2022-02-02  4:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220202042816.7FB6A385C418@sourceware.org \
    --to=vapier@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).