3 # Generated automatically from automake.in by configure.
5 eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
8 # automake - create Makefile.in from Makefile.am
9 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
10 # Free Software Foundation, Inc.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2, or (at your option)
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 # Originally written by David Mackenzie <djm@gnu.ai.mit.edu>.
28 # Perl reimplementation by Tom Tromey <tromey@cygnus.com>.
31 # Parameters set by configure. Not to be changed. NOTE: assign
32 # VERSION as string so that eg version 0.30 will print correctly.
34 $PACKAGE = "automake";
36 $am_dir = "${prefix}/share/automake";
39 $IGNORE_PATTERN = "^##([^#].*)?\$";
40 $WHITE_PATTERN = "^[ \t]*\$";
41 $COMMENT_PATTERN = "^#";
42 $RULE_PATTERN = "^([\$a-zA-Z_.][-.a-zA-Z0-9_(){}/\$]*) *:([^=].*|)\$";
43 $SUFFIX_RULE_PATTERN = "^\\.([a-zA-Z0-9]+)\\.([a-zA-Z0-9]+)\$";
44 # Only recognize leading spaces, not leading tabs. If we recognize
45 # leading tabs here then we need to make the reader smarter, because
46 # otherwise it will think rules like `foo=bar; \' are errors.
47 $MACRO_PATTERN = "^ *([A-Za-z0-9_]+)[ \t]*([:+]?)=[ \t]*(.*)\$";
48 $BOGUS_MACRO_PATTERN = "^ *([^ \t]*)[ \t]*([:+]?)=[ \t]*(.*)\$";
49 $GNITS_VERSION_PATTERN = "[0-9]+\\.[0-9]+([a-z]|\\.[0-9]+)?";
50 $IF_PATTERN = "^if[ \t]+\([A-Za-z][A-Za-z0-9_]*\)[ \t]*\(#.*\)?\$";
51 $ELSE_PATTERN = "^else[ \t]*\(#.*\)?\$";
52 $ENDIF_PATTERN = "^endif[ \t]*\(#.*\)?\$";
53 $PATH_PATTERN='(\\w|[/.-])+';
54 # This will pass through anything not of the prescribed form.
55 $INCLUDE_PATTERN = "^include[ \t]+((\\\$\\\(top_srcdir\\\)/${PATH_PATTERN})|(\\\$\\\(srcdir\\\)/${PATH_PATTERN})|([^/\\\$]${PATH_PATTERN}))[ \t]*(#.*)?\$";
57 # Some regular expressions. One reason to put them here is that it
58 # makes indentation work better in Emacs.
59 $AC_CONFIG_AUX_DIR_PATTERN = "AC_CONFIG_AUX_DIR\\(([^)]+)\\)";
60 $AM_INIT_AUTOMAKE_PATTERN = "AM_INIT_AUTOMAKE\\([^,]*,([^,)]+)[,)]";
61 $AM_PACKAGE_VERSION_PATTERN = "^\\s*\\[?([^]\\s]+)\\]?\\s*\$";
62 # Note that there is no AC_PATH_TOOL. But we don't really care.
63 $AC_CHECK_PATTERN = "AC_(CHECK|PATH)_(PROG|PROGS|TOOL)\\(\\[?(\\w+)";
64 $AM_MISSING_PATTERN = "AM_MISSING_PROG\\(\\[?(\\w+)";
65 # Just check for alphanumeric in AC_SUBST. If you do AC_SUBST(5),
67 $AC_SUBST_PATTERN = "AC_SUBST\\(\\[?(\\w+)";
68 $AM_CONDITIONAL_PATTERN = "AM_CONDITIONAL\\((\\w+)";
70 # Constants to define the "strictness" level.
75 # These constants are returned by lang_*_rewrite functions.
76 # LANG_SUBDIR means that the resulting object file should be in a
77 # subdir if the source file is. In this case the file name cannot
78 # have `..' components.
85 # Variables global to entire run.
87 # TRUE if we should always generate Makefile.in.
88 $force_generation = 1;
90 # Strictness level as set on command line.
91 $default_strictness = $GNU;
93 # Name of strictness level, as set on command line.
94 $default_strictness_name = 'gnu';
96 # This is TRUE if automatic dependency generation code should be
97 # included in generated Makefile.in.
98 $cmdline_use_dependencies = 1;
100 # TRUE if in verbose mode.
103 # This holds our (eventual) exit status. We don't actually exit until
104 # we have processed all input files.
107 # From the Perl manual.
108 $symlink_exists = (eval 'symlink ("", "");', $@
eq '');
110 # TRUE if missing standard files should be installed.
113 # TRUE if we should copy missing files; otherwise symlink if possible.
116 # TRUE if we should always update files that we know about.
119 # Files found by scanning configure.in for LIBOBJS.
122 # True if AM_C_PROTOTYPES appears in configure.in.
123 $am_c_prototypes = 0;
125 # Names used in AC_CONFIG_HEADER call. @config_fullnames holds the
126 # name which appears in AC_CONFIG_HEADER, colon and all.
127 # @config_names holds the file names. @config_headers holds the '.in'
128 # files. Ordinarily these are similar, but they can be different if
129 # the weird "NAME:FILE" syntax is used.
130 @config_fullnames = ();
132 @config_headers = ();
133 # Line number at which AC_CONFIG_HEADER appears in configure.in.
134 $config_header_line = 0;
136 # Directory where output files go. Actually, output files are
137 # relative to this directory.
138 $output_directory = '.';
140 # Relative location of top build directory.
143 # List of Makefile.am's to process, and their corresponding outputs.
147 # Complete list of Makefile.am's that exist.
148 @configure_input_files = ();
150 # List of files in AC_OUTPUT without Makefile.am, and their outputs.
151 @other_input_files = ();
152 # Line number at which AC_OUTPUT seen.
155 # List of directories to search for configure-required files. This
156 # can be set by AC_CONFIG_AUX_DIR.
157 @config_aux_path = ('.', '..', '../..');
158 $config_aux_dir = '';
160 # Whether AC_PROG_MAKE_SET has been seen in configure.in.
163 # Whether AM_GNU_GETTEXT has been seen in configure.in.
165 # Line number at which AM_GNU_GETTEXT seen.
166 $ac_gettext_line = 0;
168 # Whether ALL_LINGUAS has been seen.
172 # Line number at which it appears.
173 $all_linguas_line = 0;
175 # 1 if AC_PROG_INSTALL seen.
176 $seen_prog_install = 0;
178 # Whether AC_PATH_XTRA has been seen in configure.in.
181 # TRUE if AC_DECL_YYTEXT was seen.
182 $seen_decl_yytext = 0;
184 # TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM). The presence of
185 # AC_CHECK_TOOL also sets this.
188 # TRUE if we've seen AC_ARG_PROGRAM.
191 # TRUE if we've seen AC_PROG_LIBTOOL.
195 # Files installed by libtoolize.
196 @libtoolize_files = ('ltmain.sh', 'config.guess', 'config.sub');
197 # ltconfig appears here for compatibility with old versions of libtool.
198 @libtoolize_sometimes = ('ltconfig', 'ltcf-c.sh', 'ltcf-cxx.sh',
201 # TRUE if we've seen AM_MAINTAINER_MODE.
202 $seen_maint_mode = 0;
204 # Actual version we've seen.
205 $package_version = '';
207 # Line number where we saw version definition.
208 $package_version_line = 0;
210 # TRUE if we've seen AM_PATH_LISPDIR.
213 # TRUE if we've seen AM_CHECK_PYTHON.
216 # TRUE if we've seen AC_EXEEXT.
219 # TRUE if we've seen AC_OBJEXT.
222 # TRUE if we've seen AC_ENABLE_MULTILIB.
225 # TRUE if we've seen AM_PROG_CC_C_O
228 # TRUE if we've seen AM_INIT_AUTOMAKE.
229 $seen_init_automake = 0;
231 # Hash table of discovered configure substitutions. Keys are names,
232 # values are `FILE:LINE' strings which are used by error message
234 %configure_vars = ();
236 # This is used to keep track of which variable definitions we are
237 # scanning. It is only used in certain limited ways, but it has to be
238 # global. It is declared just for documentation purposes.
241 # Charsets used by maintainer and in distribution. MAINT_CHARSET is
242 # handled in a funny way: if seen in the top-level Makefile.am, it is
243 # used for every directory which does not specify a different value.
244 # The rationale here is that some directories (eg gettext) might be
245 # distributions of other packages, and thus require their own charset
246 # info. However, the DIST_CHARSET must be the same for the entire
247 # package; it can only be set at top-level.
248 # FIXME: this yields bugs when rebuilding. What to do? Always
249 # read (and sometimes discard) top-level Makefile.am?
251 $dist_charset = 'utf8'; # recode doesn't support this yet.
253 # Name of input file ("Makefile.in") and output file ("Makefile.am").
254 # These have no directory components.
258 # TRUE if --cygnus seen.
261 # Hash table of AM_CONDITIONAL variables seen in configure.
262 %configure_cond = ();
264 # Map from obsolete macros to hints for new macros.
265 # If you change this, change the corresponding list in aclocal.in.
266 # FIXME: should just put this into a single file.
269 'AC_FEATURE_CTYPE', "use \`AC_HEADER_STDC'",
270 'AC_FEATURE_ERRNO', "add \`strerror' to \`AC_REPLACE_FUNCS(...)'",
271 'AC_FEATURE_EXIT', '',
272 'AC_SYSTEM_HEADER', '',
274 # Note that we do not handle this one, because it is still run
275 # from AM_CONFIG_HEADER. So we deal with it specially in
277 # 'AC_CONFIG_HEADER', "use \`AM_CONFIG_HEADER'",
279 'fp_C_PROTOTYPES', "use \`AM_C_PROTOTYPES'",
280 'fp_PROG_CC_STDC', "use \`AM_PROG_CC_STDC'",
281 'fp_PROG_INSTALL', "use \`AC_PROG_INSTALL'",
282 'fp_WITH_DMALLOC', "use \`AM_WITH_DMALLOC'",
283 'fp_WITH_REGEX', "use \`AM_WITH_REGEX'",
284 'gm_PROG_LIBTOOL', "use \`AM_PROG_LIBTOOL'",
285 'jm_MAINTAINER_MODE', "use \`AM_MAINTAINER_MODE'",
286 'md_TYPE_PTRDIFF_T', "use \`AM_TYPE_PTRDIFF_T'",
287 'ud_PATH_LISPDIR', "use \`AM_PATH_LISPDIR'",
288 'ud_GNU_GETTEXT', "use \`AM_GNU_GETTEXT'",
290 # Now part of autoconf proper, under a different name.
291 'AM_FUNC_FNMATCH', "use \`AC_FUNC_FNMATCH'",
292 'fp_FUNC_FNMATCH', "use \`AC_FUNC_FNMATCH'",
293 'AM_SANITY_CHECK_CC', "automatically done by \`AC_PROG_CC'",
294 'AM_PROG_INSTALL', "use \`AC_PROG_INSTALL'",
295 'AM_EXEEXT', "use \`AC_EXEEXT'",
296 'AM_CYGWIN32', "use \`AC_CYGWIN'",
297 'AM_MINGW32', "use \`AC_MINGW32'",
298 'AM_FUNC_MKTIME', "use \`AC_FUNC_MKTIME'",
300 # These aren't quite obsolete.
304 # Regexp to match the above macros.
305 $obsolete_rx = '(' . join ('|', keys %obsolete_macros) . ')';
307 # This maps extensions onto language names.
310 # This maps languages names onto properties.
313 # This holds all the files that would go in `dist_common' which we
314 # discovered while scanning configure.in. We might distribute these
315 # in the top-level Makefile.in.
316 %configure_dist_common = ();
320 # Initialize global constants and our list of languages that are
321 # internally supported.
322 &initialize_global_constants
;
324 ®ister_language
('c', 'ansi-p=1', 'autodep=', 'flags=CFLAGS',
325 'compile=$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
326 'compiler-name=COMPILE',
329 ®ister_language
('cxx', 'linker=CXXLINK', 'autodep=CXX', 'flags=CXXFLAGS',
330 'compile=$(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
331 'compiler-name=CXXCOMPILE',
332 'output-arg=-c -o $@',
333 'c++', 'cc', 'cpp', 'cxx', 'C');
334 ®ister_language
('objc', 'linker=OBJCLINK', 'autodep=OBJC',
336 'compile=$(OBJC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
337 'compiler-name=OBJCCOMPILE',
338 'output-arg=-c -o $@',
340 ®ister_language
('header',
341 'h', 'H', 'hxx', 'h++', 'hh', 'hpp', 'inc');
343 # For now, yacc and lex can't be handled on a per-exe basis.
344 ®ister_language
('yacc', 'ansi-p=1', 'derived-autodep=yes',
346 ®ister_language
('yaccxx', 'linker=CXXLINK', 'derived-autodep=yes',
347 'y++', 'yy', 'yxx', 'ypp');
348 ®ister_language
('lex', 'ansi-p=1', 'derived-autodep=yes',
350 ®ister_language
('lexxx', 'linker=CXXLINK', 'derived-autodep=yes',
351 'l++', 'll', 'lxx', 'lpp');
353 ®ister_language
('asm',
354 'flags=CFLAGS', # FIXME: asmflags?
355 'compile=$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)', # FIXME: a different compiler?
356 'compiler-name=COMPILE',
360 ®ister_language
('f77', 'linker=F77LINK', 'flags=FFLAGS',
361 'compile=$(F77) $(AM_FFLAGS) $(FFLAGS)',
362 'compiler-name=F77COMPILE',
363 'output-arg=-c -o $@',
365 ®ister_language
('ppf77', 'linker=F77LINK', 'flags=FFLAGS',
366 'compile=$(F77) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
367 'compiler-name=PPF77COMPILE',
368 'output-arg=-c -o $@',
370 ®ister_language
('ratfor', 'linker=F77LINK',
371 'flags=RFLAGS', # FIXME also FFLAGS.
372 'compile=$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)',
373 'compiler-name=RCOMPILE',
374 'output-arg=-c -o $@',
376 # FIXME: for now we can't do dependency tracking for Java.
378 ®ister_language
('java', 'linker=GCJLINK', 'flags=GCJFLAGS',
379 'compile=$(GCJ) $(DEFS) $(INCLUDES) $(AM_GCJFLAGS) $(GCJFLAGS)',
380 'compiler-name=GCJCOMPILE',
381 'output-arg=-c -o $@',
382 'java', 'class', 'zip', 'jar');
385 # Parse command line.
386 &parse_arguments
(@ARGV);
388 # Do configure.in scan only once.
391 die "automake: no \`Makefile.am' found or specified\n"
394 # Now do all the work on each file.
395 foreach $am_file (@input_files)
397 if (! -f
($am_file . '.am'))
399 &am_error
("\`" . $am_file . ".am' does not exist");
403 &generate_makefile
($output_files{$am_file}, $am_file);
407 &am_conf_error
("AC_PROG_INSTALL must be used in configure.in")
408 if (! $seen_prog_install);
413 ################################################################
415 # Parse command line.
418 local (@arglist) = @_;
421 &set_strictness
('gnu');
425 if ($arglist[0] eq "--version")
427 print "automake (GNU $PACKAGE) $VERSION\n\n";
428 print "Copyright 2000 Free Software Foundation, Inc.\n";
429 print "This is free software; see the source for copying conditions. There is NO\n";
430 print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n";
431 print "Written by Tom Tromey <tromey\@cygnus.com>\n";
435 elsif ($arglist[0] eq "--help")
439 elsif ($arglist[0] =~ /^--amdir=(.+)$/)
443 elsif ($arglist[0] eq '--amdir')
445 &require_argument
(@arglist);
447 $am_dir = $arglist[0];
449 elsif ($arglist[0] eq '--gnu')
451 &set_strictness
('gnu');
453 elsif ($arglist[0] eq '--gnits')
455 &set_strictness
('gnits');
457 elsif ($arglist[0] eq '--cygnus')
461 elsif ($arglist[0] eq '--foreign')
463 &set_strictness
('foreign');
465 elsif ($arglist[0] eq '--include-deps')
467 $cmdline_use_dependencies = 1;
469 elsif ($arglist[0] eq '--ignore-deps' || $arglist[0] eq '-i')
471 $cmdline_use_dependencies = 0;
473 elsif ($arglist[0] eq '--no-force')
475 $force_generation = 0;
477 elsif ($arglist[0] eq '--force-missing')
481 elsif ($arglist[0] =~ /^--output-dir=(.*)$/)
483 # Set output directory.
484 $output_directory = $1;
486 elsif ($arglist[0] eq '--output-dir' || $arglist[0] eq '-o')
488 &require_argument
(@arglist);
490 $output_directory = $arglist[0];
492 elsif ($arglist[0] eq '--add-missing' || $arglist[0] eq '-a')
496 elsif ($arglist[0] eq '--copy' || $arglist[0] eq '-c')
500 elsif ($arglist[0] eq '--verbose' || $arglist[0] eq '-v')
504 elsif ($arglist[0] eq '--')
506 # Stop option processing.
508 push (@input_files, @arglist);
511 elsif ($arglist[0] =~ /^-/)
513 die "automake: unrecognized option -- \`$arglist[0]'\nTry \`automake --help' for more information.\n";
517 # Handle $local:$input syntax. Note that we only examine
518 # the first ":" file to see if it is automake input; the
519 # rest are just taken verbatim. We still keep all the
520 # files around for dependency checking, however.
521 local ($local, $input, @rest) = split (/:/, $arglist[0]);
528 # Strip .in; later on .am is tacked on. That is how
529 # the automake input file is found. Maybe not the
530 # best way, but it is easy to explain. FIXME: should
531 # be error if .in is missing.
534 push (@input_files, $input);
535 $output_files{$input} = join (':', ($local, @rest));
541 # Take global strictness from whatever we currently have set.
542 $default_strictness = $strictness;
543 $default_strictness_name = $strictness_name;
546 # Ensure argument exists, or die.
549 local ($arg, @arglist) = @_;
550 die "automake: no argument given for option \`$arg'\n"
554 ################################################################
556 # Generate a Makefile.in given the name of the corresponding Makefile and
557 # the name of the file output by config.status.
558 sub generate_makefile
560 local ($output, $makefile) = @_;
562 ($am_file_name = $makefile) =~ s/^.*\///;
563 $in_file_name = $am_file_name . '.in';
564 $am_file_name .= '.am';
566 # $OUTPUT is encoded. If it contains a ":" then the first element
567 # is the real output file, and all remaining elements are input
568 # files. We don't scan or otherwise deal with these input file,
569 # other than to mark them as dependencies. See scan_configure for
571 local (@secondary_inputs);
572 ($output, @secondary_inputs) = split (/:/, $output);
574 &initialize_per_input
;
575 $relative_dir = &dirname
($output);
576 $am_relative_dir = &dirname
($makefile);
578 # At the toplevel directory, we might need config.guess, config.sub
579 # or libtool scripts (ltconfig and ltmain.sh).
580 if ($relative_dir eq '.')
582 # libtool requires some files.
583 &require_conf_file_with_conf_line
($libtool_line, $FOREIGN,
587 # AC_CANONICAL_HOST and AC_CANONICAL_SYSTEM need config.guess and
589 &require_config_file
($FOREIGN, 'config.guess', 'config.sub')
593 # We still need Makefile.in here, because sometimes the `dist'
594 # target doesn't re-run automake.
595 if ($am_relative_dir eq $relative_dir)
597 # Only distribute the files if they are in the same subdir as
598 # the generated makefile.
599 &push_dist_common
($in_file_name, $am_file_name);
602 push (@sources, '$(SOURCES)')
603 if &variable_defined
('SOURCES');
604 push (@objects, '$(OBJECTS)')
605 if &variable_defined
('OBJECTS');
607 &read_main_am_file
($makefile . '.am');
610 # Fatal error. Just return, so we can continue with next file.
614 # Must do this after reading .am file. See read_main_am_file to
615 # understand weird tricks we play there with variables.
616 &define_variable
('subdir', $relative_dir);
618 # Check first, because we might modify some state.
620 &check_gnu_standards
;
621 &check_gnits_standards
;
623 &handle_configure
($output, $makefile, @secondary_inputs);
630 # This must be run after all the sources are scanned.
633 # Re-init SOURCES and OBJECTS. FIXME: other code shouldn't depend
634 # on this (but currently does).
635 $contents{'SOURCES'} = join (' ', @sources);
636 $contents{'OBJECTS'} = join (' ', @objects);
637 &define_pretty_variable
('DIST_SOURCES', '', @dist_sources);
649 &handle_minor_options
;
650 &handle_dependencies
;
653 # This must come after most other rules.
654 &handle_dist
($makefile);
657 &handle_merge_targets
($output);
664 if (! -d
($output_directory . '/' . $am_relative_dir))
666 mkdir ($output_directory . '/' . $am_relative_dir, 0755);
669 local ($out_file) = $output_directory . '/' . $makefile . ".in";
670 if (! $force_generation && -e
$out_file)
672 local ($am_time) = (stat ($makefile . '.am'))[9];
673 local ($in_time) = (stat ($out_file))[9];
674 # FIXME: should cache these times.
675 local ($conf_time) = (stat ('configure.in'))[9];
676 # FIXME: how to do unsigned comparison?
677 if ($am_time < $in_time || $am_time < $conf_time)
684 local ($acl_time) = (stat _
)[9];
685 return if ($am_time < $acl_time);
689 if (! open (GM_FILE
, "> " . $out_file))
691 warn "automake: ${am_file}.in: cannot write: $!\n";
695 print "automake: creating ", $makefile, ".in\n" if $verbose;
697 # In case we're running under MSWindows, don't write with CRLF
698 # (as it causes problems for the dependency-file extraction in
699 # AM_OUTPUT_DEPENDENCY_COMMANDS).
702 print GM_FILE
$output_vars;
703 # We make sure that `all:' is the first target.
704 print GM_FILE
$output_all;
705 print GM_FILE
$output_header;
706 print GM_FILE
$output_rules;
707 print GM_FILE
$output_trailer;
709 if (! close (GM_FILE
))
711 warn "automake: $am_file.in: cannot close: $!\n";
717 ################################################################
719 # Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
722 if (&variable_defined
('AUTOMAKE_OPTIONS'))
724 foreach (&variable_value_as_list
('AUTOMAKE_OPTIONS', ''))
727 if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
729 &set_strictness
($_);
731 elsif ($_ eq 'cygnus')
737 # An option like "../lib/ansi2knr" is allowed. With
738 # no path prefix, we assume the required programs are
739 # in this directory. We save the actual option for
741 $options{'ansi2knr'} = $_;
743 elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo'
744 || $_ eq 'dist-shar' || $_ eq 'dist-zip'
745 || $_ eq 'dist-tarZ' || $_ eq 'dist-bzip2'
746 || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
747 || $_ eq 'readme-alpha' || $_ eq 'check-news'
748 || $_ eq 'subdir-objects' || $_ eq 'nostdinc')
750 # Explicitly recognize these.
752 elsif ($_ eq 'no-dependencies')
754 $use_dependencies = 0;
756 elsif (/([0-9]+)\.([0-9]+)([a-z])?/)
758 # Got a version number.
760 local ($rmajor, $rminor, $ralpha) = ($1, $2, $3);
762 if ($VERSION !~ /([0-9]+)\.([0-9]+)([a-z])?/)
765 "automake: programming error: version is incorrect\n";
768 local ($tmajor, $tminor, $talpha) = ($1, $2, $3);
770 # 2.0 is better than 1.0.
771 # 1.2 is better than 1.1.
772 # 1.2a is better than 1.2.
773 if ($rmajor > $tmajor
774 || ($rmajor == $tmajor && $rminor > $tminor)
775 || ($rminor == $tminor && $rminor == $tminor
776 && $ralpha gt $talpha))
778 &am_line_error
('AUTOMAKE_OPTIONS',
779 "require version $_, only have $VERSION");
785 &am_line_error
('AUTOMAKE_OPTIONS',
786 "option \`" . $_ . "\' not recognized");
791 if ($strictness == $GNITS)
793 $options{'readme-alpha'} = 1;
794 $options{'check-news'} = 1;
800 # Return object extension. Just once, put some code into the output.
801 # Argument is the name of the output file
802 sub get_object_extension
806 # Maybe require libtool library object files.
807 local ($extension) = '.o';
808 $extension = '.$(OBJEXT)' if $seen_objext;
809 $extension = '.lo' if ($out =~ /\.la$/);
811 if (! $included_generic_compile)
815 if (! defined $options{'nostdinc'})
817 $xform = ' -I. -I\$(srcdir)';
819 if (&variable_defined
('CONFIG_HEADER'))
822 foreach $one_hdr (split (' ',
823 &variable_value
('CONFIG_HEADER')))
826 ($var = &dirname
($one_hdr)) =~ s/(\W)/\\$1/g;
827 $xform .= ' -I' . $var;
831 $xform = 's/\@DEFAULT_INCLUDES\@/' . $xform . '/go;';
832 $output_vars .= &file_contents_with_transform
($xform,
835 $xform = $seen_objext ?
's/^OBJEXT//;' : 's/^OBJEXT.*$//;';
836 $output_rules .= &file_contents_with_transform
($xform, 'compile');
838 &push_phony_cleaners
('compile');
840 # If using X, include some extra variable definitions. NOTE
841 # we don't want to force these into CFLAGS or anything,
842 # because not all programs will necessarily use X.
846 foreach $var ('X_CFLAGS', 'X_LIBS', 'X_EXTRA_LIBS', 'X_PRE_LIBS')
848 &define_configure_variable
($var);
852 push (@suffixes, '.c', '.o');
853 push (@suffixes, '.obj') if $seen_objext;
854 push (@clean, 'compile');
856 $included_generic_compile = 1;
859 if ($seen_libtool && ! $included_libtool_compile)
861 # Output the libtool compilation rules.
862 $output_rules .= &file_contents
('libtool');
864 &push_phony_cleaners
('libtool');
866 push (@suffixes, '.lo');
867 push (@clean, 'libtool');
869 $included_libtool_compile = 1;
872 # Check for automatic de-ANSI-fication.
873 if (defined $options{'ansi2knr'})
875 $extension = '$U' . $extension;
876 if (! $included_knr_compile)
878 if (! $am_c_prototypes)
880 &am_line_error
('AUTOMAKE_OPTIONS',
881 "option \`ansi2knr' in use but \`AM_C_PROTOTYPES' not in configure.in");
882 &keyed_aclocal_warning
('AM_C_PROTOTYPES');
883 # Only give this error once.
884 $am_c_prototypes = 1;
887 # Only require ansi2knr files if they should appear in
889 if ($options{'ansi2knr'} eq 'ansi2knr')
891 &require_file_with_line
('AUTOMAKE_OPTIONS', $FOREIGN,
892 'ansi2knr.c', 'ansi2knr.1');
893 $output_rules .= &file_contents
('kr-extra');
894 push (@clean, 'krextra');
895 &push_phony_cleaners
('krextra');
898 # Generate rules to build ansi2knr. If it is in some
899 # other directory, then generate dependencies but have the
900 # rule just run elsewhere.
901 $objext = $seen_objext ?
".\$(OBJEXT)" : ".o";
902 $output_rules .= ($options{'ansi2knr'} . ': '
903 . $options{'ansi2knr'} . $objext . "\n");
904 if ($options{'ansi2knr'} eq 'ansi2knr')
906 $output_rules .= ("\t\$(LINK) ansi2knr" . $objext
908 . "ansi2knr" . $objext
909 . ": \$(CONFIG_HEADER)\n\n");
913 $output_rules .= ("\tcd " . &dirname
($options{'ansi2knr'})
914 . " && \$(MAKE) \$(AM_MAKEFLAGS) "
916 # This is required for non-GNU makes.
917 $output_rules .= ($options{'ansi2knr'} . $objext . ":\n");
918 $output_rules .= ("\tcd " . &dirname
($options{'ansi2knr'})
919 . " && \$(MAKE) \$(AM_MAKEFLAGS)"
920 . " ansi2knr" . $objext . "\n\n");
923 # Make sure ansi2knr can be found: if no path specified,
925 if ($options{'ansi2knr'} eq 'ansi2knr')
927 # Substitution from AM_C_PROTOTYPES. This makes it be
928 # built only when necessary.
929 &define_configure_variable
('ANSI2KNR');
930 # ansi2knr needs to be built before subdirs, so unshift it.
931 unshift (@all, '$(ANSI2KNR)');
935 # Found in another directory.
936 &define_variable
("ANSI2KNR", $options{'ansi2knr'});
939 $output_rules .= &file_contents
('clean-kr');
942 &push_phony_cleaners
('kr');
944 $included_knr_compile = 1;
951 # Call finish function for each language that was used.
954 local ($ltcompile, $ltlink) = &libtool_compiler
;
956 local ($ext, $name, $lang, %done);
958 foreach $ext (sort keys %extension_seen)
960 $lang = $extension_map{$ext};
962 # Generate the appropriate rules for this extension. If
963 # dependency tracking was requested, and this extension
964 # supports it, then we don't generate the rule here.
967 if ($use_dependencies && $language_map{$lang . '-autodep'} ne 'no')
969 # Don't generate the rule, but still generate the variables.
970 if (defined $language_map{$lang . '-compile'})
972 $comp = $language_map{$lang . '-compile'};
975 elsif (defined $language_map{$lang . '-compile'})
977 $comp = $language_map{$lang . '-compile'};
979 local ($outarg) = $language_map{$lang . '-output-arg'};
980 if ($language_map{$lang . '-flags'} eq 'CFLAGS')
982 # C compilers don't always support -c -o.
983 if (defined $options{'subdir-objects'})
989 local ($full) = ("\t\$("
990 . $language_map{$lang . '-compiler-name'}
993 $output_rules .= (".$ext.o:\n"
996 # FIXME: Using cygpath should be somehow conditional.
997 $output_rules .= (".$ext.obj:\n"
999 . " \`cygpath -w \$<\`\n")
1001 $output_rules .= (".$ext.lo:\n"
1003 . $language_map{$lang . '-compiler-name'}
1005 . $language_map{$lang . '-output-arg'}
1006 # We can always use -c -o with libtool.
1007 . ($language_map{$lang . '-flags'} eq 'CFLAGS'
1013 push (@suffixes, '.' . $ext);
1015 # The rest of the loop is done once per language.
1016 next if defined $done{$lang};
1019 $non_c = 0 if $lang !~ /(objc|cxx|f77|ratfor)$/;
1023 &define_compiler_variable
($language_map{$lang . '-compiler-name'},
1026 # The compiler's flag must be a configure variable.
1027 if (defined $language_map{$lang . '-flags'})
1029 &define_configure_variable
($language_map{$lang . '-flags'});
1032 # Compute the function name of the finisher and then call it.
1033 $name = 'lang_' . $lang . '_finish';
1037 # If the project is entirely C++ or entirely Fortran 77, don't
1038 # bother with the C stuff. But if anything else creeps in, then use
1040 if ($need_link || ! $non_c || scalar keys %suffix_rules > 0)
1042 if (! defined $done{'c'})
1044 &define_configure_variable
($language_map{'c-flags'});
1045 &define_compiler_variable
($language_map{'c-compiler-name'},
1047 $language_map{'c-compile'});
1049 &define_variable
('CCLD', '$(CC)');
1050 &define_variable
('LINK', $ltlink . '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
1054 # Output a rule to build from a YACC source. The output from YACC is
1055 # compiled with C or C++, depending on the extension of the YACC file.
1056 sub output_yacc_build_rule
1058 local ($yacc_suffix, $use_ylwrap, $c_suffix) = @_;
1061 ($suffix = $yacc_suffix) =~ tr/y/c/;
1062 push (@suffixes, $yacc_suffix, $suffix);
1064 # Generate rule for c/c++.
1065 $output_rules .= "$yacc_suffix$suffix:\n\t";
1069 $output_rules .= ('$(SHELL) $(YLWRAP)'
1070 . ' "$(YACC)" $< y.tab.c $*' . $suffix
1071 . ' y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS)');
1075 $output_rules .= ('$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*'
1077 . "\tif test -f y.tab.h; then \\\n"
1078 . "\tif cmp -s y.tab.h \$*.h; then rm -f y.tab.h; else mv y.tab.h \$*.h; fi; \\\n"
1081 $output_rules .= "\n";
1084 sub output_lex_build_rule
1086 local ($lex_suffix, $use_ylwrap) = @_;
1089 ($c_suffix = $lex_suffix) =~ tr/l/c/;
1090 push (@suffixes, $lex_suffix);
1091 &define_configure_variable
('LEX_OUTPUT_ROOT');
1092 &define_configure_variable
('LEXLIB');
1093 $output_rules .= "$lex_suffix$c_suffix:\n\t";
1097 # Is the $@ correct here? If so, why not use it in the ylwrap
1098 # build rule for yacc above?
1099 $output_rules .= '$(SHELL) $(YLWRAP)'
1100 . ' "$(LEX)" $< $(LEX_OUTPUT_ROOT).c $@ -- $(AM_LFLAGS) $(LFLAGS)';
1104 $output_rules .= '$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@';
1106 $output_rules .= "\n";
1110 # Check to make sure a source defined in LIBOBJS is not explicitly
1111 # mentioned. This is a separate function (as opposed to being inlined
1112 # in handle_source_transform) because it isn't always appropriate to
1114 sub check_libobjs_sources
1116 local ($one_file, $unxformed) = @_;
1118 local ($prefix, $file, @files);
1119 foreach $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
1120 'dist_EXTRA_', 'nodist_EXTRA_')
1122 if (&variable_defined
($prefix . $one_file . '_SOURCES'))
1124 @files = &variable_value_as_list
(($prefix
1125 . $one_file . '_SOURCES'),
1128 elsif ($prefix eq '')
1130 @files = ($unxformed . '.c');
1137 foreach $file (@files)
1139 if (defined $libsources{$file})
1141 &am_line_error
($prefix . $one_file . '_SOURCES',
1142 "automatically discovered file \`$file' should not be explicitly mentioned");
1148 # Does much of the actual work for handle_source_transform.
1150 # name of resulting executable or library ("derived")
1151 # object extension (e.g., `$U.lo')
1152 # list of source files to transform
1154 # first element is name of linker to use (empty string for default linker)
1155 # remaining elements are names of objects
1156 sub handle_single_transform_list
1158 local ($var, $derived, $obj, @files) = @_;
1159 local (@result) = ();
1160 local ($nonansi_obj) = $obj;
1161 $nonansi_obj =~ s/_//g;
1162 local (%linkers_used) = ();
1165 # Turn sources into objects.
1168 # Configure substitutions in _SOURCES variables are errors.
1171 &am_line_error
($var, "$var includes configure substitution \`$_'");
1175 # If the source file is in a subdirectory then the `.o' is
1176 # put into the current directory.
1178 # Split file name into base and extension.
1179 local ($full, $directory, $base, $extension, $linker, $object);
1180 next if ! /^((.*)\/)?
([^\
/]*)\.(.*)$/;
1183 ++$sourcedirs{$2} if ($2);
1187 local ($xbase) = $base;
1189 # We must generate a rule for the object if it requires
1192 local ($renamed) = 0;
1194 $extension = &derive_suffix
($extension);
1195 local ($lang) = $extension_map{$extension};
1198 &saw_extension
($extension);
1199 # Found the language, so see what it says.
1200 local ($subr) = 'lang_' . $lang . '_rewrite';
1201 # Note: computed subr call.
1202 local ($r) = & $subr ($directory, $base, $extension);
1203 # Skip this entry if we were asked not to process it.
1204 next if $r == $LANG_IGNORE;
1206 # Now extract linker and other info.
1207 $linker = $language_map{$lang . '-linker'};
1209 local ($this_obj_ext);
1210 if ($language_map{$lang . '-ansi-p'})
1212 $object = $base . $obj;
1213 $this_obj_ext = $obj;
1217 $object = $base . $nonansi_obj;
1218 $this_obj_ext = $nonansi_obj;
1221 if ($language_map{$lang . '-flags'} ne ''
1222 && &variable_defined
($derived . '_'
1223 . $language_map{$lang . '-flags'}))
1225 # We have a per-executable flag in effect for this
1226 # object. In this case we rewrite the object's
1227 # name to ensure it is unique. We also require
1228 # the `compile' program to deal with compilers
1229 # where `-c -o' does not work.
1231 # We choose the name `DERIVED-OBJECT' to ensure
1232 # (1) uniqueness, and (2) continuity between
1233 # invocations. However, this will result in a
1234 # name that is too long for losing systems, in
1235 # some situations. So we provide _SHORTNAME to
1238 local ($dname) = $derived;
1239 if (&variable_defined
($derived . '_SHORTNAME'))
1241 # FIXME: should use the same conditional as
1242 # the _SOURCES variable. But this is really
1243 # silly overkill -- nobody should have
1244 # conditional shortnames.
1245 $dname = &variable_value
($derived . '_SHORTNAME');
1247 $object = $dname . '-' . $object;
1249 &require_file
($FOREIGN, 'compile')
1252 if (! defined $language_map{$lang . '-compile'})
1254 print STDERR
"automake: programming error: $lang flags defined without compiler\n";
1257 # Compute the rule to compile this object.
1258 local ($flag) = $language_map{$lang . '-flags'};
1259 local ($val) = "(${derived}_${flag}";
1260 ($rule = $language_map{$lang . '-compile'}) =~
1263 $rule .= ' ' . $language_map{$lang . '-output-arg'};
1264 # For C we have to add the -o, because the
1265 # standard rule doesn't include it.
1266 if ($language_map{$lang . '-flags'} eq 'CFLAGS')
1274 # If rewrite said it was ok, put the object into a
1276 if ($r == $LANG_SUBDIR && $directory ne '')
1278 $object = $directory . '/' . $object;
1279 $xbase = $directory . '/' . $base;
1282 # If doing dependency tracking, then we can't print
1283 # the rule. Also, if we have a subdir object, we need
1284 # to generate an explicit rule.
1285 if (($use_dependencies
1287 && $language_map{$lang . '-autodep'} ne 'no')
1288 || ($r == $LANG_SUBDIR && $directory ne ''))
1291 local ($obj_sans_ext) = substr ($object, 0,
1292 - length ($this_obj_ext));
1293 $lang_specific_files{$lang} .= (' ' . $derived
1295 . ' ' . $obj_sans_ext);
1298 elsif ($extension eq 'o')
1300 # This is probably the result of a direct suffix rule.
1301 # In this case we just accept the rewrite. FIXME:
1302 # this fails if we want libtool objects.
1303 $object = $base . '.' . $extension;
1308 # No error message here. Used to have one, but it was
1313 $linkers_used{$linker} = 1;
1315 push (@result, $object);
1317 if (defined $object_map{$object})
1319 if ($object_map{$object} ne $full)
1321 &am_error
("object \`$object' created by \`$full' and \`$object_map{$object}'");
1326 local (@dep_list) = ();
1327 $object_map{$object} = $full;
1329 # If file is in subdirectory, we need explicit
1331 if ($directory ne '' || $renamed)
1333 push (@dep_list, $full);
1336 # If resulting object is in subdir, we need to make
1337 # sure the subdir exists at build time.
1338 if ($object =~ /\//)
1340 # FIXME: check that $DIRECTORY is somewhere in the
1343 # We don't allow `..' in object file names for
1344 # *any* source, not just Java. For Java it just
1345 # doesn't make sense, but in general it is
1346 # a problem because we can't pick a good name for
1348 if ($object =~ /(\/|^)\
.\
.\
//)
1350 &am_error
("\`$full' contains \`..' component but should not");
1353 push (@dep_list, $directory . '/.dirstamp');
1355 # If we're generating dependencies, we also want
1356 # to make sure that the appropriate subdir of the
1357 # .deps directory is created.
1358 if ($use_dependencies)
1360 push (@dep_list, '.deps/' . $directory . '/.dirstamp');
1363 if (! defined $directory_map{$directory})
1365 $directory_map{$directory} = 1;
1366 $output_rules .= ($directory . "/.dirstamp:\n"
1367 . "\t\@\$(mkinstalldirs) $directory\n"
1368 . "\t\@: > $directory/.dirstamp\n");
1369 if ($use_dependencies)
1371 $output_rules .= ('.deps/' . $directory
1373 . "\t\@\$(mkinstalldirs) .deps/$directory\n"
1374 . "\t\@: > .deps/$directory/.dirstamp\n");
1379 &pretty_print_rule
($object . ':', "\t", @dep_list)
1380 if scalar @dep_list > 0 || $rule ne '';
1382 # Print the rule if we have one.
1385 # Turn `$@' into name of our object file.
1387 ($xform = $object) =~ s
,/,\\/,g
;
1388 $rule =~ s/\$\@/$xform/;
1390 # We cannot use $< here since this is an explicit
1391 # rule and not all makes handle that.
1392 $rule .= " \`test -f $full || echo '\$(srcdir)/'\`$full";
1394 # FIXME: handle .lo and .obj as well.
1395 $output_rules .= "\t" . $rule . "\n";
1399 # Transform .o or $o file into .P file (for automatic
1402 && ($language_map{$lang . '-autodep'} ne 'no'
1403 || $language_map{$lang . '-derived-autodep'} eq 'yes'))
1405 local ($depfile) = $object;
1406 $depfile =~ s/\.([^.]*)$/.P$1/;
1407 $depfile =~ s/\$\(OBJEXT\)$/o/ if $seen_objext;
1408 $dep_files{'$(DEPDIR)/' . $depfile} = 1;
1413 return (&resolve_linker
(%linkers_used), @result);
1416 # Handle SOURCE->OBJECT transform for one program or library.
1418 # canonical (transformed) name of object to build
1419 # actual name of object to build
1420 # object extension (ie either `.o' or `$o'.
1421 # Return result is name of linker variable that must be used.
1422 # Empty return means just use `LINK'.
1423 sub handle_source_transform
1425 # one_file is canonical name. unxformed is given name. obj is
1427 local ($one_file, $unxformed, $obj) = @_;
1429 local ($linker) = '';
1431 if (&variable_defined
($one_file . "_OBJECTS"))
1433 &am_line_error
($one_file . '_OBJECTS',
1434 $one_file . '_OBJECTS', 'should not be defined');
1435 # No point in continuing.
1439 local (@files, @result, $prefix, $temp, $xpfx);
1440 local (%used_pfx) = ();
1441 foreach $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
1442 'dist_EXTRA_', 'nodist_EXTRA_')
1444 # We are going to define _OBJECTS variables using the prefix.
1445 # Then we glom them all together. So we can't use the null
1446 # prefix here as we need it later.
1447 $xpfx = ($prefix eq '') ?
'am_' : $prefix;
1450 local ($var) = $prefix . $one_file . "_SOURCES";
1451 if (&variable_defined
($var))
1453 # Keep track of which prefixes we saw.
1454 $used_pfx{$xpfx} = 1
1455 unless $prefix =~ /EXTRA_/;
1457 push (@sources, '$(' . $prefix . $one_file . "_SOURCES)");
1458 push (@objects, '$(' . $xpfx . $one_file . "_OBJECTS)")
1459 unless $prefix =~ /EXTRA_/;
1460 push (@dist_sources, '$(' . $prefix . $one_file . "_SOURCES)")
1461 unless $prefix =~ /^nodist_/;
1462 local (@conds) = &variable_conditions
($var);
1465 @files = &variable_value_as_list
($var, '');
1470 foreach $cond (@conds)
1472 @files = &variable_value_as_list
($var, $cond);
1474 &handle_single_transform_list
($var, $one_file, $obj,
1476 $linker = $temp if $linker eq '';
1478 # Define _OBJECTS conditionally.
1479 &define_pretty_variable
($xpfx . $one_file . '_OBJECTS',
1481 unless $prefix =~ /EXTRA_/;
1488 # Avoid defining needless variables.
1489 next if (scalar @files == 0);
1491 ($temp, @result) = &handle_single_transform_list
($var, $one_file,
1493 $linker = $temp if $linker eq '';
1494 &define_pretty_variable
($xpfx . $one_file . "_OBJECTS", '', @result)
1495 unless $prefix =~ /EXTRA_/;
1498 local (@keys) = sort keys %used_pfx;
1499 if (scalar @keys == 0)
1501 &define_variable
($one_file . "_SOURCES", $unxformed . ".c");
1502 push (@sources, $unxformed . '.c');
1503 push (@dist_sources, $unxformed . '.c');
1504 push (@objects, $unxformed . $obj);
1505 push (@files, $unxformed . '.c');
1507 ($temp, @result) = &handle_single_transform_list
($one_file . '_SOURCES',
1510 $linker = $temp if $linker eq '';
1511 &define_pretty_variable
($one_file . "_OBJECTS", '', @result)
1515 grep ($_ = '$(' . $_ . $one_file . '_OBJECTS)', @keys);
1516 &define_pretty_variable
($one_file . '_OBJECTS', '', @keys);
1519 # If we want to use `LINK' we must make sure it is defined.
1528 # Special-case @ALLOCA@ and @LIBOBJS@ in _LDADD or _LIBADD variables.
1529 # Also, generate _DEPENDENCIES variable if appropriate.
1531 # transformed name of object being built, or empty string if no object
1532 # name of _LDADD/_LIBADD-type variable to examine
1533 # boolean (lex_seen) which is true if a lex source file was seen in this
1534 # object. valid only for LDADDs, not LIBADDs.
1535 # Returns 1 if LIBOBJS seen, 0 otherwise.
1536 sub handle_lib_objects
1538 local ($xname, $var, $lex_seen) = @_;
1541 die "automake: programming error 1 in handle_lib_objects\n"
1542 if ! &variable_defined
($var);
1544 die "automake: programming error 2 in handle_lib_objects\n"
1545 if $lex_seen && $var =~ /LIBADD/;
1547 local (@conds) = &variable_conditions
($var);
1550 $ret = &handle_lib_objects_cond
($xname, $var, $lex_seen, '');
1556 foreach $cond (@conds)
1558 if (&handle_lib_objects_cond
($xname, $var, $lex_seen, $cond))
1568 # Subroutine of handle_lib_objects: handle a particular condition.
1569 sub handle_lib_objects_cond
1571 local ($xname, $var, $lex_seen, $cond) = @_;
1573 # We recognize certain things that are commonly put in LIBADD or
1576 local (@dep_list) = ();
1578 local ($seen_libobjs) = 0;
1579 local ($flagvar) = 0;
1581 foreach $lsearch (&variable_value_as_list
($var, $cond))
1583 # Skip -lfoo and -Ldir; these are explicitly allowed.
1584 next if $lsearch =~ /^-[lL]/;
1585 if (! $flagvar && $lsearch =~ /^-/)
1587 if ($var =~ /^(.*)LDADD$/)
1589 # Skip -dlopen and -dlpreopen; these are explicitly allowed.
1590 next if $lsearch =~ /^-dl(pre)?open$/;
1591 &am_line_error
($var, "linker flags such as \`$lsearch' belong in \`${1}LDFLAGS");
1595 # Only get this error once.
1597 &am_line_error
($var, "linker flags such as \`$lsearch' belong in \`${1}LDFLAGS");
1601 # Assume we have a file of some sort, and push it onto the
1602 # dependency list. Autoconf substitutions are not pushed;
1603 # rarely is a new dependency substituted into (eg) foo_LDADD
1604 # -- but "bad things (eg -lX11) are routinely substituted.
1605 # Note that LIBOBJS and ALLOCA are exceptions to this rule,
1606 # and handled specially below.
1607 push (@dep_list, $lsearch)
1608 unless $lsearch =~ /^\@.*\@$/;
1610 # Automatically handle @LIBOBJS@ and @ALLOCA@. Basically this
1611 # means adding entries to dep_files.
1612 if ($lsearch =~ /^\@(LT)?LIBOBJS\@$/)
1614 local ($myobjext) = ($1 ?
'l' : '') . 'o';
1616 push (@dep_list, $lsearch);
1618 if (! keys %libsources
1619 && ! &variable_defined
($1 . 'LIBOBJS'))
1621 &am_line_error
($var, "\@$1" . "LIBOBJS\@ seen but never set in \`configure.in'");
1624 local ($iter, $rewrite);
1625 foreach $iter (keys %libsources)
1627 if ($iter =~ /\.([cly])$/)
1629 &saw_extension
($1);
1630 &saw_extension
('c');
1633 if ($iter =~ /\.h$/)
1635 &require_file_with_line
($var, $FOREIGN, $iter);
1637 elsif ($iter ne 'alloca.c')
1639 ($rewrite = $iter) =~ s/\.c$/.P$myobjext/;
1640 $dep_files{'$(DEPDIR)/' . $rewrite} = 1;
1641 ($rewrite = $iter) =~ s/(\W)/\\$1/g;
1642 $rewrite = "^" . $rewrite . "\$";
1643 # Only require the file if it is not a built source.
1644 if (! &variable_defined
('BUILT_SOURCES')
1645 || ! grep (/$rewrite/,
1646 &variable_value_as_list
('BUILT_SOURCES',
1649 &require_file_with_line
($var, $FOREIGN, $iter);
1654 elsif ($lsearch =~ /^\@(LT)?ALLOCA\@$/)
1656 local ($myobjext) = ($1 ?
'l' : '') . 'o';
1658 push (@dep_list, $lsearch);
1659 &am_line_error
($var,
1660 "\@$1" . "ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'")
1661 if ! defined $libsources{'alloca.c'};
1662 $dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1;
1663 &require_file_with_line
($var, $FOREIGN, 'alloca.c');
1664 &saw_extension
('c');
1668 if ($xname ne '' && ! &variable_defined
($xname . '_DEPENDENCIES', $cond))
1670 &define_pretty_variable
($xname . '_DEPENDENCIES', $cond, @dep_list);
1673 return $seen_libobjs;
1676 # Canonicalize a name, and check to make sure the non-canonical name
1677 # is never used. Returns canonical name. Arguments are name and a
1678 # list of suffixes to check for.
1679 sub check_canonical_spelling
1681 local ($name, @suffixes) = @_;
1682 local ($xname, $xt);
1684 ($xname = $name) =~ tr/A-Za-z0-9_/_/c;
1685 if ($xname ne $name)
1688 foreach $xt (@suffixes)
1690 &am_line_error
($name . $xt,
1691 "invalid variable \`" . $name . $xt
1692 . "'; should be \`" . $xname . $xt . "'")
1693 if &variable_defined
($name . $xt);
1700 # Handle C programs.
1703 local (@proglist) = &am_install_var
('-clean',
1704 'progs', 'PROGRAMS',
1705 'bin', 'sbin', 'libexec', 'pkglib',
1707 return if ! @proglist;
1709 # If a program is installed, this is required. We only want this
1710 # error to appear once.
1711 &am_conf_error
("AC_ARG_PROGRAM must be used in configure.in")
1712 unless $seen_arg_prog;
1715 local ($one_file, $xname, $munge);
1717 local ($seen_libobjs) = 0;
1718 foreach $one_file (@proglist)
1720 local ($obj) = &get_object_extension
($one_file);
1722 # Canonicalize names and check for misspellings.
1723 $xname = &check_canonical_spelling
($one_file, '_LDADD', '_LDFLAGS',
1724 '_SOURCES', '_OBJECTS',
1727 # FIXME: Using a trick to figure out if any lex sources appear
1728 # in our program; should use some cleaner method.
1729 local ($lex_num) = scalar (keys %lex_sources);
1730 local ($linker) = &handle_source_transform
($xname, $one_file, $obj);
1731 local ($lex_file_seen) = (scalar (keys %lex_sources) > $lex_num);
1734 if (&variable_defined
($xname . "_LDADD"))
1736 if (&handle_lib_objects
($xname, $xname . '_LDADD',
1746 # User didn't define prog_LDADD override. So do it.
1747 &define_variable
($xname . '_LDADD', '$(LDADD)');
1749 # This does a bit too much work. But we need it to
1750 # generate _DEPENDENCIES when appropriate.
1751 if (&variable_defined
('LDADD'))
1753 if (&handle_lib_objects
($xname, 'LDADD', $lex_file_seen))
1759 elsif (! &variable_defined
($xname . '_DEPENDENCIES'))
1761 &define_variable
($xname . '_DEPENDENCIES', '');
1766 if (&variable_defined
($xname . '_LIBADD'))
1768 &am_line_error
($xname . '_LIBADD',
1769 "use \`" . $xname . "_LDADD', not \`"
1770 . $xname . "_LIBADD'");
1773 if (! &variable_defined
($xname . '_LDFLAGS'))
1775 # Define the prog_LDFLAGS variable.
1776 &define_variable
($xname . '_LDFLAGS', '');
1779 # Determine program to use for link.
1781 if (&variable_defined
($xname . '_LINK'))
1783 $xlink = $xname . '_LINK';
1787 $xlink = $linker ?
$linker : 'LINK';
1791 if ($seen_exeext && $one_file !~ /\./)
1793 $xexe = 's/\@EXEEXT\@/\$(EXEEXT)/g;';
1797 $xexe = 's/\@EXEEXT\@//g;';
1801 &file_contents_with_transform
1802 ('s/\@PROGRAM\@/' . $one_file . '/go;'
1803 . 's/\@XPROGRAM\@/' . $xname . '/go;'
1804 . 's/\@XLINK\@/' . $xlink . '/go;'
1809 if (&variable_defined
('LDADD') && &handle_lib_objects
('', 'LDADD', 0))
1816 foreach $one_file (@proglist)
1818 # Canonicalize names.
1819 ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c;
1821 if (&variable_defined
($xname . '_LDADD'))
1823 &check_libobjs_sources
($xname, $xname . '_LDADD');
1825 elsif (&variable_defined
('LDADD'))
1827 &check_libobjs_sources
($xname, 'LDADD');
1835 sub handle_libraries
1837 local (@liblist) = &am_install_var
('-clean',
1838 'libs', 'LIBRARIES',
1839 'lib', 'pkglib', 'noinst', 'check');
1840 return if ! @liblist;
1842 local (%valid) = &am_primary_prefixes
('LIBRARIES', 0, 'lib', 'pkglib',
1844 if (! defined $configure_vars{'RANLIB'})
1847 foreach $key (keys %valid)
1849 if (&variable_defined
($key . '_LIBRARIES'))
1851 &am_line_error
($key . '_LIBRARIES', "library used but \`RANLIB' not defined in \`configure.in'");
1852 # Only get this error once. If this is ever printed,
1854 $configure_vars{'RANLIB'} = 'BUG';
1863 local ($seen_libobjs) = 0;
1864 foreach $onelib (@liblist)
1866 # Check that the library fits the standard naming convention.
1867 if ($onelib !~ /^lib.*\.a$/)
1869 # FIXME should put line number here. That means mapping
1870 # from library name back to variable name.
1871 &am_error
("\`$onelib' is not a standard library name");
1874 local ($obj) = &get_object_extension
($onelib);
1876 # Canonicalize names and check for misspellings.
1877 $xlib = &check_canonical_spelling
($onelib, '_LIBADD', '_SOURCES',
1878 '_OBJECTS', '_DEPENDENCIES', '_AR');
1880 if (! &variable_defined
($xlib . '_AR'))
1882 &define_variable
($xlib . '_AR', '$(AR) cru');
1885 if (&variable_defined
($xlib . '_LIBADD'))
1887 if (&handle_lib_objects
($xlib, $xlib . '_LIBADD', 0))
1894 # Generate support for conditional object inclusion in
1896 &define_variable
($xlib . "_LIBADD", '');
1899 if (&variable_defined
($xlib . '_LDADD'))
1901 &am_line_error
($xlib . '_LDADD',
1902 "use \`" . $xlib . "_LIBADD', not \`"
1903 . $xlib . "_LDADD'");
1906 # Make sure we at look at this.
1907 &examine_variable
($xlib . '_DEPENDENCIES');
1909 &handle_source_transform
($xlib, $onelib, $obj);
1912 &file_contents_with_transform
('s/\@LIBRARY\@/' . $onelib . '/go;'
1920 foreach $onelib (@liblist)
1922 # Canonicalize names.
1923 ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c;
1924 if (&variable_defined
($xlib . '_LIBADD'))
1926 &check_libobjs_sources
($xlib, $xlib . '_LIBADD');
1931 &define_variable
('AR', 'ar');
1932 &define_configure_variable
('RANLIB');
1935 # Handle shared libraries.
1936 sub handle_ltlibraries
1938 local (@liblist) = &am_install_var
('-clean',
1939 'ltlib', 'LTLIBRARIES',
1940 'noinst', 'lib', 'pkglib', 'check');
1941 return if ! @liblist;
1944 local (%valid) = &am_primary_prefixes
('LTLIBRARIES', 0, 'lib', 'pkglib',
1948 foreach $key (keys %valid)
1950 if (&variable_defined
($key . '_LTLIBRARIES'))
1954 &am_line_error
($key . '_LTLIBRARIES', "library used but \`LIBTOOL' not defined in \`configure.in'");
1955 # Only get this error once. If this is ever printed,
1957 $configure_vars{'LIBTOOL'} = 'BUG';
1961 # Get the installation directory of each library.
1962 for (&variable_value_as_list
($key . '_LTLIBRARIES', 'all'))
1966 &am_error
("\`$_' is already going to be installed in \`$instdirs{$_}'");
1970 $instdirs{$_} = $key;
1979 local ($seen_libobjs) = 0;
1980 foreach $onelib (@liblist)
1982 local ($obj) = &get_object_extension
($onelib);
1984 # Canonicalize names and check for misspellings.
1985 $xlib = &check_canonical_spelling
($onelib, '_LIBADD', '_LDFLAGS',
1986 '_SOURCES', '_OBJECTS',
1989 if (! &variable_defined
($xlib . '_LDFLAGS'))
1991 # Define the lib_LDFLAGS variable.
1992 &define_variable
($xlib . '_LDFLAGS', '');
1995 # Check that the library fits the standard naming convention.
1996 $libname_rx = "^lib.*\.la";
1997 if ((&variable_defined
($xlib . '_LDFLAGS')
1998 && grep (/-module/, &variable_value_as_list
($xlib . '_LDFLAGS',
2000 || (&variable_defined
('LDFLAGS')
2001 && grep (/-module/, &variable_value_as_list
('LDFLAGS',
2004 # Relax name checking for libtool modules.
2005 $libname_rx = "\.la";
2007 if ($onelib !~ /$libname_rx$/)
2009 # FIXME this should only be a warning for foreign packages
2010 # FIXME should put line number here. That means mapping
2011 # from library name back to variable name.
2012 &am_error
("\`$onelib' is not a standard libtool library name");
2015 if (&variable_defined
($xlib . '_LIBADD'))
2017 if (&handle_lib_objects
($xlib, $xlib . '_LIBADD', 0))
2024 # Generate support for conditional object inclusion in
2026 &define_variable
($xlib . "_LIBADD", '');
2029 if (&variable_defined
($xlib . '_LDADD'))
2031 &am_line_error
($xlib . '_LDADD',
2032 "use \`" . $xlib . "_LIBADD', not \`"
2033 . $xlib . "_LDADD'");
2036 # Make sure we at look at this.
2037 &examine_variable
($xlib . '_DEPENDENCIES');
2039 local ($linker) = &handle_source_transform
($xlib, $onelib, $obj);
2041 # Determine program to use for link.
2043 if (&variable_defined
($xlib . '_LINK'))
2045 $xlink = $xlib . '_LINK';
2049 $xlink = $linker ?
$linker : 'LINK';
2053 if ($instdirs{$onelib} eq 'EXTRA' || $instdirs{$onelib} eq 'noinst')
2055 # It's an EXTRA_ library, so we can't specify -rpath,
2056 # because we don't know where the library will end up.
2057 # The user probably knows, but generally speaking automake
2058 # doesn't -- and in fact configure could decide
2059 # dynamically between two different locations.
2060 $rpath = 's/\@RPATH\@//go;';
2064 $rpath = ('s/\@RPATH\@/-rpath \$(' . $instdirs{$onelib}
2069 &file_contents_with_transform
('s/\@LTLIBRARY\@/'
2071 . 's/\@XLTLIBRARY\@/'
2074 . 's/\@XLINK\@/' . $xlink . '/go;',
2080 foreach $onelib (@liblist)
2082 # Canonicalize names.
2083 ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c;
2084 if (&variable_defined
($xlib . '_LIBADD'))
2086 &check_libobjs_sources
($xlib, $xlib . '_LIBADD');
2092 # See if any _SOURCES variable were misspelled. Also, make sure that
2093 # EXTRA_ variables don't contain configure substitutions.
2096 local ($varname, $primary);
2097 foreach $varname (keys %contents)
2099 foreach $primary ('_SOURCES', '_LIBADD', '_LDADD', '_LDFLAGS',
2102 if ($varname =~ /$primary$/ && ! $content_seen{$varname})
2104 &am_line_error
($varname,
2105 "invalid unused variable name: \`$varname'");
2114 # NOTE we no longer automatically clean SCRIPTS, because it is
2115 # useful to sometimes distribute scripts verbatim. This happens
2116 # eg in Automake itself.
2117 &am_install_var
('-candist', 'scripts', 'SCRIPTS',
2118 'bin', 'sbin', 'libexec', 'pkgdata',
2121 local ($scripts_installed) = 0;
2122 # Set $scripts_installed if appropriate. Make sure we only find
2123 # scripts which are actually installed -- this is why we can't
2124 # simply use the return value of am_install_var.
2125 local (%valid) = &am_primary_prefixes
('SCRIPTS', 1, 'bin', 'sbin',
2126 'libexec', 'pkgdata',
2129 foreach $key (keys %valid)
2131 if ($key ne 'noinst'
2133 && &variable_defined
($key . '_SCRIPTS'))
2135 $scripts_installed = 1;
2136 # push (@check_tests, 'check-' . $key . 'SCRIPTS');
2140 if ($scripts_installed)
2142 # If a program is installed, this is required. We only want this
2143 # error to appear once.
2144 &am_conf_error
("AC_ARG_PROGRAM must be used in configure.in")
2145 unless $seen_arg_prog;
2150 # Search a file for a "version.texi" Texinfo include. Return the name
2151 # of the include file if found, or the empty string if not. A
2152 # "version.texi" file is actually any file whose name matches
2154 sub scan_texinfo_file
2156 local ($filename) = @_;
2158 if (! open (TEXI
, $filename))
2160 &am_error
("couldn't open \`$filename': $!");
2163 print "automake: reading $filename\n" if $verbose;
2165 local ($vfile, $outfile);
2168 if (/^\@setfilename +(\S+)/)
2174 if (/^\@include\s+(vers[^.]*\.texi)\s*$/)
2176 # Found version.texi include.
2183 return ($outfile, $vfile);
2186 # Handle all Texinfo source.
2189 &am_line_error
('TEXINFOS',
2190 "\`TEXINFOS' is an anachronism; use \`info_TEXINFOS'")
2191 if &variable_defined
('TEXINFOS');
2192 return if (! &variable_defined
('info_TEXINFOS')
2193 && ! &variable_defined
('html_TEXINFOS'));
2195 if (&variable_defined
('html_TEXINFOS'))
2197 &am_line_error
('html_TEXINFOS',
2198 "HTML generation not yet supported");
2202 local (@texis) = &variable_value_as_list
('info_TEXINFOS', 'all');
2204 local (@info_deps_list, @dvis_list, @texi_deps);
2205 local ($infobase, $info_cursor);
2209 local ($tc_cursor, @texi_cleans);
2212 foreach $info_cursor (@texis)
2214 # FIXME: This is mildly hacky, since it recognizes "txinfo".
2215 # I don't feel like making it right.
2216 ($infobase = $info_cursor) =~ s/\.te?xi(nfo)?$//;
2218 # If 'version.texi' is referenced by input file, then include
2219 # automatic versioning capability.
2220 local ($out_file, $vtexi) = &scan_texinfo_file
($relative_dir
2221 . "/" . $info_cursor);
2223 if ($out_file eq '')
2225 &am_error
("\`$info_cursor' missing \@setfilename");
2229 if ($out_file =~ /\.(.+)$/ && $1 ne 'info')
2231 # FIXME should report line number in input file.
2232 &am_error
("output of \`$info_cursor', \`$out_file', has unrecognized extension");
2238 &am_error
("\`$vtexi', included in \`$info_cursor', also included in \`$versions{$vtexi}'")
2239 if (defined $versions{$vtexi});
2240 $versions{$vtexi} = $info_cursor;
2242 # We number the stamp-vti files. This is doable since the
2243 # actual names don't matter much. We only number starting
2244 # with the second one, so that the common case looks nice.
2245 $vti = ($done ?
$done : 'vti');
2248 &push_dist_common
($vtexi, 'stamp-' . $vti);
2249 push (@clean, $vti);
2251 &require_conf_file_with_line
('info_TEXINFOS', $FOREIGN,
2254 local ($conf_pat, $conf_dir);
2255 if ($config_aux_dir eq '.' || $config_aux_dir eq '')
2257 $conf_dir = '$(srcdir)/';
2261 $conf_dir = $config_aux_dir;
2262 $conf_dir .= '/' unless $conf_dir =~ /\
/$/;
2264 ($conf_pat = $conf_dir) =~ s/(\W)/\\$1/g;
2266 &file_contents_with_transform
2267 ('s/\@TEXI\@/' . $info_cursor . '/g; '
2268 . 's/\@VTI\@/' . $vti . '/g; '
2269 . 's/\@VTEXI\@/' . $vtexi . '/g;'
2270 . 's,\@MDDIR\@,' . $conf_pat . ',g;',
2273 &push_phony_cleaners
($vti);
2276 # If user specified file_TEXINFOS, then use that as explicit
2279 push (@texi_deps, $info_cursor);
2280 # Prefix with $(srcdir) because some version of make won't
2281 # work if the target has it and the dependency doesn't.
2282 push (@texi_deps, '$(srcdir)/' . $vtexi) if $vtexi;
2284 # Canonicalize name first.
2285 ($canonical = $infobase) =~ tr/A-Za-z0-9_/_/c;
2286 if (&variable_defined
($canonical . "_TEXINFOS"))
2288 push (@texi_deps, '$(' . $canonical . '_TEXINFOS)');
2289 &push_dist_common
('$(' . $canonical . '_TEXINFOS)');
2292 $output_rules .= ("\n" . $out_file . ": "
2293 . join (' ', @texi_deps)
2294 . "\n" . $infobase . ".dvi: "
2295 . join (' ', @texi_deps)
2298 push (@info_deps_list, $out_file);
2299 push (@dvis_list, $infobase . '.dvi');
2301 # Generate list of things to clean for this target. We do
2302 # this explicitly because otherwise too many things could be
2303 # removed. In particular the ".log" extension might
2304 # reasonably be used in other contexts by the user.
2305 # FIXME: this is really out of control.
2306 foreach $tc_cursor ('aux', 'cp', 'cps', 'dvi', 'fn', 'fns', 'pgs',
2307 'ky', 'kys', 'ps', 'log', 'pg', 'toc', 'tp', 'tps',
2308 'vr', 'vrs', 'op', 'tr', 'cv', 'cn', 'cm', 'ov')
2310 push (@texi_cleans, $infobase . '.' . $tc_cursor);
2314 # Find these programs wherever they may lie. Yes, this has
2315 # intimate knowledge of the structure of the texinfo distribution.
2316 &define_program_variable
('MAKEINFO', 'build', 'texinfo/makeinfo',
2318 # Circumlocution to avoid accidental
2319 # configure substitution.
2321 &define_program_variable
('TEXI2DVI', 'src', 'texinfo/util',
2324 # Set transform for including texinfos.am. First, handle --cygnus
2329 $xform = 's/^NOTCYGNUS.*$//; s/^CYGNUS//;';
2333 $xform = 's/^CYGNUS.*$//; s/^NOTCYGNUS//;';
2336 # Handle location of texinfo.tex.
2337 local ($need_texi_file) = 0;
2338 local ($texinfo_tex);
2341 $texinfo_tex = '$(top_srcdir)/../texinfo/texinfo.tex';
2342 &define_variable
('TEXINFO_TEX', $texinfo_tex);
2345 elsif ($config_aux_dir ne '.' && $config_aux_dir ne '')
2347 $texinfo_tex = $config_aux_dir . '/texinfo.tex';
2348 &define_variable
('TEXINFO_TEX', $texinfo_tex);
2349 $need_texi_file = 2; # so that we require_conf_file later
2351 elsif (&variable_defined
('TEXINFO_TEX'))
2353 # The user defined TEXINFO_TEX so assume he knows what he is
2355 $texinfo_tex = ('$(srcdir)/'
2356 . &dirname
(&variable_value
('TEXINFO_TEX')));
2360 $texinfo_tex = '$(srcdir)/texinfo.tex';
2361 $need_texi_file = 1;
2364 ($xxform = $texinfo_tex) =~ s/\/texinfo\.tex$//;
2365 $xxform =~ s/(\W)/\\$1/g;
2366 $xform .= ' s/\@TEXINFODIR\@/' . $xxform . '/g;';
2368 $output_rules .= &file_contents_with_transform
($xform, 'texinfos');
2369 push (@phony, 'install-info-am', 'uninstall-info');
2370 push (@dist_targets, 'dist-info');
2372 # How to clean. The funny name is due to --cygnus influence; in
2373 # Cygnus mode, `clean-info' is a target that users can use.
2374 $output_rules .= "\nmostlyclean-aminfo:\n";
2375 &pretty_print_rule
("\t-rm -f", "\t ", @texi_cleans);
2376 $output_rules .= ("\nclean-aminfo:\n\ndistclean-aminfo:\n\n"
2377 . "maintainer-clean-aminfo:\n\t"
2378 # Eww. But how else can we find all the output
2379 # files from makeinfo?
2380 . ($cygnus_mode ?
'' : 'cd $(srcdir) && ')
2381 . 'for i in $(INFO_DEPS); do' . " \\\n"
2382 . "\t" . ' rm -f $$i;' . " \\\n"
2383 . "\t" . ' if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then' . " \\\n"
2384 . "\t" . ' rm -f $$i-[0-9]*;' . " \\\n"
2385 . "\t" . ' fi;' . " \\\n"
2387 &push_phony_cleaners
('aminfo');
2390 $output_rules .= "clean-info: mostlyclean-aminfo\n";
2393 push (@suffixes, '.texi', '.texinfo', '.txi', '.info', '.dvi', '.ps');
2395 if (! defined $options{'no-installinfo'})
2397 push (@uninstall, 'uninstall-info');
2398 push (@installdirs, '$(DESTDIR)$(infodir)');
2399 unshift (@install_data, 'install-info-am');
2401 # Make sure documentation is made and installed first. Use
2402 # $(INFO_DEPS), not 'info', because otherwise recursive makes
2403 # get run twice during "make all".
2404 unshift (@all, '$(INFO_DEPS)');
2406 push (@clean, 'aminfo');
2407 push (@info, '$(INFO_DEPS)');
2408 push (@dvi, '$(DVIS)');
2410 &define_variable
("INFO_DEPS", join (' ', @info_deps_list));
2411 &define_variable
("DVIS", join (' ', @dvis_list));
2412 # This next isn't strictly needed now -- the places that look here
2413 # could easily be changed to look in info_TEXINFOS. But this is
2414 # probably better, in case noinst_TEXINFOS is ever supported.
2415 &define_variable
("TEXINFOS", &variable_value
('info_TEXINFOS'));
2417 # Do some error checking. Note that this file is not required
2418 # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly
2420 if ($need_texi_file && ! defined $options{'no-texinfo.tex'})
2422 if ($need_texi_file > 1)
2424 &require_conf_file_with_line
('info_TEXINFOS', $FOREIGN,
2429 &require_file_with_line
('info_TEXINFOS', $FOREIGN, 'texinfo.tex');
2434 # Handle any man pages.
2435 sub handle_man_pages
2437 &am_line_error
('MANS', "\`MANS' is an anachronism; use \`man_MANS'")
2438 if &variable_defined
('MANS');
2440 # Find all the sections in use. We do this by first looking for
2441 # "standard" sections, and then looking for any additional
2442 # sections used in man_MANS.
2443 local ($sect, %sections, %vlist);
2445 # Add more sections as needed.
2446 foreach $sect ('0'..'9', 'n', 'l')
2448 if (&variable_defined
('man' . $sect . '_MANS'))
2450 $sections{$sect} = 1;
2451 $vlist{'$(man' . $sect . '_MANS)'} = 1;
2456 if (&variable_defined
('man_MANS'))
2458 $vlist{'$(man_MANS)'} = 1;
2459 foreach (&variable_value_as_list
('man_MANS', 'all'))
2461 # A page like `foo.1c' goes into man1dir.
2462 if (/\.([0-9a-z])([a-z]*)$/)
2470 return unless $found;
2472 # Now for each section, generate an install and unintall rule.
2473 # Sort sections so output is deterministic.
2475 foreach $sect (sort keys %sections)
2477 &define_variable
('man' . $sect . 'dir', '$(mandir)/man' . $sect);
2478 push (@installdirs, '$(DESTDIR)$(mandir)/man' . $sect)
2479 unless defined $options{'no-installman'};
2480 $output_rules .= &file_contents_with_transform
('s/\@SECTION\@/'
2483 push (@phony, 'install-man' . $sect, 'uninstall-man' . $sect);
2484 push (@namelist, 'install-man' . $sect);
2487 # We don't really need this, but we use it in case we ever want to
2488 # support noinst_MANS.
2489 &define_variable
("MANS", join (' ', sort keys %vlist));
2491 # Generate list of install dirs.
2492 $output_rules .= ("install-man: \$(MANS)\n"
2493 . "\t\@\$(NORMAL_INSTALL)\n");
2494 &pretty_print_rule
("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);
2495 push (@phony, 'install-man');
2497 $output_rules .= "uninstall-man:\n\t\@\$(NORMAL_UNINSTALL)\n";
2498 grep ($_ = 'un' . $_, @namelist);
2499 &pretty_print_rule
("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);
2500 push (@phony, 'uninstall-man');
2502 $output_vars .= &file_contents
('mans-vars');
2504 if (! defined $options{'no-installman'})
2506 push (@install_data, 'install-man');
2507 push (@uninstall, 'uninstall-man');
2508 push (@all, '$(MANS)');
2512 # Handle DATA variables.
2515 &am_install_var
('-noextra', '-candist', 'data', 'DATA',
2516 'data', 'sysconf', 'sharedstate', 'localstate',
2517 'pkgdata', 'noinst', 'check');
2523 push (@phony, 'tags');
2524 local (@tag_deps) = ();
2525 if (&variable_defined
('SUBDIRS'))
2527 $output_rules .= ("tags-recursive:\n"
2528 . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n"
2529 # Never fail here if a subdir fails; it
2531 . "\t test \"\$\$subdir\" = . || (cd \$\$subdir"
2532 . " && \$(MAKE) \$(AM_MAKEFLAGS) tags); \\\n"
2534 push (@tag_deps, 'tags-recursive');
2535 push (@phony, 'tags-recursive');
2538 if (&saw_sources_p
(1)
2539 || &variable_defined
('ETAGS_ARGS')
2542 local ($xform) = '';
2544 foreach $one_hdr (@config_headers)
2546 if ($relative_dir eq &dirname
($one_hdr))
2548 # The config header is in this directory. So require it.
2550 ($var = &basename
($one_hdr)) =~ s/(\W)/\\$1/g;
2551 $xform .= ' ' if $xform;
2555 $xform = ('s/\@CONFIG\@/' . $xform . '/;'
2556 . 's/\@DIRS\@/' . join (' ', @tag_deps) . '/;');
2558 if (&variable_defined
('SUBDIRS'))
2560 $xform .= 's/^SUBDIRS//;';
2564 $xform .= 's/^SUBDIRS.*$//;';
2567 $output_rules .= &file_contents_with_transform
($xform, 'tags');
2568 $output_rules .= &file_contents
('tags-clean');
2569 push (@clean, 'tags');
2570 &push_phony_cleaners
('tags');
2571 &examine_variable
('TAGS_DEPENDENCIES');
2573 elsif (&variable_defined
('TAGS_DEPENDENCIES'))
2575 &am_line_error
('TAGS_DEPENDENCIES',
2576 "doesn't make sense to define \`TAGS_DEPENDENCIES' without sources or \`ETAGS_ARGS'");
2580 # Every Makefile must define some sort of TAGS rule.
2581 # Otherwise, it would be possible for a top-level "make TAGS"
2582 # to fail because some subdirectory failed.
2583 $output_rules .= "tags: TAGS\nTAGS:\n\n";
2587 # Handle multilib support.
2590 return unless $seen_multilib;
2592 $output_rules .= &file_contents
('multilib');
2593 &push_phony_cleaners
('multi');
2594 push (@phony, 'all-multi', 'install-multi');
2597 # Worker for handle_dist.
2598 sub handle_dist_worker
2600 local ($makefile) = @_;
2602 $output_rules .= 'distdir: $(DISTFILES)' . "\n";
2604 # Initialization; only at top level.
2605 if ($relative_dir eq '.')
2607 if (defined $options{'check-news'})
2609 # For Gnits users, this is pretty handy. Look at 15 lines
2610 # in case some explanatory text is desirable.
2611 $output_rules .= ' @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \\
2612 echo "NEWS not updated; not releasing" 1>&2; \\
2619 # Create dist directory.
2620 $output_rules .= ("\t-chmod -R a+w \$(distdir) > /dev/null 2>&1; rm -rf \$(distdir)\n"
2621 . "\tmkdir \$(distdir)\n");
2624 # Scan EXTRA_DIST to see if we need to distribute anything from a
2625 # subdir. If so, add it to the list. I didn't want to do this
2626 # originally, but there were so many requests that I finally
2629 if (&variable_defined
('EXTRA_DIST'))
2631 # FIXME: This should be fixed to work with conditionals. That
2632 # will require only making the entries in @dist_dirs under the
2633 # appropriate condition. This is meaningful if the nature of
2634 # the distribution should depend upon the configure options
2636 foreach (&variable_value_as_list
('EXTRA_DIST', ''))
2639 next unless s
,/+[^/]+$,,;
2640 push (@dist_dirs, $_)
2645 # We have to check DIST_COMMON for extra directories in case the
2646 # user put a source used in AC_OUTPUT into a subdir.
2647 foreach (&variable_value_as_list
('DIST_COMMON', 'all'))
2650 next unless s
,/+[^/]+$,,;
2651 push (@dist_dirs, $_)
2657 # Prepend $(distdir) to each directory given. Doing it via a
2658 # hash lets us ensure that each directory is used only once.
2660 grep ($dhash{'$(distdir)/' . $_} = 1, @dist_dirs);
2661 $output_rules .= "\t";
2662 &pretty_print_rule
('$(mkinstalldirs)', "\t ", sort keys %dhash);
2665 # In loop, test for file existence because sometimes a file gets
2666 # included in DISTFILES twice. For example this happens when a
2667 # single source file is used in building more than one program.
2668 # Also, there are situations in which "ln" can fail. For instance
2669 # a file to distribute could actually be a cross-filesystem
2670 # symlink -- this can easily happen if "gettextize" was run on the
2672 $output_rules .= "\t\@for file in \$(DISTFILES); do \\\n";
2675 $output_rules .= "\t if test -f \$\$file; then d=.; else d=\$(srcdir); fi; \\\n";
2679 $output_rules .= "\t d=\$(srcdir); \\\n";
2681 $output_rules .= ("\t if test -d \$\$d/\$\$file; then \\\n"
2682 # Don't mention $$file in destination argument,
2683 # since this fails if destination directory
2684 # already exists. Also, use `-R' and not `-r'.
2685 # `-r' is almost always incorrect.
2686 . "\t cp -pR \$\$d/\$\$file \$(distdir) \\\n"
2687 . "\t || exit 1; \\\n"
2689 . "\t test -f \$(distdir)/\$\$file \\\n"
2690 . "\t || cp -p \$\$d/\$\$file \$(distdir)/\$\$file \\\n"
2691 . "\t || exit 1; \\\n"
2695 # If we have SUBDIRS, create all dist subdirectories and do
2697 if (&variable_defined
('SUBDIRS'))
2699 # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
2700 # to all possible directories, and use it. If DIST_SUBDIRS is
2701 # defined, just use it.
2702 local ($dist_subdir_name);
2703 if (&variable_conditions
('SUBDIRS')
2704 || &variable_defined
('DIST_SUBDIRS'))
2706 $dist_subdir_name = 'DIST_SUBDIRS';
2707 if (! &variable_defined
('DIST_SUBDIRS'))
2709 local (@full_list) = &variable_value_as_list
('SUBDIRS',
2711 local (@ds_list, %uniq, $iter);
2712 foreach $iter (@full_list)
2714 if (! defined $uniq{$iter})
2717 push (@ds_list, $iter);
2720 &define_pretty_variable
('DIST_SUBDIRS', '', @ds_list);
2725 $dist_subdir_name = 'SUBDIRS';
2726 # We always define this because that is what `distclean'
2728 &define_pretty_variable
('DIST_SUBDIRS', '', '$(SUBDIRS)');
2731 # Test for directory existence here because previous automake
2732 # invocation might have created some directories. Note that
2733 # we explicitly set distdir for the subdir make; that lets us
2734 # mix-n-match many automake-using packages into one large
2735 # package, and have "dist" at the top level do the right
2736 # thing. If we're in the topmost directory, then we use
2737 # `distdir' instead of `top_distdir'; this lets us work
2738 # correctly with an enclosing package.
2740 ("\t" . 'for subdir in $(' . $dist_subdir_name . '); do ' . "\\\n"
2741 . "\t" . ' if test "$$subdir" = .; then :; else ' . "\\\n"
2742 . "\t" . ' test -d $(distdir)/$$subdir ' . "\\\n"
2743 . "\t" . ' || mkdir $(distdir)/$$subdir ' . "\\\n"
2744 . "\t" . ' || exit 1; ' . "\\\n"
2745 . "\t" . ' (cd $$subdir'
2746 . ' && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$('
2747 . (($relative_dir eq '.') ?
'distdir' : 'top_distdir')
2748 . ') distdir=../$(distdir)/$$subdir distdir) ' . "\\\n"
2749 . "\t" . ' || exit 1; ' . "\\\n"
2750 . "\t" . ' fi; ' . "\\\n"
2754 # If the target `dist-hook' exists, make sure it is run. This
2755 # allows users to do random weird things to the distribution
2756 # before it is packaged up.
2757 push (@dist_targets, 'dist-hook') if &target_defined
('dist-hook');
2760 foreach $targ (@dist_targets)
2762 # We must explicitly set distdir and top_distdir for these
2764 $output_rules .= ("\t\$(MAKE) \$(AM_MAKEFLAGS)"
2765 . " top_distdir=\"\$(top_distdir)\""
2766 . " distdir=\"\$(distdir)\" $targ\n");
2769 push (@phony, 'distdir');
2772 # Handle 'dist' target.
2775 local ($makefile) = @_;
2777 # Set up maint_charset.
2778 $local_maint_charset = &variable_value
('MAINT_CHARSET')
2779 if &variable_defined
('MAINT_CHARSET');
2780 $maint_charset = $local_maint_charset
2781 if $relative_dir eq '.';
2783 if (&variable_defined
('DIST_CHARSET'))
2785 &am_line_error
('DIST_CHARSET',
2786 "DIST_CHARSET defined but no MAINT_CHARSET defined")
2787 if ! $local_maint_charset;
2788 if ($relative_dir eq '.')
2790 $dist_charset = &variable_value
('DIST_CHARSET')
2794 &am_line_error
('DIST_CHARSET',
2795 "DIST_CHARSET can only be defined at top level");
2799 # Look for common files that should be included in distribution.
2801 foreach $cfile (@common_files)
2803 if (-f
($relative_dir . "/" . $cfile))
2805 &push_dist_common
($cfile);
2809 # Always require configure.in and configure at top level, even if
2810 # they don't exist. This is especially important for configure,
2811 # since it won't be created until autoconf is run -- which might
2812 # be after automake is run.
2813 &push_dist_common
('configure.in', 'configure')
2814 if $relative_dir eq '.';
2816 # We might copy elements from %configure_dist_common to
2817 # %dist_common if we think we need to. If the file appears in our
2818 # directory, we would have discovered it already, so we don't
2819 # check that. But if the file is in a subdir without a Makefile,
2820 # we want to distribute it here if we are doing `.'. Ugly!
2821 if ($relative_dir eq '.')
2824 foreach $iter (keys %configure_dist_common)
2826 if (! &is_make_dir
(&dirname
($iter)))
2828 &push_dist_common
($iter);
2833 # Keys of %dist_common are names of files to distributed. We put
2834 # README first because it then becomes easier to make a
2835 # Usenet-compliant shar file (in these, README must be first).
2836 # FIXME: do more ordering of files here.
2838 if (defined $dist_common{'README'})
2840 push (@coms, 'README');
2841 delete $dist_common{'README'};
2843 push (@coms, sort keys %dist_common);
2845 # Now that we've processed %dist_common, disallow further attempts
2847 $handle_dist_run = 1;
2849 &define_pretty_variable
("DIST_COMMON", '', @coms);
2850 $output_vars .= "\n";
2853 $output_vars .= &file_contents
('dist-vars') . "\n";
2854 &define_variable
('GZIP_ENV', '--best');
2856 # Put these things in rules section so it is easier for whoever
2857 # reads Makefile.in.
2858 if (! &variable_defined
('distdir'))
2860 if ($relative_dir eq '.')
2862 $output_rules .= "\n" . 'distdir = $(PACKAGE)-$(VERSION)' . "\n";
2866 $output_rules .= ("\n"
2867 . 'distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)'
2871 if ($relative_dir eq '.')
2873 $output_rules .= "top_distdir = \$(distdir)\n";
2875 $output_rules .= "\n";
2877 # Generate 'dist' target, and maybe other dist targets.
2878 if ($relative_dir eq '.')
2880 # Rule to check whether a distribution is viable.
2881 local ($xform) = '';
2883 if (&target_defined
('distcheck-hook'))
2885 $xform .= 's/^DISTHOOK//;';
2889 $xform .= 's/^DISTHOOK.*$//;';
2893 $xform .= 's/^GETTEXT//;';
2897 $xform .= 's/^GETTEXT.*$//;';
2900 $output_rules .= &file_contents_with_transform
($xform, 'dist');
2902 local ($dist_all) = ('dist-all: distdir' . "\n"
2905 foreach $curs ('dist', 'dist-shar', 'dist-zip', 'dist-tarZ',
2908 if (defined $options{$curs} || $curs eq 'dist')
2910 $output_rules .= ($curs . ': distdir' . "\n"
2914 $dist_all .= $dist{$curs};
2917 $output_rules .= $dist_all . $dist_trailer;
2920 # Generate distdir target.
2921 &handle_dist_worker
($makefile);
2924 # A subroutine of handle_dependencies. This function includes
2925 # `depend2' with appropriate transformations.
2930 # First include code for ordinary objects.
2931 local ($key) = $lang . '-autodep';
2932 local ($xform, $ext);
2934 local ($pfx) = $language_map{$key};
2935 local ($fpfx) = ($pfx eq '') ?
'CC' : $pfx;
2936 $xform = ('s/\@PFX\@/' . $pfx . '/g;'
2937 . 's/\@FPFX\@/' . $fpfx . '/g;'
2938 . ($seen_objext ?
's/^OBJEXT//;' : 's/^OBJEXT.*$//;')
2939 . ($seen_libtool ?
's/^LIBTOOL//;' : 's/^LIBTOOL.*$//;'));
2941 # This function can be called even when we don't want dependency
2942 # tracking. This happens when we need an explicit rule for some
2943 # target. In this case we don't want to include the generic code.
2944 if ($use_dependencies)
2946 local ($xform1) = ($xform
2947 . 's/\@BASE\@/\$\*/g;'
2948 . 's/\@SOURCE\@/\$\</g;'
2949 . 's/\@(LT|OBJ)?OBJ\@/\$\@/g;');
2951 foreach $ext (&lang_extensions
($lang))
2953 $output_rules .= (&file_contents_with_transform
('s/\@EXT\@/'
2958 for $sourcedir (keys %sourcedirs) {
2959 $output_rules .= (&file_contents_with_transform
(
2960 's/\@EXT\@([^:]*):/'
2961 . '%$1: ' . quotemeta($sourcedir) . '\/%' . $ext . '/g;'
2969 # Now include code for each specially handled object with this
2971 local (@list) = grep ($_ ne '', split (' ', $lang_specific_files{$lang}));
2972 local ($max) = scalar @list;
2974 local ($derived, $source, $obj);
2976 # If dependency tracking is disabled, we just elide the code.
2977 if (! $use_dependencies)
2979 $xform .= 's/\@AMDEP\@.*$//;';
2984 $derived = $list[$i];
2985 ($source = $list[$i + 1]) =~ s
,([/\
$]),\\$1,g
;
2986 ($obj = $list[$i + 2]) =~ s
,([/\
$]),\\$1,g
;
2989 local ($flag) = $language_map{$lang . '-flags'};
2990 local ($val) = "(${derived}_${flag}";
2991 ($rule = $language_map{$lang . '-compile'}) =~
2994 $rule =~ s
,([/\
$]),\\$1,g
;
2996 # Generate a transform which will turn suffix targets in
2997 # depend2.am into real targets for the particular objects we
3000 &file_contents_with_transform
($xform
3001 . 's/\$\(' . $pfx . 'COMPILE\)/'
3003 . 's/\$\(LT' . $pfx . 'COMPILE\)/'
3004 . '\$(LIBTOOL) --mode=compile '
3006 # Generate rule for `.o'.
3008 . $obj . '.o: ' . $source
3010 # Maybe generate rule for `.lo'.
3011 # Might be eliminated by
3013 . 's/^\@EXT\@\.lo:/'
3014 . $obj . '.lo: ' . $source
3016 # Maybe generate rule for `.obj'.
3017 # Might be eliminated by
3019 . 's/^\@EXT\@\.obj:/'
3020 . $obj . '.obj: ' . $source
3022 # Handle source and obj
3024 . 's/\@OBJ\@/' . $obj . '.o/g;'
3025 . 's/\@OBJOBJ\@/' . $obj . '.obj/g;'
3026 . 's/\@LTOBJ\@/' . $obj . '.lo/g;'
3027 . 's/\@BASE\@/' . $obj . '/g;'
3028 . 's/\@SOURCE\@/' . $source . '/g;',
3033 # Handle auto-dependency code.
3034 sub handle_dependencies
3036 if ($use_dependencies)
3038 # Include auto-dep code. Don't include it if DEP_FILES would
3040 if (&saw_sources_p
(0) && keys %dep_files)
3042 local ($config_aux_dir_specified) = ($config_aux_dir ne '.'
3043 && $config_aux_dir ne '');
3045 # Set $require_file_found{'depcomp'} if the depcomp file exists,
3046 # before calling require_config_file on `depcomp'. This makes
3047 # require_file_internal skip its buggy existence test that would
3048 # make automake fail (with `required file `lib/depcomp' not found')
3049 # when AC_CONFIG_AUX_DIR is not set. See tests/subdir4.test.
3050 local ($depcomp_dir) = ($config_aux_dir_specified ?
$config_aux_dir
3052 $require_file_found{'depcomp'} = 1 if -f
"$depcomp_dir/depcomp";
3054 # Set location of depcomp.
3055 local ($prefix) = ($config_aux_dir_specified ?
$config_aux_dir
3058 &define_variable
('depcomp', "\$(SHELL) $prefix/depcomp");
3060 &require_config_file
($FOREIGN, 'depcomp');
3063 local (@deplist) = sort keys %dep_files;
3065 &define_pretty_variable
('DEP_FILES', '', ("\@AMDEP\@", @deplist));
3067 # Generate each `include' individually. Irix 6 make will
3068 # not properly include several files resulting from a
3069 # variable expansion; generating many separate includes
3071 $output_rules .= "\n";
3072 foreach $iter (@deplist)
3074 $output_rules .= "\@AMDEP\@" . 'include ' . $iter . "\n";
3077 $output_rules .= &file_contents
('depend');
3078 push (@clean, 'depend');
3079 &push_phony_cleaners
('depend');
3084 &define_variable
('depcomp', '');
3087 local ($key, $lang, $ext, $xform);
3088 foreach $key (sort keys %language_map)
3090 next unless $key =~ /^(.*)-autodep$/;
3091 next if $language_map{$key} eq 'no';
3096 # Handle subdirectories.
3099 return if ! &variable_defined
('SUBDIRS');
3101 # Make sure each directory mentioned in SUBDIRS actually exists.
3103 foreach $dir (&variable_value_as_list
('SUBDIRS', 'all'))
3105 # Skip directories substituted by configure.
3106 next if $dir =~ /^\@.*\@$/;
3108 if (! -d
$am_relative_dir . '/' . $dir)
3110 &am_line_error
('SUBDIRS',
3111 "required directory $am_relative_dir/$dir does not exist");
3115 &am_line_error
('SUBDIRS', "directory should not contain \`/'")
3119 local ($xform) = ('s/\@INSTALLINFO\@/' .
3120 (defined $options{'no-installinfo'}
3121 ?
'install-info-recursive'
3124 $output_rules .= &file_contents_with_transform
($xform, 'subdirs');
3126 # Push a bunch of phony targets.
3128 foreach $phonies ('', '-data', '-exec', 'dirs')
3130 push (@phony, 'install' . $phonies . '-recursive');
3131 push (@phony, 'uninstall' . $phonies . '-recursive');
3133 foreach $phonies ('all', 'check', 'installcheck', 'info', 'dvi')
3135 push (@phony, $phonies . '-recursive');
3137 &push_phony_cleaners
('recursive');
3139 $recursive_install = 1;
3142 # Handle aclocal.m4.
3143 sub handle_aclocal_m4
3145 local ($regen_aclocal) = 0;
3146 if (-f
'aclocal.m4')
3148 &define_variable
("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4');
3149 &push_dist_common
('aclocal.m4');
3151 if (open (ACLOCAL
, '< aclocal.m4'))
3157 if ($line =~ 'generated automatically by aclocal')
3164 local ($acinclude) = 0;
3165 if (-f
'acinclude.m4')
3171 # Note that it might be possible that aclocal.m4 doesn't exist but
3172 # should be auto-generated. This case probably isn't very
3176 local (@ac_deps) = (
3178 ?
"\@MAINTAINER_MODE_TRUE\@"
3181 ($acinclude ?
' acinclude.m4' : '')
3184 if (&variable_defined
('ACLOCAL_M4_SOURCES'))
3186 push (@ac_deps, "\$(ACLOCAL_M4_SOURCES)");
3188 elsif (&variable_defined
('ACLOCAL_AMFLAGS'))
3190 # Scan all -I directories for m4 files. These are our
3192 local ($examine_next, $amdir) = 0;
3193 foreach $amdir (&variable_value_as_list
('ACLOCAL_AMFLAGS', ''))
3198 if ($amdir !~ /^\// && -d
$amdir)
3200 foreach $ac_dep (&my_glob
($amdir . '/*.m4'))
3202 $ac_dep =~ s/^\.\/*//;
3203 push (@ac_deps, $ac_dep)
3204 unless $ac_dep eq "aclocal.m4"
3205 || $ac_dep eq "acinclude.m4";
3209 elsif ($amdir eq '-I')
3216 &pretty_print_rule
("\$(ACLOCAL_M4):", "\t\t", @ac_deps);
3218 $output_rules .= ("\t"
3219 . 'cd $(srcdir) && $(ACLOCAL)'
3220 . (&variable_defined
('ACLOCAL_AMFLAGS')
3221 ?
' $(ACLOCAL_AMFLAGS)' : '')
3226 # Rewrite a list of input files into a form suitable to put on a
3227 # dependency list. The idea is that if an input file has a directory
3228 # part the same as the current directory, then the directory part is
3229 # simply removed. But if the directory part is different, then
3230 # $(top_srcdir) is prepended. Among other things, this is used to
3231 # generate the dependency list for the output files generated by
3232 # AC_OUTPUT. Consider what the dependencies should look like in this
3234 # AC_OUTPUT(src/out:src/in1:lib/in2)
3235 # The first argument, ADD_SRCDIR, is 1 if $(top_srcdir) should be added.
3236 # If 0 then files that require this addition will simply be ignored.
3237 sub rewrite_inputs_into_dependencies
3239 local ($add_srcdir, @inputs) = @_;
3240 local ($single, @newinputs);
3242 foreach $single (@inputs)
3244 if (&dirname
($single) eq $relative_dir)
3246 push (@newinputs, &basename
($single));
3250 push (@newinputs, '$(top_srcdir)/' . $single);
3257 # Handle remaking and configure stuff.
3258 # We need the name of the input file, to do proper remaking rules.
3259 sub handle_configure
3261 local ($local, $input, @secondary_inputs) = @_;
3263 local ($top_reldir);
3265 local ($input_base) = &basename
($input);
3266 local ($local_base) = &basename
($local);
3268 local ($amfile) = $input_base . '.am';
3269 # We know we can always add '.in' because it really should be an
3270 # error if the .in was missing originally.
3271 local ($infile) = '$(srcdir)/' . $input_base . '.in';
3272 local ($colon_infile);
3273 if ($local ne $input || @secondary_inputs)
3275 $colon_infile = ':' . $input . '.in';
3277 $colon_infile .= ':' . join (':', @secondary_inputs)
3278 if @secondary_inputs;
3280 local (@rewritten) = &rewrite_inputs_into_dependencies
(1,
3283 # This rule remakes the Makefile.in. Note use of
3284 # @MAINTAINER_MODE_TRUE@ forces us to abandon pretty-printing.
3286 $output_rules .= ($infile
3287 # NOTE perl 5.003 (with -w) gives a
3288 # uninitialized value error on the next line.
3291 . ($seen_maint_mode ?
"\@MAINTAINER_MODE_TRUE\@ " : '')
3293 . '$(top_srcdir)/configure.in $(ACLOCAL_M4)'
3294 . ' ' . join (' ', @include_stack)
3296 . "\tcd \$(top_srcdir) && \$(AUTOMAKE) "
3297 . ($cygnus_mode ?
'--cygnus' : ('--' . $strictness_name))
3298 . ($cmdline_use_dependencies ?
'' : ' --ignore-deps')
3299 . ' ' . $input . $colon_infile . "\n\n");
3301 # This rule remakes the Makefile.
3302 $output_rules .= ($local_base
3303 # NOTE: bogus uninit value error on next line;
3304 # see comment above.
3307 . join (' ', @rewritten)
3308 . ' $(top_builddir)/config.status'
3310 . "\tcd \$(top_builddir) \\\n"
3311 . "\t && CONFIG_FILES="
3312 . (($relative_dir eq '.') ?
'$@' : '$(subdir)/$@')
3314 . ' CONFIG_HEADERS= $(SHELL) ./config.status'
3317 if ($relative_dir ne '.')
3320 $top_reldir = '../';
3325 $output_rules .= &file_contents
('remake');
3326 &examine_variable
('CONFIG_STATUS_DEPENDENCIES');
3327 &examine_variable
('CONFIGURE_DEPENDENCIES');
3330 &push_dist_common
('acconfig.h')
3334 # If we have a configure header, require it.
3336 local (@local_fullnames) = @config_fullnames;
3337 local (@local_names) = @config_names;
3338 local ($hdr_index) = 0;
3339 local ($distclean_config) = '';
3340 foreach $one_hdr (@config_headers)
3342 local ($one_fullname) = shift (@local_fullnames);
3343 local ($one_name) = shift (@local_names);
3345 local ($header_dir) = &dirname
($one_name);
3347 # If the header is in the current directory we want to build
3348 # the header here. Otherwise, if we're at the topmost
3349 # directory and the header's directory doesn't have a
3350 # Makefile, then we also want to build the header.
3351 if ($relative_dir eq $header_dir
3352 || ($relative_dir eq '.' && ! &is_make_dir
($header_dir)))
3354 local ($ch_sans_dir, $cn_sans_dir, $stamp_dir);
3355 if ($relative_dir eq $header_dir)
3357 $cn_sans_dir = &basename
($one_name);
3362 $cn_sans_dir = $one_name;
3363 if ($header_dir eq '.')
3369 $stamp_dir = $header_dir . '/';
3373 # Compute relative path from directory holding output
3374 # header to directory holding input header. FIXME:
3375 # doesn't handle case where we have multiple inputs.
3376 if (&dirname
($one_hdr) eq $relative_dir)
3378 $ch_sans_dir = &basename
($one_hdr);
3382 local (@rel_out_path);
3383 # FIXME this chunk of code should be its own sub.
3384 # It is used elsewhere.
3385 foreach (split (/\//, $relative_dir))
3387 next if $_ eq '' || $_ eq '.';
3390 # FIXME: actually this is an error.
3395 push (@rel_out_path, '..');
3400 $ch_sans_dir = join ('/', @rel_out_path) . '/' . $one_hdr;
3404 $ch_sans_dir = $one_hdr;
3408 &require_file_with_conf_line
($config_header_line,
3409 $FOREIGN, $ch_sans_dir);
3411 # Header defined and in this directory.
3413 if (-f
$one_name . '.top')
3415 push (@files, "${cn_sans_dir}.top");
3417 if (-f
$one_name . '.bot')
3419 push (@files, "${cn_sans_dir}.bot");
3422 &push_dist_common
(@files);
3424 # For now, acconfig.h can only appear in the top srcdir.
3425 if (-f
'acconfig.h')
3427 if ($relative_dir eq '.')
3429 push (@files, 'acconfig.h');
3433 # Strange quoting because this gets fed through
3435 push (@files, '\$(top_srcdir)/acconfig.h');
3439 local ($stamp_name) = 'stamp-h';
3440 $stamp_name .= "${hdr_index}" if scalar (@config_headers) > 1;
3442 local ($xform) = '';
3444 $xform = 's,\@FILES\@,' . join (' ', @files) . ',;';
3445 $xform .= 's,\@CONFIG_HEADER\@,' . "${cn_sans_dir}" . ',;';
3446 $xform .= 's,\@CONFIG_HEADER_IN\@,' . "${ch_sans_dir}" . ',;';
3447 $xform .= 's,\@CONFIG_HEADER_FULL\@,' . "${one_fullname}" . ',;';
3448 $xform .= 's,\@STAMP\@,' . "${stamp_dir}${stamp_name}" . ',g;';
3450 local ($out_dir) = &dirname
($ch_sans_dir);
3451 $xform .= 's,\@SRC_STAMP\@,' . "${out_dir}/${stamp_name}" . ',g;';
3452 $output_rules .= &file_contents_with_transform
($xform,
3455 &create
("${relative_dir}/${out_dir}/${stamp_name}.in");
3456 &require_file_with_conf_line
($config_header_line, $FOREIGN,
3457 "${out_dir}/${stamp_name}.in");
3459 $distclean_config .= ' ' if $distclean_config;
3460 $distclean_config .= $cn_sans_dir;
3464 if ($distclean_config)
3466 $output_rules .= &file_contents_with_transform
('s,\@FILES\@,'
3470 push (@clean, 'hdr');
3471 &push_phony_cleaners
('hdr');
3474 # Set location of mkinstalldirs.
3475 if ($config_aux_dir ne '.' && $config_aux_dir ne '')
3477 &define_variable
('mkinstalldirs', ('$(SHELL) ' . $config_aux_dir
3478 . '/mkinstalldirs'));
3482 &define_variable
('mkinstalldirs',
3483 '$(SHELL) $(top_srcdir)/mkinstalldirs');
3486 &am_line_error
('CONFIG_HEADER',
3487 "\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'")
3488 if &variable_defined
('CONFIG_HEADER');
3491 local ($config_header) = '';
3492 foreach $one_name (@config_names)
3494 # Generate CONFIG_HEADER define.
3496 if ($relative_dir eq &dirname
($one_name))
3498 $one_hdr = &basename
($one_name);
3502 $one_hdr = "${top_builddir}/${one_name}";
3505 $config_header .= ' ' if $config_header;
3506 $config_header .= $one_hdr;
3510 &define_variable
("CONFIG_HEADER", $config_header);
3513 # Now look for other files in this directory which must be remade
3514 # by config.status, and generate rules for them.
3515 local (@actual_other_files) = ();
3516 local ($file, $local);
3517 local (@inputs, @rewritten_inputs, $single);
3518 local ($need_rewritten);
3519 foreach $file (@other_input_files)
3521 if ($file =~ /^([^:]*):(.*)$/)
3523 # This is the ":" syntax of AC_OUTPUT.
3525 $local = &basename
($file);
3526 @inputs = split (':', $2);
3527 @rewritten_inputs = &rewrite_inputs_into_dependencies
(1, @inputs);
3528 $need_rewritten = 1;
3533 $local = &basename
($file);
3534 @inputs = ($local . '.in');
3536 &rewrite_inputs_into_dependencies
(1, $file . '.in');
3537 $need_rewritten = 0;
3540 # Skip files not in this directory.
3541 next unless &dirname
($file) eq $relative_dir;
3543 # Skip any file that is an automake input.
3544 next if -f
$file . '.am';
3546 # Some users have been tempted to put `stamp-h' in the
3547 # AC_OUTPUT line. This won't do the right thing, so we
3548 # explicitly fail here.
3549 if ($local eq 'stamp-h')
3551 # FIXME: allow real filename.
3552 &am_conf_error
('configure.in', $ac_output_line,
3553 'stamp-h should not appear in AC_OUTPUT');
3557 $output_rules .= ($local . ': '
3558 . '$(top_builddir)/config.status '
3559 . join (' ', @rewritten_inputs) . "\n"
3561 . 'cd $(top_builddir) && CONFIG_FILES='
3562 . ($relative_dir eq '.' ?
'' : '$(subdir)/')
3563 . '$@' . ($need_rewritten
3564 ?
(':' . join (':', @inputs))
3566 . ' CONFIG_HEADERS= $(SHELL) ./config.status'
3568 &push_dist_common
(@inputs);
3569 push (@actual_other_files, $local);
3571 # Require all input files.
3572 &require_file_with_conf_line
($ac_output_line, $FOREIGN,
3573 &rewrite_inputs_into_dependencies
(0, @inputs));
3576 # These files get removed by "make clean".
3577 &define_pretty_variable
('CONFIG_CLEAN_FILES', '', @actual_other_files);
3584 @r = &am_install_var
('-defaultdist', 'header', 'HEADERS', 'include',
3585 'oldinclude', 'pkginclude',
3589 next unless /\.(.*)$/;
3590 &saw_extension
($1);
3596 return if ! $seen_gettext || $relative_dir ne '.';
3598 if (! &variable_defined
('SUBDIRS'))
3601 ("AM_GNU_GETTEXT in configure.in but SUBDIRS not defined");
3605 &require_file_with_conf_line
($ac_gettext_line, $GNU, 'ABOUT-NLS');
3607 if (&variable_defined
('SUBDIRS'))
3611 "AM_GNU_GETTEXT in configure.in but \`po' not in SUBDIRS")
3612 if $contents{'SUBDIRS'} !~ /\bpo\b/;
3615 "AM_GNU_GETTEXT in configure.in but \`intl' not in SUBDIRS")
3616 if $contents{'SUBDIRS'} !~ /\bintl\b/;
3619 # Ensure that each language in ALL_LINGUAS has a .po file, and
3620 # each po file is mentioned in ALL_LINGUAS.
3623 local (%linguas) = ();
3624 grep ($linguas{$_} = 1, split (' ', $all_linguas));
3631 &am_line_error
($all_linguas_line,
3632 ("po/$_.po exists but \`$_' not in \`ALL_LINGUAS'"))
3636 foreach (keys %linguas)
3638 &am_line_error
($all_linguas_line,
3639 "$_ in \`ALL_LINGUAS' but po/$_.po does not exist")
3645 &am_error
("AM_GNU_GETTEXT in configure.in but \`ALL_LINGUAS' not defined");
3649 # Handle footer elements.
3652 if ($contents{'SOURCES'})
3654 # NOTE don't use define_pretty_variable here, because
3655 # $contents{...} is already defined.
3656 $output_vars .= 'SOURCES = ' . $contents{'SOURCES'} . "\n";
3658 if ($contents{'OBJECTS'})
3660 # NOTE don't use define_pretty_variable here, because
3661 # $contents{...} is already defined.
3662 $output_vars .= 'OBJECTS = ' . $contents{'OBJECTS'} . "\n";
3664 if ($contents{'SOURCES'} || $contents{'OBJECTS'})
3666 $output_vars .= "\n";
3669 if (&target_defined
('.SUFFIXES'))
3671 &am_line_error
('.SUFFIXES',
3672 "use variable \`SUFFIXES', not target \`.SUFFIXES'");
3675 # Note: AIX 4.1 /bin/make will fail if any suffix rule appears
3676 # before .SUFFIXES. So we make sure that .SUFFIXES appears before
3677 # anything else, by sticking it right after the default: target.
3678 $output_header .= ".SUFFIXES:\n";
3679 if (@suffixes || &variable_defined
('SUFFIXES'))
3681 # Make sure suffixes has unique elements. Sort them to ensure
3682 # the output remains consistent. However, $(SUFFIXES) is
3683 # always at the start of the list, unsorted. This is done
3684 # because make will choose rules depending on the ordering of
3685 # suffixes, and this lets the user have some control. Push
3686 # actual suffixes, and not $(SUFFIXES). Some versions of make
3687 # do not like variable substitutions on the .SUFFIXES line.
3689 local (@user_suffixes) = (&variable_defined
('SUFFIXES')
3690 ?
&variable_value_as_list
('SUFFIXES', '')
3693 grep ($suffixes{$_} = 1, @suffixes);
3694 delete @suffixes{@user_suffixes};
3696 $output_header .= (".SUFFIXES: "
3697 . join (' ', @user_suffixes, sort keys %suffixes)
3700 $output_trailer .= &file_contents
('footer');
3703 # Deal with installdirs target.
3704 sub handle_installdirs
3706 # GNU Makefile standards recommend this.
3707 if ($recursive_install)
3709 # We create a separate `-am' target so that the -recursive
3710 # rule will work correctly.
3711 $output_rules .= ("installdirs: installdirs-recursive\n"
3712 . "installdirs-am:\n");
3713 push (@phony, 'installdirs-am');
3717 $output_rules .= "installdirs:\n";
3719 push (@phony, 'installdirs');
3722 &pretty_print_rule
("\t" . '$(mkinstalldirs) ', "\t\t",
3725 $output_rules .= "\n";
3728 # There are several targets which need to be merged. This is because
3729 # their complete definition is compiled from many parts. Note that we
3730 # avoid double colon rules, otherwise we'd use them instead.
3731 sub handle_merge_targets
3733 local ($makefile) = @_;
3735 # There are a few install-related variables that you should not define.
3737 foreach $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL')
3739 if (&variable_defined
($var))
3741 &am_line_error
($var, "\`$var' should not be defined");
3745 # Put this at the beginning for the sake of non-GNU makes. This
3746 # is still wrong if these makes can run parallel jobs. But it is
3748 unshift (@all, &basename
($makefile));
3751 foreach $one_name (@config_names)
3753 push (@all, &basename
($one_name))
3754 if &dirname
($one_name) eq $relative_dir;
3757 &do_one_merge_target
('info', @info);
3758 &do_one_merge_target
('dvi', @dvi);
3759 &do_check_merge_target
;
3760 &do_one_merge_target
('installcheck', @installcheck);
3762 if (defined $options{'no-installinfo'})
3764 &do_one_merge_target
('install-info', '');
3766 elsif (&target_defined
('install-info-local'))
3768 &am_line_error
('install-info-local',
3769 "\`install-info-local' target defined but \`no-installinfo' option not in use");
3773 foreach $utarg ('uninstall-data-local', 'uninstall-data-hook',
3774 'uninstall-exec-local', 'uninstall-exec-hook')
3776 if (&target_defined
($utarg))
3779 ($x = $utarg) =~ s/(data|exec)-//;
3780 &am_line_error
($utarg, "use \`$x', not \`$utarg'");
3784 if (&target_defined
('install-local'))
3786 &am_line_error
('install-local',
3787 "use \`install-data-local' or \`install-exec-local', not \`install-local'");
3790 if (@all || &variable_defined
('BUILT_SOURCES'))
3793 local ($local_headers) = '';
3794 $local_headers = '$(BUILT_SOURCES)'
3795 if &variable_defined
('BUILT_SOURCES');
3796 foreach $one_name (@config_names)
3798 if (&dirname
($one_name) eq $relative_dir)
3800 $local_headers .= ' ' if $local_headers;
3801 $local_headers .= &basename
($one_name);
3806 # This is kind of a hack, but I couldn't see a better way
3807 # to handle it. In this particular case, we need to make
3808 # sure config.h is built before we recurse. We can't do
3809 # this by changing the order of dependencies to the "all"
3810 # because that breaks when using parallel makes. Instead
3811 # we handle things explicitly.
3812 $output_rules .= ("all-recursive-am: ${local_headers}"
3814 . '$(MAKE) $(AM_MAKEFLAGS)'
3817 $all_target = 'all-recursive-am';
3818 push (@phony, 'all-recursive-am');
3822 if (&variable_defined
('lib_LTLIBRARIES') &&
3823 &variable_defined
('bin_PROGRAMS'))
3825 $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
3827 # Print definitions users can use.
3828 &do_one_merge_target
('install-exec', @install_exec);
3829 $output_rules .= "\n";
3831 &do_one_merge_target
('install-data', @install_data);
3832 $output_rules .= "\n";
3834 &do_one_merge_target
('install', 'all-am');
3835 &do_one_merge_target
('uninstall', @uninstall);
3837 &do_one_merge_target
('all', @all);
3839 # Generate the new 'install-strip' target. We can't just set
3840 # INSTALL_PROGRAM because that might be a relative path.
3841 $output_rules .= ("install-strip:\n\t"
3842 . '$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install'
3844 push (@phony, 'install-strip');
3847 # Helper for handle_merge_targets. Note that handle_merge_targets
3848 # relies on the fact that this doesn't add an extra \n at the end.
3849 sub do_one_merge_target
3851 local ($name, @values) = @_;
3853 if (&target_defined
($name . '-local'))
3855 # User defined local form of target. So include it.
3856 push (@values, $name . '-local');
3857 push (@phony, $name . '-local');
3860 &pretty_print_rule
($name . "-am:", "\t\t", @values);
3861 if ($name eq 'install')
3863 # Special-case `install-am' to run install-exec-am and
3864 # install-data-am after all-am is built.
3865 &pretty_print_rule
("\t\@\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
3866 'install-exec-am', 'install-data-am');
3868 elsif ($name eq 'install-exec' && &target_defined
('install-exec-hook'))
3870 $output_rules .= ("\t\@\$(NORMAL_INSTALL)\n"
3871 . "\t" . '$(MAKE) $(AM_MAKEFLAGS) install-exec-hook'
3874 elsif ($name eq 'install-data' && &target_defined
('install-data-hook'))
3876 $output_rules .= ("\t\@\$(NORMAL_INSTALL)\n"
3877 . "\t" . '$(MAKE) $(AM_MAKEFLAGS) install-data-hook'
3881 local ($lname) = $name . ($recursive_install ?
'-recursive' : '-am');
3882 local ($tname) = $name;
3883 # To understand this special case, see handle_merge_targets.
3886 $tname = 'all-redirect';
3887 $lname = $all_target if $recursive_install;
3888 push (@phony, 'all-redirect');
3889 $output_all = "all: all-redirect\n";
3891 &pretty_print_rule
($tname . ":", "\t\t", $lname);
3892 push (@phony, $name . '-am', $name);
3895 # Handle check merge target specially.
3896 sub do_check_merge_target
3898 if (&target_defined
('check-local'))
3900 # User defined local form of target. So include it.
3901 push (@check_tests, 'check-local');
3902 push (@phony, 'check-local');
3905 # In --cygnus mode, check doesn't depend on all.
3908 # Just run the local check rules.
3909 &pretty_print_rule
('check-am:', "\t\t", @check);
3913 # The check target must depend on the local equivalent of
3914 # `all', to ensure all the primary targets are built. Then it
3915 # must build the local check rules.
3916 $output_rules .= "check-am: all-am\n";
3917 &pretty_print_rule
("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
3921 &pretty_print_rule
("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
3925 push (@phony, 'check', 'check-am');
3926 $output_rules .= ("check: "
3927 . ($recursive_install ?
'check-recursive' : 'check-am')
3931 # Handle all 'clean' targets.
3934 local ($xform) = '';
3937 # Don't include `MAINTAINER'; it is handled specially below.
3938 foreach $name ('MOSTLY', '', 'DIST')
3940 if (! &variable_defined
($name . 'CLEANFILES'))
3942 $xform .= 's/^' . $name . 'CLEAN.*$//;';
3946 $xform .= 's/^' . $name . 'CLEAN//;';
3950 # Built sources are automatically removed by maintainer-clean.
3951 push (@maintainer_clean_files, '\$(BUILT_SOURCES)')
3952 if &variable_defined
('BUILT_SOURCES');
3953 push (@maintainer_clean_files, '\$(MAINTAINERCLEANFILES)')
3954 if &variable_defined
('MAINTAINERCLEANFILES');
3955 if (! @maintainer_clean_files)
3957 $xform .= 's/^MAINTAINERCLEAN.*$//;';
3961 $xform .= ('s/^MAINTAINERCLEAN//;'
3962 # Join with no space to avoid spurious `test -z'
3963 # success at runtime.
3964 . 's,\@MCFILES\@,' . join ('', @maintainer_clean_files)
3966 # A space is required in the join here.
3967 . 's,\@MFILES\@,' . join (' ', @maintainer_clean_files)
3971 $output_rules .= &file_contents_with_transform
($xform, 'clean');
3973 push (@clean, 'generic');
3974 &push_phony_cleaners
('generic');
3976 &do_one_clean_target
('clean', 'mostly', '', @clean);
3977 &do_one_clean_target
('clean', '', 'mostly', @clean);
3978 &do_one_clean_target
('clean', 'dist', '', @clean);
3979 &do_one_clean_target
('clean', 'maintainer-', 'dist', @clean);
3981 push (@phony, 'clean', 'mostlyclean', 'distclean', 'maintainer-clean');
3984 # Helper for handle_clean.
3985 sub do_one_clean_target
3987 local ($target, $name, $last_name, @deps) = @_;
3989 # Change each dependency `BLARG' into `clean-BLARG'.
3990 grep (($_ = $name . 'clean-' . $_) && 0, @deps);
3992 # Push the previous clean target. There is no previous clean
3993 # target if we're doing mostlyclean.
3994 push (@deps, $last_name . $target . '-am')
3995 unless $name eq 'mostly';
3997 # If a -local version of the rule is given, add it to the list.
3998 if (&target_defined
($name . $target . '-local'))
4000 push (@deps, $name . $target . '-local');
4003 # Print the target and the dependencies.
4004 &pretty_print_rule
($name . $target . "-am: ", "\t\t", @deps);
4006 # FIXME: shouldn't we really print these messages before running
4008 if ($name . $target eq 'maintainer-clean')
4010 # Print a special warning.
4012 ("\t\@echo \"This command is intended for maintainers to use;\"\n"
4013 . "\t\@echo \"it deletes files that may require special "
4014 . "tools to rebuild.\"\n");
4016 elsif ($name . $target eq 'distclean')
4018 $output_rules .= "\t-rm -f libtool\n" if $seen_libtool;
4020 $output_rules .= "\n";
4022 # Now generate the actual clean target.
4023 $output_rules .= ($name . $target . ": " . $name . $target
4024 . ($recursive_install ?
'-recursive' : '-am')
4027 # We special-case config.status here. If we do it as part of the
4028 # normal clean processing for this directory, then it might be
4029 # removed before some subdir is cleaned. However, that subdir's
4030 # Makefile depends on config.status.
4031 if (($name . $target eq 'maintainer-clean'
4032 || $name . $target eq 'distclean')
4033 && $relative_dir eq '.')
4035 $output_rules .= "\t-rm -f config.status\n";
4037 $output_rules .= "\n";
4040 # Handle .PHONY target.
4043 &pretty_print_rule
('.PHONY:', "", @phony);
4044 $output_rules .= "\n";
4047 # Handle TESTS variable and other checks.
4050 if (defined $options{'dejagnu'})
4052 push (@check_tests, 'check-DEJAGNU');
4053 push (@phony, 'check-DEJAGNU');
4058 $xform = 's/^CYGNUS//;';
4062 $xform = 's/^CYGNUS.*$//;';
4064 $output_rules .= &file_contents_with_transform
($xform, 'dejagnu');
4066 # In Cygnus mode, these are found in the build tree.
4067 # Otherwise they are looked for in $PATH.
4068 &define_program_variable
('EXPECT', 'build', 'expect', 'expect');
4069 &define_program_variable
('RUNTEST', 'src', 'dejagnu', 'runtest');
4071 # Only create site.exp rule if user hasn't already written
4073 if (! &target_defined
('site.exp'))
4075 # Note that in the rule we don't directly generate
4076 # site.exp to avoid the possibility of a corrupted
4077 # site.exp if make is interrupted. Jim Meyering has some
4078 # useful text on this topic.
4079 $output_rules .= ("site.exp: Makefile\n"
4080 . "\t\@echo 'Making a new site.exp file...'\n"
4081 . "\t\@test ! -f site.bak || rm -f site.bak\n"
4082 . "\t\@echo '## these variables are automatically generated by make ##' > \$\@-t\n"
4083 . "\t\@echo '# Do not edit here. If you wish to override these values' >> \$\@-t\n"
4084 . "\t\@echo '# edit the last section' >> \$\@-t\n"
4085 . "\t\@echo 'set tool \$(DEJATOOL)' >> \$\@-t\n"
4086 . "\t\@echo 'set srcdir \$(srcdir)' >> \$\@-t\n"
4087 . "\t\@echo 'set objdir' \`pwd\` >> \$\@-t\n");
4089 # Extra stuff for AC_CANONICAL_*
4090 local (@whatlist) = ();
4091 if ($seen_canonical)
4093 push (@whatlist, 'host');
4096 # Extra stuff only for AC_CANONICAL_SYSTEM.
4097 if ($seen_canonical == $AC_CANONICAL_SYSTEM)
4099 push (@whatlist, 'target', 'build');
4103 foreach $c1 (@whatlist)
4105 foreach $c2 ('alias', 'triplet')
4107 $output_rules .= "\t\@echo 'set ${c1}_${c2} \$(${c1}_${c2})' >> \$\@-t\n";
4111 $output_rules .= ("\t\@echo '## All variables above are generated by configure. Do Not Edit ##' >> \$\@-t\n"
4112 . "\t\@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> \$\@-t\n"
4113 . "\t\@test ! -f site.exp || mv site.exp site.bak\n"
4114 . "\t\@mv \$\@-t site.exp\n");
4120 foreach $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS')
4122 if (&variable_defined
($c))
4124 &am_line_error
($c, "\`$c' defined but \`dejagnu' not in \`AUTOMAKE_OPTIONS'");
4129 if (&variable_defined
('TESTS'))
4131 push (@check_tests, 'check-TESTS');
4132 push (@phony, 'check-TESTS');
4134 # Note: Solaris 2.7 seems to expand TESTS using VPATH. That's
4135 # why we also try `dir='
4136 $output_rules .= 'check-TESTS: $(TESTS)
4137 @failed=0; all=0; xfail=0; xpass=0; \\
4138 srcdir=$(srcdir); export srcdir; \\
4139 list=' . "'\$(TESTS)'; \\" . '
4140 if test -n "$$list"; then \\
4141 for tst in $$list; do \\
4142 if test -f ./$$tst; then dir=./; \\
4143 elif test -f $$tst; then dir=; \\
4144 else dir="$(srcdir)/"; fi; \\
4145 if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \\
4146 all=`expr $$all + 1`; \\
4147 case " $(XFAIL_TESTS) " in \\
4149 xpass=`expr $$xpass + 1`; \\
4150 failed=`expr $$failed + 1`; \\
4151 echo "XPASS: $$tst"; \\
4154 echo "PASS: $$tst"; \\
4157 elif test $$? -ne 77; then \\
4158 all=`expr $$all + 1`; \\
4159 case " $(XFAIL_TESTS) " in \\
4161 xfail=`expr $$xfail + 1`; \\
4162 echo "XFAIL: $$tst"; \\
4165 failed=`expr $$failed + 1`; \\
4166 echo "FAIL: $$tst"; \\
4171 if test "$$failed" -eq 0; then \\
4172 if test "$$xfail" -eq 0; then \\
4173 banner="All $$all tests passed"; \\
4175 banner="All $$all tests behaved as expected ($$xfail expected failures)"; \\
4178 if test "$$xpass" -eq 0; then \\
4179 banner="$$failed of $$all tests failed"; \\
4181 banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \\
4184 dashes=`echo "$$banner" | sed s/./=/g`; \\
4188 test "$$failed" -eq 0; \\
4194 # Handle Emacs Lisp.
4195 sub handle_emacs_lisp
4197 local (@elfiles) = &am_install_var
('-candist', 'lisp', 'LISP',
4203 &define_configure_variable
('lispdir');
4204 &define_configure_variable
('EMACS');
4205 $output_rules .= (".el.elc:\n"
4206 . "\t\@echo 'WARNING: Warnings can be ignored. :-)'\n"
4207 . "\tif test \$(EMACS) != no; then \\\n"
4208 . "\t EMACS=\$(EMACS) \$(SHELL) \$(srcdir)/elisp-comp \$<; \\\n"
4210 push (@suffixes, '.el', '.elc');
4212 # Generate .elc files.
4213 grep ($_ .= 'c', @elfiles);
4214 &define_pretty_variable
('ELCFILES', '', @elfiles);
4216 $output_rules .= &file_contents
('lisp-clean');
4217 push (@clean, 'lisp');
4218 &push_phony_cleaners
('lisp');
4220 push (@all, '$(ELCFILES)');
4223 if (&variable_defined
('lisp_LISP'))
4225 $varname = 'lisp_LISP';
4226 &am_error
("\`lisp_LISP' defined but \`AM_PATH_LISPDIR' not in \`configure.in'")
4231 $varname = 'noinst_LISP';
4234 &require_file_with_line
($varname, $FOREIGN, 'elisp-comp');
4241 local (@pyfiles) = &am_install_var
('-defaultdist', 'python', 'PYTHON',
4242 'python', 'noinst');
4243 return if ! @pyfiles;
4245 # Found some python.
4246 &define_configure_variable
('pythondir');
4247 &define_configure_variable
('PYTHON');
4249 $output_rules .= &file_contents
('python-clean');
4250 push (@clean, 'python');
4252 &am_error
("\`python_PYTHON' defined but \`AM_CHECK_PYTHON' not in \`configure.in'")
4253 if ! $seen_pythondir && &variable_defined
('python_PYTHON');
4255 if ($config_aux_dir eq '.' || $config_aux_dir eq '')
4257 &define_variable
('py_compile', '$(top_srcdir)/py-compile');
4261 &define_variable
('py_compile', $config_aux_dir . '/py-compile');
4268 local (@sourcelist) = &am_install_var
('-candist', '-clean',
4270 'java', 'noinst', 'check');
4271 return if ! @sourcelist;
4273 &define_variable
('JAVAC', 'javac');
4274 &define_variable
('JAVACFLAGS', '');
4275 &define_variable
('CLASSPATH_ENV',
4276 'CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT):$$CLASSPATH');
4277 &define_variable
('JAVAROOT', '$(top_builddir)');
4279 local (%valid) = &am_primary_prefixes
('JAVA', 1,
4280 'java', 'noinst', 'check');
4282 local ($dir, $curs);
4283 foreach $curs (keys %valid)
4285 if (! &variable_defined
($curs . '_JAVA') || $curs eq 'EXTRA')
4292 &am_line_error
($curs . '_JAVA',
4293 "multiple _JAVA primaries in use");
4298 $output_rules .= ('class' . $dir . '.stamp: $(' . $dir . '_JAVA)' . "\n"
4299 . "\t" . '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) '
4300 . '$(JAVACFLAGS) $?' . "\n"
4301 . "\t" . 'echo timestamp > class' . $dir . '.stamp'
4303 push (@all, 'class' . $dir . '.stamp');
4304 &push_dist_common
('$(' . $dir . '_JAVA)');
4307 # Handle some of the minor options.
4308 sub handle_minor_options
4310 if (defined $options{'readme-alpha'})
4312 if ($relative_dir eq '.')
4314 if ($package_version !~ /^$GNITS_VERSION_PATTERN$/)
4316 # FIXME: allow real filename.
4317 &am_conf_line_error
('configure.in',
4318 $package_version_line,
4319 "version \`$package_version' doesn't follow Gnits standards");
4321 elsif (defined $1 && -f
'README-alpha')
4323 # This means we have an alpha release. See
4324 # GNITS_VERSION_PATTERN for details.
4325 &require_file
($FOREIGN, 'README-alpha');
4331 ################################################################
4333 # Scan one file for interesting things. Subroutine of scan_configure.
4334 sub scan_one_configure_file
4336 local ($filename) = @_;
4339 open (CONFIGURE
, $filename)
4340 || die "automake: couldn't open \`$filename': $!\n";
4341 print "automake: reading $filename\n" if $verbose;
4345 # Remove comments from current line.
4349 # Skip macro definitions. Otherwise we might be confused into
4350 # thinking that a macro that was only defined was actually
4354 # Follow includes. This is a weirdness commonly in use at
4355 # Cygnus and hopefully nowhere else.
4356 if (/sinclude\((.*)\)/ && -f
$1)
4358 &scan_one_configure_file
($1);
4361 # Populate libobjs array.
4362 if (/AC_FUNC_ALLOCA/)
4364 $libsources{'alloca.c'} = 1;
4366 elsif (/AC_FUNC_GETLOADAVG/)
4368 $libsources{'getloadavg.c'} = 1;
4370 elsif (/AC_FUNC_MEMCMP/)
4372 $libsources{'memcmp.c'} = 1;
4374 elsif (/AC_STRUCT_ST_BLOCKS/)
4376 $libsources{'fileblocks.c'} = 1;
4378 elsif (/A[CM]_REPLACE_GNU_GETOPT/)
4380 $libsources{'getopt.c'} = 1;
4381 $libsources{'getopt1.c'} = 1;
4383 elsif (/AM_FUNC_STRTOD/)
4385 $libsources{'strtod.c'} = 1;
4387 elsif (/AM_WITH_REGEX/)
4389 $libsources{'rx.c'} = 1;
4390 $libsources{'rx.h'} = 1;
4391 $libsources{'regex.c'} = 1;
4392 $libsources{'regex.h'} = 1;
4393 $omit_dependencies{'rx.h'} = 1;
4394 $omit_dependencies{'regex.h'} = 1;
4396 elsif (/AC_FUNC_MKTIME/)
4398 $libsources{'mktime.c'} = 1;
4400 elsif (/AM_FUNC_ERROR_AT_LINE/)
4402 $libsources{'error.c'} = 1;
4403 $libsources{'error.h'} = 1;
4405 elsif (/AM_FUNC_OBSTACK/)
4407 $libsources{'obstack.c'} = 1;
4408 $libsources{'obstack.h'} = 1;
4410 elsif (/LIBOBJS="(.*)\s+\$LIBOBJS"/
4411 || /LIBOBJS="\$LIBOBJS\s+(.*)"/)
4413 foreach $libobj_iter (split (' ', $1))
4415 if ($libobj_iter =~ /^(.*)\.o(bj)?$/
4416 || $libobj_iter =~ /^(.*)\.\$ac_objext$/
4417 || $libobj_iter =~ /^(.*)\.\$\{ac_objext\}$/)
4419 $libsources{$1 . '.c'} = 1;
4423 elsif (/AC_LIBOBJ\(([^)]+)\)/)
4425 $libsources{"$1.c"} = 1;
4428 if (! $in_ac_replace && s/AC_REPLACE_FUNCS\s*\(\[?//)
4434 $in_ac_replace = 0 if s/[\]\)].*$//;
4435 # Remove trailing backslash.
4439 # Need to skip empty elements for Perl 4.
4441 $libsources{$_ . '.c'} = 1;
4445 if (/$obsolete_rx/o)
4448 if ($obsolete_macros{$1} ne '')
4450 $hint = '; ' . $obsolete_macros{$1};
4452 &am_conf_line_error
($filename, $., "\`$1' is obsolete$hint");
4455 # Process the AC_OUTPUT and AC_CONFIG_FILES macros.
4456 if (! $in_ac_output && s/AC_(OUTPUT|CONFIG_FILES)\s*\(\[?//)
4459 $ac_output_line = $.;
4463 local ($closing) = 0;
4470 # Look at potential Makefile.am's.
4473 # Must skip empty string for Perl 4.
4474 next if $_ eq "\\" || $_ eq '';
4476 # Handle $local:$input syntax. Note that we ignore
4477 # every input file past the first, though we keep
4478 # those around for later.
4479 local ($local, $input, @rest) = split (/:/);
4486 # FIXME: should be error if .in is missing.
4487 $input =~ s/\.in$//;
4490 if (-f
$input . '.am')
4492 # We have a file that automake should generate.
4493 push (@make_input_list, $input);
4494 $make_list{$input} = join (':', ($local, @rest));
4498 # We have a file that automake should cause to be
4499 # rebuilt, but shouldn't generate itself.
4500 push (@other_input_files, $_);
4504 if ($closing && @make_input_list == 0 && @other_input_files == 0)
4506 &am_conf_line_error
($filename, $ac_output_line,
4507 "No files mentioned in \`AC_OUTPUT'");
4512 if (/$AC_CONFIG_AUX_DIR_PATTERN/o)
4514 @config_aux_path = $1;
4517 # Check for ansi2knr.
4518 $am_c_prototypes = 1 if /AM_C_PROTOTYPES/;
4520 # Check for exe extension stuff.
4524 $configure_vars{'EXEEXT'} = $filename . ':' . $.;
4530 $configure_vars{'OBJEXT'} = $filename . ':' . $.;
4533 # Check for `-c -o' code.
4534 $seen_cc_c_o = 1 if /AM_PROG_CC_C_O/;
4536 # Check for NLS support.
4537 if (/AM_GNU_GETTEXT/)
4540 $ac_gettext_line = $.;
4541 $omit_dependencies{'libintl.h'} = 1;
4544 # Look for ALL_LINGUAS.
4545 if (/ALL_LINGUAS="(.*)"$/ || /ALL_LINGUAS=(.*)$/)
4549 $all_linguas_line = $.;
4552 # Handle configuration headers. A config header of `[$1]'
4553 # means we are actually scanning AM_CONFIG_HEADER from
4555 if (/A([CM])_CONFIG_HEADERS?\s*\((.*)\)/
4559 ($filename, $., "\`automake requires \`AM_CONFIG_HEADER', not \`AC_CONFIG_HEADER'")
4562 $config_header_line = $.;
4564 foreach $one_hdr (split (' ', $2))
4566 push (@config_fullnames, $one_hdr);
4567 if ($one_hdr =~ /^([^:]+):(.+)$/)
4569 push (@config_names, $1);
4570 push (@config_headers, $2);
4574 push (@config_names, $one_hdr);
4575 push (@config_headers, $one_hdr . '.in');
4580 # Handle AC_CANONICAL_*. Always allow upgrading to
4581 # AC_CANONICAL_SYSTEM, but never downgrading.
4582 $seen_canonical = $AC_CANONICAL_HOST
4583 if ! $seen_canonical
4584 && (/AC_CANONICAL_HOST/ || /AC_CHECK_TOOL/);
4585 $seen_canonical = $AC_CANONICAL_SYSTEM if /AC_CANONICAL_SYSTEM/;
4587 $seen_path_xtra = 1 if /AC_PATH_XTRA/;
4589 # This macro handles several different things.
4590 if (/$AM_INIT_AUTOMAKE_PATTERN/o)
4594 $seen_prog_install = 1;
4595 ($package_version = $1) =~ s/$AM_PACKAGE_VERSION_PATTERN/$1/o;
4596 $package_version_line = $.;
4597 $seen_init_automake = 1;
4600 # Some things required by Automake.
4601 $seen_make_set = 1 if /AC_PROG_MAKE_SET/;
4602 $seen_arg_prog = 1 if /AC_ARG_PROGRAM/;
4606 $configure_vars{'LEX'} = $filename . ':' . $.;
4607 $seen_decl_yytext = 1;
4609 if (/AC_DECL_YYTEXT/ && $filename =~ /configure\.in$/)
4611 &am_conf_line_warning
($filename, $., "\`AC_DECL_YYTEXT' is covered by \`AM_PROG_LEX'");
4613 if (/AC_PROG_LEX/ && $filename =~ /configure\.in$/)
4615 &am_conf_line_warning
($filename, $., "automake requires \`AM_PROG_LEX', not \`AC_PROG_LEX'");
4618 if (/AC_PROG_(F77|YACC|RANLIB|CC|CXXCPP|CXX|LEX|AWK|CPP|LN_S)/)
4620 $configure_vars{$1} = $filename . ':' . $.;
4622 if (/$AC_CHECK_PATTERN/o)
4624 $configure_vars{$3} = $filename . ':' . $.;
4626 if (/$AM_MISSING_PATTERN/o
4630 && $1 ne 'AUTOHEADER')
4632 $configure_vars{$1} = $filename . ':' . $.;
4635 # Explicitly avoid ANSI2KNR -- we AC_SUBST that in protos.m4,
4636 # but later define it elsewhere. This is pretty hacky. We
4637 # also explicitly avoid INSTALL_SCRIPT and some other
4638 # variables because they are defined in header-vars.am.
4640 if (/$AC_SUBST_PATTERN/o
4642 && $1 ne 'INSTALL_SCRIPT'
4643 && $1 ne 'INSTALL_DATA')
4645 $configure_vars{$1} = $filename . ':' . $.;
4648 $seen_decl_yytext = 1 if /AC_DECL_YYTEXT/;
4649 if (/AM_MAINTAINER_MODE/)
4651 $seen_maint_mode = 1;
4652 $configure_cond{'MAINTAINER_MODE'} = 1;
4655 $seen_prog_install = 1 if /AC_PROG_INSTALL/;
4656 $seen_lispdir = 1 if /AM_PATH_LISPDIR/;
4657 $seen_pythondir = 1 if /AM_PATH_PYTHON/;
4659 if (/A(C|M)_PROG_LIBTOOL/)
4661 if (/AM_PROG_LIBTOOL/)
4663 &am_conf_line_warning
($filename, $., "\`AM_PROG_LIBTOOL' is obsolete, use \`AC_PROG_LIBTOOL' instead");
4667 $configure_vars{'LIBTOOL'} = $filename . ':' . $.;
4668 $configure_vars{'RANLIB'} = $filename . ':' . $.;
4669 $configure_vars{'CC'} = $filename . ':' . $.;
4670 # AC_PROG_LIBTOOL runs AC_CANONICAL_HOST. Make sure we
4671 # never downgrade (if we've seen AC_CANONICAL_SYSTEM).
4672 $seen_canonical = $AC_CANONICAL_HOST if ! $seen_canonical;
4675 $seen_multilib = 1 if (/AM_ENABLE_MULTILIB/);
4677 if (/$AM_CONDITIONAL_PATTERN/o)
4679 $configure_cond{$1} = 1;
4682 # Check for Fortran 77 intrinsic and run-time libraries.
4683 if (/AC_F77_LIBRARY_LDFLAGS/)
4685 $configure_vars{'FLIBS'} = $filename . ':' . $.;
4692 # Scan configure.in and aclocal.m4 for interesting things. We must
4693 # scan aclocal.m4 because there might be AC_SUBSTs and such there.
4696 # Reinitialize libsources here. This isn't really necessary,
4697 # since we currently assume there is only one configure.in. But
4698 # that won't always be the case.
4701 local ($in_ac_output, $in_ac_replace) = (0, 0);
4702 local (%make_list, @make_input_list);
4703 local ($libobj_iter);
4705 &scan_one_configure_file
('configure.in');
4706 &scan_one_configure_file
('aclocal.m4')
4709 # Set input and output files if not specified by user.
4712 @input_files = @make_input_list;
4713 %output_files = %make_list;
4716 @configure_input_files = @make_input_list;
4718 &am_conf_error
("\`AM_INIT_AUTOMAKE' must be used in configure.in")
4719 if ! $seen_init_automake;
4721 # Always require AC_PROG_MAKE_SET. We might randomly use $(MAKE)
4722 # for our own reasons.
4723 &am_conf_error
("\`AC_PROG_MAKE_SET' must be used in configure.in")
4724 if ! $seen_make_set;
4726 # Look for some files we need. Always check for these. This
4727 # check must be done for every run, even those where we are only
4728 # looking at a subdir Makefile. We must set relative_dir so that
4729 # the file-finding machinery works.
4730 local ($relative_dir) = '.';
4731 &require_config_file
($FOREIGN, 'install-sh', 'mkinstalldirs', 'missing');
4732 &am_error
("\`install.sh' is an anachronism; use \`install-sh' instead")
4733 if -f
$config_aux_path[0] . '/install.sh';
4735 &require_config_file
($FOREIGN, 'py-compile')
4738 # Preserve dist_common for later.
4739 %configure_dist_common = %dist_common;
4742 ################################################################
4744 # Set up for Cygnus mode.
4747 return unless $cygnus_mode;
4749 &set_strictness
('foreign');
4750 $options{'no-installinfo'} = 1;
4751 $options{'no-dependencies'} = 1;
4752 $use_dependencies = 0;
4754 if (! $seen_maint_mode)
4756 &am_conf_error
("\`AM_MAINTAINER_MODE' required when --cygnus specified");
4761 &am_conf_error
("\`AC_EXEEXT' required when --cygnus specified");
4765 # Do any extra checking for GNU standards.
4766 sub check_gnu_standards
4768 if ($relative_dir eq '.')
4770 # In top level (or only) directory.
4771 &require_file
($GNU, 'INSTALL', 'NEWS', 'README', 'COPYING',
4772 'AUTHORS', 'ChangeLog');
4775 if ($strictness >= $GNU)
4777 if (defined $options{'no-installman'})
4779 &am_line_error
('AUTOMAKE_OPTIONS',
4780 "option \`no-installman' disallowed by GNU standards");
4783 if (defined $options{'no-installinfo'})
4785 &am_line_error
('AUTOMAKE_OPTIONS',
4786 "option \`no-installinfo' disallowed by GNU standards");
4791 # Do any extra checking for GNITS standards.
4792 sub check_gnits_standards
4794 if ($relative_dir eq '.')
4796 # In top level (or only) directory.
4797 &require_file
($GNITS, 'THANKS');
4801 ################################################################
4803 # Functions to handle files of each language.
4805 # Each `lang_X_rewrite' function follows a simple formula:
4806 # * Args are the directory, base name and extension of the file.
4807 # * Return value is 1 if file is to be dealt with, 0 otherwise.
4808 # Much of the actual processing is handled in handle_single_transform_list.
4809 # These functions exist so that auxiliary information can be recorded
4810 # for a later cleanup pass. Note that the calls to these functions
4811 # are computed, so don't bother searching for their precise names
4814 # This is just a convenience function that can be used to determine
4815 # when a subdir object should be used.
4818 return defined $options{'subdir-objects'} ?
$LANG_SUBDIR : $LANG_PROCESS;
4821 # Rewrite a single C source file.
4824 local ($directory, $base, $ext) = @_;
4826 if (defined $options{'ansi2knr'} && $base =~ /_$/)
4828 # FIXME: include line number in error.
4829 &am_error
("C source file \`$base.c' would be deleted by ansi2knr rules");
4832 local ($r) = $LANG_PROCESS;
4833 if (defined $options{'subdir-objects'})
4836 $base = $directory . '/' . $base;
4840 # Only give error once.
4842 # FIXME: line number.
4843 &am_error
("C objects in subdir but \`AM_PROG_CC_C_O' not in \`configure.in'");
4846 &require_file
($FOREIGN, 'compile')
4847 if $relative_dir eq '.';
4850 $de_ansi_files{$base} = 1;
4854 # Rewrite a single C++ source file.
4855 sub lang_cxx_rewrite
4857 return &lang_sub_obj
;
4860 # Rewrite a single header file.
4861 sub lang_header_rewrite
4863 # Header files are simply ignored.
4864 return $LANG_IGNORE;
4867 # Rewrite a single yacc file.
4868 sub lang_yacc_rewrite
4870 local ($directory, $base, $ext) = @_;
4872 local ($r) = &lang_c_rewrite
($directory, $base, $ext);
4874 if ($r == $LANG_SUBDIR)
4876 $pfx = $directory . '/';
4878 $yacc_sources{$pfx . $base . '.' . $ext} = 1;
4880 &saw_extension
('c');
4882 &push_dist_common
($pfx . $base . '.' . $ext);
4886 # Rewrite a single yacc++ file.
4887 sub lang_yaccxx_rewrite
4889 local ($directory, $base, $ext) = @_;
4891 local ($r) = $LANG_PROCESS;
4893 if (defined $options{'subdir-objects'})
4895 $pfx = $directory . '/';
4898 $yacc_sources{$pfx . $base . '.' . $ext} = 1;
4900 &saw_extension
($ext);
4902 &push_dist_common
($pfx . $base . '.' . $ext);
4906 # Rewrite a single lex file.
4907 sub lang_lex_rewrite
4909 local ($directory, $base, $ext) = @_;
4911 local ($r) = &lang_c_rewrite
($directory, $base, $ext);
4913 if ($r == $LANG_SUBDIR)
4915 $pfx = $directory . '/';
4917 $lex_sources{$pfx . $base . '.' . $ext} = 1;
4919 &saw_extension
('c');
4921 &push_dist_common
($pfx . $base . '.' . $ext);
4925 # Rewrite a single lex++ file.
4926 sub lang_lexxx_rewrite
4928 local ($directory, $base, $ext) = @_;
4930 local ($r) = $LANG_PROCESS;
4932 if (defined $options{'subdir-objects'})
4934 $pfx = $directory . '/';
4937 $lex_sources{$pfx . $base . '.' . $ext} = 1;
4939 &saw_extension
($ext);
4941 &push_dist_common
($pfx . $base . '.' . $ext);
4945 # Rewrite a single assembly file.
4946 sub lang_asm_rewrite
4948 return &lang_sub_obj
;
4951 # Rewrite a single Fortran 77 file.
4952 sub lang_f77_rewrite
4954 return $LANG_PROCESS;
4957 # Rewrite a single preprocessed Fortran 77 file.
4958 sub lang_ppf77_rewrite
4960 return $LANG_PROCESS;
4963 # Rewrite a single ratfor file.
4964 sub lang_ratfor_rewrite
4966 return $LANG_PROCESS;
4969 # Rewrite a single Objective C file.
4970 sub lang_objc_rewrite
4972 return &lang_sub_obj
;
4975 # Rewrite a single Java file.
4976 sub lang_java_rewrite
4978 return $LANG_SUBDIR;
4981 # The lang_X_finish functions are called after all source file
4982 # processing is done. Each should handle defining rules for the
4983 # language, etc. A finish function is only called if a source file of
4984 # the appropriate type has been seen.
4988 # Push all libobjs files onto de_ansi_files. We actually only
4989 # push files which exist in the current directory, and which are
4990 # genuine source files.
4992 foreach $file (keys %libsources)
4994 if ($file =~ /^(.*)\.[cly]$/ && -f
"$relative_dir/$file")
4996 $de_ansi_files{$1} = 1;
5000 if (defined $options{'ansi2knr'} && keys %de_ansi_files)
5002 # Make all _.c files depend on their corresponding .c files.
5003 local ($base, @objects);
5004 foreach $base (sort keys %de_ansi_files)
5006 # Each _.c file must depend on ansi2knr; otherwise it
5007 # might be used in a parallel build before it is built.
5008 # We need to support files in the srcdir and in the build
5009 # dir (because these files might be auto-generated. But
5010 # we can't use $< -- some makes only define $< during a
5012 $output_rules .= ($base . "_.c: $base.c \$(ANSI2KNR)\n\t"
5013 . '$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) '
5014 . '`if test -f $(srcdir)/' . $base . '.c'
5015 . '; then echo $(srcdir)/' . $base . '.c'
5016 . '; else echo ' . $base . '.c; fi` '
5017 . "| sed 's/^# \\([0-9]\\)/#line \\1/' "
5018 . '| $(ANSI2KNR) > ' . $base . "_.c\n");
5019 push (@objects, $base . '_'
5020 . ($seen_objext ?
'.$(OBJEXT)' : '.o'));
5021 push (@objects, $base . '_.lo') if $seen_libtool;
5024 # Make all _.o (and _.lo) files depend on ansi2knr.
5025 # Use a sneaky little hack to make it print nicely.
5026 &pretty_print_rule
('', '', @objects, ':', '$(ANSI2KNR)');
5029 if (! defined $configure_vars{'CC'})
5031 # FIXME: line number.
5032 &am_error
("C source seen but \`CC' not defined in \`configure.in'");
5038 local ($ltcompile, $ltlink) = &libtool_compiler
;
5040 &define_variable
('CXXLD', '$(CXX)');
5041 &define_variable
('CXXLINK', $ltlink . '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
5043 if (! defined $configure_vars{'CXX'})
5045 &am_error
("C++ source seen but \`CXX' not defined in \`configure.in'");
5049 sub lang_header_finish
5054 # This is a helper for both lex and yacc.
5055 sub yacc_lex_finish_helper
5057 return if defined $language_scratch{'lex-yacc-done'};
5058 $language_scratch{'lex-yacc-done'} = 1;
5060 # If there is more than one distinct yacc (resp lex) source file
5061 # in a given directory, then the `ylwrap' program is required to
5062 # allow parallel builds to work correctly. FIXME: for now, no
5064 &require_config_file
($FOREIGN, 'ylwrap');
5065 if ($config_aux_dir ne '.' && $config_aux_dir ne '')
5067 &define_variable
('YLWRAP', $config_aux_dir . "/ylwrap");
5071 &define_variable
('YLWRAP', '$(srcdir)/ylwrap');
5075 sub lang_yacc_finish
5077 return if defined $language_scratch{'yacc-done'};
5078 $language_scratch{'yacc-done'} = 1;
5080 local ($file, $base, $hname, $cname);
5081 local (%seen_suffix) = ();
5082 local (@yacc_files) = sort keys %yacc_sources;
5083 local ($yacc_count) = scalar (@yacc_files);
5084 foreach $file (@yacc_files)
5087 &output_yacc_build_rule
($1, $yacc_count > 1)
5088 if ! defined $seen_suffix{$1};
5089 $seen_suffix{$1} = 1;
5091 $file =~ /^(.*)\.(y|yy|y\+\+|yxx|ypp)$/;
5093 $hname = 'h'; # Always use `.h' for header file.
5094 ($cname = $2) =~ tr/y/c/;
5096 if ((&variable_defined
('AM_YFLAGS')
5097 && &variable_value
('AM_YFLAGS') =~ /(^|\s)-d(\s|$)/)
5098 || (&variable_defined
('YFLAGS')
5099 && &variable_value
('YFLAGS') =~ /(^|\s)-d(\s|$)/)) {
5100 # Now generate rule to make the header file. This should only
5101 # be generated if `yacc -d' specified.
5102 $output_rules .= "${base}.${hname}: ${base}.${cname}\n";
5104 # If the files are built in the build directory, then we want
5105 # to remove them with `make clean'. If they are in srcdir
5106 # they shouldn't be touched. However, we can't determine this
5107 # statically, and the GNU rules say that yacc/lex output files
5108 # should be removed by maintainer-clean. So that's what we
5110 push (@maintainer_clean_files, "${base}.${hname}");
5112 &push_dist_common
("${base}.${hname}");
5114 push (@maintainer_clean_files, "${base}.${cname}");
5116 $output_rules .= "\n";
5118 if (! defined $configure_vars{'YACC'})
5120 &am_error
("yacc source seen but \`YACC' not defined in \`configure.in'");
5122 if (&variable_defined
('YACCFLAGS'))
5124 &am_line_error
('YACCFLAGS',
5125 "\`YACCFLAGS' obsolete; use \`YFLAGS' instead");
5128 if ($yacc_count > 1)
5130 &yacc_lex_finish_helper
;
5134 sub lang_yaccxx_finish
5141 return if defined $language_scratch{'lex-done'};
5142 $language_scratch{'lex-done'} = 1;
5144 local (%seen_suffix) = ();
5145 local ($file, $cname);
5146 local ($lex_count) = scalar (keys %lex_sources);
5147 foreach $file (sort keys %lex_sources)
5150 &output_lex_build_rule
($1, $lex_count > 1)
5151 if (! defined $seen_suffix{$1});
5152 $seen_suffix{$1} = 1;
5154 # If the files are built in the build directory, then we want
5155 # to remove them with `make clean'. If they are in srcdir
5156 # they shouldn't be touched. However, we can't determine this
5157 # statically, and the GNU rules say that yacc/lex output files
5158 # should be removed by maintainer-clean. So that's what we
5160 $file =~ /^(.*)\.(l|ll|l\+\+|lxx|lpp)$/;
5161 ($cname = $2) =~ tr/l/c/;
5162 push (@maintainer_clean_files, "${1}.${cname}");
5165 if (! defined $configure_vars{'LEX'})
5167 &am_error
("lex source seen but \`LEX' not defined in \`configure.in'");
5169 if (! $seen_decl_yytext)
5171 &am_error
("lex source seen but \`AC_DECL_YYTEXT' not in \`configure.in'");
5176 &yacc_lex_finish_helper
;
5180 sub lang_lexxx_finish
5187 # We need the C code for assembly.
5193 # FIXME: this function can be called more than once. We should
5194 # arrange for it to only do anything the first time through.
5196 local ($ltcompile, $ltlink) = &libtool_compiler
;
5198 &define_variable
('F77LD', '$(F77)');
5199 &define_variable
('F77LINK', $ltlink . '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
5201 if (! defined $configure_vars{'F77'})
5203 &am_error
("Fortran 77 source seen but \`F77' not defined in \`configure.in'");
5207 # Preprocessed Fortran 77
5209 # The current support for preprocessing Fortran 77 just involves passing
5210 # `$(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)' as additional flags
5211 # to the Fortran 77 compiler, since this is how GNU Make does it; see
5212 # the `GNU Make Manual, Edition 0.51 for `make' Version 3.76 Beta'
5213 # (specifically, from info file `(make)Catalogue of Rules').
5215 # A better approach would be to write an Autoconf test
5216 # (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all
5217 # Fortran 77 compilers know how to do preprocessing. The Autoconf macro
5218 # AC_PROG_FPP should test the Fortran 77 compiler first for
5219 # preprocessing capabilities, and then fall back on cpp (if cpp were
5221 sub lang_ppf77_finish
5225 # We also handle the case of preprocessing `.F' files into `.f'
5227 $output_rules .= (".F.f:\n"
5228 . "\t\$(F77COMPILE) -F \$<\n");
5231 sub lang_ratfor_finish
5235 # We also handle the case of preprocessing `.r' files into `.f'
5237 $output_rules .= (".r.f:\n"
5238 . "\t\$(RCOMPILE) -F \$<\n");
5241 sub lang_objc_finish
5243 local ($ltcompile, $ltlink) = &libtool_compiler
;
5245 &define_variable
('OBJCLD', '$(OBJC)');
5246 &define_variable
('OBJCLINK', $ltlink . '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
5248 if (! defined $configure_vars{'OBJC'})
5250 &am_error
("Objective C source seen but \`OBJC' not defined in \`configure.in'");
5254 sub lang_java_finish
5256 local ($ltcompile, $ltlink) = &libtool_compiler
;
5258 &define_variable
('GCJLD', '$(GCJ)');
5259 &define_variable
('GCJLINK', $ltlink . '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
5261 if (! defined $configure_vars{'GCJ'})
5263 &am_error
("Java source seen but \`GCJ' not defined in \`configure.in'");
5267 # A helper which computes a sorted list of all extensions for LANG.
5272 foreach $key (sort keys %extension_seen)
5274 push (@r, '.' . $key) if $extension_map{$key} eq $lang;
5279 # A helper which decides whether libtool is needed. Returns prefix
5280 # for compiler and linker.
5281 sub libtool_compiler
5283 local ($ltcompile, $ltlink) = ('', '');
5286 &define_configure_variable
("LIBTOOL");
5287 $ltcompile = '$(LIBTOOL) --mode=compile ';
5288 $ltlink = '$(LIBTOOL) --mode=link ';
5290 return ($ltcompile, $ltlink);
5293 # Given a hash table of linker names, pick the name that has the most
5294 # precedence. This is lame, but something has to have global
5295 # knowledge in order to eliminate the conflict. Add more linkers as
5299 local (%linkers) = @_;
5302 if defined $linkers{'GCJLINK'};
5304 if defined $linkers{'CXXLINK'};
5306 if defined $linkers{'F77LINK'};
5308 if defined $linkers{'OBJCLINK'};
5312 # Called to indicate that an extension was used.
5316 $extension_seen{$ext} = 1;
5319 # Called to ask whether source files have been seen . If HEADERS is 1,
5320 # headers can be included.
5323 local ($headers) = @_;
5331 local (@exts) = &lang_extensions
('header');
5335 return scalar keys %extension_seen > $headers;
5338 # Register a single language. LANGUAGE is the name of the language.
5339 # Each OPTION is either of the form NAME=VALUE, or is a file extension
5341 sub register_language
5343 local ($language, @options) = @_;
5346 $language_map{$language . '-ansi-p'} = 0;
5347 $language_map{$language . '-linker'} = '';
5348 $language_map{$language . '-autodep'} = 'no';
5349 $language_map{$language . '-derived-autodep'} = 'no';
5352 foreach $iter (@options)
5354 if ($iter =~ /^(.*)=(.*)$/)
5356 $language_map{$language . '-' . $1} = $2;
5358 elsif (defined $extension_map{$iter})
5361 "automake: programming error: duplicate extension $iter\n";
5366 $extension_map{$iter} = $language;
5371 # This function is used to find a path from a user-specified suffix to
5372 # `o' or to some other suffix we recognize internally, eg `cc'.
5375 local ($source_ext) = @_;
5377 # FIXME: hard-coding `o' is a mistake. Doing something
5378 # intelligent is harder.
5379 while ($extension_map{$source_ext} eq ''
5380 && $source_ext ne 'o'
5381 && defined $suffix_rules{$source_ext})
5383 $source_ext = $suffix_rules{$source_ext};
5390 ################################################################
5392 # Pretty-print something. HEAD is what should be printed at the
5393 # beginning of the first line, FILL is what should be printed at the
5394 # beginning of every subsequent line.
5395 sub pretty_print_internal
5397 local ($head, $fill, @values) = @_;
5399 local ($column) = length ($head);
5400 local ($result) = $head;
5402 # Fill length is number of characters. However, each Tab
5403 # character counts for eight. So we count the number of Tabs and
5405 local ($fill_length) = length ($fill);
5406 $fill_length += 7 * ($fill =~ tr/\t/\t/d);
5408 local ($bol) = ($head eq '');
5411 # "71" because we also print a space.
5412 if ($column + length ($_) > 71)
5414 $result .= " \\\n" . $fill;
5415 $column = $fill_length;
5419 $result .= ' ' unless ($bol);
5421 $column += length ($_) + 1;
5429 # Pretty-print something and append to output_vars.
5432 $output_vars .= &pretty_print_internal
(@_);
5435 # Pretty-print something and append to output_rules.
5436 sub pretty_print_rule
5438 $output_rules .= &pretty_print_internal
(@_);
5442 ################################################################
5444 # See if a target exists.
5447 local ($target) = @_;
5448 return defined $targets{$target};
5451 # See if two conditionals are the same.
5452 sub conditional_same
5454 local ($cond1, $cond2) = @_;
5456 return (&conditional_true_when
($cond1, $cond2)
5457 && &conditional_true_when
($cond2, $cond1));
5460 # See if a conditional is true. Both arguments are conditional
5461 # strings. This returns true if the first conditional is true when
5462 # the second conditional is true.
5463 sub conditional_true_when
5465 local ($cond, $when) = @_;
5467 # Check the easy case first.
5473 # Check each component of $cond, which looks @COND1@@COND2@.
5474 foreach $comp (split ('@', $cond))
5476 # The way we split will give null strings between each
5480 if (index ($when, '@' . $comp . '@') == -1)
5489 # Check for an ambiguous conditional. This is called when a variable
5490 # or target is being defined conditionally. If we already know about
5491 # a definition that is true under the same conditions, then we have an
5493 sub check_ambiguous_conditional
5495 local ($var_name, $cond) = @_;
5496 local (@cond_vals) = split (' ', $conditional{$var_name});
5499 local ($vcond) = shift (@cond_vals);
5501 if (&conditional_true_when
($vcond, $cond)
5502 || &conditional_true_when
($cond, $vcond))
5504 &am_line_error
($var_name,
5505 "$var_name multiply defined in condition");
5510 # See if a variable exists. The first argument is the variable name,
5511 # and the optional second argument is the condition which we should
5512 # check. If no condition is given, we currently return true if the
5513 # variable is defined under any condition.
5514 sub variable_defined
5516 local ($var, $cond) = @_;
5517 if (defined $targets{$var})
5519 &am_line_error
($var, "\`$var' is target; expected variable");
5522 elsif (defined $contents{$var})
5524 if ($cond && $conditional{$var})
5526 # We have been asked to check for a particular condition,
5527 # and the variable is defined conditionally. We need to
5528 # look through the conditions under which the variable is
5529 # defined, and see if any of them match the conditional we
5530 # have been asked to check.
5531 local (@cond_vars) = split (' ', $conditional{$var});
5534 if (&conditional_same
($cond, shift (@cond_vars)))
5536 # Even a conditional examination is good enough
5537 # for us. FIXME: really should maintain examined
5538 # status on a per-condition basis.
5539 $content_seen{$var} = 1;
5545 # The variable is not defined for the given condition.
5549 $content_seen{$var} = 1;
5555 # Mark a variable as examined.
5556 sub examine_variable
5559 &variable_defined
($var);
5562 # Quote a value in order to put it in $conditional. We need to quote
5563 # spaces, and we need to handle null strings, so that we can later
5564 # retrieve values by splitting on space.
5568 $val =~ tr/ \t\n/\001\003\004/;
5569 $val = "\002" if $val eq '';
5573 # Unquote a value in $conditional.
5574 sub unquote_cond_val
5577 $val =~ tr/\001\003\004/ \t\n/;
5582 # Return the set of conditions for which a variable is defined.
5584 # If the variable is not defined conditionally, and is not defined in
5585 # terms of any variables which are defined conditionally, then this
5586 # returns the empty list.
5588 # If the variable is defined conditionally, but is not defined in
5589 # terms of any variables which are defined conditionally, then this
5590 # returns the list of conditions for which the variable is defined.
5592 # If the variable is defined in terms of any variables which are
5593 # defined conditionally, then this returns a full set of permutations
5594 # of the subvariable conditions. For example, if the variable is
5595 # defined in terms of a variable which is defined for @COND_TRUE@,
5596 # then this returns both @COND_TRUE@ and @COND_FALSE@. This is
5597 # because we will need to define the variable under both conditions.
5599 sub variable_conditions
5607 foreach $cond (&variable_conditions_sub
($var, '', ()))
5609 $uniqify{$cond} = 1;
5612 @uniq_list = sort keys %uniqify;
5613 # Note we cannot just do `return sort keys %uniqify', because this
5614 # function is sometimes used in a scalar context.
5618 # A subroutine of variable_conditions. We only return conditions
5619 # which are true for all the conditions in @PARENT_CONDS.
5620 sub variable_conditions_sub
5622 local ($var, $parent, @parent_conds) = @_;
5623 local (@new_conds) = ();
5625 if (defined $vars_scanned{$var})
5627 &am_line_error
($parent, "variable \`$var' recursively defined");
5630 $vars_scanned{$var} = 1;
5632 if (! $conditional{$var})
5634 foreach (split (' ', $contents{$var}))
5636 # If a comment seen, just leave.
5639 # Handle variable substitutions.
5640 if (/^\$\{(.*)\}$/ || /^\$\((.*)\)$/)
5643 &variable_conditions_sub
($1, $var, @parent_conds));
5647 # Now we want to return all permutations of the subvariable
5649 local (%allconds, $item);
5650 foreach $item (@new_conds)
5652 foreach (split ('@', $item))
5656 $allconds{$_ . '_TRUE'} = 1;
5660 # Unset our entry in vars_scanned. We only care about recursive
5662 delete $vars_scanned{$var};
5664 return &variable_conditions_permutations
(sort keys %allconds);
5667 local (@this_conds) = ();
5668 local (@condvals) = split (' ', $conditional{$var});
5671 local ($cond) = shift (@condvals);
5672 local ($val) = &unquote_cond_val
(shift (@condvals));
5677 local ($parent_cond);
5678 foreach $parent_cond (@parent_conds)
5680 if (! &conditional_true_when
($parent_cond, $cond))
5690 push (@this_conds, $cond);
5692 push (@parent_conds, $cond);
5693 local (@subvar_conds) = ();
5694 foreach (split (' ', $val))
5696 # If a comment seen, just leave.
5699 # Handle variable substitutions.
5700 if (/^\$\{(.*)\}$/ || /^\$\((.*)\)$/)
5702 push (@subvar_conds,
5703 &variable_conditions_sub
($1, $var, @parent_conds));
5706 pop (@parent_conds);
5708 # If there are no conditional subvariables, then we want to
5709 # return this condition. Otherwise, we want to return the
5710 # permutations of the subvariables.
5711 if (! @subvar_conds)
5713 push (@new_conds, $cond);
5717 push (@new_conds, &variable_conditions_reduce
(@subvar_conds));
5721 # Unset our entry in vars_scanned. We only care about recursive
5723 delete $vars_scanned{$var};
5728 # If we are being called on behalf of another variable, we need to
5729 # return all possible permutations of the conditions. We have
5730 # already handled everything in @this_conds along with their
5731 # subvariables. We now need to add any permutations that are not
5734 foreach $this_cond (@this_conds)
5737 &variable_conditions_permutations
(split('@', $this_cond));
5739 foreach $perm (@perms)
5743 foreach $scan (@this_conds)
5745 if (&conditional_true_when
($perm, $scan)
5746 || &conditional_true_when
($scan, $perm))
5757 local ($parent_cond);
5758 foreach $parent_cond (@parent_conds)
5760 if (! &conditional_true_when
($parent_cond, $perm))
5770 # This permutation was not already handled, and is valid
5772 push (@new_conds, $perm);
5779 # Subroutine for variable_conditions_sort
5780 sub variable_conditions_cmp
5786 return (length ($as) <=> length ($bs)
5790 # Sort a list of conditionals so that only the exclusive ones are
5791 # retained. For example, if both @COND1_TRUE@@COND2_TRUE@ and
5792 # @COND1_TRUE@ are in the list, discard the latter.
5793 sub variable_conditions_reduce
5795 local (@conds) = @_;
5798 foreach $cond (sort variable_conditions_cmp
@conds)
5802 foreach $scan (@ret)
5804 if (&conditional_true_when
($cond, $scan))
5817 # Return a list of permutations of a conditional string.
5818 sub variable_conditions_permutations
5820 local (@comps) = @_;
5823 local ($comp) = shift (@comps);
5824 return &variable_conditions_permutations
(@comps)
5826 local ($neg) = $comp;
5827 $neg =~ s/TRUE$/TRUEO/;
5828 $neg =~ s/FALSE$/TRUE/;
5829 $neg =~ s/TRUEO$/FALSE/;
5832 foreach $sub (&variable_conditions_permutations
(@comps))
5834 push (@ret, '@' . $comp . '@' . $sub);
5835 push (@ret, '@' . $neg . '@' . $sub);
5839 push (@ret, '@' . $comp . '@');
5840 push (@ret, '@' . $neg . '@');
5845 # Warn if a variable is conditionally defined. This is called if we
5846 # are using the value of a variable.
5847 sub variable_conditionally_defined
5849 local ($var, $parent) = @_;
5850 if ($conditional{$var})
5854 &am_line_error
($parent,
5855 "warning: automake does not support conditional definition of $var in $parent");
5859 &am_line_error
($parent,
5860 "warning: automake does not support $var being defined conditionally")
5865 # Get the value of a variable. This just returns $contents, but warns
5866 # if the variable is conditionally defined.
5870 &variable_conditionally_defined
($var);
5871 return $contents{$var};
5874 # Convert a variable value to a list, split as whitespace. This will
5875 # recursively follow $(...) and ${...} inclusions. It preserves @...@
5876 # substitutions. If COND is 'all', then all values under all
5877 # conditions should be returned; if COND is a particular condition
5878 # (all conditions are surrounded by @...@) then only the value for
5879 # that condition should be returned; otherwise, warn if VAR is
5880 # conditionally defined. SCANNED is a global hash listing whose keys
5881 # are all the variables already scanned; it is an error to rescan a
5885 local ($var, $val, $cond) = @_;
5889 $val =~ s/\\(\n|$)/ /g;
5891 foreach (split (' ', $val))
5893 # If a comment seen, just leave.
5896 # Handle variable substitutions.
5897 if (/^\$\{([^}]*)\}$/ || /^\$\(([^)]*)\)$/)
5899 local ($varname) = $1;
5901 # If the user uses a losing variable name, just ignore it.
5902 # This isn't ideal, but people have requested it.
5903 next if ($varname =~ /\@.*\@/);
5907 if ($varname =~ /^([^:]*):([^=]*)=(.*)$/)
5911 ($from = $2) =~ s/(\W)/\\$1/g;
5915 @temp_list = &variable_value_as_list_worker
($1, $cond, $var);
5917 # Now rewrite the value if appropriate.
5920 grep (s/$from$/$to/, @temp_list);
5923 push (@result, @temp_list);
5934 # Return contents of variable as list, split as whitespace. This will
5935 # recursively follow $(...) and ${...} inclusions. It preserves @...@
5936 # substitutions. If COND is 'all', then all values under all
5937 # conditions should be returned; if COND is a particular condition
5938 # (all conditions are surrounded by @...@) then only the value for
5939 # that condition should be returned; otherwise, warn if VAR is
5940 # conditionally defined. If PARENT is specified, it is the name of
5941 # the including variable; this is only used for error reports.
5942 sub variable_value_as_list_worker
5944 local ($var, $cond, $parent) = @_;
5947 if (defined $targets{$var})
5949 &am_line_error
($var, "\`$var' is target; expected variable");
5951 elsif (! defined $contents{$var})
5953 &am_line_error
($parent, "variable \`$var' not defined");
5955 elsif (defined $vars_scanned{$var})
5957 # `vars_scanned' is a global we use to keep track of which
5958 # variables we've already examined.
5959 &am_line_error
($parent, "variable \`$var' recursively defined");
5961 elsif ($cond eq 'all' && $conditional{$var})
5963 $vars_scanned{$var} = 1;
5964 local (@condvals) = split (' ', $conditional{$var});
5968 local ($val) = &unquote_cond_val
(shift (@condvals));
5969 push (@result, &value_to_list
($var, $val, $cond));
5972 elsif ($cond && $conditional{$var})
5974 $vars_scanned{$var} = 1;
5975 local (@condvals) = split (' ', $conditional{$var});
5979 local ($vcond) = shift (@condvals);
5980 local ($val) = &unquote_cond_val
(shift (@condvals));
5981 if (&conditional_true_when
($vcond, $cond))
5983 # Warn if we have an ambiguity. It's hard to know how
5984 # to handle this case correctly.
5985 &variable_conditionally_defined
($var, $parent)
5988 push (@result, &value_to_list
($var, $val, $cond));
5994 $vars_scanned{$var} = 1;
5995 &variable_conditionally_defined
($var, $parent);
5996 $content_seen{$var} = 1;
5997 push (@result, &value_to_list
($var, $contents{$var}, $cond));
6000 # Unset our entry in vars_scanned. We only care about recursive
6002 delete $vars_scanned{$var};
6007 # This is just a wrapper for variable_value_as_list_worker that
6008 # initializes the global hash `vars_scanned'. This hash is used to
6009 # avoid infinite recursion.
6010 sub variable_value_as_list
6012 local ($var, $cond, $parent) = @_;
6014 return &variable_value_as_list_worker
($var, $cond, $parent);
6017 # Define a new variable, but only if not already defined.
6020 local ($var, $value) = @_;
6022 if (! defined $contents{$var})
6024 $output_vars .= $var . ' = ' . $value . "\n";
6025 $contents{$var} = $value;
6026 $content_seen{$var} = 1;
6028 elsif ($var_was_plus_eq{$var})
6030 &am_line_error
($var, "internally generated variable \`$var' was set with \`+='");
6034 # Like define_variable, but the value is a list, and the variable may
6035 # be defined conditionally. The second argument is the conditional
6036 # under which the value should be defined; this should be the empty
6037 # string to define the variable unconditionally. The third argument
6038 # is a list holding the values to use for the variable. The value is
6039 # pretty printed in the output file.
6040 sub define_pretty_variable
6042 local ($var, $cond, @value) = @_;
6043 if (! defined $contents{$var}
6044 || ($cond && ! &variable_defined
($var, $cond)))
6046 $contents{$var} = join (' ', @value);
6049 if ($conditional{$var})
6051 $conditional{$var} .= ' ';
6055 $conditional{$var} = '';
6057 $conditional{$var} .= ($cond
6059 . "e_cond_val
($contents{$var}));
6061 &pretty_print
($cond . $var . ' = ', $cond, @value);
6062 $content_seen{$var} = 1;
6066 # Like define_variable, but define a variable to be the configure
6067 # substitution by the same name.
6068 sub define_configure_variable
6071 local ($value) = '@' . $var . '@';
6072 &define_variable
($var, $value);
6075 # Define a compiler variable. We also handle defining the `LT'
6076 # version of the command when using libtool.
6077 sub define_compiler_variable
6079 local ($var, $ltcompile, $value) = @_;
6080 local ($name) = $var;
6081 &define_variable
($name, $value);
6082 &define_variable
('LT' . $name, $ltcompile . $value)
6086 # Define a variable that represents a program to run. If in Cygnus
6087 # mode, the program is searched for in the build (or source) tree.
6088 # Otherwise no searching is done at all. Arguments are:
6089 # * VAR Name of variable to define
6090 # * WHATDIR Either `src' or `build', depending on where program should
6091 # be found. (runtest is in srcdir!)
6092 # * SUBDIR Subdir of top-level dir
6093 # * PROGRAM Name of program
6094 # * OVERRIDE If specified, the name of the program to use when not in
6095 # Cygnus mode. Defaults to PROGRAM.
6096 sub define_program_variable
6098 local ($var, $whatdir, $subdir, $program, $override) = @_;
6102 $override = $program;
6107 local ($full) = ('$(top_' . $whatdir . 'dir)/../'
6108 . $subdir . '/' . $program);
6109 &define_variable
($var, ('`if test -f ' . $full
6110 . '; then echo ' . $full . '; else echo '
6111 . $program . '; fi`'));
6115 &define_variable
($var, $override);
6120 ################################################################
6122 # Read Makefile.am and set up %contents. Simultaneously copy lines
6123 # from Makefile.am into $output_trailer or $output_vars as
6124 # appropriate. NOTE we put rules in the trailer section. We want
6125 # user rules to come after our generated stuff.
6128 local ($amfile) = @_;
6131 open (AM_FILE
, $amfile) || die "automake: couldn't open \`$amfile': $!\n";
6132 print "automake: reading $amfile\n" if $verbose;
6134 local ($saw_bk) = 0;
6135 local ($was_rule) = 0;
6136 local ($spacing) = '';
6137 local ($comment) = '';
6138 local ($last_var_name) = '';
6141 # We save the conditional stack on entry, and then check to make
6142 # sure it is the same on exit. This lets us conditonally include
6144 local (@saved_cond_stack) = @conditional_stack;
6148 if (/$IGNORE_PATTERN/o)
6150 # Merely delete comments beginning with two hashes.
6152 elsif (/$WHITE_PATTERN/o)
6154 # Stick a single white line before the incoming macro or rule.
6158 elsif (/$COMMENT_PATTERN/o)
6160 # Stick comments before the incoming macro or rule. Make
6161 # sure a blank line preceeds first block of comments.
6162 $spacing = "\n" unless $blank;
6164 $comment .= $spacing . $_;
6173 $output_vars .= $comment . "\n";
6177 local ($is_ok_macro);
6181 unless substr ($_, -1, 1) eq "\n";
6183 # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be
6184 # used by users. @MAINT@ is an anachronism now.
6185 $_ =~ s/\@MAINT\@//g
6186 unless $seen_maint_mode;
6188 if (/$IGNORE_PATTERN/o)
6190 # Merely delete comments beginning with two hashes.
6192 elsif (/$WHITE_PATTERN/o)
6194 # Stick a single white line before the incoming macro or rule.
6196 &am_line_error
($., "blank line following trailing backslash")
6199 elsif (/$COMMENT_PATTERN/o)
6201 # Stick comments before the incoming macro or rule.
6202 $comment .= $spacing . $_;
6204 &am_line_error
($., "comment following trailing backslash")
6211 $output_trailer .= join ('', @conditional_stack) . $_;
6217 $contents{$last_var_name} .= ' '
6218 unless $contents{$last_var_name} =~ /\s$/;
6219 $contents{$last_var_name} .= $_;
6220 if (@conditional_stack)
6222 $conditional{$last_var_name} .= "e_cond_val
($_);
6226 elsif (/$IF_PATTERN/o)
6228 &am_line_error
($., "$1 does not appear in AM_CONDITIONAL")
6229 if (! $configure_cond{$1});
6230 push (@conditional_stack, "\@" . $1 . "_TRUE\@");
6232 elsif (/$ELSE_PATTERN/o)
6234 if (! @conditional_stack)
6236 &am_line_error
($., "else without if");
6238 elsif ($conditional_stack[$#conditional_stack] =~ /_FALSE\@$/)
6240 &am_line_error
($., "else after else");
6244 $conditional_stack[$#conditional_stack]
6245 =~ s/_TRUE\@$/_FALSE\@/;
6248 elsif (/$ENDIF_PATTERN/o)
6250 if (! @conditional_stack)
6252 &am_line_error
($., "endif without if");
6256 pop @conditional_stack;
6259 elsif (/$RULE_PATTERN/o)
6263 if (defined $contents{$1}
6264 && (@conditional_stack
6265 ?
! defined $conditional{$1}
6266 : defined $conditional{$1}))
6269 "$1 defined both conditionally and unconditionally");
6271 # Value here doesn't matter; for targets we only note
6275 local ($cond_string) = join ('', @conditional_stack);
6276 if (@conditional_stack)
6278 if ($conditional{$1})
6280 &check_ambiguous_conditional
($1, $cond_string);
6281 $conditional{$1} .= ' ';
6285 $conditional{$1} = '';
6287 $conditional{$1} .= $cond_string . ' 1';
6289 $content_lines{$1} = $.;
6290 $output_trailer .= $comment . $spacing . $cond_string . $_;
6291 $comment = $spacing = '';
6294 # Check the rule for being a suffix rule. If so, store in
6297 local ($source_suffix);
6298 local ($object_suffix);
6300 if (($source_suffix, $object_suffix) = ($1 =~ $SUFFIX_RULE_PATTERN))
6302 $suffix_rules{$source_suffix} = $object_suffix;
6303 print "Sources ending in .$source_suffix become .$object_suffix\n" if $verbose;
6304 $source_suffix_pattern = "(" . join ('|', keys %suffix_rules) . ")";
6307 # FIXME: make sure both suffixes are in SUFFIXES? Or set
6308 # SUFFIXES from suffix_rules?
6310 elsif (($is_ok_macro = /$MACRO_PATTERN/o)
6311 || /$BOGUS_MACRO_PATTERN/o)
6313 # Found a macro definition.
6315 $last_var_name = $1;
6316 if (defined $contents{$1}
6317 && (@conditional_stack
6318 ?
! defined $conditional{$1}
6319 : defined $conditional{$1}))
6322 "$1 defined both conditionally and unconditionally");
6325 if ($3 ne '' && substr ($3, -1) eq "\\")
6327 # We preserve the `\' because otherwise the long lines
6328 # that are generated will be truncated by broken
6338 if (! defined $contents{$last_var_name})
6340 # The first assignment to a macro sets the line
6341 # number. Ideally I suppose we would associate line
6342 # numbers with random bits of text.
6343 $content_lines{$last_var_name} = $.;
6345 # If first assignment, set `+=' indicator.
6346 $var_was_plus_eq{$last_var_name} =
6348 && ! defined $am_var_defs{$last_var_name});
6353 if (! defined $contents{$last_var_name}
6354 && defined $am_var_defs{$last_var_name})
6356 $contents{$last_var_name} = $am_var_defs{$last_var_name};
6358 if (substr ($contents{$last_var_name}, -1) eq "\n")
6360 # Insert a backslash before a trailing newline.
6361 $contents{$last_var_name}
6362 = substr ($contents{$last_var_name}, 0, -1) . "\\\n";
6364 $contents{$last_var_name} .= ' ' . $value;
6368 $contents{$last_var_name} = $value;
6370 local ($cond_string) = join ('', @conditional_stack);
6371 if (@conditional_stack)
6375 if ($conditional{$last_var_name})
6379 # If we're adding to the conditional, and it
6380 # exists, then we might want to simply replace
6381 # the old value with the new one.
6382 local (@new_vals, @cond_vals);
6383 @cond_vals = split (' ', $conditional{$last_var_name});
6386 local ($vcond) = shift (@cond_vals);
6387 push (@new_vals, $vcond);
6388 if (&conditional_same
($vcond, $cond_string))
6391 $val = (&unquote_cond_val
(shift (@cond_vals))
6393 push (@new_vals, "e_cond_val
($val));
6397 push (@new_vals, shift (@cond_vals));
6402 $conditional{$last_var_name}
6403 = join (' ', @new_vals);
6409 &check_ambiguous_conditional
($last_var_name,
6411 $conditional{$last_var_name} .= ' ';
6417 $conditional{$last_var_name} = '';
6418 $val = $contents{$last_var_name};
6422 $conditional{$last_var_name} .= ($cond_string
6424 . "e_cond_val
($val));
6428 # FIXME: this doesn't always work correctly; it will group
6429 # all comments for a given variable, no matter where
6431 $am_vars{$last_var_name} = $comment . $spacing;
6432 $def_type{$last_var_name} = ($type eq ':') ?
':' : '';
6433 push (@var_list, $last_var_name);
6434 $comment = $spacing = '';
6438 &am_line_error
($., "bad macro name \`$last_var_name'")
6441 elsif (/$INCLUDE_PATTERN/o)
6445 if ($path =~ s/^\$\(top_srcdir\)\///)
6447 push (@include_stack, "\$\(top_srcdir\)/$path");
6451 $path =~ s/\$\(srcdir\)\///;
6452 push (@include_stack, "\$\(srcdir\)/$path");
6453 $path = $relative_dir . "/" . $path;
6455 &read_am_file
($path);
6459 # This isn't an error; it is probably a continued rule.
6460 # In fact, this is what we assume.
6462 $output_trailer .= ($comment . $spacing
6463 . join ('', @conditional_stack) . $_);
6464 $comment = $spacing = '';
6471 $output_trailer .= $comment;
6473 if (join (' ', @saved_cond_stack) ne join (' ', @conditional_stack))
6475 if (@conditional_stack)
6477 &am_error
("unterminated conditionals: " . join (' ', @conditional_stack));
6481 # FIXME: better error message here.
6482 &am_error
("conditionals not nested in include file");
6487 # A helper for read_main_am_file which initializes configure variables
6488 # and variables from header-vars.am. This is a subr so we can call it
6490 sub define_standard_variables
6492 # Compute relative location of the top object directory.
6493 local (@topdir) = ();
6494 foreach (split (/\//, $relative_dir))
6496 next if $_ eq '.' || $_ eq '';
6503 push (@topdir, '..');
6506 @topdir = ('.') if ! @topdir;
6508 $top_builddir = join ('/', @topdir);
6510 ($build_rx = $top_builddir) =~ s/(\W)/\\$1/g;
6511 $output_vars .= &file_contents_with_transform
6512 ('s/\@top_builddir\@/' . $build_rx . '/g;',
6515 # Generate some useful variables when AC_CANONICAL_* used. FIXME:
6516 # this should use generic %configure_vars method.
6517 if ($seen_canonical)
6519 local ($curs, %vars);
6520 $vars{'host_alias'} = 'host_alias';
6521 $vars{'host_triplet'} = 'host';
6522 if ($seen_canonical == $AC_CANONICAL_SYSTEM)
6524 $vars{'build_alias'} = 'build_alias';
6525 $vars{'build_triplet'} = 'build';
6526 $vars{'target_alias'} = 'target_alias';
6527 $vars{'target_triplet'} = 'target';
6529 foreach $curs (sort keys %vars)
6531 $output_vars .= "$curs = \@$vars{$curs}\@\n";
6532 $contents{$curs} = "\@$vars{$curs}\@";
6537 foreach $curs (sort keys %configure_vars)
6539 &define_configure_variable
($curs);
6543 # Read main am file.
6544 sub read_main_am_file
6546 local ($amfile) = @_;
6548 # The keys here are variables we want to dump at the end of this
6549 # function. The values are corresponding comments.
6550 local (%am_vars) = ();
6551 local (@var_list) = ();
6552 local (%def_type) = ();
6554 # This supports the strange variable tricks we are about to play.
6555 if (scalar keys %contents > 0)
6557 print STDERR
"automake: programming error: variable defined before read_main_am_file\n";
6561 # We want to predefine as many variables as possible. This lets
6562 # the user set them with `+=' in Makefile.am. However, we don't
6563 # want these initial definitions to end up in the output quite
6564 # yet. So we adopt a hack: read the `.am' file twice, throwing
6565 # away the output the first time. We also squirrel away a list of
6566 # all the variables defined by the .am file so that we know which
6567 # ones to remove from the content list.
6570 &define_standard_variables
;
6571 local (%saved_contents) = %contents;
6573 # Read user file, but discard text of variable assignments we just
6576 &read_am_file
($amfile);
6578 # Now dump the variables that were defined. We do it in the same
6579 # order in which they were defined (skipping duplicates).
6581 foreach $curs (@var_list)
6583 next if $done{$curs};
6586 $output_vars .= $am_vars{$curs};
6587 if ($conditional{$curs})
6589 local (@cond_vals) = split (' ', $conditional{$curs});
6592 local ($vcond) = shift (@cond_vals);
6593 local ($val) = &unquote_cond_val
(shift (@cond_vals));
6594 $output_vars .= ($vcond . $curs . ' '
6595 . $def_type{$curs} . "= ");
6597 foreach $line (split ("\n", $val))
6599 $output_vars .= $vcond . $line . "\n";
6601 $output_vars .= "\n"
6607 $output_vars .= ($curs . ' ' . $def_type{$curs} . '= '
6608 . $contents{$curs} . "\n");
6612 # Generate copyright header for generated Makefile.in.
6613 local ($ov) = $output_vars;
6614 $output_vars = ("# $in_file_name generated automatically by automake "
6615 . $VERSION . " from $am_file_name\n");
6616 $output_vars .= $gen_copyright;
6618 # Now go through and delete all the variables that the user did
6621 foreach $var (keys %saved_contents)
6623 if ($contents{$var} eq $saved_contents{$var})
6625 delete $contents{$var};
6629 # Re-read the standard variables, and this time keep their
6630 # contributions to the output. Then add the user's output to the
6632 &define_standard_variables
;
6633 $output_vars .= $ov;
6637 ################################################################
6639 sub initialize_global_constants
6641 # Values for AC_CANONICAL_*
6642 $AC_CANONICAL_HOST = 1;
6643 $AC_CANONICAL_SYSTEM = 2;
6645 # Associative array of standard directory names. Entry is TRUE if
6646 # corresponding directory should be installed during
6647 # 'install-exec' phase.
6665 # Commonly found files we look for and automatically include in
6669 "README", "THANKS", "TODO", "NEWS", "COPYING", "COPYING.LIB",
6670 "INSTALL", "ABOUT-NLS", "ChangeLog", "configure", "configure.in",
6671 "config.guess", "config.sub", "AUTHORS", "BACKLOG", "ABOUT-GNU",
6672 "libversion.in", "mdate-sh", "mkinstalldirs", "install-sh",
6673 'texinfo.tex', "ansi2knr.c", "ansi2knr.1", 'elisp-comp',
6674 # ltconfig appears here for compatibility with old versions
6676 'ylwrap', 'acinclude.m4', @libtoolize_files, @libtoolize_sometimes,
6677 'missing', 'depcomp', 'compile', 'py-compile'
6680 # Commonly used files we auto-include, but only sometimes.
6683 "aclocal.m4", "acconfig.h", "config.h.top",
6684 "config.h.bot", "stamp-h.in", 'stamp-vti'
6688 -a, --add-missing add missing standard files to package
6689 --amdir=DIR directory storing config files
6690 -c, --copy with -a, copy missing files (default is symlink)
6691 --cygnus assume program is part of Cygnus-style tree
6692 --force-missing force update of standard files
6693 --foreign set strictness to foreign
6694 --gnits set strictness to gnits
6695 --gnu set strictness to gnu
6696 --help print this help, then exit
6697 -i, --ignore-deps disable dependency tracking code
6698 --include-deps enable dependency tracking code
6699 --no-force only update Makefile.in's that are out of date
6700 -o DIR, --output-dir=DIR
6701 put generated Makefile.in's into DIR
6702 -v, --verbose verbosely list files processed
6703 --version print version number, then exit\n";
6705 # Copyright on generated Makefile.ins.
6707 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
6708 # Free Software Foundation, Inc.
6709 # This Makefile.in is free software; the Free Software Foundation
6710 # gives unlimited permission to copy and/or distribute it,
6711 # with or without modifications, as long as this notice is preserved.
6713 # This program is distributed in the hope that it will be useful,
6714 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
6715 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6716 # PARTICULAR PURPOSE.
6719 # This complex find command will try to avoid changing the modes of
6720 # links into the source tree, in case they're hard-linked. It will
6721 # also make directories writable by everybody, because some
6722 # brain-dead tar implementations change ownership and permissions of
6723 # a directory before extracting the files, thus becoming unable to
6725 # Ignore return result from chmod, because it might give an error
6726 # if we chmod a symlink.
6727 # Another nastiness: if the file is unreadable by us, we make it
6728 # readable regardless of the number of links to it. This only
6729 # happens in perverse cases.
6730 # We use $(install_sh) because that is a known-portable way to
6731 # modify the file in place in the source tree.
6732 $dist_header = ' -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \\
6733 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \\
6734 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \\
6735 ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \\
6736 || chmod -R a+r $(distdir)
6738 $dist{'dist-bzip2'} = ("\t"
6739 . '$(AMTAR) chof - $(distdir) | bzip2 -9 -c > $(distdir).tar.bz2'
6741 $dist{'dist-tarZ'} = ("\t"
6742 . '$(AMTAR) chof - $(distdir) | compress -c > $(distdir).tar.Z'
6744 $dist{'dist-shar'} = ("\t"
6745 . 'shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).shar.gz'
6747 $dist{'dist-zip'} = ("\t" . '-rm -f $(distdir).zip' . "\n" .
6748 "\t" . 'zip -rq $(distdir).zip $(distdir)' . "\n");
6750 # Note that we don't use GNU tar's `-z' option. One reason (but
6751 # not the only reason) is that some versions of tar (e.g., OSF1)
6752 # interpret `-z' differently.
6753 $dist{'dist'} = ("\t"
6754 . '$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz'
6756 $dist_trailer = "\t" . '-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)' . "\n";
6759 # (Re)-Initialize per-Makefile.am variables.
6760 sub initialize_per_input
6762 # These two variables are used when generating each Makefile.in.
6763 # They hold the Makefile.in until it is ready to be printed.
6766 $output_trailer = '';
6768 $output_header = '';
6770 # Suffixes found during a run.
6773 # This holds the contents of a Makefile.am, as parsed by
6777 # This holds the names which are targets. These also appear in
6781 # This maps a variable name onto a flag. The flag is true iff the
6782 # variable was first defined with `+='.
6783 %var_was_plus_eq = ();
6785 # This holds definitions of all variables defined in .am files.
6786 # This is used during startup to determine which variables can be
6787 # assigned with `+='.
6790 # For a variable or target which is defined conditionally, this
6791 # holds an array of the conditional values. The array is composed
6792 # of pairs of condition strings (the variables which configure
6793 # will substitute) and values (the value of a target is
6794 # meaningless). For an unconditional variable, this is empty.
6797 # This holds the line numbers at which various elements of
6798 # %contents are defined.
6799 %content_lines = ();
6801 # This holds a 1 if a particular variable was examined.
6804 # This is the conditional stack.
6805 @conditional_stack = ();
6807 # This holds the set of included files.
6808 @include_stack = ();
6810 # This holds the "relative directory" of the current Makefile.in.
6811 # Eg for src/Makefile.in, this is "src".
6814 # This holds a list of files that are included in the
6818 # List of dependencies for the obvious targets.
6834 # A list of files deleted by `maintainer-clean'.
6835 @maintainer_clean_files = ();
6837 # These are pretty obvious, too. They are used to define the
6838 # SOURCES and OBJECTS variables.
6841 # Sources which go in the distribution.
6844 # This hash maps object file names onto their corresponding source
6845 # file names. This is used to ensure that each object is created
6846 # by a single source file.
6849 # This keeps track of the directories for which we've already
6850 # created `.dirstamp' code.
6851 %directory_map = ();
6853 # These variables track inclusion of various compile-related .am
6854 # files. $included_generic_compile is TRUE if the basic code has
6855 # been included. $included_knr_compile is TRUE if the ansi2knr
6856 # code has been included. $included_libtool_compile is TRUE if
6857 # libtool support has been included.
6858 $included_generic_compile = 0;
6859 $included_knr_compile = 0;
6860 $included_libtool_compile = 0;
6862 # TRUE if install targets should work recursively.
6863 $recursive_install = 0;
6868 # Strictness levels.
6869 $strictness = $default_strictness;
6870 $strictness_name = $default_strictness_name;
6872 # Options from AUTOMAKE_OPTIONS.
6875 # Whether or not dependencies are handled. Can be further changed
6876 # in handle_options.
6877 $use_dependencies = $cmdline_use_dependencies;
6880 $local_maint_charset = $maint_charset;
6882 # All yacc and lex source filenames for this directory. Use
6883 # filenames instead of raw count so that multiple instances are
6884 # counted correctly (eg one yacc file can appear in multiple
6885 # programs without harm).
6889 # This is a list of all targets to run during "make dist".
6892 # Keys in this hash are the basenames of files which must depend
6894 %de_ansi_files = ();
6896 # This maps the source extension of a suffix rule to its
6897 # corresponding output extension.
6900 # This is a regular expression which matches all the known source
6901 # suffix. A source suffix is one that appears in the first
6902 # position of a suffix rule.
6903 $source_suffix_pattern = '';
6905 # This is the name of the recursive `all' target to use.
6906 $all_target = 'all-recursive';
6908 # This keeps track of which extensions we've seen (that we care
6910 %extension_seen = ();
6912 # This is random scratch space for the language finish functions.
6913 # Don't randomly overwrite it; examine other uses of keys first.
6914 %language_scratch = ();
6916 # We keep track of which objects need special (per-executable)
6917 # handling on a per-language basis.
6918 %lang_specific_files = ();
6920 # This is set when `handle_dist' has finished. Once this happens,
6921 # we should no longer push on dist_common.
6922 $handle_dist_run = 0;
6924 # True if we need `LINK' defined. This is a hack.
6929 ################################################################
6931 # Return contents of a file from $am_dir, automatically skipping
6932 # macros or rules which are already known. Runs command on each line
6933 # as it is read; this command can modify $_.
6934 sub file_contents_with_transform
6936 local ($command, $basename) = @_;
6937 local ($file) = $am_dir . '/' . $basename . '.am';
6939 if ($command ne '' && substr ($command, -1) ne ';')
6941 die "automake: programming error in file_contents_with_transform: $command\n";
6944 open (FC_FILE
, $file)
6945 || die "automake: installation error: cannot open \`$file'\n";
6947 # print "automake: reading $file\n" if $verbose;
6949 local ($was_rule) = 0;
6950 local ($result_vars) = '';
6951 local ($result_rules) = '';
6952 local ($comment) = '';
6953 local ($spacing) = "\n";
6954 local ($skipping) = 0;
6959 $_ =~ s/\@MAINTAINER_MODE_TRUE\@//g
6960 unless $seen_maint_mode;
6962 $had_chars = length ($_) && $_ ne "\n";
6964 # If the transform caused all the characters to go away, then
6965 # ignore the line. Why do this? Because in Perl 4, a "next"
6966 # inside of an eval doesn't affect a loop outside the eval.
6967 # So we can't pass in a "transform" that uses next. We used
6968 # to do this. "Empty" also means consisting of a single
6970 next if $had_chars && ($_ eq '' || $_ eq "\n");
6972 if (/$IGNORE_PATTERN/o)
6974 # Merely delete comments beginning with two hashes.
6976 elsif (/$WHITE_PATTERN/o)
6978 # Stick a single white line before the incoming macro or rule.
6980 &am_line_error
($., "blank line following trailing backslash")
6983 elsif (/$COMMENT_PATTERN/o)
6985 # Stick comments before the incoming macro or rule.
6986 $comment .= $spacing . $_;
6988 &am_line_error
($., "comment following trailing backslash")
6995 $result_rules .= $_ if ! $skipping;
6999 $result_vars .= $_ if ! $skipping;
7003 elsif (/$RULE_PATTERN/o)
7007 $skipping = defined $contents{$1};
7008 $result_rules .= $comment . $spacing . $_ if ! $skipping;
7009 $comment = $spacing = '';
7012 elsif (/$MACRO_PATTERN/o)
7014 # Found a variable reference.
7016 $skipping = defined $contents{$1};
7017 $result_vars .= $comment . $spacing . $_ if ! $skipping;
7018 $comment = $spacing = '';
7020 print STDERR
"automake: programming error: .am macro \`$1' with trailing backslash at $file:$.\n"
7022 $am_var_defs{$1} = $3;
7026 # This isn't an error; it is probably a continued rule.
7027 # In fact, this is what we assume.
7029 $result_rules .= $comment . $spacing . $_ if ! $skipping;
7030 $comment = $spacing = '';
7036 return $result_vars . $result_rules . $comment;
7039 # Like file_contents_with_transform, but no transform.
7042 return &file_contents_with_transform
('', @_);
7045 # Find all variable prefixes that are used for install directories. A
7046 # prefix `zar' qualifies iff:
7047 # * `zardir' is a variable.
7048 # * `zar_PRIMARY' is a variable.
7049 sub am_primary_prefixes
7051 local ($primary, $can_dist, @prefixes) = @_;
7053 local (%valid, $varname);
7054 grep ($valid{$_} = 0, @prefixes);
7055 $valid{'EXTRA'} = 0;
7056 foreach $varname (keys %contents)
7058 if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_$primary$/)
7060 if (($2 ne '' && ! $can_dist)
7061 || (! defined $valid{$3} && ! &variable_defined
($3 . 'dir')))
7063 # Note that a configure variable is always legitimate.
7064 # It is natural to name such variables after the
7065 # primary, so we explicitly allow it.
7066 if (! defined $configure_vars{$varname})
7068 &am_line_error
($varname, "invalid variable \`$varname'");
7073 # Ensure all extended prefixes are actually used.
7074 $valid{$1 . $2 . $3} = 1;
7082 # Handle `where_HOW' variable magic. Does all lookups, generates
7083 # install code, and possibly generates code to define the primary
7084 # variable. The first argument is the name of the .am file to munge,
7085 # the second argument is the primary variable (eg HEADERS), and all
7086 # subsequent arguments are possible installation locations. Returns
7087 # list of all values of all _HOW targets.
7089 # FIXME: this should be rewritten to be cleaner. It should be broken
7090 # up into multiple functions.
7092 # Usage is: am_install_var (OPTION..., file, HOW, where...)
7097 local ($do_clean) = 0;
7098 local ($do_require) = 1;
7099 local ($can_dist) = 0;
7100 local ($default_dist) = 0;
7103 if (defined $configure_vars{'LIBTOOL'})
7105 # Transform '@LIBTOOL ...@' to '$(LIBTOOL) ...'
7106 $ltxform = 's/\@LIBTOOL([^\@]*)\@/\$(LIBTOOL) $1/;';
7110 # Delete '@LIBTOOL ...@'
7111 $ltxform = 's/\@LIBTOOL([^\@]*)\@//;';
7117 $cygxform = 's/\@EXEEXT\@//g;';
7121 $cygxform = 's/\@EXEEXT\@/\$(EXEEXT)/g;';
7126 if ($args[0] eq '-clean')
7130 elsif ($args[0] eq '-noextra')
7134 elsif ($args[0] eq '-candist')
7138 elsif ($args[0] eq '-defaultdist')
7143 elsif ($args[0] !~ /^-/)
7150 local ($file, $primary, @prefixes) = @args;
7153 local (@result) = ();
7155 # Now that configure substitutions are allowed in where_HOW
7156 # variables, it is an error to actually define the primary. We
7157 # allow `JAVA', as it is customarily used to mean the Java
7158 # interpreter. This is but one of several Java hacks. Similarly,
7159 # `PYTHON' is customarily used to mean the Python interpreter.
7160 &am_line_error
($primary, "\`$primary' is an anachronism")
7161 if &variable_defined
($primary)
7162 && ($primary ne 'JAVA' && $primary ne 'PYTHON');
7165 # Look for misspellings. It is an error to have a variable ending
7166 # in a "reserved" suffix whose prefix is unknown, eg
7167 # "bni_PROGRAMS". However, unusual prefixes are allowed if a
7168 # variable of the same name (with "dir" appended) exists. For
7169 # instance, if the variable "zardir" is defined, then
7170 # "zar_PROGRAMS" becomes valid. This is to provide a little extra
7171 # flexibility in those cases which need it.
7172 local (%valid) = &am_primary_prefixes
($primary, $can_dist, @prefixes);
7174 # If a primary includes a configure substitution, then the EXTRA_
7175 # form is required. Otherwise we can't properly do our job.
7176 local ($require_extra);
7177 local ($warned_about_extra) = 0;
7179 local ($clean_file) = $file . '-clean';
7182 local ($nodir_name);
7183 local ($strip_subdir) = 1;
7184 foreach $X (sort keys %valid)
7186 $one_name = $X . '_' . $primary;
7187 if (&variable_defined
($one_name))
7189 # If subdir prefix should be preserved, do so.
7190 if ($X =~ /^nobase_/)
7196 # If files should be distributed, do so.
7199 if (($default_dist && $one_name !~ /^nodist_/)
7200 || (! $default_dist && $one_name =~ /^dist_/))
7202 &push_dist_common
('$(' . $one_name . ')');
7204 ($nodir_name = $X) =~ s/^(dist|nodist)_//;
7211 # Append actual contents of where_PRIMARY variable to
7214 foreach $rcurs (&variable_value_as_list
($one_name, 'all'))
7216 # Skip configure substitutions. Possibly bogus.
7217 if ($rcurs =~ /^\@.*\@$/)
7221 if (! $warned_about_extra)
7223 $warned_about_extra = 1;
7225 &am_line_error
($one_name,
7226 "\`$one_name' contains configure substitution, but shouldn't");
7230 # Check here to make sure variables defined in
7231 # configure.in do not imply that EXTRA_PRIMARY
7233 elsif (! defined $configure_vars{$one_name})
7235 $require_extra = $one_name
7242 push (@result, $rcurs);
7245 # A blatant hack: we rewrite each _PROGRAMS primary to
7246 # include EXEEXT when in Cygwin32 mode.
7247 if ($seen_exeext && $primary eq 'PROGRAMS')
7249 local (@conds) = &variable_conditions
($one_name);
7250 local (@one_binlist);
7252 # FIXME: this definitely loses aesthetically; it
7253 # redefines $ONE_NAME. Instead we should arrange for
7254 # variable definitions to be output later, instead of
7260 foreach $rcurs (&variable_value_as_list
($one_name, ''))
7262 if ($rcurs =~ /\./ || $rcurs =~ /^\@.*\@$/)
7264 push (@one_binlist, $rcurs);
7268 push (@one_binlist, $rcurs . '$(EXEEXT)');
7272 delete $contents{$one_name};
7273 &define_pretty_variable
($one_name, '', @one_binlist);
7278 local ($condvals) = '';
7279 foreach $cond (@conds)
7282 local (@condval) = &variable_value_as_list
($one_name,
7284 foreach $rcurs (@condval)
7286 if ($rcurs =~ /\./ || $rcurs =~ /^\@.*\@$/)
7288 push (@one_binlist, $rcurs);
7292 push (@one_binlist, $rcurs . '$(EXEEXT)');
7296 push (@condvals, $cond);
7297 push (@condvals, join (' ', @one_binlist));
7300 delete $contents{$one_name};
7304 $cond = shift (@condvals);
7305 local (@val) = split (' ', shift (@condvals));
7306 &define_pretty_variable
($one_name, $cond, @val);
7311 # "EXTRA" shouldn't be used when generating clean targets,
7312 # all, or install targets.
7315 # We used to warn if EXTRA_FOO was defined uselessly,
7316 # but this was annoying.
7323 &file_contents_with_transform
('s/\@DIR\@/' . $X . '/go;'
7327 push (@clean, $X . $primary);
7328 &push_phony_cleaners
($X . $primary);
7333 push (@check, '$(' . $one_name . ')');
7337 push (@used, '$(' . $one_name . ')');
7339 if ($X eq 'noinst' || $X eq 'check')
7341 # Objects which don't get installed by default.
7345 local ($subdir_xform);
7348 $subdir_xform = 's/^NOBASE.*$//; s/^BASE//;';
7352 $subdir_xform = 's/^BASE.*$//; s/^NOBASE//;';
7356 &file_contents_with_transform
('s/\@DIR\@/' . $X . '/g;'
7357 . 's/\@NDIR\@/' . $nodir_name . '/go;'
7358 . $ltxform . $cygxform
7362 push (@uninstall, 'uninstall-' . $X . $primary);
7363 push (@phony, 'uninstall-' . $X . $primary);
7364 push (@installdirs, '$(DESTDIR)$(' . $X . 'dir)');
7365 if (defined $exec_dir_p{$X} ?
$exec_dir_p{$X} : ($X =~ /exec/))
7367 push (@install_exec, 'install-' . $X . $primary);
7368 push (@phony, 'install-' . $X . $primary);
7372 push (@install_data, 'install-' . $X . $primary);
7373 push (@phony, 'install-' . $X . $primary);
7378 # The JAVA variable is used as the name of the Java interpreter.
7379 # The PYTHON variable is used as the name of the Python interpreter.
7380 if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON')
7383 &define_pretty_variable
($primary, '', @used);
7384 $output_vars .= "\n";
7387 if ($require_extra && ! &variable_defined
('EXTRA_' . $primary))
7389 &am_line_error
($require_extra,
7390 "\`$require_extra' contains configure substitution, but \`EXTRA_$primary' not defined");
7393 # Push here because PRIMARY might be configure time determined.
7394 push (@all, '$(' . $primary . ')')
7395 if @used && $primary ne 'JAVA' && $primary ne 'PYTHON';
7397 # Make the result unique. This lets the user use conditionals in
7398 # a natural way, but still lets us program lazily -- we don't have
7399 # to worry about handling a particular object more than once.
7400 local (%uniquify) = ();
7401 grep ($uniquify{$_} = 1, @result);
7402 return sort keys %uniquify;
7406 ################################################################
7408 # Each key in this hash is the name of a directory holding a
7409 # Makefile.in. These variables are local to `is_make_dir'.
7416 if (! $make_dirs_set)
7418 foreach $iter (@configure_input_files)
7420 $make_dirs{&dirname
($iter)} = 1;
7422 # We also want to notice Makefile.in's.
7423 foreach $iter (@other_input_files)
7425 if ($iter =~ /Makefile\.in$/)
7427 $make_dirs{&dirname
($iter)} = 1;
7432 return defined $make_dirs{$dir};
7435 ################################################################
7437 # This variable is local to the "require file" set of functions.
7438 @require_file_paths = ();
7440 # If a file name appears as a key in this hash, then it has already
7441 # been checked for. This variable is local to the "require file"
7443 %require_file_found = ();
7445 # See if we want to push this file onto dist_common. This function
7446 # encodes the rules for deciding when to do so.
7447 sub maybe_push_required_file
7449 local ($dir, $file, $fullfile) = @_;
7451 # FIXME: Once again, special-case `.'.
7452 if ($dir eq $relative_dir || $dir eq '.')
7454 &push_dist_common
($file);
7456 elsif ($relative_dir eq '.' && ! &is_make_dir
($dir))
7458 # If we are doing the topmost directory, and the file is in a
7459 # subdir which does not have a Makefile, then we distribute it
7461 &push_dist_common
($fullfile);
7465 # Verify that the file must exist in the current directory. Usage:
7466 # require_file (isconfigure, line_number, strictness, file) strictness
7467 # is the strictness level at which this file becomes required. Must
7468 # set require_file_paths before calling this function.
7469 # require_file_paths is set to hold a single directory (the one in
7470 # which the first file was found) before return.
7471 sub require_file_internal
7473 local ($is_configure, $line, $mystrict, @files) = @_;
7474 local ($file, $fullfile);
7475 local ($found_it, $dangling_sym, $errfile, $errdir);
7478 foreach $file (@files)
7480 # If we've already looked for it, we're done.
7481 next if defined $require_file_found{$file};
7482 $require_file_found{$file} = 1;
7486 foreach $dir (@require_file_paths)
7490 $fullfile = $relative_dir . "/" . $file;
7491 $errdir = $relative_dir unless $errdir;
7495 $fullfile = $dir . "/" . $file;
7496 $errdir = $dir unless $errdir;
7499 # Use different name for "error filename". Otherwise on
7500 # an error the bad file will be reported as eg
7501 # `../../install-sh' when using the default
7503 $errfile = $errdir . '/' . $file;
7505 if (-l
$fullfile && ! -f
readlink ($fullfile))
7510 elsif (-f
$fullfile)
7513 &maybe_push_required_file
($dir, $file, $fullfile);
7519 if ($found_it && ! $force_missing)
7521 # Prune the path list.
7522 @require_file_paths = $save_dir;
7526 if ($strictness >= $mystrict)
7528 if ($dangling_sym && ($force_missing || $add_missing))
7533 local ($trailer) = '';
7534 local ($suppress) = 0;
7536 # Only install missing files according to our desired
7538 local ($message) = "required file \`$errfile' not found";
7543 # Maybe run libtoolize.
7544 local @syslist = ('libtoolize', '--automake');
7545 push @syslist, '--copy'
7548 && grep ($_ eq $file, @libtoolize_files)
7549 && system (@syslist))
7551 $message = "installing \`$errfile'";
7553 $trailer = "; cannot run \`libtoolize': $!";
7555 elsif (-f
($am_dir . '/' . $file))
7557 # Install the missing file. Symlink if we
7558 # can, copy if we must. Note: delete the file
7559 # first, in case it is a dangling symlink.
7560 $message = "installing \`$errfile'";
7561 # Windows Perl will hang if we try to delete a
7562 # file that doesn't exist.
7563 unlink ($errfile) if -f
$errfile;
7564 if ($symlink_exists && ! $copy_missing)
7566 if (! symlink ($am_dir . '/' . $file, $errfile))
7569 $trailer = "; error while making link: $!";
7572 elsif (system ('cp', $am_dir . '/' . $file, $errfile))
7575 $trailer = "\n error while copying";
7579 &maybe_push_required_file
(&dirname
($errfile),
7583 local ($save) = $exit_status;
7586 # FIXME: allow actual file to be specified.
7587 &am_conf_line_error
('configure.in', $line,
7588 "$message$trailer");
7592 &am_line_error
($line, "$message$trailer");
7594 $exit_status = $save if $suppress;
7600 # Like require_file_with_line, but error messages refer to
7601 # configure.in, not the current Makefile.am.
7602 sub require_file_with_conf_line
7604 @require_file_paths = '.';
7605 &require_file_internal
(1, @_);
7608 sub require_file_with_line
7610 @require_file_paths = '.';
7611 &require_file_internal
(0, @_);
7616 @require_file_paths = '.';
7617 &require_file_internal
(0, '', @_);
7620 # Require a file that is also required by Autoconf. Looks in
7621 # configuration path, as specified by AC_CONFIG_AUX_DIR.
7622 sub require_config_file
7624 @require_file_paths = @config_aux_path;
7625 &require_file_internal
(1, '', @_);
7626 local ($dir) = $require_file_paths[0];
7627 @config_aux_path = @require_file_paths;
7630 $config_aux_dir = '.';
7634 $config_aux_dir = '$(top_srcdir)/' . $dir;
7638 # Assumes that the line number is in Makefile.am.
7639 sub require_conf_file_with_line
7641 @require_file_paths = @config_aux_path;
7642 &require_file_internal
(0, @_);
7643 local ($dir) = $require_file_paths[0];
7644 @config_aux_path = @require_file_paths;
7647 $config_aux_dir = '.';
7651 $config_aux_dir = '$(top_srcdir)/' . $dir;
7655 # Assumes that the line number is in configure.in.
7656 sub require_conf_file_with_conf_line
7658 @require_file_paths = @config_aux_path;
7659 &require_file_internal
(1, @_);
7660 local ($dir) = $require_file_paths[0];
7661 @config_aux_path = @require_file_paths;
7664 $config_aux_dir = '.';
7668 $config_aux_dir = '$(top_srcdir)/' . $dir;
7672 ################################################################
7674 # Push a list of files onto dist_common.
7675 sub push_dist_common
7677 local (@files) = @_;
7680 foreach $file (@files)
7682 if (! defined $dist_common{$file})
7684 if ($handle_dist_run)
7687 "automake: programming error: push_dist_common run after handle_dist\n";
7690 $dist_common{$file} = 1;
7695 # Push a list of clean targets onto phony.
7696 sub push_phony_cleaners
7700 foreach $target ('mostly', 'dist', '', 'maintainer-')
7702 push (@phony, $target . 'clean-' . $base);
7709 $strictness_name = $_[0];
7710 if ($strictness_name eq 'gnu')
7714 elsif ($strictness_name eq 'gnits')
7716 $strictness = $GNITS;
7718 elsif ($strictness_name eq 'foreign')
7720 $strictness = $FOREIGN;
7724 die "automake: level \`$strictness_name' not recognized\n";
7729 ################################################################
7731 # Return directory name of file.
7737 ($sub = $file) =~ s
,/+[^/]+$,,g
;
7738 $sub = '.' if $sub eq $file;
7742 # Return file name of a file.
7748 ($sub = $file) =~s
,^.*/+,,g
;
7752 # Ensure a file exists.
7757 open (TOUCH
, ">> $file");
7761 # Glob something. Do this to avoid indentation screwups everywhere we
7762 # want to glob. Gross!
7769 ################################################################
7771 # Print an error message and set exit status.
7774 warn "automake: ${am_file}.am: ", join (' ', @_), "\n";
7780 local ($symbol, @args) = @_;
7782 if ($symbol && "$symbol" ne '-1')
7784 local ($file) = "${am_file}.am";
7786 if ($symbol =~ /^\d+$/)
7788 # SYMBOL is a line number, so just add the colon.
7789 $file .= ':' . $symbol;
7791 elsif (defined $content_lines{$symbol})
7793 # SYMBOL is a variable defined in Makefile.am, so add the
7794 # line number we saved from there.
7795 $file .= ':' . $content_lines{$symbol};
7797 elsif (defined $configure_vars{$symbol})
7799 # SYMBOL is a variable defined in configure.in, so add the
7800 # appropriate line number.
7801 $file = $configure_vars{$symbol};
7805 # Couldn't find the line number.
7807 warn $file, ": ", join (' ', @args), "\n";
7816 # Like am_error, but while scanning configure.in.
7819 # FIXME: can run in subdirs.
7820 warn "automake: configure.in: ", join (' ', @_), "\n";
7824 # Error message with line number referring to configure.in.
7825 sub am_conf_line_error
7827 local ($file, $line, @args) = @_;
7831 warn "$file: $line: ", join (' ', @args), "\n";
7836 &am_conf_error
(@args);
7840 # Warning message with line number referring to configure.in.
7841 # Does not affect exit_status
7842 sub am_conf_line_warning
7844 local ($saved_exit_status) = $exit_status;
7845 &am_conf_line_error
(@_);
7846 $exit_status = $saved_exit_status;
7849 # Tell user where our aclocal.m4 is, but only once.
7850 sub keyed_aclocal_warning
7853 warn "automake: macro \`$key' can be generated by \`aclocal'\n";
7856 # Print usage information.
7859 print "Usage: automake [OPTION] ... [Makefile]...\n\n";
7860 print "Generate Makefile.in for autoconf from Makefile.am\n";
7862 print "\nFiles which are automatically distributed, if found:\n";
7863 $~ = "USAGE_FORMAT";
7864 local ($last, $iter, @lcomm);
7866 foreach $iter (sort ((@common_files, @common_sometimes)))
7868 push (@lcomm, $iter) unless $iter eq $last;
7872 local ($one, $two, $three, $four, $i, $max);
7873 $max = int (($#lcomm + 1) / 4);
7875 for ($i = 0; $i < $max; ++$i)
7878 $two = $lcomm[$max + $i];
7879 $three = $lcomm[2 * $max + $i];
7880 $four = $lcomm[3 * $max + $i];
7884 local ($mod) = ($#lcomm + 1) % 4;
7887 $one = $lcomm[$max];
7888 $two = ($mod > 1) ?
$lcomm[2 * $max] : '';
7889 $three = ($mod > 2) ?
$lcomm[3 * $max] : '';
7890 $four = ($mod > 3) ?
$lcomm[4 * $max] : '';
7894 print "\nReport bugs to <bug-automake\@gnu.org>.\n";
7899 format USAGE_FORMAT
=
7900 @
<<<<<<<<<<<<<<<< @
<<<<<<<<<<<<<<<< @
<<<<<<<<<<<<<<<< @
<<<<<<<<<<<<<<<<
7901 $one, $two, $three, $four