From: Alexandre Duret-Lutz Date: Sun, 26 Oct 2003 21:20:11 +0000 (+0000) Subject: * automake.in (handle_configure): Distribute all AC_CONFIG_HEADERS X-Git-Tag: Release-1-7b~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8e03ecac94e7d805b8c507665e4effdfecdb823;p=thirdparty%2Fautomake.git * 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. --- diff --git a/ChangeLog b/ChangeLog index d1fd476cd..9b964fcd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-10-26 Alexandre Duret-Lutz + + * 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 * tests/output7.test: Populate sub/ with a dummy file, so that it diff --git a/automake.in b/automake.in index 84df19ac0..71ac065e6 100755 --- a/automake.in +++ b/automake.in @@ -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; } diff --git a/lib/am/remake-hdr.am b/lib/am/remake-hdr.am index 063ddb796..c9b8070da 100644 --- a/lib/am/remake-hdr.am +++ b/lib/am/remake-hdr.am @@ -28,11 +28,14 @@ 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% diff --git a/tests/Makefile.am b/tests/Makefile.am index aac2a6977..e6063031a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,6 +46,7 @@ ar.test \ asm.test \ autohdr.test \ autohdr2.test \ +autohdr4.test \ auxdir.test \ auxdir2.test \ backsl.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 8b099cf49..e83f67565 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..50dc2260f --- /dev/null +++ b/tests/autohdr4.test @@ -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 < 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 +#include +#include + +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 diff --git a/tests/config.test b/tests/config.test index 2b33654c1..d25b912b7 100755 --- a/tests/config.test +++ b/tests/config.test @@ -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. # @@ -22,21 +22,29 @@ # 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