+2004-12-30 Noah Misch <noah@cs.caltech.edu>
+
+ * bin/autoreconf.in (autoreconf_current_directory): AM_INIT_AUTOMAKE
+ signals that the package uses Automake; a `Makefile.am' is typical but
+ not essential. Reported by Magnus Therning.
+ * tests/torture.at (autoreconf.): New banner.
+ (autoreconf and non-AC configure): Rename to `Non-Autoconf
+ AC_CONFIG_SUBDIRS'.
+ (autoreconf an empty directory): Rename to `Empty directory'.
+ (Unusual Automake input files): New test.
+
2004-12-30 Noah Misch <noah@cs.caltech.edu>
* lib/autotest/general.m4 (AT_CAPTURE_FILE): New macro.
Carl Edman cedman@princeton.edu
Carlos Velasco carlosev@newipnet.com
Chad R. Larson chad@anasazi.com
+Charles 'Buck' Krasic krasic@cs.ubc.ca
Chris P. Ross cross@uu.net
Chris Provenzano proven@cygnus.com
Christian Cornelssen ccorn@cs.tu-berlin.de
Larry Schwimmer rosebud@cyclone.stanford.edu
Lars Hecking lhecking@nmrc.ucc.ie
Lars J. Aas larsa@sim.no
+Magnus Therning therning@gforge.natlab.research.philips.com
Marc Espie Marc.Espie@liafa.jussieu.fr
Marcus Daniels marcus@sysc.pdx.edu
Marcus Thiessel marcus@xemacs.org
if 0;
# autoreconf - install the GNU Build System in a directory tree
-# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003
+# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# -----------------------------
sub autoreconf_current_directory ()
{
- my $configure_ac = require_configure_ac;
+ my $configure_ac = find_configure_ac;
# ---------------------- #
# Is it using Autoconf? #
my $uses_autoconf;
my $uses_gettext;
- my $configure_ac_file = new Autom4te::XFile $configure_ac;
- while ($_ = $configure_ac_file->getline)
- {
- s/#.*//;
- s/dnl.*//;
- $uses_autoconf = 1 if /AC_INIT/;
- # See below for why we look for gettext here.
- $uses_gettext = 1 if /^AM_GNU_GETTEXT_VERSION/;
- }
-
+ if (-f $configure_ac)
+ {
+ my $configure_ac_file = new Autom4te::XFile $configure_ac;
+ while ($_ = $configure_ac_file->getline)
+ {
+ s/#.*//;
+ s/dnl.*//;
+ $uses_autoconf = 1 if /AC_INIT/;
+ # See below for why we look for gettext here.
+ $uses_gettext = 1 if /^AM_GNU_GETTEXT_VERSION/;
+ }
+ }
if (!$uses_autoconf)
{
verb "$configure_ac: not using Autoconf";
my $uses_gettext_via_traces;
my $uses_libtool;
my $uses_autoheader;
+ my $uses_automake;
my @subdir;
verb "$configure_ac: tracing";
my $traces = new Autom4te::XFile
'AC_PROG_LIBTOOL',
'LT_INIT',
'AM_GNU_GETTEXT',
+ 'AM_INIT_AUTOMAKE',
)
. ' |');
while ($_ = $traces->getline)
$uses_gettext_via_traces = 1 if /AM_GNU_GETTEXT/;
$uses_libtool = 1 if /(AC_PROG_LIBTOOL|LT_INIT)/;
$uses_autoheader = 1 if /AC_CONFIG_HEADERS/;
+ $uses_automake = 1 if /AM_INIT_AUTOMAKE/;
push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;
}
# Running automake. #
# ------------------ #
- # Assumes that there is a Makefile.am in the topmost directory.
- if (!-f 'Makefile.am')
+ if (!$uses_automake)
{
verb "$configure_ac: not using Automake";
}
# since the list can change at runtime because of AC_CONFIG_SUBDIRS.
for my $directory (@ARGV)
{
+ require_configure_ac;
autoreconf ($directory);
}
AT_CLEANUP
+
+AT_BANNER([autoreconf.])
+
## ---------------------------- ##
## Configuring subdirectories. ##
## ---------------------------- ##
]])
AT_CLEANUP
+
+
+
+## -------------------------------- ##
+## Non-Autoconf AC_CONFIG_SUBDIRS. ##
+## -------------------------------- ##
+
+AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
+AT_KEYWORDS([autoreconf])
+
+# We use aclocal (via autoreconf).
+AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
+
+AT_DATA([install-sh], [])
+AT_DATA([configure.in],
+[[AC_INIT(GNU Outer, 1.0)
+AC_CONFIG_SUBDIRS([inner])
+AC_OUTPUT
+]])
+
+AS_MKDIR_P([inner])
+
+AT_DATA([inner/configure],
+[[#! /bin/sh
+case "$*" in
+ *--help*) echo 'No Autoconf here, folks!' ;;
+ *) echo got_it >myfile ;;
+esac
+exit 0
+]])
+chmod +x inner/configure
+
+AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
+
+# Running the outer configure recursively should provide the innermost
+# help strings.
+AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
+
+# Running the outer configure should trigger the inner.
+AT_CHECK([./configure], 0, [ignore])
+AT_CHECK([test -f inner/myfile], 0)
+
+AT_CLEANUP
+
+
+
+## ----------------- ##
+## Empty directory. ##
+## ----------------- ##
+
+AT_SETUP([Empty directory])
+AT_KEYWORDS([autoreconf])
+
+# We use aclocal (via autoreconf).
+AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
+
+# The test group directory is not necessarily _empty_, but it does not contain
+# files meaningful to `autoreconf'.
+
+AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+
+## ------------------------------ ##
+## Unusual Automake input files. ##
+## ------------------------------ ##
+
+# This parallels gnumake.test in Automake.
+
+AT_SETUP([Unusual Automake input files])
+AT_KEYWORDS([autoreconf])
+
+# We use aclocal and automake via autoreconf.
+AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
+
+AT_DATA([configure.in],
+[[AC_INIT(GNU foo, 1.0)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([HeeHee])
+AC_OUTPUT
+]])
+
+AT_DATA([HeeHee.am],
+[[# Humans do no worse than `GNUmakefile.am'.
+AUTOMAKE_OPTIONS = foreign
+]])
+
+AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [ignore])
+AT_CHECK([test -f HeeHee.in])
+
+AT_CLEANUP