]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* automake.in (handle_configure): Distribute all AC_CONFIG_HEADERS
authorAlexandre Duret-Lutz <adl@gnu.org>
Sun, 26 Oct 2003 21:20:11 +0000 (21:20 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sun, 26 Oct 2003 21:20:11 +0000 (21:20 +0000)
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.

ChangeLog
automake.in
lib/am/remake-hdr.am
tests/Makefile.am
tests/Makefile.in
tests/autohdr4.test [new file with mode: 0755]
tests/config.test

index d1fd476cdcfbe29ca630f5cf2dc9c4b207e61e99..9b964fcd9f373d2f762e3afb4219c60064bb7590 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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
index 84df19ac00a6ec40837de6a4cc6b9d0b5b517bfc..71ac065e657c0e9fc71b2f7632fd8b8f192ebd60 100755 (executable)
@@ -3437,20 +3437,14 @@ sub handle_configure ($$$@)
                }
            }
 
-         # 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;
@@ -3475,11 +3469,13 @@ sub handle_configure ($$$@)
          $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;
        }
index 063ddb7968957d2460d81d705d64c684896fc6bb..c9b8070dabdddf158f4ae7b7c634e910db3c1e1f 100644 (file)
        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
@@ -41,3 +44,4 @@ $(srcdir)/%CONFIG_HIN%: %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL
 ## by config.status, there is no reason to make things complex for
 ## config.hin.
        touch $(srcdir)/%CONFIG_HIN%
+endif %?FIRST_CONFIG_HIN%
index aac2a6977ff7706e69ec80a9b8d12056df9987e8..e6063031aa89da6bfbb5a99de83f2c98f845d5a5 100644 (file)
@@ -46,6 +46,7 @@ ar.test \
 asm.test \
 autohdr.test \
 autohdr2.test \
+autohdr4.test \
 auxdir.test \
 auxdir2.test \
 backsl.test \
index 8b099cf4942f02c761059c9555808083ce216b5e..e83f67565400a15f2236d4bcad755b8cb01c254a 100644 (file)
@@ -156,6 +156,7 @@ ar.test \
 asm.test \
 autohdr.test \
 autohdr2.test \
+autohdr4.test \
 auxdir.test \
 auxdir2.test \
 backsl.test \
diff --git a/tests/autohdr4.test b/tests/autohdr4.test
new file mode 100755 (executable)
index 0000000..50dc226
--- /dev/null
@@ -0,0 +1,71 @@
+#!/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
index 2b33654c1cc629d3105c978d68706c5dbcc824f4..d25b912b7d04e092ae3c466861f09ca25824bef8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /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