+2003-10-26 Alexandre Duret-Lutz <adl@gnu.org>
+
+ * automake.in (handle_configure): Distribute all AC_CONFIG_HEADERS
+ sources, and without using require_file. Define %CONFIG_H_DEPS%
+ and %FIRST_CONFIG_HIN% while processing remake-hdr.am.
+ * lib/am/remake-hdr.am (%STAMP%): Use %CONFIG_H_DEPS% instead
+ of (srcdir)/%CONFIG_HIN%. Output the $(srcdir)/%CONFIG_HIN%
+ rule only for the first header (i.e., if %FIRST_CONFIG_HIN%).
+ * tests/autohdr4.test: New file.
+ * tests/Makefile.am (TESTS): Add autohdr4.test.
+ * tests/config.test: Do not grep, run things to see if they work.
+
2003-10-25 Alexandre Duret-Lutz <adl@gnu.org>
* tests/output7.test: Populate sub/ with a dummy file, so that it
}
}
- # Compute relative path from directory holding output
- # header to directory holding input header. FIXME:
- # doesn't handle case where we have multiple inputs.
- my $in0_sans_dir;
- if (dirname ($ins[0]) eq $relative_dir)
+ # Distribute all inputs.
+ for my $in (@ins)
{
- $in0_sans_dir = basename ($ins[0]);
+ error $config_header_location, "required file `$in' not found"
+ unless -f $in;
+ push_dist_common (rewrite_inputs_into_dependencies (1, $in));
}
- else
- {
- $in0_sans_dir = backname ($relative_dir) . '/' . $ins[0];
- }
-
- require_file ($config_header_location, FOREIGN, $in0_sans_dir);
+ @ins = rewrite_inputs_into_dependencies (1, @ins);
# Header defined and in this directory.
my @files;
$output_rules .=
file_contents ('remake-hdr',
new Automake::Location,
- FILES => "@files",
- CONFIG_H => $cn_sans_dir,
- CONFIG_HIN => $in0_sans_dir,
- CONFIG_H_PATH => $config_h_path,
- STAMP => "$stamp");
+ FILES => "@files",
+ CONFIG_H => $cn_sans_dir,
+ CONFIG_HIN => $ins[0],
+ CONFIG_H_DEPS => "@ins",
+ CONFIG_H_PATH => $config_h_path,
+ FIRST_CONFIG_HIN => ($hdr_index == 1),
+ STAMP => "$stamp");
push @distclean_config, $cn_sans_dir, $stamp;
}
else :; fi
-%STAMP%: $(srcdir)/%CONFIG_HIN% $(top_builddir)/config.status
+%STAMP%: %CONFIG_H_DEPS% $(top_builddir)/config.status
@rm -f %STAMP%
cd $(top_builddir) && $(SHELL) ./config.status %CONFIG_H_PATH%
+## Only the first file of AC_CONFIG_HEADERS is assumed to be generated
+## by autoheader.
+if %?FIRST_CONFIG_HIN%
$(srcdir)/%CONFIG_HIN%: %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %FILES%
cd $(top_srcdir) && $(AUTOHEADER)
## Autoheader has the bad habit of not changing the time stamp if
## by config.status, there is no reason to make things complex for
## config.hin.
touch $(srcdir)/%CONFIG_HIN%
+endif %?FIRST_CONFIG_HIN%
asm.test \
autohdr.test \
autohdr2.test \
+autohdr4.test \
auxdir.test \
auxdir2.test \
backsl.test \
asm.test \
autohdr.test \
autohdr2.test \
+autohdr4.test \
auxdir.test \
auxdir2.test \
backsl.test \
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Check rebuild rules for AC_CONFIG_HEADERS.
+# (This should also work without GNU Make.)
+
+required=gcc
+. ./defs
+
+set -e
+
+cat >>configure.in <<EOF
+AC_PROG_CC
+AC_CONFIG_HEADERS([defs.h config.h:sub1/config.top:sub2/config.bot])
+AC_CONFIG_FILES([sub3/Makefile])
+AC_OUTPUT
+EOF
+
+mkdir sub1 sub2 sub3
+
+: > sub1/config.top
+echo '#define NAME "grepme1"' >sub2/config.bot
+echo SUBDIRS = sub3 >Makefile.am
+echo noinst_PROGRAMS = run >sub3/Makefile.am
+
+cat >sub3/run.c <<'EOF'
+#include <defs.h>
+#include <config.h>
+#include <stdio.h>
+
+int
+main ()
+{
+ puts (NAME); /* from config.h */
+ puts (PACKAGE); /* from defs.h */
+}
+EOF
+
+
+$ACLOCAL
+$AUTOCONF
+$AUTOHEADER
+$AUTOMAKE
+
+./configure
+$MAKE
+sub3/run | grep grepme1
+
+$sleep
+echo '#define NAME "grepme2"' > sub2/config.bot
+$MAKE
+sub3/run | grep grepme2
+
+$MAKE distcheck
#! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# idea is that if config.h is in a subdir, and there is no Makefile in
# that subdir, then we want to build config.h as the top level.
+required=GNUmake
. ./defs || exit 1
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
AM_CONFIG_HEADER(subdir/config.h)
-AC_PROG_CC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
: > Makefile.am
mkdir subdir
: > subdir/config.h.in
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+
+$sleep
+echo '#define FOO' > subdir/config.h.in
+$MAKE subdir/config.h
+grep FOO subdir/config.h
-grep '^subdir/config.h:' Makefile.in
+$MAKE distcheck