[PATCH] newlib: libm: merge machine/ trampoline up a level

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
The machine/{configure,Makefile} files exist only to fan out to the
specific machine/$arch/ subdir.  We already have all that same info
in the libm/ dir itself, so by moving the recursive configure and
make calls into it, we can cut off this logic entirely and save the
overhead.

For arches that don't have a machine subdir, it means they can skip
the logic entirely.
---
 newlib/libm/Makefile.am          |     5 +-
 newlib/libm/Makefile.in          |     6 +-
 newlib/libm/common/Makefile.in   |     1 +
 newlib/libm/complex/Makefile.in  |     1 +
 newlib/libm/configure            |    63 +-
 newlib/libm/configure.ac         |    23 +-
 newlib/libm/fenv/Makefile.in     |     1 +
 newlib/libm/machine/Makefile.am  |    26 -
 newlib/libm/machine/Makefile.in  |   650 --
 newlib/libm/machine/aclocal.m4   |  1178 ---
 newlib/libm/machine/configure    | 14383 -----------------------------
 newlib/libm/machine/configure.ac |    53 -
 newlib/libm/math/Makefile.in     |     1 +
 newlib/libm/mathfp/Makefile.in   |     1 +
 14 files changed, 91 insertions(+), 16301 deletions(-)
 delete mode 100644 newlib/libm/machine/Makefile.am
 delete mode 100644 newlib/libm/machine/Makefile.in
 delete mode 100644 newlib/libm/machine/aclocal.m4
 delete mode 100755 newlib/libm/machine/configure
 delete mode 100644 newlib/libm/machine/configure.ac

diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 8d355cbf6f69..5165ff34b9c0 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -6,7 +6,10 @@ else
 MATHDIR = math
 endif
 
-SUBDIRS = $(MATHDIR) common complex fenv machine
+SUBDIRS = $(MATHDIR) common complex fenv
+if HAVE_LIBM_MACHINE_DIR
+SUBDIRS += $(LIBM_MACHINE_DIR)
+endif
 
 libm_la_LDFLAGS = -Xcompiler -nostdlib
 
diff --git a/newlib/libm/configure.ac b/newlib/libm/configure.ac
index 3f9c01e1563f..500a542f64f1 100644
--- a/newlib/libm/configure.ac
+++ b/newlib/libm/configure.ac
@@ -34,13 +34,30 @@ AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
 
 LIBM_MACHINE_LIB=
 if test -n "${libm_machine_dir}"; then
+  case ${libm_machine_dir} in
+	aarch64) AC_CONFIG_SUBDIRS(machine/aarch64) ;;
+	arm) AC_CONFIG_SUBDIRS(machine/arm) ;;
+	i386) AC_CONFIG_SUBDIRS(machine/i386) ;;
+	nds32) AC_CONFIG_SUBDIRS(machine/nds32) ;;
+	pru) AC_CONFIG_SUBDIRS(machine/pru) ;;
+	spu) AC_CONFIG_SUBDIRS(machine/spu) ;;
+	riscv) AC_CONFIG_SUBDIRS(machine/riscv) ;;
+	x86_64) AC_CONFIG_SUBDIRS(machine/x86_64) ;;
+	powerpc) AC_CONFIG_SUBDIRS(machine/powerpc) ;;
+	sparc) AC_CONFIG_SUBDIRS(machine/sparc) ;;
+	mips) AC_CONFIG_SUBDIRS(machine/mips) ;;
+	*) AC_MSG_ERROR([unsupported libm_machine_dir "${libm_machine_dir}"]) ;;
+  esac
+
+  LIBM_MACHINE_DIR=machine/${libm_machine_dir}
   if test "${use_libtool}" = "yes"; then
-    LIBM_MACHINE_LIB=machine/${libm_machine_dir}/lib${libm_machine_dir}.${aext}
+    LIBM_MACHINE_LIB=${LIBM_MACHINE_DIR}/lib${libm_machine_dir}.${aext}
   else
-    LIBM_MACHINE_LIB=machine/lib.${aext}
+    LIBM_MACHINE_LIB=${LIBM_MACHINE_DIR}/lib.${aext}
   fi
 fi
-
+AM_CONDITIONAL(HAVE_LIBM_MACHINE_DIR, test "x${LIBM_MACHINE_DIR}" != x)
+AC_SUBST(LIBM_MACHINE_DIR)
 AC_SUBST(LIBM_MACHINE_LIB)
 
 AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile fenv/Makefile])
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.