public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] newlib: move to ../config/multi.m4 for multilib logic
@ 2022-01-21 22:23 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2022-01-21 22:23 UTC (permalink / raw)
  To: newlib-cvs

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

commit 17c2b857dc42cfe5e46d110250279f78807a3e5f
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Thu Jan 20 22:52:02 2022 -0500

    newlib: move to ../config/multi.m4 for multilib logic
    
    The current newlib 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.

Diff:
---
 newlib/Makefile.in  |  2 ++
 newlib/acinclude.m4 |  2 ++
 newlib/aclocal.m4   |  1 +
 newlib/configure    | 79 +++++++++++++++++++++++++++++++++++++----------------
 newlib/configure.ac | 21 +-------------
 5 files changed, 61 insertions(+), 44 deletions(-)

diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index 05abe50e9..a365218a5 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -100,6 +100,7 @@ subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
+	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
@@ -392,6 +393,7 @@ lpfx = @lpfx@
 machine_dir = @machine_dir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
 newlib_basedir = @newlib_basedir@
 oext = @oext@
 oldincludedir = @oldincludedir@
diff --git a/newlib/acinclude.m4 b/newlib/acinclude.m4
index bdefd9635..9e25b8589 100644
--- a/newlib/acinclude.m4
+++ b/newlib/acinclude.m4
@@ -13,6 +13,7 @@ dnl newlib directory.
 
 AC_DEFUN([NEWLIB_CONFIGURE],
 [AC_REQUIRE([DEF_NEWLIB_VERSION])
+m4_if($1, [.], [AM_ENABLE_MULTILIB(, ..)], [dnl
 dnl Default to --enable-multilib
 AC_ARG_ENABLE(multilib,
 [  --enable-multilib         build many library versions (default)],
@@ -21,6 +22,7 @@ AC_ARG_ENABLE(multilib,
   no)  multilib=no ;;
   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
  esac], [multilib=yes])dnl
+])dnl
 
 dnl Support --enable-target-optspace
 AC_ARG_ENABLE(target-optspace,
diff --git a/newlib/aclocal.m4 b/newlib/aclocal.m4
index abf45db51..3d928e199 100644
--- a/newlib/aclocal.m4
+++ b/newlib/aclocal.m4
@@ -1169,6 +1169,7 @@ 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([../libtool.m4])
 m4_include([../ltoptions.m4])
diff --git a/newlib/configure b/newlib/configure
index 2d015dbb6..0cfd83fe0 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -771,6 +771,7 @@ build
 newlib_basedir
 MAY_SUPPLY_SYSCALLS_FALSE
 MAY_SUPPLY_SYSCALLS_TRUE
+multi_basedir
 target_alias
 host_alias
 build_alias
@@ -1512,7 +1513,7 @@ Optional Features:
   --enable-newlib-retargetable-locking    Allow locking routines to be retargeted at link time
   --enable-newlib-long-time_t   define time_t to long
   --enable-newlib-use-gdtoa   Use gdtoa rather than legacy ldtoa
-  --enable-multilib         build many library versions (default)
+  --enable-multilib       build many library versions (default)
   --enable-target-optspace  optimize for space
   --enable-malloc-debugging indicate malloc debugging requested
   --enable-newlib-multithread        enable support for multiple threads
@@ -3188,17 +3189,43 @@ fi
 
 
 
+# Default to --enable-multilib
 # Check whether --enable-multilib was given.
 if test "${enable_multilib+set}" = set; then :
-  enableval=$enable_multilib; case "${enableval}" in
+  enableval=$enable_multilib; case "$enableval" in
   yes) multilib=yes ;;
   no)  multilib=no ;;
-  *)   as_fn_error $? "bad value ${enableval} for multilib option" "$LINENO" 5 ;;
+  *)   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"
+
 # Check whether --enable-target-optspace was given.
 if test "${enable_target_optspace+set}" = set; then :
   enableval=$enable_target_optspace; case "${enableval}" in
@@ -11980,7 +12007,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11983 "configure"
+#line 12010 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12086,7 +12113,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12089 "configure"
+#line 12116 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12586,12 +12613,6 @@ _ACEOF
 
 
 
-if test "${multilib}" = "yes"; then
-  multilib_arg="--enable-multilib"
-else
-  multilib_arg=
-fi
-
 if test "${newlib_iconv}" = "yes"; then
 
 $as_echo "#define _ICONV_ENABLED 1" >>confdefs.h
@@ -14182,6 +14203,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #
 # INIT-COMMANDS
 #
+
+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"
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 
 
@@ -14447,15 +14482,6 @@ fi
 
 
 
-srcdir=${srcdir}
-host=${host}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${multilib_arg} ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-newlib_basedir=${newlib_basedir}
-CC="${CC}"
-LDFLAGS="${LDFLAGS}"
-
 
 _ACEOF
 
@@ -14467,6 +14493,7 @@ do
   case $ac_config_target in
     "newlib.h") CONFIG_HEADERS="$CONFIG_HEADERS newlib.h:newlib.hin" ;;
     "_newlib_version.h") CONFIG_HEADERS="$CONFIG_HEADERS _newlib_version.h:_newlib_version.hin" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
@@ -15066,6 +15093,14 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "newlib.h":H) sed -i.tmp -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' newlib.h && rm -f newlib.h.tmp ;;
+    "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 ;;
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
@@ -15804,10 +15839,6 @@ _LT_EOF
   chmod +x "$ofile"
 
  ;;
-    "Makefile":F) if test -n "$CONFIG_FILES"; then
-  unset ac_file
-  . ${newlib_basedir}/../config-ml.in
-fi ;;
 
   esac
 done # for ac_tag
diff --git a/newlib/configure.ac b/newlib/configure.ac
index c54d2047a..b5ee6ff4f 100644
--- a/newlib/configure.ac
+++ b/newlib/configure.ac
@@ -500,12 +500,6 @@ AC_SUBST([NEWLIB_MAJOR_VERSION])
 AC_SUBST([NEWLIB_MINOR_VERSION])
 AC_SUBST([NEWLIB_PATCHLEVEL_VERSION])
 
-if test "${multilib}" = "yes"; then
-  multilib_arg="--enable-multilib"
-else
-  multilib_arg=
-fi
-
 if test "${newlib_iconv}" = "yes"; then
   AC_DEFINE(_ICONV_ENABLED, 1, [ICONV enabled.])
 fi
@@ -719,18 +713,5 @@ fi
 
 AC_SUBST(CFLAGS)
 
-AC_CONFIG_FILES([Makefile],
-[if test -n "$CONFIG_FILES"; then
-  unset ac_file
-  . ${newlib_basedir}/../config-ml.in
-fi],
-srcdir=${srcdir}
-host=${host}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${multilib_arg} ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-newlib_basedir=${newlib_basedir}
-CC="${CC}"
-LDFLAGS="${LDFLAGS}"
-)
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-21 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 22:23 [newlib-cygwin] newlib: move to ../config/multi.m4 for multilib logic Michael Frysinger

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).