{
return if ! &variable_defined ('AUTOMAKE_OPTIONS');
- foreach (split (' ', $contents{'AUTOMAKE_OPTIONS'}))
+ foreach (&variable_value_as_list ('AUTOMAKE_OPTIONS'))
{
last if /^#/;
return;
}
- local ($source_list);
+ local (@files);
local ($prefix);
foreach $prefix ('', 'EXTRA_')
{
- $source_list = '';
+ @files = ();
if (&variable_defined ($prefix . $one_file . "_SOURCES"))
{
push (@sources, '$(' . $prefix . $one_file . "_SOURCES)");
push (@objects, '$(' . $prefix . $one_file . "_OBJECTS)")
unless $prefix eq 'EXTRA_';
- $source_list = $contents{$prefix . $one_file . "_SOURCES"};
+ @files = &variable_value_as_list ($prefix
+ . $one_file . "_SOURCES");
}
elsif ($prefix eq '')
{
$output_vars .= $one_file . "_SOURCES = " . $unxformed . ".c\n";
push (@sources, $unxformed . '.c');
push (@objects, $unxformed . $obj);
- $source_list = $unxformed . ".c ";
+ push (@files, $unxformed . ".c ");
}
else
{
$output_vars .= "EXTRA_" . $one_file . "_SOURCES =\n";
}
- if ($source_list)
+ if (length (@files))
{
# Turn sources into objects.
- local (@files) = split (' ', $source_list);
local (@result) = ();
foreach (@files)
{
next if /\.h\+\+$/;
next if /\.hh$/;
next if /\.hpp$/;
- # Skip things that look like macro references.
- next if /^\$\(.*\)$/;
- next if /^\$\{.*\}$/;
# Skip things that look like configure substitutions.
next if /^\@.*\@$/;
local ($lsearch);
local (@dep_list) = ();
- foreach $lsearch (split (' ', $contents{$var}))
+ foreach $lsearch (&variable_value_as_list ($var))
{
# Skip -lfoo and -Ldir.
next if /^-[lL]/;
if (&variable_defined ($onedir . '_LIBRARIES'))
{
@outlist = ();
- foreach $onelib (split (' ', $contents{$onedir . '_LIBRARIES'}))
+ foreach $onelib (&variable_value_as_list ($onedir . '_LIBRARIES'))
{
push (@outlist, 'lib' . $onelib . '.a');
}
return if (! &variable_defined ('info_TEXINFOS')
&& ! &variable_defined ('html_TEXINFOS'));
- local (@texis) = split (' ', $contents{'info_TEXINFOS'});
+ local (@texis) = &variable_value_as_list ('info_TEXINFOS');
local (@infos_list, @info_deps_list, @dvis_list, @texi_deps);
local ($infobase, $info_cursor);
# We generate the manpage install code by hand to avoid the use of
# basename in the generated Makefile.
- local (@mans) = split (' ', $contents{'man_MANS'});
+ local (@mans) = &variable_value_as_list ('man_MANS');
local (%sections, %inames, %mbases, %secmap, %fullsecmap);
local ($i) = 1;
foreach (@mans)
# Make sure each directory mentioned in SUBDIRS actually exists.
local ($dir);
- foreach $dir (split (' ', $contents{'SUBDIRS'}))
+ foreach $dir (&variable_value_as_list ('SUBDIRS'))
{
# Skip directories substituted by configure.
next if $dir =~ /^\@.*\@$/;
return (defined $contents{$var} && ! defined $targets{$var});
}
+# Return contents of variable as list, split as whitespace. This will
+# recursively follow $(...) and ${...} inclusions. It preserves @...@
+# substitutions. If PARENT is specified, it is the name of the
+# including variable; this is only used for error reports.
+sub variable_value_as_list
+{
+ local ($var, $parent) = @_;
+ local (@result);
+
+ if (defined $targets{$var})
+ {
+ &am_line_error ($var, "\`$var' is target; expected variable");
+ }
+ elsif (! defined $contents{$var})
+ {
+ &am_error ($parent, "variable \`$var' not defined");
+ }
+ else
+ {
+ foreach (split (' ', $contents{$var}))
+ {
+ # Handle variable substitutions.
+ if (/^\$\{(.*)\}$/ || /^\$\((.*)\)$/)
+ {
+ push (@result, &variable_value_as_list ($1, $var));
+ }
+ else
+ {
+ push (@result, $_);
+ }
+ }
+ }
+
+ return @result;
+}
+
# Read Makefile.am and set up %contents. Simultaneously copy lines
# from Makefile.am into $output_trailer or $output_vars as
# appropriate. NOTE we put rules in the trailer section. We want
# Append actual contents of where_PRIMARY variable to
# result.
local ($rcurs);
- foreach $rcurs (split (' ', $contents{$one_name}))
+ foreach $rcurs (&variable_value_as_list ($one_name))
{
# Skip configure substitutions. Possibly bogus.
next if $rcurs =~ /^\@.*\@$/;
This is required if any libraries are built in the package.
@cvindex AC_PROG_RANLIB
+@item AC_PROG_CXX
+This is required if any C++ source is included.
+@cvindex AC_PROG_CXX
+
@item AC_PROG_INSTALL
@item AM_PROG_INSTALL
-
@code{AM_PROG_INSTALL} is required if any scripts (@pxref{Scripts}) are
installed by the package. Otherwise, @code{AC_PROG_INSTALL} is
required. @code{AM_INIT_AUTOMAKE} automatically calls
still preliminary.
@cvindex AM_PROG_LIBTOOL
+@item AC_PROG_YACC
+If a Yacc source file is seen, then you must either use this macro or
+declare the variable @samp{YACC} in @file{configure.in}. The former is
+preferred.
+@cvindex AC_PROG_YACC
+@cvindex YACC
+
+@item AC_DECL_YYTEXT
+This macro is required if there is Yacc source in the package.
+@cvindex AC_DECL_YYTEXT
+
+@item AC_PROG_LEX
+If a Lex source file is seen, then this macro must be used.
+@cvindex AC_PROG_LEX
+
@item ALL_LINGUAS
If Automake sees that this variable is set in @file{configure.in}, it
will check the @file{po} directory to ensure that all the named
@node Program variables
@section Variables used when building a program
-@table @code
-@item CC
-@item CFLAGS
-@item CPPFLAGS
-@item CXX
-@item CXXFLAGS
-@item DEFS
-@item LDFLAGS
-@item LIBS
+Occasionally it is useful to know which @file{Makefile} variables
+Automake uses for compilations; for instance you might need to do your
+own compilation in some special cases.
+
+Some variables are inherited from Autoconf; these are @code{CC},
+@code{CFLAGS}, @code{CPPFLAGS}, @code{CXX}, @code{CXXFLAGS},
+@code{DEFS}, @code{LDFLAGS}, and @code{LIBS}.
+
+There are some additional variables which Automake itself defines:
+
+@table @code
@item INCLUDES
+A list of @samp{-I} options. This can be set in your @file{Makefile.am}
+if you have special directories you want to look in.
+
@item COMPILE
+This is the command used to actually compile a C source file. The
+filename is appended to form the complete command line.
+
@item LINK
+This is the command used to actually link a C program.
@end table
@node Yacc and Lex
@section Yacc and Lex support
-Y
+Automake has somewhat idiosyncratic support for Yacc and Lex.
+
+
+
@node C++
@section C++ and other languages
other languages. Support for other languages will be improved based on
demand.
+Any package including C++ code must use @code{AC_PROG_CXX} in its
+@file{configure.in}.
+
+A few additional variables are defined when a C++ source file is seen.
@node ANSI