# Variables global to entire run.
+# Variables related to the options.
+
# TRUE if we should always generate Makefile.in.
$force_generation = 1;
# TRUE if we should always update files that we know about.
$force_missing = 0;
-# Files found by scanning configure.in for LIBOBJS.
+
+# Variables filled during files scanning.
+
+# Name of the top autoconf input: `configure.ac' or `configure.in'.
+$configure_ac = '';
+
+# Files found by scanning configure.ac for LIBOBJS.
%libsources = ();
-# True if AM_C_PROTOTYPES appears in configure.in.
+# True if AM_C_PROTOTYPES appears in configure.ac.
$am_c_prototypes = 0;
# Names used in AC_CONFIG_HEADER call. @config_fullnames holds the
@config_fullnames = ();
@config_names = ();
@config_headers = ();
-# Line number at which AC_CONFIG_HEADER appears in configure.in.
+# Line number at which AC_CONFIG_HEADER appears in configure.ac.
$config_header_line = 0;
# Directory where output files go. Actually, output files are
@config_aux_path = ('.', '..', '../..');
$config_aux_dir = '';
-# Whether AC_PROG_MAKE_SET has been seen in configure.in.
+# Whether AC_PROG_MAKE_SET has been seen in configure.ac.
$seen_make_set = 0;
-# Whether AM_GNU_GETTEXT has been seen in configure.in.
+# Whether AM_GNU_GETTEXT has been seen in configure.ac.
$seen_gettext = 0;
# Line number at which AM_GNU_GETTEXT seen.
$ac_gettext_line = 0;
# 1 if AC_PROG_INSTALL seen.
$seen_prog_install = 0;
-# Whether AC_PATH_XTRA has been seen in configure.in.
+# Whether AC_PATH_XTRA has been seen in configure.ac.
$seen_path_xtra = 0;
# TRUE if AC_DECL_YYTEXT was seen.
# Note that we do not handle this one, because it is still run
# from AM_CONFIG_HEADER. So we deal with it specially in
- # scan_configure.
+ # &scan_autoconf_files.
# 'AC_CONFIG_HEADER', "use \`AM_CONFIG_HEADER'",
'fp_C_PROTOTYPES', "use \`AM_C_PROTOTYPES'",
%language_map = ();
# This holds all the files that would go in `dist_common' which we
-# discovered while scanning configure.in. We might distribute these
+# discovered while scanning configure.ac. We might distribute these
# in the top-level Makefile.in.
%configure_dist_common = ();
# Parse command line.
&parse_arguments (@ARGV);
-# Do configure.in scan only once.
-&scan_configure;
+# Do configure.ac scan only once.
+&scan_autoconf_files;
die "automake: no \`Makefile.am' found or specified\n"
if ! @input_files;
}
}
-&am_conf_error ("AC_PROG_INSTALL must be used in configure.in")
+&am_conf_error ("AC_PROG_INSTALL must be used")
if (! $seen_prog_install);
exit $exit_status;
# $OUTPUT is encoded. If it contains a ":" then the first element
# is the real output file, and all remaining elements are input
# files. We don't scan or otherwise deal with these input file,
- # other than to mark them as dependencies. See scan_configure for
- # details.
+ # other than to mark them as dependencies. See
+ # &scan_autoconf_files for details.
local (@secondary_inputs);
($output, @secondary_inputs) = split (/:/, $output);
local ($am_time) = (stat ($makefile . '.am'))[9];
local ($in_time) = (stat ($out_file))[9];
# FIXME: should cache these times.
- local ($conf_time) = (stat ('configure.in'))[9];
+ local ($conf_time) = (stat ($configure_ac))[9];
# FIXME: how to do unsigned comparison?
if ($am_time < $in_time || $am_time < $conf_time)
{
if (! $am_c_prototypes)
{
&am_line_error ('AUTOMAKE_OPTIONS',
- "option \`ansi2knr' in use but \`AM_C_PROTOTYPES' not in configure.in");
+ "option \`ansi2knr' in use but \`AM_C_PROTOTYPES' not in \`$configure_ac'");
&keyed_aclocal_warning ('AM_C_PROTOTYPES');
# Only give this error once.
$am_c_prototypes = 1;
if (! keys %libsources
&& ! &variable_defined ($1 . 'LIBOBJS'))
{
- &am_line_error ($var, "\@$1" . "LIBOBJS\@ seen but never set in \`configure.in'");
+ &am_line_error ($var, "\@$1" . "LIBOBJS\@ seen but never set in \`$configure_ac'");
}
local ($iter, $rewrite);
push (@dep_list, $lsearch);
&am_line_error ($var,
- "\@$1" . "ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'")
+ "\@$1" . "ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`$configure_ac'")
if ! defined $libsources{'alloca.c'};
$dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1;
&require_file_with_line ($var, $FOREIGN, 'alloca.c');
# If a program is installed, this is required. We only want this
# error to appear once.
- &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in")
+ &am_conf_error ("AC_ARG_PROGRAM must be used")
unless $seen_arg_prog;
$seen_arg_prog = 1;
{
if (&variable_defined ($key . '_LIBRARIES'))
{
- &am_line_error ($key . '_LIBRARIES', "library used but \`RANLIB' not defined in \`configure.in'");
+ &am_line_error ($key . '_LIBRARIES', "library used but \`RANLIB' not defined in \`$configure_am'");
# Only get this error once. If this is ever printed,
# we have a bug.
$configure_vars{'RANLIB'} = 'BUG';
{
if (!$seen_libtool)
{
- &am_line_error ($key . '_LTLIBRARIES', "library used but \`LIBTOOL' not defined in \`configure.in'");
+ &am_line_error ($key . '_LTLIBRARIES', "library used but \`LIBTOOL' not defined in \`$configure_ac'");
# Only get this error once. If this is ever printed,
# we have a bug.
$configure_vars{'LIBTOOL'} = 'BUG';
{
# If a program is installed, this is required. We only want this
# error to appear once.
- &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in")
+ &am_conf_error ("AC_ARG_PROGRAM must be used")
unless $seen_arg_prog;
$seen_arg_prog = 1;
}
}
}
- # Always require configure.in and configure at top level, even if
+ # Always require configure.ac and configure at top level, even if
# they don't exist. This is especially important for configure,
# since it won't be created until autoconf is run -- which might
# be after automake is run.
- &push_dist_common ('configure.in', 'configure')
+ &push_dist_common ($configure_ac, 'configure')
if $relative_dir eq '.';
# We might copy elements from %configure_dist_common to
($seen_maint_mode
? "\@MAINTAINER_MODE_TRUE\@"
: "") ,
- "configure.in",
+ $configure_ac,
($acinclude ? ' acinclude.m4' : '')
);
. ': '
. ($seen_maint_mode ? "\@MAINTAINER_MODE_TRUE\@ " : '')
. $amfile . ' '
- . '$(top_srcdir)/configure.in $(ACLOCAL_M4)'
+ . '$(top_srcdir)/' . $configure_ac .' $(ACLOCAL_M4)'
. ' ' . join (' ', @include_stack)
. "\n"
. "\tcd \$(top_srcdir) && \$(AUTOMAKE) "
}
else
{
+ local ($xform) = &transform ("CONFIGURE_AC" => $configure_ac);
&handle_aclocal_m4;
- $output_rules .= &file_contents ('remake');
+ $output_rules .= &file_contents_with_transform ($xform,
+ 'remake');
&examine_variable ('CONFIG_STATUS_DEPENDENCIES');
&examine_variable ('CONFIGURE_DEPENDENCIES');
$top_reldir = '';
local ($xform) = '';
- $xform = 's,\@FILES\@,' . join (' ', @files) . ',;';
- $xform .= 's,\@CONFIG_HEADER\@,' . "${cn_sans_dir}" . ',;';
- $xform .= 's,\@CONFIG_HEADER_IN\@,' . "${ch_sans_dir}" . ',;';
- $xform .= 's,\@CONFIG_HEADER_FULL\@,' . "${one_fullname}" . ',;';
- $xform .= 's,\@STAMP\@,' . "${stamp_dir}${stamp_name}" . ',g;';
+ $xform = &transform ('CONFIGURE_AC' => $configure_ac,
+ 'FILES' => join (' ', @files),
+ 'CONFIG_HEADER' => $cn_sans_dir,
+ 'CONFIG_HEADER_IN' => $ch_sans_dir,
+ 'CONFIG_HEADER_FULL' => $one_fullname,
+ 'STAMP' => "$stamp_dir$stamp_name");
local ($out_dir) = &dirname ($ch_sans_dir);
- $xform .= 's,\@SRC_STAMP\@,' . "${out_dir}/${stamp_name}" . ',g;';
+ $xform .= &transform ('SRC_STAMP' => "${out_dir}/${stamp_name}");
$output_rules .= &file_contents_with_transform ($xform,
'remake-hdr');
}
&am_line_error ('CONFIG_HEADER',
- "\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'")
+ "\`CONFIG_HEADER' is an anachronism; now determined from \`$configure_ac'")
if &variable_defined ('CONFIG_HEADER');
local ($one_name);
if ($local eq 'stamp-h')
{
# FIXME: allow real filename.
- &am_conf_error ('configure.in', $ac_output_line,
+ &am_conf_error ($configure_ac, $ac_output_line,
'stamp-h should not appear in AC_OUTPUT');
next;
}
if (! &variable_defined ('SUBDIRS'))
{
&am_conf_error
- ("AM_GNU_GETTEXT in configure.in but SUBDIRS not defined");
+ ("AM_GNU_GETTEXT used but SUBDIRS not defined");
return;
}
{
&am_line_error
('SUBDIRS',
- "AM_GNU_GETTEXT in configure.in but \`po' not in SUBDIRS")
+ "AM_GNU_GETTEXT in \`$configure_ac' but \`po' not in SUBDIRS")
if $contents{'SUBDIRS'} !~ /\bpo\b/;
&am_line_error
('SUBDIRS',
- "AM_GNU_GETTEXT in configure.in but \`intl' not in SUBDIRS")
+ "AM_GNU_GETTEXT in \`$configure_ac' but \`intl' not in SUBDIRS")
if $contents{'SUBDIRS'} !~ /\bintl\b/;
}
}
else
{
- &am_error ("AM_GNU_GETTEXT in configure.in but \`ALL_LINGUAS' not defined");
+ &am_error ("AM_GNU_GETTEXT in \`$configure_ac' but \`ALL_LINGUAS' not defined");
}
}
}
}
- if (&variable_defined('lib_LTLIBRARIES') &&
+ if (&variable_defined('lib_LTLIBRARIES') &&
&variable_defined('bin_PROGRAMS'))
{
$output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
if (&variable_defined ('lisp_LISP'))
{
$varname = 'lisp_LISP';
- &am_error ("\`lisp_LISP' defined but \`AM_PATH_LISPDIR' not in \`configure.in'")
+ &am_error ("\`lisp_LISP' defined but \`AM_PATH_LISPDIR' not in \`$configure_ac'")
if ! $seen_lispdir;
}
else
$output_rules .= &file_contents ('python-clean');
push (@clean, 'python');
- &am_error ("\`python_PYTHON' defined but \`AM_CHECK_PYTHON' not in \`configure.in'")
+ &am_error ("\`python_PYTHON' defined but \`AM_CHECK_PYTHON' not in \`$configure_ac'")
if ! $seen_pythondir && &variable_defined ('python_PYTHON');
if ($config_aux_dir eq '.' || $config_aux_dir eq '')
if ($package_version !~ /^$GNITS_VERSION_PATTERN$/)
{
# FIXME: allow real filename.
- &am_conf_line_error ('configure.in',
+ &am_conf_line_error ($configure_ac,
$package_version_line,
"version \`$package_version' doesn't follow Gnits standards");
}
################################################################
-# Scan one file for interesting things. Subroutine of scan_configure.
-sub scan_one_configure_file
+# &scan_one_autoconf_file ($FILENAME)
+# -----------------------------------
+# Scan one file for interesting things. Subroutine of
+# &scan_autoconf_files.
+sub scan_one_autoconf_file
{
local ($filename) = @_;
local (*CONFIGURE);
# Cygnus and hopefully nowhere else.
if (/sinclude\((.*)\)/ && -f $1)
{
- &scan_one_configure_file ($1);
+ &scan_one_autoconf_file ($1);
}
# Populate libobjs array.
close (CONFIGURE);
}
-# Scan configure.in and aclocal.m4 for interesting things. We must
-# scan aclocal.m4 because there might be AC_SUBSTs and such there.
-sub scan_configure
+# &scan_autoconf_files ()
+# -----------------------
+# Check whether we use `configure.ac' or `configure.in'.
+# Scan it (and possibly `aclocal.m4') for interesting things.
+# We must scan aclocal.m4 because there might be AC_SUBSTs and such there.
+sub scan_autoconf_files
{
# Reinitialize libsources here. This isn't really necessary,
- # since we currently assume there is only one configure.in. But
+ # since we currently assume there is only one configure.ac. But
# that won't always be the case.
%libsources = ();
local (%make_list, @make_input_list);
local ($libobj_iter);
- &scan_one_configure_file ('configure.in');
- &scan_one_configure_file ('aclocal.m4')
+ warn "automake: both \`configure.ac' and \`configure.in' present:"
+ . " ignoring \`configure.in'\n"
+ if -f 'configure.ac' && -f 'configure.in';
+ $configure_ac = 'configure.in'
+ if -f 'configure.in';
+ $configure_ac = 'configure.ac'
+ if -f 'configure.ac';
+ die "automake: \`configure.ac' or \`configure.in' is required\n"
+ if !$configure_ac;
+
+ &scan_one_autoconf_file ($configure_ac);
+ &scan_one_autoconf_file ('aclocal.m4')
if -f 'aclocal.m4';
# Set input and output files if not specified by user.
@configure_input_files = @make_input_list;
- &am_conf_error ("\`AM_INIT_AUTOMAKE' must be used in configure.in")
+ &am_conf_error ("\`AM_INIT_AUTOMAKE' must be used")
if ! $seen_init_automake;
# Always require AC_PROG_MAKE_SET. We might randomly use $(MAKE)
# for our own reasons.
- &am_conf_error ("\`AC_PROG_MAKE_SET' must be used in configure.in")
+ &am_conf_error ("\`AC_PROG_MAKE_SET' must be used")
if ! $seen_make_set;
# Look for some files we need. Always check for these. This
# Only give error once.
$seen_cc_c_o = 1;
# FIXME: line number.
- &am_error ("C objects in subdir but \`AM_PROG_CC_C_O' not in \`configure.in'");
+ &am_error ("C objects in subdir but \`AM_PROG_CC_C_O' not in \`$configure_ac'");
}
&require_file ($FOREIGN, 'compile')
if (! defined $configure_vars{'CC'})
{
# FIXME: line number.
- &am_error ("C source seen but \`CC' not defined in \`configure.in'");
+ &am_error ("C source seen but \`CC' not defined in \`$configure_ac'");
}
}
if (! defined $configure_vars{'CXX'})
{
- &am_error ("C++ source seen but \`CXX' not defined in \`configure.in'");
+ &am_error ("C++ source seen but \`CXX' not defined in \`$configure_ac'");
}
}
if (! defined $configure_vars{'YACC'})
{
- &am_error ("yacc source seen but \`YACC' not defined in \`configure.in'");
+ &am_error ("yacc source seen but \`YACC' not defined in \`$configure_ac'");
}
if (&variable_defined ('YACCFLAGS'))
{
if (! defined $configure_vars{'LEX'})
{
- &am_error ("lex source seen but \`LEX' not defined in \`configure.in'");
+ &am_error ("lex source seen but \`LEX' not defined in \`$configure_ac'");
}
if (! $seen_decl_yytext)
{
- &am_error ("lex source seen but \`AC_DECL_YYTEXT' not in \`configure.in'");
+ &am_error ("lex source seen but \`AC_DECL_YYTEXT' not in \`$configure_ac'");
}
if ($lex_count > 1)
if (! defined $configure_vars{'F77'})
{
- &am_error ("Fortran 77 source seen but \`F77' not defined in \`configure.in'");
+ &am_error ("Fortran 77 source seen but \`F77' not defined in \`$configure_ac'");
}
}
if (! defined $configure_vars{'OBJC'})
{
- &am_error ("Objective C source seen but \`OBJC' not defined in \`configure.in'");
+ &am_error ("Objective C source seen but \`OBJC' not defined in \`$configure_ac'");
}
}
if (! defined $configure_vars{'GCJ'})
{
- &am_error ("Java source seen but \`GCJ' not defined in \`configure.in'");
+ &am_error ("Java source seen but \`GCJ' not defined in \`$configure_ac'");
}
}
# DISTFILES.
@common_files =
(
- "README", "THANKS", "TODO", "NEWS", "COPYING", "COPYING.LIB",
- "INSTALL", "ABOUT-NLS", "ChangeLog", "configure", "configure.in",
- "config.guess", "config.sub", "AUTHORS", "BACKLOG", "ABOUT-GNU",
- "libversion.in", "mdate-sh", "mkinstalldirs", "install-sh",
- 'texinfo.tex', "ansi2knr.c", "ansi2knr.1", 'elisp-comp',
+ 'README', 'THANKS', 'TODO', 'NEWS', 'COPYING', 'COPYING.LIB',
+ 'INSTALL', 'ABOUT-NLS', 'ChangeLog', 'configure.ac',
+ 'configure.in', 'configure', 'config.guess', 'config.sub',
+ 'AUTHORS', 'BACKLOG', 'ABOUT-GNU', 'libversion.in',
+ 'mdate-sh', 'mkinstalldirs', 'install-sh', 'texinfo.tex',
+ 'ansi2knr.c', 'ansi2knr.1', 'elisp-comp',
# ltconfig appears here for compatibility with old versions
# of libtool.
'ylwrap', 'acinclude.m4', @libtoolize_files, @libtoolize_sometimes,
# Commonly used files we auto-include, but only sometimes.
@common_sometimes =
(
- "aclocal.m4", "acconfig.h", "config.h.top",
- "config.h.bot", "stamp-h.in", 'stamp-vti'
+ 'aclocal.m4', 'acconfig.h', 'config.h.top',
+ 'config.h.bot', 'stamp-h.in', 'stamp-vti'
);
$USAGE = "\
return &file_contents_with_transform ('', @_);
}
+# &transform (%PAIRS)
+# -------------------
+# Create a replacement expression suitable for file_contents_with_transform
+# to replace each key of %PAIRS by its value.
+sub transform
+{
+ local (%pairs) = @_;
+ local ($result) = '';
+
+ foreach $pattern (sort keys %pairs)
+ {
+ $result .= 's,\@' . $pattern . '\@,' . $pairs{$pattern} . ',g;';
+ }
+ print STDERR "transform: $result\n";
+ return $result;
+}
+
# Find all variable prefixes that are used for install directories. A
# prefix `zar' qualifies iff:
# * `zardir' is a variable.
}
}
# Check here to make sure variables defined in
- # configure.in do not imply that EXTRA_PRIMARY
+ # configure.ac do not imply that EXTRA_PRIMARY
# must be defined.
elsif (! defined $configure_vars{$one_name})
{
if ($is_configure)
{
# FIXME: allow actual file to be specified.
- &am_conf_line_error ('configure.in', $line,
+ &am_conf_line_error ($configure_ac, $line,
"$message$trailer");
}
else
}
# Like require_file_with_line, but error messages refer to
-# configure.in, not the current Makefile.am.
+# configure.ac, not the current Makefile.am.
sub require_file_with_conf_line
{
@require_file_paths = '.';
}
}
-# Assumes that the line number is in configure.in.
+# Assumes that the line number is in configure.ac.
sub require_conf_file_with_conf_line
{
@require_file_paths = @config_aux_path;
}
elsif (defined $configure_vars{$symbol})
{
- # SYMBOL is a variable defined in configure.in, so add the
+ # SYMBOL is a variable defined in configure.ac, so add the
# appropriate line number.
$file = $configure_vars{$symbol};
}
}
}
-# Like am_error, but while scanning configure.in.
+# Like am_error, but while scanning configure.ac.
sub am_conf_error
{
# FIXME: can run in subdirs.
- warn "automake: configure.in: ", join (' ', @_), "\n";
+ warn "automake: $configure_ac: ", join (' ', @_), "\n";
$exit_status = 1;
}
-# Error message with line number referring to configure.in.
+# Error message with line number referring to configure.ac.
sub am_conf_line_error
{
local ($file, $line, @args) = @_;
}
}
-# Warning message with line number referring to configure.in.
+# Warning message with line number referring to configure.ac.
# Does not affect exit_status
sub am_conf_line_warning
{