automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 3/5] [ng] vars: list input config headers in an int


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 3/5] [ng] vars: list input config headers in an internal make variable as well
Date: Mon, 30 Jul 2012 15:28:13 +0200

This is only a preparatory change in view of future refactorings.

* automake.in (handle_config_headers): Define a new make variable
'am.config-hdr.local.in'.
* t/confh-internals.sh: New test.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in          |  8 +++++-
 t/confh-internals.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100755 t/confh-internals.sh

diff --git a/automake.in b/automake.in
index 490226c..1601e07 100644
--- a/automake.in
+++ b/automake.in
@@ -3558,7 +3558,7 @@ sub rewrite_inputs_into_dependencies ($@)
 
 sub handle_config_headers ()
 {
-  my (@config_h_local, @config_h_nonlocal);
+  my (@config_h_local, @config_h_nonlocal, @config_hin_local);
   foreach my $spec (@config_headers)
     {
       my ($out, @ins) = split_config_file_spec ($spec);
@@ -3570,9 +3570,15 @@ sub handle_config_headers ()
        {
          push @config_h_nonlocal, "\$(top_builddir)/$out";
        }
+      foreach my $in (@ins)
+        {
+         push @config_hin_local, '$(srcdir)/' . basename ($in)
+            if $relative_dir eq dirname ($in);
+        }
     }
   define_variable ('am.config-hdr.local', INTERNAL, @config_h_local);
   define_variable ('am.config-hdr.non-local', INTERNAL, @config_h_nonlocal);
+  define_variable ('am.config-hdr.local.in',  INTERNAL, @config_hin_local);
   define_variable ('AM_CONFIG_HEADERS', INTERNAL,
                    qw/$(am.config-hdr.local) $(am.config-hdr.global)/);
 }
diff --git a/t/confh-internals.sh b/t/confh-internals.sh
new file mode 100755
index 0000000..eca43b7
--- /dev/null
+++ b/t/confh-internals.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+# Copyright (C) 2003-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/>.
+
+# Check internal make variable populated from AC_CONFIG_HEADERS calls.
+
+. ./defs || exit 1
+
+cat >>configure.ac <<'EOF'
+AC_SUBST([BOT], [bot])
+AC_CONFIG_HEADERS([defs.h config.h:sub1/config.top:sub2/config.${BOT}],,
+                  [BOT=$BOT])
+AC_CONFIG_HEADERS([sub0/CFG.h:sub0/CFG-H.in])
+AC_CONFIG_FILES([sub0/Makefile])
+AC_OUTPUT
+EOF
+
+mkdir sub0 sub1 sub2
+
+echo TOP > sub1/config.top
+echo BOT > sub2/config.bot
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub0
+.PHONY: test-vapth test-intree
+test-intree:
+       is $(am.config-hdr.local) == defs.h config.h
+       is $(am.config-hdr.local.in) == ./defs.h.in
+test-vpath:
+       is $(am.config-hdr.local) == defs.h config.h
+       is $(am.config-hdr.local.in) == ../defs.h.in
+END
+
+cat > sub0/Makefile.am << 'END'
+.PHONY: test-vapth test-intree
+test-intree:
+       is $(am.config-hdr.local) == CFG.h
+       is $(am.config-hdr.local.in) == ../sub0/CFG-H.in
+test-vpath:
+       is $(am.config-hdr.local) == CFG.h
+       is $(am.config-hdr.local.in) == ../../sub0/CFG-H.in
+END
+
+: > sub0/CFG-H.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOHEADER
+test -f defs.h.in
+$AUTOMAKE
+
+./configure
+$MAKE test-intree
+$MAKE distclean
+mkdir build
+cd build
+../configure
+$MAKE test-vpath
+$MAKE distcleancheck
+
+:
-- 
1.7.12.rc0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]