public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: newlib@sourceware.org
Subject: [PATCH 2/7] newlib: libm: merge machine/ configure scripts up a level
Date: Sun, 23 Jan 2022 01:04:24 -0500	[thread overview]
Message-ID: <20220123060429.16293-3-vapier@gentoo.org> (raw)
In-Reply-To: <20220123060429.16293-1-vapier@gentoo.org>

The machine configure scripts are all effectively stub scripts that
pass the higher level options to its own makefile.  The only one doing
any custom tests was nds32.  The rest were all effectively the same as
the libm/ configure script.

So instead of recursively running configure in all of these subdirs,
generate their makefiles from the top-level configure.  For nds32,
deploy a pattern of including subdir logic via m4:
	m4_include([machine/nds32/acinclude.m4])

Even its set of checks are very small -- it does 2 preprocessor tests
and sets up 2 makefile conditionals.

Some of the generated machine makefiles have a bunch of extra stuff
added to them, but that's because they were inconsistent in their
configure libtool calls.  The top-level has it, so it exports some
new vars to the ones that weren't already.
---
 newlib/libm/Makefile.in                  |     5 +-
 newlib/libm/common/Makefile.in           |     5 +-
 newlib/libm/complex/Makefile.in          |     5 +-
 newlib/libm/configure                    |   272 +-
 newlib/libm/configure.ac                 |    26 +-
 newlib/libm/fenv/Makefile.in             |     5 +-
 newlib/libm/machine/aarch64/Makefile.am  |     3 -
 newlib/libm/machine/aarch64/Makefile.in  |   125 +-
 newlib/libm/machine/aarch64/aclocal.m4   |  1109 --
 newlib/libm/machine/aarch64/configure    |  4942 -------
 newlib/libm/machine/aarch64/configure.ac |    13 -
 newlib/libm/machine/arm/Makefile.am      |     3 -
 newlib/libm/machine/arm/Makefile.in      |   125 +-
 newlib/libm/machine/arm/aclocal.m4       |  1109 --
 newlib/libm/machine/arm/configure        |  4942 -------
 newlib/libm/machine/arm/configure.ac     |    13 -
 newlib/libm/machine/i386/Makefile.am     |     4 -
 newlib/libm/machine/i386/Makefile.in     |   101 +-
 newlib/libm/machine/i386/aclocal.m4      |  1178 --
 newlib/libm/machine/i386/configure       | 14169 ---------------------
 newlib/libm/machine/i386/configure.ac    |    23 -
 newlib/libm/machine/mips/Makefile.am     |     3 -
 newlib/libm/machine/mips/Makefile.in     |   125 +-
 newlib/libm/machine/mips/aclocal.m4      |  1109 --
 newlib/libm/machine/mips/configure       |  4942 -------
 newlib/libm/machine/mips/configure.ac    |    10 -
 newlib/libm/machine/nds32/Makefile.am    |     3 -
 newlib/libm/machine/nds32/Makefile.in    |   127 +-
 newlib/libm/machine/nds32/acinclude.m4   |    17 +
 newlib/libm/machine/nds32/aclocal.m4     |  1173 --
 newlib/libm/machine/nds32/configure      |  6066 ---------
 newlib/libm/machine/nds32/configure.ac   |    29 -
 newlib/libm/machine/powerpc/Makefile.am  |     3 -
 newlib/libm/machine/powerpc/Makefile.in  |   125 +-
 newlib/libm/machine/powerpc/aclocal.m4   |  1109 --
 newlib/libm/machine/powerpc/configure    |  4942 -------
 newlib/libm/machine/powerpc/configure.ac |    10 -
 newlib/libm/machine/pru/Makefile.am      |     3 -
 newlib/libm/machine/pru/Makefile.in      |   125 +-
 newlib/libm/machine/pru/aclocal.m4       |  1109 --
 newlib/libm/machine/pru/configure        |  4942 -------
 newlib/libm/machine/pru/configure.ac     |    10 -
 newlib/libm/machine/riscv/Makefile.am    |     3 -
 newlib/libm/machine/riscv/Makefile.in    |   125 +-
 newlib/libm/machine/riscv/aclocal.m4     |  1109 --
 newlib/libm/machine/riscv/configure      |  4942 -------
 newlib/libm/machine/riscv/configure.ac   |    10 -
 newlib/libm/machine/sparc/Makefile.am    |     3 -
 newlib/libm/machine/sparc/Makefile.in    |   125 +-
 newlib/libm/machine/sparc/aclocal.m4     |  1109 --
 newlib/libm/machine/sparc/configure      |  4942 -------
 newlib/libm/machine/sparc/configure.ac   |    10 -
 newlib/libm/machine/spu/Makefile.am      |     3 -
 newlib/libm/machine/spu/Makefile.in      |   125 +-
 newlib/libm/machine/spu/aclocal.m4       |  1109 --
 newlib/libm/machine/spu/configure        |  4942 -------
 newlib/libm/machine/spu/configure.ac     |    13 -
 newlib/libm/machine/x86_64/Makefile.am   |     3 -
 newlib/libm/machine/x86_64/Makefile.in   |   101 +-
 newlib/libm/machine/x86_64/aclocal.m4    |  1178 --
 newlib/libm/machine/x86_64/configure     | 14169 ---------------------
 newlib/libm/machine/x86_64/configure.ac  |    23 -
 newlib/libm/math/Makefile.in             |     5 +-
 newlib/libm/mathfp/Makefile.in           |     5 +-
 64 files changed, 924 insertions(+), 87289 deletions(-)
 delete mode 100644 newlib/libm/machine/aarch64/aclocal.m4
 delete mode 100755 newlib/libm/machine/aarch64/configure
 delete mode 100644 newlib/libm/machine/aarch64/configure.ac
 delete mode 100644 newlib/libm/machine/arm/aclocal.m4
 delete mode 100755 newlib/libm/machine/arm/configure
 delete mode 100644 newlib/libm/machine/arm/configure.ac
 delete mode 100644 newlib/libm/machine/i386/aclocal.m4
 delete mode 100755 newlib/libm/machine/i386/configure
 delete mode 100644 newlib/libm/machine/i386/configure.ac
 delete mode 100644 newlib/libm/machine/mips/aclocal.m4
 delete mode 100755 newlib/libm/machine/mips/configure
 delete mode 100644 newlib/libm/machine/mips/configure.ac
 create mode 100644 newlib/libm/machine/nds32/acinclude.m4
 delete mode 100644 newlib/libm/machine/nds32/aclocal.m4
 delete mode 100755 newlib/libm/machine/nds32/configure
 delete mode 100644 newlib/libm/machine/nds32/configure.ac
 delete mode 100644 newlib/libm/machine/powerpc/aclocal.m4
 delete mode 100755 newlib/libm/machine/powerpc/configure
 delete mode 100644 newlib/libm/machine/powerpc/configure.ac
 delete mode 100644 newlib/libm/machine/pru/aclocal.m4
 delete mode 100755 newlib/libm/machine/pru/configure
 delete mode 100644 newlib/libm/machine/pru/configure.ac
 delete mode 100644 newlib/libm/machine/riscv/aclocal.m4
 delete mode 100755 newlib/libm/machine/riscv/configure
 delete mode 100644 newlib/libm/machine/riscv/configure.ac
 delete mode 100644 newlib/libm/machine/sparc/aclocal.m4
 delete mode 100755 newlib/libm/machine/sparc/configure
 delete mode 100644 newlib/libm/machine/sparc/configure.ac
 delete mode 100644 newlib/libm/machine/spu/aclocal.m4
 delete mode 100644 newlib/libm/machine/spu/configure
 delete mode 100644 newlib/libm/machine/spu/configure.ac
 delete mode 100644 newlib/libm/machine/x86_64/aclocal.m4
 delete mode 100755 newlib/libm/machine/x86_64/configure
 delete mode 100644 newlib/libm/machine/x86_64/configure.ac

diff --git a/newlib/libm/configure.ac b/newlib/libm/configure.ac
index 44d3391bd60c..e4611ed846dd 100644
--- a/newlib/libm/configure.ac
+++ b/newlib/libm/configure.ac
@@ -30,20 +30,24 @@ fi
 AC_TYPE_LONG_DOUBLE
 AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
 
+dnl We have to include these unconditionally since machines might want to use
+dnl AM_CONDITIONAL in their subdirs.
+m4_include([machine/nds32/acinclude.m4])
+
 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) ;;
+    aarch64) AC_CONFIG_FILES([machine/aarch64/Makefile]) ;;
+    arm) AC_CONFIG_FILES([machine/arm/Makefile]) ;;
+    i386) AC_CONFIG_FILES([machine/i386/Makefile]) ;;
+    nds32) AC_CONFIG_FILES([machine/nds32/Makefile]) ;;
+    pru) AC_CONFIG_FILES([machine/pru/Makefile]) ;;
+    spu) AC_CONFIG_FILES([machine/spu/Makefile]) ;;
+    riscv) AC_CONFIG_FILES([machine/riscv/Makefile]) ;;
+    x86_64) AC_CONFIG_FILES([machine/x86_64/Makefile]) ;;
+    powerpc) AC_CONFIG_FILES([machine/powerpc/Makefile]) ;;
+    sparc) AC_CONFIG_FILES([machine/sparc/Makefile]) ;;
+    mips) AC_CONFIG_FILES([machine/mips/Makefile]) ;;
     *) AC_MSG_ERROR([unsupported libm_machine_dir "${libm_machine_dir}"]) ;;
   esac
 
diff --git a/newlib/libm/machine/aarch64/Makefile.am b/newlib/libm/machine/aarch64/Makefile.am
index b2ad4ecc44b4..1073ddcf944f 100644
--- a/newlib/libm/machine/aarch64/Makefile.am
+++ b/newlib/libm/machine/aarch64/Makefile.am
@@ -53,6 +53,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/arm/Makefile.am b/newlib/libm/machine/arm/Makefile.am
index b030bd157cb1..30ab57b00644 100644
--- a/newlib/libm/machine/arm/Makefile.am
+++ b/newlib/libm/machine/arm/Makefile.am
@@ -43,6 +43,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/i386/Makefile.am b/newlib/libm/machine/i386/Makefile.am
index deca873ac495..85e9a0299ef4 100644
--- a/newlib/libm/machine/i386/Makefile.am
+++ b/newlib/libm/machine/i386/Makefile.am
@@ -30,7 +30,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
-
diff --git a/newlib/libm/machine/mips/Makefile.am b/newlib/libm/machine/mips/Makefile.am
index 4fe79397c4ca..67e551ec5f63 100644
--- a/newlib/libm/machine/mips/Makefile.am
+++ b/newlib/libm/machine/mips/Makefile.am
@@ -24,6 +24,3 @@ lib_a-fenv.o: fenv.c
 
 lib_a-fenv.obj: fenv.c
 	$(COMPILE) -mno-mips16 -c -o $@ `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi`
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/nds32/Makefile.am b/newlib/libm/machine/nds32/Makefile.am
index ee3af7243e29..85da0861a2d6 100644
--- a/newlib/libm/machine/nds32/Makefile.am
+++ b/newlib/libm/machine/nds32/Makefile.am
@@ -22,6 +22,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/nds32/acinclude.m4 b/newlib/libm/machine/nds32/acinclude.m4
new file mode 100644
index 000000000000..6363df8a3c76
--- /dev/null
+++ b/newlib/libm/machine/nds32/acinclude.m4
@@ -0,0 +1,17 @@
+if test "${libm_machine_dir}" = "nds32"; then
+  dnl Use builtin macro to detect if FPU extension support is on.
+  AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
+[[#if (__NDS32_EXT_FPU_SP__)
+# error "Has nds32 FPU SP extension support"
+#endif
+]])], [has_nds32_fpu_sp="no"], [has_nds32_fpu_sp="yes"])
+
+  AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
+[[#if (__NDS32_EXT_FPU_DP__)
+# error "Has nds32 FPU DP extension support"
+#endif
+]])], [has_nds32_fpu_dp="no"], [has_nds32_fpu_dp="yes"])
+fi
+
+AM_CONDITIONAL(HAS_NDS32_FPU_SP, test "$has_nds32_fpu_sp" = "yes")
+AM_CONDITIONAL(HAS_NDS32_FPU_DP, test "$has_nds32_fpu_dp" = "yes")
diff --git a/newlib/libm/machine/powerpc/Makefile.am b/newlib/libm/machine/powerpc/Makefile.am
index bd5cf0b19c0d..353d0395d756 100644
--- a/newlib/libm/machine/powerpc/Makefile.am
+++ b/newlib/libm/machine/powerpc/Makefile.am
@@ -14,6 +14,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/pru/Makefile.am b/newlib/libm/machine/pru/Makefile.am
index d7402a6e97f1..e85e45b3f345 100644
--- a/newlib/libm/machine/pru/Makefile.am
+++ b/newlib/libm/machine/pru/Makefile.am
@@ -13,6 +13,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/riscv/Makefile.am b/newlib/libm/machine/riscv/Makefile.am
index 0b8775dff4df..38519251b42e 100644
--- a/newlib/libm/machine/riscv/Makefile.am
+++ b/newlib/libm/machine/riscv/Makefile.am
@@ -26,6 +26,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/sparc/Makefile.am b/newlib/libm/machine/sparc/Makefile.am
index 7faf09f3d185..c2b89ecd38c3 100644
--- a/newlib/libm/machine/sparc/Makefile.am
+++ b/newlib/libm/machine/sparc/Makefile.am
@@ -15,6 +15,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/spu/Makefile.am b/newlib/libm/machine/spu/Makefile.am
index 338a8cc0a5f6..1a575df95f18 100644
--- a/newlib/libm/machine/spu/Makefile.am
+++ b/newlib/libm/machine/spu/Makefile.am
@@ -33,6 +33,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/machine/x86_64/Makefile.am b/newlib/libm/machine/x86_64/Makefile.am
index 44f5b024417c..6c30f4364877 100644
--- a/newlib/libm/machine/x86_64/Makefile.am
+++ b/newlib/libm/machine/x86_64/Makefile.am
@@ -22,6 +22,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../../Makefile.shared
-
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. -I ../../../../config
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
-- 
2.34.1


  parent reply	other threads:[~2022-01-23  6:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23  6:04 [PATCH 0/7] newlib: reduce number of configure scripts Mike Frysinger
2022-01-23  6:04 ` [PATCH 1/7] newlib: libm: merge machine/ trampoline up a level Mike Frysinger
2022-01-26 15:58   ` Jon Turney
2022-01-27  2:46     ` Mike Frysinger
2022-01-27 15:28       ` Jon Turney
2022-01-28  0:37         ` Mike Frysinger
2022-01-28 14:28           ` Jon Turney
2022-01-29  4:56             ` Mike Frysinger
2022-01-23  6:04 ` Mike Frysinger [this message]
2022-01-23  6:04 ` [PATCH 3/7] newlib: libc: " Mike Frysinger
2022-01-23  6:04 ` [PATCH 4/7] newlib: libc: merge sys/ " Mike Frysinger
2022-01-23  6:04 ` [PATCH 5/7] newlib: libc: install CRT0 straight out of subdir Mike Frysinger
2022-01-23  6:04 ` [PATCH 6/7] newlib: libc: merge most sys/ configure scripts up a level Mike Frysinger
2022-01-31 16:08   ` Richard Earnshaw
2022-02-01  4:49     ` arm-eabi fails in libc/sys/arm/: No rule to make target 'lib_a-trap.o', needed by 'lib.a' Mike Frysinger
2022-02-03 16:49       ` Richard Earnshaw
2022-02-04  1:44         ` Mike Frysinger
2022-01-23  6:04 ` [PATCH 7/7] newlib: libc: merge machine/ configure scripts up a level Mike Frysinger
2022-01-25 13:58 ` [PATCH 0/7] newlib: reduce number of configure scripts Corinna Vinschen

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=20220123060429.16293-3-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=newlib@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).