'SUBDIRS' => !! var ('SUBDIRS'),
'TOPDIR_P' => $relative_dir eq '.',
- 'BUILD' => ($seen_canonical >= AC_CANONICAL_BUILD),
- 'HOST' => ($seen_canonical >= AC_CANONICAL_HOST),
- 'TARGET' => ($seen_canonical >= AC_CANONICAL_TARGET),
-
'LIBTOOL' => !! var ('LIBTOOL'),
'NONLIBTOOL' => 1,
'SILENT' => silent_flag (),
}
}
- # Must do this after reading .am file.
+ # Some of these must do this after reading .am file.
+
define_variable ('subdir', INTERNAL, $relative_dir);
define_variable ('am.conf.is-topdir', INTERNAL,
$relative_dir eq '.' ? "yes" : "");
define_variable ('am.relpath.makefile.in', INTERNAL,
prepend_srcdir ($makefile_in));
+ define_variable 'am.conf.build-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_BUILD ? '$(build)' : '';
+ define_variable 'am.conf.host-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_HOST ? '$(host)' : '';
+ define_variable 'am.conf.target-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_TARGET ? '$(target)' : '';
+
# If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that
# recursive rules are enabled.
define_variable ('SUBDIRS', INTERNAL, '')
@echo 'set srcdir "$(srcdir)"' >>site.tmp
@echo "set objdir `pwd`" >>site.tmp
## Quote the *_alias variables because they might be empty.
-?BUILD? @echo 'set build_alias "$(build_alias)"' >>site.tmp
-?BUILD? @echo 'set build_triplet $(build)' >>site.tmp
-?HOST? @echo 'set host_alias "$(host_alias)"' >>site.tmp
-?HOST? @echo 'set host_triplet $(host)' >>site.tmp
-?TARGET? @echo 'set target_alias "$(target_alias)"' >>site.tmp
-?TARGET? @echo 'set target_triplet $(target)' >>site.tmp
+ $(if $(am.conf.build-triplet),@echo 'set build_triplet $(build)' >>site.tmp)
+ $(if $(am.conf.build-triplet),@echo 'set build_alias "$(build_alias)"' >>site.tmp)
+ $(if $(am.conf.host-triplet),@echo 'set host_triplet $(host)' >>site.tmp)
+ $(if $(am.conf.host-triplet),@echo 'set host_alias "$(host_alias)"' >>site.tmp)
+ $(if $(am.conf.target-triplet),@echo 'set target_alias "$(target_alias)"' >>site.tmp)
+ $(if $(am.conf.target-triplet),@echo 'set target_triplet $(target)' >>site.tmp)
## Allow the package author to extend site.exp.
@list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
echo "## Begin content included from file $$f. Do not modify. ##" \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# The $(host), $(build), $(target) variables, and their '*_alias'
+# and 'am.conf.*-triplet' counterparts.
+
+. ./defs || exit 1
+
+: > config.guess
+: > config.sub
+: > Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+grep "^am\.conf\.host-triplet = *$" Makefile.in
+grep "^am\.conf\.build-triplet = *$" Makefile.in
+grep "^am\.conf\.target-triplet = *$" Makefile.in
+
+mv -f configure.ac configure.tmpl
+
+for M in HOST BUILD TARGET; do
+ m=$(echo $M | LC_ALL=C tr '[A-Z]' '[a-z]')
+ (cat configure.tmpl && echo AC_CANONICAL_$M) > configure.ac
+ rm -rf autom4te.cache
+ $AUTOMAKE
+ grep "^$m = @$m@$" Makefile.in
+ grep "^${m}_alias = @${m}_alias@$" Makefile.in
+ grep "^am\\.conf\\.${m}-triplet = \\\$(${m})$" Makefile.in
+ case $m in
+ build)
+ grep '^am\.conf\.host-triplet = *$' Makefile.in
+ grep '^am\.conf\.target-triplet = *$' Makefile.in
+ ;;
+ host)
+ grep '^am\.conf\.build-triplet = $(build)$' Makefile.in
+ grep '^am\.conf\.target-triplet = *$' Makefile.in
+ ;;
+ target)
+ grep '^am\.conf\.build-triplet = $(build)$' Makefile.in
+ grep '^am\.conf\.target-triplet = $(target)$' Makefile.in
+ ;;
+ esac
+done
+
+rm -rf autom4te.cache
+
+cat configure.tmpl - >configure.ac <<'END'
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
+AC_CANONICAL_TARGET
+END
+
+$AUTOMAKE
+for m in host build target; do
+ grep "^$m = @$m@$" Makefile.in
+ grep "^${m}_alias = @${m}_alias@$" Makefile.in
+ grep "^am\.conf\.${m}-triplet = \$(${m})$" Makefile.in
+done
+
+: