[PATCH 5/5] libgloss: merge arm configure script up a level

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Move the minor arm-specific logic to a dedicated variable so we can
merge its configure logic up a level.
---
 libgloss/Makefile.in              |   13 +-
 libgloss/arm/Makefile.in          |   49 +-
 libgloss/arm/acinclude.m4         |   20 +
 libgloss/arm/aclocal.m4           |  546 ----
 libgloss/arm/configure            | 4813 -----------------------------
 libgloss/arm/configure.ac         |   72 -
 libgloss/arm/cpu-init/Makefile.in |    7 +-
 libgloss/configure                |  207 +-
 libgloss/configure.ac             |   14 +-
 9 files changed, 98 insertions(+), 5643 deletions(-)
 create mode 100644 libgloss/arm/acinclude.m4
 delete mode 100644 libgloss/arm/aclocal.m4
 delete mode 100755 libgloss/arm/configure
 delete mode 100644 libgloss/arm/configure.ac

diff --git a/libgloss/arm/Makefile.in b/libgloss/arm/Makefile.in
index 5dab75f750b2..06fae10c1fca 100644
--- a/libgloss/arm/Makefile.in
+++ b/libgloss/arm/Makefile.in
@@ -3,6 +3,7 @@
 DESTDIR =
 VPATH = @srcdir@ @srcdir@/..
 srcdir = @srcdir@
+abs_srcdir = @abs_srcdir@
 objdir = .
 srcroot = $(srcdir)/../..
 objroot = $(objdir)/../..
@@ -17,7 +18,7 @@ bindir = @bindir@
 libdir = @libdir@
 tooldir = $(exec_prefix)/$(target_alias)
 
-objtype = @objtype@
+objtype = @ARM_OBJTYPE@
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -43,8 +44,6 @@ AR = @AR@
 LD = @LD@
 RANLIB = @RANLIB@
 
-SUBDIRS = @subdirs@
-
 OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
 	then echo ${objroot}/../binutils/objdump ; \
 	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
@@ -52,10 +51,10 @@ OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
 	then echo ${objroot}/../binutils/objcopy ; \
 	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
 
-@BUILD_CRT0_TRUE@CRT0		= crt0.o
-@BUILD_CRT0_TRUE@CRT0_INSTALL	= install-crt0
-@BUILD_CRT0_FALSE@CRT0		=
-@BUILD_CRT0_FALSE@CRT0_INSTALL	=
+@ARM_BUILD_CRT0_TRUE@CRT0		= crt0.o
+@ARM_BUILD_CRT0_TRUE@CRT0_INSTALL	= install-crt0
+@ARM_BUILD_CRT0_FALSE@CRT0		=
+@ARM_BUILD_CRT0_FALSE@CRT0_INSTALL	=
 
 NANO_SCRIPTS=nano.specs
 NANO_INSTALL=install-nano
@@ -105,15 +104,6 @@ INCLUDES += `if [ -d ${objroot}/newlib ]; then echo -I$(srcroot)/newlib/libc/mac
 # it to link is a good test, so we ignore all the errors for now.
 #
 all: ${CRT0} ${LINUX_CRT0} ${LINUX_BSP} ${REDBOOT_CRT0} ${REDBOOT_OBJS} ${RDPMON_CRT0} ${RDPMON_BSP} ${RDIMON_CRT0} ${RDIMON_BSP}
-	@rootpre=`pwd`/; export rootpre; \
-	srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
-	for dir in .. ${SUBDIRS}; do \
-	  if [ x$$dir != x.. ]; then \
-	    if [ -d $$dir ]; then \
-	      (cd $$dir; $(MAKE) $(FLAGS_TO_PASS)); \
-	    else true; fi; \
-	  else true; fi; \
-	done
 
 #
 # here's where we build the test programs for each target
@@ -199,30 +189,12 @@ librdimon-v2m.a: $(RDIMON_SEMIHV2M_OBJS)
 
 clean mostlyclean:
 	rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(IQ80310_BSP)
-	@rootpre=`pwd`/; export rootpre; \
-	srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
-	for dir in .. ${SUBDIRS}; do \
-	  if [ x$$dir != x.. ]; then \
-	    if [ -d $$dir ]; then \
-	      (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) clean); \
-	    else true; fi; \
-	  else true; fi; \
-	done
 
 distclean maintainer-clean realclean: clean
-	rm -f Makefile config.status *~
+	rm -f Makefile *~
 
 .PHONY: install info install-info clean-info
 install: ${CRT0_INSTALL} ${LINUX_INSTALL} ${REDBOOT_INSTALL} ${RDPMON_INSTALL} ${RDIMON_INSTALL} ${IQ80310_INSTALL}  ${PID_INSTALL} ${NANO_INSTALL}
-	@rootpre=`pwd`/; export rootpre; \
-	srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
-	for dir in .. ${SUBDIRS}; do \
-	  if [ x$$dir != x.. ]; then \
-	    if [ -d $$dir ]; then \
-	      (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) install); \
-	    else true; fi; \
-	  else true; fi; \
-	done
 
 install-nano:
 	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
@@ -267,8 +239,5 @@ info:
 install-info:
 clean-info:
 
-Makefile: Makefile.in config.status @host_makefile_frag_path@
-	$(SHELL) config.status
-
-config.status: configure
-	$(SHELL) config.status --recheck
+Makefile: Makefile.in ../config.status
+	cd .. && $(SHELL) ./config.status
diff --git a/libgloss/arm/acinclude.m4 b/libgloss/arm/acinclude.m4
new file mode 100644
index 000000000000..b34a40f9c61d
--- /dev/null
+++ b/libgloss/arm/acinclude.m4
@@ -0,0 +1,20 @@
+if test "x$newlib_may_supply_syscalls" = "xyes"; then
+  ARM_BUILD_CRT0_TRUE='#'
+  ARM_BUILD_CRT0_FALSE=
+else
+  ARM_BUILD_CRT0_TRUE=
+  ARM_BUILD_CRT0_FALSE='#'
+fi
+AC_SUBST(ARM_BUILD_CRT0_TRUE)
+AC_SUBST(ARM_BUILD_CRT0_FALSE)
+
+ARM_OBJTYPE=
+case "${target}" in
+  *-*-elf | *-*-eabi* | *-*-tirtos*)
+	ARM_OBJTYPE=elf-
+	;;
+  *-*-coff)
+	ARM_OBJTYPE=coff-
+	;;
+esac
+AC_SUBST(ARM_OBJTYPE)
diff --git a/libgloss/arm/configure.ac b/libgloss/arm/configure.ac
deleted file mode 100644
index 44f5f73962e4..000000000000
--- a/libgloss/arm/configure.ac
+++ /dev/null
@@ -1,72 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(redboot-crt0.S)
-
-dnl Support --disable-newlib-supplied-syscalls
-AC_ARG_ENABLE(newlib-supplied-syscalls,
-[  --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
-[case "${enableval}" in
-  yes) newlib_may_supply_syscalls=yes ;;
-  no)  newlib_may_supply_syscalls=no ;;
-  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
- esac], [newlib_may_supply_syscalls=yes])dnl
-
-if test "x$newlib_may_supply_syscalls" = "xyes"; then
-  BUILD_CRT0_TRUE='#'
-  BUILD_CRT0_FALSE=
-else
-  BUILD_CRT0_TRUE=
-  BUILD_CRT0_FALSE='#'
-fi
-
-AC_SUBST(BUILD_CRT0_TRUE)
-AC_SUBST(BUILD_CRT0_FALSE)
-
-AC_CONFIG_AUX_DIR(../..)
-
-AC_CANONICAL_SYSTEM
-AC_ARG_PROGRAM
-
-AC_PROG_INSTALL
-
-AC_NO_EXECUTABLES
-AC_PROG_CC
-AM_PROG_AS
-AM_PROG_AR
-LD=${LD-ld}
-AC_SUBST(LD)
-AC_PROG_RANLIB
-
-case "${target}" in
-  *-*-elf | *-*-eabi* | *-*-tirtos*)
-	objtype=elf-
-	;;
-  *-*-coff)
-	objtype=coff-
-	;;
-esac
-
-AC_SUBST(objtype)
-
-host_makefile_frag=`cd $srcdir/../config;pwd`/default.mh
-
-dnl We have to assign the same value to other variables because autoconf
-dnl doesn't provide a mechanism to substitute a replacement keyword with
-dnl arbitrary data or pathnames.
-dnl
-host_makefile_frag_path=$host_makefile_frag
-AC_SUBST(host_makefile_frag_path)
-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], [dnl
-    ac_file=cpu-init/Makefile . ${srcdir}/../../config-ml.in
-  ])
-  AC_SUBST(subdirs)
-fi
-
-AM_ENABLE_MULTILIB(, ../..)
-
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
diff --git a/libgloss/arm/cpu-init/Makefile.in b/libgloss/arm/cpu-init/Makefile.in
index 547c58daf89f..49ad53818d08 100644
--- a/libgloss/arm/cpu-init/Makefile.in
+++ b/libgloss/arm/cpu-init/Makefile.in
@@ -80,8 +80,5 @@ info:
 install-info:
 clean-info:
 
-Makefile: Makefile.in ../config.status @host_makefile_frag_path@
-	$(SHELL) ../config.status --file cpu-init/Makefile
-
-../config.status: ../configure
-	$(SHELL) ../config.status --recheck
+Makefile: Makefile.in ../../config.status
+	cd ../.. && $(SHELL) ./config.status --file arm/cpu-init/Makefile
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 931e3f6de42d..3e3b8afe95e0 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -8,6 +8,15 @@ fi
 
 AC_CONFIG_AUX_DIR(..)
 
+dnl Support --disable-newlib-supplied-syscalls
+AC_ARG_ENABLE(newlib-supplied-syscalls,
+[  --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
+[case "${enableval}" in
+  yes) newlib_may_supply_syscalls=yes ;;
+  no)  newlib_may_supply_syscalls=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
+ esac], [newlib_may_supply_syscalls=yes])dnl
+
 AC_PROG_INSTALL
 
 AC_CANONICAL_SYSTEM
@@ -205,7 +214,8 @@ case "${target}" in
 	subdirs="$subdirs rx"
 	;;
   arm*-*-elf | arm*-*-coff | arm*-*-*)
-	AC_CONFIG_SUBDIRS([arm])
+	AC_CONFIG_FILES([arm/Makefile arm/cpu-init/Makefile])
+	subdirs="$subdirs arm arm/cpu-init"
 	;;
   spu-*-elf)
 	AC_CONFIG_FILES([spu/Makefile])
@@ -235,6 +245,7 @@ case "${target}" in
 	subdirs="$subdirs nios2"
 	;;
 esac
+AC_SUBST(subdirs)
 
 dnl These subdirs have converted to non-recursive make.  Hopefully someday all
 dnl the ports above will too!
@@ -332,6 +343,7 @@ dnl
 AC_DEFINE_UNQUOTED(__SYMBOL_PREFIX, "$libc_cv_symbol_prefix", [symbol prefix])
 
 m4_include([aarch64/acinclude.m4])
+m4_include([arm/acinclude.m4])
 m4_include([i386/acinclude.m4])
 m4_include([libnosys/acinclude.m4])
 m4_include([m68k/acinclude.m4])
-- 
2.38.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.