ld TDIRS substitution

Message ID 20190413031328.GM14424@bubble.grove.modra.org
State New
Headers show
Series
  • ld TDIRS substitution
Related show

Commit Message

Alan Modra April 13, 2019, 3:13 a.m.
It is no longer true that autoconf/automake cannot substitute vars
with embedded new-lines.

	* configure.ac (TDIRS): Build up tdirs in this variable and
	AC_SUBST, also using AM_SUBST_NOTMAKE.
	* configure: Regenerate.
	* Makefile.am (DISTCLEANFILES): Remove tdirs.
	* Makefile.in: Regenerate.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/Makefile.am b/ld/Makefile.am
index 0434a827b9..7f8722dc2d 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -2013,7 +2013,7 @@  diststuff: info $(EXTRA_DIST)
 # ld.1 to support parallel build.
 info-recursive: ld.1
 
-DISTCLEANFILES = tdirs site.exp development.exp site.bak stringify.sed
+DISTCLEANFILES = site.exp development.exp site.bak stringify.sed
 distclean-local:
 	rm -rf ldscripts
 
diff --git a/ld/configure.ac b/ld/configure.ac
index d335f21091..ec434066af 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -319,12 +319,7 @@  EMUL=
 all_emuls=
 all_emul_extras=
 all_libpath=
-
-dnl We need to get an arbitrary number of tdir definitions into
-dnl Makefile.  We can't do it using AC_SUBST, because autoconf does
-dnl not permit literal newlines in an AC_SUBST variables.  So we use a
-dnl file.
-rm -f tdirs
+TDIRS=
 
 # If the host is 64-bit, then we enable 64-bit targets by default.
 # This is consistent with what ../bfd/configure.ac does.
@@ -376,7 +371,8 @@  do
 	  all_emuls="$all_emuls e${i}.o"
 	  eval result=\$tdir_$i
 	  test -z "$result" && result=$targ_alias
-	  echo tdir_$i=$result >> tdirs
+	  TDIRS="$TDIRS
+tdir_$i=$result"
 	  case "${i}" in
 	  *elf*)
 	    elf_list_options=TRUE
@@ -463,8 +459,8 @@  AC_SUBST(elf_shlib_list_options)
 AC_SUBST(elf_plt_unwind_list_options)
 AC_SUBST(EMUL)
 
-TDIRS=tdirs
-AC_SUBST_FILE(TDIRS)
+AC_SUBST(TDIRS)
+AM_SUBST_NOTMAKE(TDIRS)
 
 if test x${all_targets} = xtrue; then
   if test x${want64} = xtrue; then