# Initialize our list of languages that are internally supported.
- $(DEFAULT_INCLUDES)
- $(INCLUDES)
+ my @cpplike_flags =
+ qw{
+ $(DEFS)
++ $(AM_DEFAULT_INCLUDES)
+ $(AM_CPPFLAGS)
+ $(CPPFLAGS)
+ };
+
# C.
register_language ('name' => 'c',
'Name' => 'C',
return @res;
}
+sub handle_config_headers ()
+{
+ my (@config_h_local, @config_h_nonlocal, @config_hin_local);
+ foreach my $spec (@config_headers)
+ {
+ my ($out, @ins) = split_config_file_spec ($spec);
+ if ($relative_dir eq dirname ($out))
+ {
+ push @config_h_local, basename ($out);
+ }
+ else
+ {
+ push @config_h_nonlocal, "\$(top_builddir)/$out";
+ }
+ foreach my $in (@ins)
+ {
+ push @config_hin_local, '$(srcdir)/' . basename ($in)
+ if $relative_dir eq dirname ($in);
+ }
+ }
+ define_variable ('am.config-hdr.local', INTERNAL, @config_h_local);
+ define_variable ('am.config-hdr.non-local', INTERNAL, @config_h_nonlocal);
+ define_variable ('am.config-hdr.local.in', INTERNAL, @config_hin_local);
+ define_variable ('AM_CONFIG_HEADERS', INTERNAL,
+ qw/$(am.config-hdr.local) $(am.config-hdr.non-local)/);
+}
-
-# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
-# -----------------------------------------------------------------
+# handle_configure ($MAKEFILE, @INPUTS)
+# -------------------------------------
# Handle remaking and configure stuff.
# We need the name of the input file, to do proper remaking rules.
- sub handle_configure ($@)
+ sub handle_configure
{
- my ($makefile_am, $makefile_in, $makefile, @inputs) = @_;
+ my ($makefile, @inputs) = @_;
prog_error 'empty @inputs'
unless @inputs;
# be defined conditionally. The second argument is the condition
# under which the value should be defined; this should be the empty
# string to define the variable unconditionally. The third argument
-# is a list holding the values to use for the variable. The value is
-# pretty printed in the output file.
-sub define_pretty_variable
+# is a list holding the values to use for the variable.
- sub define_cond_variable ($$$@)
++sub define_cond_variable
{
my ($var, $cond, $where, @value) = @_;
# --------------------------------------
# Define a new Automake Makefile variable VAR to VALUE, but only if
# not already defined.
- sub define_variable ($$@)
+ sub define_variable
{
- my ($var, $value, $where) = @_;
- define_pretty_variable ($var, TRUE, $where, $value);
+ my ($var, $where, @value) = @_;
+ define_cond_variable ($var, TRUE, $where, @value);
}
# Some variables we do not want to output. For instance it
# would be a bad idea to output `U = @U@` when `@U@` can be
# substituted as `\`.
- my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
+ return if exists $ignored_configure_vars{$var};
- Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst $var,
+ Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var),
- '', $configure_vars{$var}, $pretty);
+ '', $configure_vars{$var});
}
chomp;
$_ .= "\n";
- # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be
- # used by users. @MAINT@ is an anachronism now.
- $_ =~ s/\@MAINT\@//g
- unless $seen_maint_mode;
-
my $new_saw_bk = check_trailing_slash ($where, $_);
+ if ($reldir eq '.')
+ {
+ # If present, eat the following '_' or '/', converting
+ # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo"
+ # when $reldir is '.'.
+ $_ =~ s,%(D|reldir)%/,,g;
+ $_ =~ s,%(C|canon_reldir)%_,,g;
+ }
+ $_ =~ s/%(D|reldir)%/${reldir}/g;
+ $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g;
+
if (/$IGNORE_PATTERN/o)
{
# Merely delete comments beginning with two hashes.
{
define_configure_variable ($var);
}
-
- $output_vars .= $comments . $rules;
+ $output_vars .= verbatim ('header-vars');
}
- sub read_main_am_file ($$)
+
+ # read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN)
+ # ----------------------------------------------
+ sub read_main_am_file
{
my ($amfile, $infile) = @_;
}
-# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
-# ---------------------------------------------------------------------
+# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
+# -------------------------------------------------------------
# Verify that the file must exist in $DIRECTORY, or install it.
# $MYSTRICT is the strictness level at which this file becomes required.
- sub require_file_internal ($$$@)
-# Worker threads may queue up the action to be serialized by the master,
-# if $QUEUE is true
+ sub require_file_internal
{
- my ($where, $mystrict, $dir, $queue, @files) = @_;
+ my ($where, $mystrict, $dir, @files) = @_;
return
unless $strictness >= $mystrict;
# require_file ($WHERE, $MYSTRICT, @FILES)
# ----------------------------------------
- sub require_file ($$@)
+ sub require_file
{
my ($where, $mystrict, @files) = @_;
- require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
+ require_file_internal ($where, $mystrict, $relative_dir, @files);
}
# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
# require_conf_file ($WHERE, $MYSTRICT, @FILES)
# ---------------------------------------------
# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
- sub require_conf_file ($$@)
+ sub require_conf_file
{
my ($where, $mystrict, @files) = @_;
- my $queue = defined $required_conf_file_queue ? 1 : 0;
- require_file_internal ($where, $mystrict, $config_aux_dir,
- $queue, @files);
+ require_file_internal ($where, $mystrict, $config_aux_dir, @files);
}
# require_build_directory ($DIRECTORY)
# ------------------------------------
-# Emit rules to create $DIRECTORY if needed, and return
-# the file that any target requiring this directory should be made
-# dependent upon.
-# We don't want to emit the rule twice, and want to reuse it
-# for directories with equivalent names (e.g., 'foo/bar' and './foo//bar').
-sub require_build_directory
-{
- my $directory = shift;
-
- return $directory_map{$directory} if exists $directory_map{$directory};
-
- my $cdir = File::Spec->canonpath ($directory);
-
- if (exists $directory_map{$cdir})
- {
- my $stamp = $directory_map{$cdir};
- $directory_map{$directory} = $stamp;
- return $stamp;
- }
-
- my $dirstamp = "$cdir/\$(am__dirstamp)";
-
- $directory_map{$directory} = $dirstamp;
- $directory_map{$cdir} = $dirstamp;
-
- # Set a variable for the dirstamp basename.
- define_pretty_variable ('am__dirstamp', TRUE, INTERNAL, '.dirstamp');
-
- # Directory must be removed by 'make distclean'.
- $clean_files{$dirstamp} = DIST_CLEAN;
-
- $output_rules .= ("$dirstamp:\n"
- . "\t\@\$(MKDIR_P) $directory\n"
- . "\t\@: > $dirstamp\n");
-
- return $dirstamp;
-}
-
-# require_build_directory_maybe ($FILE)
-# -------------------------------------
-# If $FILE lies in a subdirectory, emit a rule to create this
-# directory and return the file that $FILE should be made
-# dependent upon. Otherwise, just return the empty string.
-sub require_build_directory_maybe
-{
- my $file = shift;
- my $directory = dirname ($file);
-
- if ($directory ne '.')
- {
- return require_build_directory ($directory);
- }
- else
- {
- return '';
- }
-}
-
-################################################################
-
# Push a list of files onto '@dist_common'.
- sub push_dist_common (@)
+ sub push_dist_common
{
prog_error "push_dist_common run after handle_dist"
if $handle_dist_run;
"'ACLOCAL_AMFLAGS' is deprecated; use 'AC_CONFIG_MACRO_DIRS'"
. " in configure.ac instead";
}
- msg_var 'obsolete', $ovar,
- "'INCLUDES' is deprecated; you should use 'AM_CPPFLAGS'"
+ if (my $ovar = var ('INCLUDES'))
+ {
++ reject_var $ovar,
++ "'INCLUDES' is obsolete; you should use 'AM_CPPFLAGS'"
+ . " (or '*_CPPFLAGS') instead"
+ }
- # Must do this after reading .am file.
- define_variable ('subdir', $relative_dir, INTERNAL);
+ # Some of these must do this after reading .am file.
+
+ define_variable ('subdir', INTERNAL, $relative_dir);
+ define_variable ('am.conf.is-topdir', INTERNAL,
+ $relative_dir eq '.' ? "yes" : "");
+ define_variable ('am.conf.check-news', INTERNAL,
+ option 'check-news' ? "yes" : "");
+ define_variable ('am.conf.no-installinfo', INTERNAL,
+ option 'no-installinfo' ? "yes" : "");
+ define_variable ('am.conf.aux-dir', INTERNAL, $am_config_aux_dir);
+ define_variable ('am.relpath.makefile', INTERNAL, basename ($makefile));
+ define_variable ('am.relpath.makefile.am', INTERNAL,
+ prepend_srcdir ($makefile_am));
+ define_variable ('am.relpath.makefile.in', INTERNAL,
+ prepend_srcdir ($makefile_in));
+
+ define_variable 'am.conf.build-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_BUILD ? '$(build)' : '';
+ define_variable 'am.conf.host-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_HOST ? '$(host)' : '';
+ define_variable 'am.conf.target-triplet', INTERNAL,
+ $seen_canonical >= AC_CANONICAL_TARGET ? '$(target)' : '';
# If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that
# recursive rules are enabled.