5 eval 'exec @PERL@ -S $0 ${1+"$@"}'
6 if $running_under_some_shell;
8 # automake - create Makefile.in from Makefile.am
9 # Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2, or (at your option)
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 # Originally written by David Mackenzie <djm@gnu.ai.mit.edu>.
27 # Perl reimplementation by Tom Tromey <tromey@drip.colorado.edu>.
30 # Parameters set by configure. Not to be changed. NOTE: assign
31 # VERSION as string so that eg version 0.30 will print correctly.
32 $VERSION = "@VERSION@";
34 $am_dir = "@datadir@/@PACKAGE@";
37 $IGNORE_PATTERN = "^##([^#].*)?\$";
38 $WHITE_PATTERN = "^[ \t]*\$";
39 $COMMENT_PATTERN = "^#";
40 $RULE_PATTERN = "^([a-zA-Z_.][-.a-zA-Z0-9_.]*) *:";
41 $MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)\$";
42 $BOGUS_MACRO_PATTERN = "^([^ \t]*)[ \t]*=[ \t]*(.*)\$";
44 # Constants to define the "strictness" level.
51 # Variables global to entire run.
53 # Strictness level as set on command line.
54 $default_strictness = $GNU;
56 # Name of strictness level, as set on command line.
57 $default_strictness_name = 'gnu';
59 # This is TRUE if GNU make specific automatic dependency generation
60 # code should be included in generated Makefile.in.
61 $cmdline_use_dependencies = 1;
63 # TRUE if in verbose mode.
66 # This holds our (eventual) exit status. We don't actually exit until
67 # we have processed all input files.
70 # From the Perl manual.
71 $symlink_exists = (eval 'symlink ("", "");', $@ eq '');
73 # TRUE if missing standard files should be installed.
76 # Files found by scanning configure.in for LIBOBJS.
79 # True if fp_C_PROTOTYPES appears in configure.in.
82 # Names used in AC_CONFIG_HEADER call. $config_name is the actual
83 # (first) argument. $config_header is the '.in' file. Ordinarily the
84 # second is derived from the first, but they can be different if the
85 # weird "NAME:FILE" syntax is used.
88 # Line number at which AC_CONFIG_HEADER appears in configure.in.
89 $config_header_line = 0;
91 # Relative location of top build directory.
94 # List of Makefile.am's to process.
97 # List of files in AC_OUTPUT without Makefile.am.
98 @other_input_files = ();
99 # Line number at which AC_OUTPUT seen.
102 # List of directories to search for configure-required files. This
103 # can be set by AC_CONFIG_AUX_DIR.
104 @config_aux_path = ('.', '..', '../..');
106 # Whether AC_PROG_MAKE_SET has been seen in configure.in.
109 # Whether ud_GNU_GETTEXT has been seen in configure.in.
111 # Line number at which ud_GNU_GETTEXT seen.
112 $ac_gettext_line = 0;
114 # Whether ALL_LINGUAS has been seen.
118 # Line number at which it appears.
119 $all_linguas_line = 0;
121 # 1 if AC_PROG_INSTALL seen, 2 if fp_PROG_INSTALL seen.
122 $seen_prog_install = 0;
124 # 1 if any scripts installed, 0 otherwise.
125 $scripts_installed = 0;
127 # Whether AC_PATH_XTRA has been seen in configure.in.
130 # Whether YACC variable has been seen in configure.in.
133 # TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM). The presence of
134 # AC_CHECK_TOOL also sets this.
137 # TRUE if we've seen AC_PROG_RANLIB.
140 # Charsets used by maintainer and in distribution. MAINT_CHARSET is
141 # handled in a funny way: if seen in the top-level Makefile.am, it is
142 # used for every directory which does not specify a different value.
143 # The rationale here is that some directories (eg gettext) might be
144 # distributions of other packages, and thus require their own charset
145 # info. However, the DIST_CHARSET must be the same for the entire
146 # package; it can only be set at top-level.
147 # FIXME this yields bugs when rebuilding. What to do? Always
148 # read (and sometimes discard) top-level Makefile.am?
150 $dist_charset = 'utf8'; # recode doesn't support this yet.
154 &initialize_global_constants;
156 # Parse command line.
157 &parse_arguments (@ARGV);
159 # Do configure.in scan only once.
162 die "automake: no \`Makefile.am' found or specified\n"
165 # Now do all the work on each file.
166 foreach $am_file (@input_files)
168 # FIXME should support the AC_OUTPUT ":" syntax here.
169 if (! -f ($am_file . '.am'))
171 &am_error ('no such file');
175 &generate_makefile ($am_file);
179 if ($seen_prog_install <= $scripts_installed)
181 &am_conf_error (($scripts_installed ? 'fp_PROG_INSTALL' : 'AC_PROG_INSTALL')
182 . " must be used in configure.in");
183 &keyed_aclocal_warning ('fp_PROG_INSTALL')
184 if $scripts_installed;
190 ################################################################
192 # Parse command line.
195 local (@arglist) = @_;
198 &set_strictness ('gnu');
202 if ($arglist[0] eq "--version")
204 print "Automake version $VERSION\n";
207 elsif ($arglist[0] eq "--help")
211 elsif ($arglist[0] =~ /^--amdir=(.+)$/)
215 elsif ($arglist[0] eq '--amdir')
217 &require_argument (@arglist);
219 $am_dir = $arglist[0];
221 elsif ($arglist[0] =~ /^--strictness=(.+)$/)
223 &set_strictness ($1);
225 elsif ($arglist[0] eq '--gnu')
227 &set_strictness ('gnu');
229 elsif ($arglist[0] eq '--gnits')
231 &set_strictness ('gnits');
233 elsif ($arglist[0] eq '--foreign')
235 &set_strictness ('foreign');
237 elsif ($arglist[0] eq '--strictness')
239 &require_argument (@arglist);
241 &set_strictness ($arglist[0]);
243 elsif ($arglist[0] eq '--include-deps')
245 $cmdline_use_dependencies = 0;
247 elsif ($arglist[0] =~ /^--output-dir=(.*)$/)
249 # Set output directory.
250 $output_directory = $1;
252 elsif ($arglist[0] eq '--output-dir')
254 &require_argument (@arglist);
256 $output_directory = $arglist[0];
258 elsif ($arglist[0] eq '--add-missing')
262 elsif ($arglist[0] eq '--verbose')
266 elsif ($arglist[0] eq '--')
268 # Stop option processing.
270 push (@input_files, @arglist);
273 elsif ($arglist[0] =~ /^-/)
275 die "automake: unrecognized option -- \`$arglist[0]'\n";
279 push (@input_files, $arglist[0]);
285 # Take global strictness from whatever we currently have set.
286 $default_strictness = $strictness;
287 $default_strictness_name = $strictness_name;
290 # Ensure argument exists, or die.
293 local ($arg, @arglist) = @_;
294 die "automake: no argument given for option \`$arg'\n"
298 ################################################################
300 # Generate a Makefile.in given the name of the corresponding Makefile.
301 sub generate_makefile
303 local ($makefile) = @_;
305 print "automake: creating ", $makefile, ".in\n" if $verbose;
307 &initialize_per_input;
308 $relative_dir = &dirname ($makefile);
310 # AC_CANONICAL_HOST and AC_CANONICAL_SYSTEM need config.guess and
312 &require_config_file ($FOREIGN, 'config.guess', 'config.sub')
313 if $relative_dir eq '.' && $seen_canonical;
315 # We still need Makefile.in here, because sometimes the `dist'
316 # target doesn't re-run automake.
317 &push_dist_common ('Makefile.in', 'Makefile.am');
318 push (@sources, '$(SOURCES)') if defined $contents{'SOURCES'};
319 push (@objects, '$(OBJECTS)') if defined $contents{'OBJECTS'};
321 # This is always the default target. This gives us freedom to do
322 # things in whatever order is convenient.
323 $output_rules .= "default: all\n\n";
324 push (@phony, 'default');
326 &read_am_file ($makefile . '.am');
329 # Check first, because we might modify some state.
330 &check_gnu_standards;
331 &check_gnits_standards;
339 # Re-init SOURCES and OBJECTS. FIXME other code shouldn't depend
340 # on this (but currently does).
341 $contents{'SOURCES'} = join (' ', @sources);
342 $contents{'OBJECTS'} = join (' ', @objects);
351 &handle_dependencies;
354 &handle_merge_targets;
359 if (! -d ($output_directory . '/' . $relative_dir))
361 &mkdir ($output_directory . '/' . $relative_dir);
363 if (! open (GM_FILE, "> " . $output_directory . '/' . $makefile . ".in"))
365 warn "automake: ${am_file}.in: cannot open: $!\n";
370 print GM_FILE $output_vars;
371 print GM_FILE $output_rules;
372 print GM_FILE $output_trailer;
377 ################################################################
379 # Handle AUTOMAKE_OPTIONS variable.
382 return if ! defined $contents{'AUTOMAKE_OPTIONS'};
384 foreach (split (/\s+/, $contents{'AUTOMAKE_OPTIONS'}))
387 if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
389 &set_strictness ($_);
391 elsif ($_ eq 'no-installman' || $_ eq 'ansi2knr' || $_ eq 'dist-shar')
393 # Explicitly recognize these.
395 elsif ($_ eq 'no-dependencies')
397 $use_dependencies = 0;
399 elsif (/[0-9]+\.?[0-9]+/)
401 # Got a version number. Is the syntax too strict?
404 &am_line_error ('AUTOMAKE_OPTIONS',
405 "require version $_, only have $VERSION");
411 &am_line_error ('AUTOMAKE_OPTIONS',
412 'option ', $_, 'not recognized');
417 # Return object extension. Just once, put some code into the output.
418 sub get_object_extension
420 if (! $dir_holds_sources)
424 if (defined $contents{'CONFIG_HEADER'})
426 ($xform = &dirname ($contents{'CONFIG_HEADER'}))
428 $xform = '-I' . $xform;
430 $xform = 's/\@CONFIG_INCLUDE_SPEC\@/' . $xform . '/go';
431 $output_vars .= &file_contents_with_transform ($xform,
433 $output_rules .= &file_contents ('compile');
434 &push_phony_cleaners ('compile');
436 # If using X, include some extra variable definitions. NOTE
437 # we don't want to force these into CFLAGS or anything,
438 # because not all programs will necessarily use X.
441 $output_vars .= ("X_CFLAGS = \@X_CFLAGS\@\n"
442 . "X_LIBS = \@X_LIBS\@\n"
443 . "X_EXTRA_LIBS = \@X_EXTRA_LIBS\@\n"
444 . "X_PRE_LIBS = \@X_PRE_LIBS\@\n");
447 # Check for automatic de-ANSI-fication.
448 $dir_holds_sources = '.o';
449 push (@suffixes, '.c', '.o');
450 push (@clean, 'compile');
452 if (defined $options{'ansi2knr'})
454 if (! $fp_c_prototypes)
456 &am_line_error ('AUTOMAKE_OPTIONS',
457 "option \`ansi2knr' in use but \`fp_C_PROTOTYPES' not in configure.in");
458 &keyed_aclocal_warning ('fp_C_PROTOTYPES');
459 # Only give this error once.
460 $fp_c_prototypes = 1;
463 $dir_holds_sources = '$o';
464 push (@suffixes, '._c', '._o');
466 &require_file_with_line ('AUTOMAKE_OPTIONS', $FOREIGN,
467 'ansi2knr.c', 'ansi2knr.1');
469 $output_vars .= &file_contents ('kr-vars');
470 $output_rules .= &file_contents ('compile-kr');
471 $output_rules .= &file_contents ('clean-kr');
474 &push_phony_cleaners ('kr');
477 return $dir_holds_sources;
480 # Handle SOURCE->OBJECT transform for one program or library.
481 sub handle_source_transform
483 local ($one_file, $obj) = @_;
484 local ($objpat) = $obj;
485 $objpat =~ s/(\W)/\\$1/g;
487 # Look for file_SOURCES and file_OBJECTS.
488 if (defined $contents{$one_file . "_SOURCES"})
490 if (! defined $contents{$one_file . "_OBJECTS"})
492 # Turn sources into objects.
493 local (@files) = split (/\s+/, $contents{$one_file . "_SOURCES"});
494 local (@result) = ();
497 # Skip header files, including C++-ish ones.
500 # Skip things that look like macro references.
501 next if /^\$\(.*\)$/;
502 next if /^\$\{.*\}$/;
503 # Skip things that look like configure substitutions.
506 # One wonders how this can happen. But, apparently,
507 # it can. I believe it happens when nothing precedes
508 # a backslash-newline on a line -- the \s+ regexp
509 # doesn't match the newline. Anyway, skip empty
510 # strings. See tests/depend.test for an example of
511 # how to trigger this code.
516 # Automatically include generated .c file in
518 &push_dist_common ($1 . '.c');
521 # Transform source files into .o files.
524 s/\.[cCmylfs]$/$obj/g;
527 # Transform .o or $o file into .P file (for automatic
530 $dep_files{'$(srcdir)/.deps/' . $_} = 1;
533 &pretty_print ($one_file . "_OBJECTS =", "", @result);
537 &am_line_error ($one_file . '_OBJECTS',
538 $one_file . '_OBJECTS', 'should not be defined');
541 push (@sources, '$(' . $one_file . "_SOURCES)");
542 push (@objects, '$(' . $one_file . "_OBJECTS)");
546 $output_vars .= ($one_file . "_SOURCES = " . $one_file . ".c\n"
547 . $one_file . "_OBJECTS = ". $one_file
549 push (@sources, $one_file . '.c');
550 push (@objects, $one_file . $obj);
551 $dep_files{'$(srcdir)/.deps/' . $one_file . '.P'} = 1;
554 if (defined $contents{'CONFIG_HEADER'})
556 $output_rules .= ('$(' . $one_file . "_OBJECTS): "
557 . $contents{'CONFIG_HEADER'} . "\n");
563 # Special-case @ALLOCA@ and @LIBOBJS@ in _LDADD or _LIBADD variables.
564 sub handle_lib_objects
568 die "programming error in handle_lib_objects"
569 if ! defined $contents{$var};
571 # We recognize certain things that are commonly put in LIBADD or
575 foreach $lsearch (split (/\s+/, $contents{$var}))
577 # Automatically handle @LIBOBJS@ and @ALLOCA@. Basically this
578 # means adding entries to dep_files.
579 if ($lsearch eq '@LIBOBJS@')
581 local ($iter, $rewrite);
582 foreach $iter (keys %libsources)
584 if ($iter ne 'alloca.c')
586 ($rewrite = $iter) =~ s/\.c$/.P/;
587 $dep_files{'$(srcdir)/.deps/' . $rewrite} = 1;
588 &require_file_with_line ($var, $FOREIGN, $iter);
592 elsif ($lsearch eq '@ALLOCA@')
594 &am_line_error ($var,
595 "\@ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'")
596 if ! defined $libsources{'alloca.c'};
597 $dep_files{'$(srcdir)/.deps/alloca.P'} = 1;
598 &require_file_with_line ($var, $FOREIGN, 'alloca.c');
606 local (@proglist) = &am_install_var ('-clean',
607 'programs', 'PROGRAMS',
608 'bin', 'sbin', 'libexec', 'pkglib',
610 return if ! @proglist;
612 local ($obj) = &get_object_extension;
613 local ($one_file, $xname, $munge);
615 foreach $one_file (@proglist)
617 # Canonicalize names.
618 ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c;
619 if ($xname ne $one_file)
622 foreach $xt ('_LDADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES')
624 &am_line_error ($one_file . $xt,
625 "invalid variable \`" . $one_file . $xt
626 . "'; should be \`" . $xname . $xt . "'")
627 if defined $contents{$one_file . $xt};
631 &handle_source_transform ($xname, $obj);
633 if (defined $contents{$xname . "_LDADD"})
635 &handle_lib_objects ($xname . '_LDADD');
639 # User didn't define prog_LDADD override. So do it.
640 $output_vars .= $xname . '_LDADD = $(LDADD)' . "\n";
644 &file_contents_with_transform
645 ('s/\@PROGRAM\@/' . $one_file . '/go;'
646 . 's/\@XPROGRAM\@/' . $xname . '/go;',
650 &handle_lib_objects ('LDADD')
651 if defined $contents{'LDADD'};
657 local (@liblist) = &am_install_var ('-no-all', '-clean',
658 'libraries', 'LIBRARIES',
659 'lib', 'pkglib', 'noinst', 'check');
660 return if ! @liblist;
664 # FIXME need am_line_error here. But we don't know which
665 # variable exists. Must add a loop... No. Must have
666 # am_install_var return a hash. Otherwise the user could add
667 # install directories that we'd never find.
668 &am_error ("building a library but \`AC_PROG_RANLIB' not in configure.in");
669 # Only get this error once.
673 # Generate _LIBFILES variables. Too bad we can't do this in
675 local ($onedir, $onelib);
677 foreach $onedir ('lib', 'pkglib', 'noinst')
679 if (defined $contents{$onedir . '_LIBRARIES'})
682 foreach $onelib (split (/\s+/, $contents{$onedir . '_LIBRARIES'}))
684 push (@outlist, 'lib' . $onelib . '.a');
686 &pretty_print ($onedir . '_LIBFILES =', "", @outlist);
689 push (@all, '$(LIBFILES)');
691 local ($obj) = &get_object_extension;
693 foreach $onelib (@liblist)
695 if (defined $contents{$onelib . '_LIBADD'})
697 &handle_lib_objects ($onelib . '_LIBADD');
701 # Generate support for conditional object inclusion in
703 $output_vars .= $onelib . "_LIBADD =\n";
706 &handle_source_transform ($onelib, $obj);
709 &file_contents_with_transform ('s/\@LIBRARY\@/' . $onelib . '/go',
713 # Turn "foo" into "libfoo.a" and include macro definition.
714 grep (($_ = 'lib' . $_ . '.a') && 0, @liblist);
716 if (! defined $contents{'LIBFILES'})
718 &pretty_print ('LIBFILES = ', "", @liblist);
720 $output_vars .= &file_contents ('libraries-vars');
726 # NOTE we no longer automatically clean SCRIPTS, because it is
727 # useful to sometimes distribute scripts verbatim. This happens
728 # eg in Automake itself.
729 $scripts_installed = &am_install_var ('scripts', 'SCRIPTS',
730 'bin', 'sbin', 'libexec', 'pkgdata',
733 # We really only want a boolean value.
734 $scripts_installed = 1 if $scripts_installed;
737 # Search a file for a "version.texi" Texinfo include. Return the name
738 # of the include file if found, or the empty string if not. A
739 # "version.texi" file is actually any file whose name matches
741 sub grep_for_vers_texi
743 local ($filename) = @_;
745 if (! open (TEXI, $filename))
747 &am_error ("couldn't open \`$filename': $!");
750 print "automake: reading $filename\n" if $verbose;
754 if (/^\@include\s+(vers[^.]*\.texi)\s*$/)
766 # Handle all Texinfo source.
769 &am_line_error ('TEXINFOS',
770 "\`TEXINFOS' is an anachronism; use \`info_TEXINFOS'")
771 if defined $contents{'TEXINFOS'};
772 return if (! defined $contents{'info_TEXINFOS'}
773 && ! defined $contents{'html_TEXINFOS'});
775 local (@texis) = split (/\s+/, $contents{'info_TEXINFOS'});
777 local (@infos_list, @info_deps_list, @dvis_list, @texi_deps);
778 local ($infobase, $info_cursor);
782 local ($tc_cursor, @texi_cleans);
784 foreach $info_cursor (@texis)
786 ($infobase = $info_cursor) =~ s/\.texi$//;
788 # If 'version.texi' is referenced by input file, then include
789 # automatic versioning capability.
791 = &grep_for_vers_texi ($relative_dir . "/" . $info_cursor);
794 &am_error ("\`$vtexi', included in \`$info_cursor', also included in \`$versions{$vtexi}'")
795 if (defined $versions{$vtexi});
796 $versions{$vtexi} = $info_cursor;
798 # We number the stamp-vti files. This is doable since the
799 # actual names don't matter much. We only number starting
800 # with the second one, so that the common case looks nice.
801 $vti = 'vti' . ($done ? $done : '');
802 &push_dist_common ($vtexi, 'stamp-' . $vti);
806 &file_contents_with_transform
807 ('s/\@TEXI\@/' . $info_cursor . '/g; '
808 . 's/\@VTI\@/' . $vti . '/g; '
809 . 's/\@VTEXI\@/' . $vtexi . '/g',
812 &push_phony_cleaners ($vti);
815 &require_file_with_line ('info_TEXINFOS', $FOREIGN, 'mdate-sh')
820 # If user specified file_TEXINFOS, then use that as explicit
823 push (@texi_deps, $info_cursor);
824 push (@texi_deps, $vtexi) if $vtexi;
825 if (defined $contents{$infobase . "_TEXINFOS"})
827 push (@texi_deps, "\$" . $infobase . '_TEXINFOS');
828 &push_dist_common ("\$" . $infobase . '_TEXINFOS');
831 $output_rules .= ("\n" . $infobase . ".info: "
832 . join (' ', @texi_deps) . "\n\n");
834 push (@infos_list, $infobase . '.info*');
835 push (@info_deps_list, $infobase . '.info');
836 push (@dvis_list, $infobase . '.dvi');
838 # Generate list of things to clean for this target. We do
839 # this explicitly because otherwise too many things could be
840 # removed. In particular the ".log" extension might
841 # reasonably be used in other contexts by the user.
842 foreach $tc_cursor ('aux', 'cp', 'cps', 'dvi', 'fn', 'fns',
843 'ky', 'log', 'pg', 'toc', 'tp', 'vr', 'op')
845 push (@texi_cleans, $infobase . '.' . $tc_cursor);
850 $output_vars .= &file_contents ('texinfos-vars');
851 $output_rules .= &file_contents ('texinfos');
852 push (@phony, 'install-info', 'uninstall-info');
855 $output_rules .= "\nmostlyclean-info:\n";
856 &pretty_print_rule ("\trm -f", "\t ", @texi_cleans);
857 $output_rules .= ("\nclean-info:\n\ndistclean-info:\n\n"
858 . "maintainer-clean-info:\n\t"
859 . 'rm -f $(INFOS)' . "\n");
860 &push_phony_cleaners ('info');
862 push (@suffixes, '.texi', '.info', '.dvi');
863 push (@uninstall, 'uninstall-info');
864 push (@clean, 'info');
865 push (@info, '$(INFO_DEPS)');
866 push (@dvi, '$(DVIS)');
867 push (@installdirs, '$(infodir)');
868 unshift (@install_data, 'install-info');
870 # Make sure documentation is made and installed first. Use
871 # $(INFO_DEPS), not 'info', because otherwise recursive makes get
872 # run twice during "make all".
873 unshift (@all, '$(INFO_DEPS)');
875 $output_vars .= ("INFOS = " . join (' ', @infos_list) . "\n"
876 . "INFO_DEPS = " . join (' ', @info_deps_list) . "\n"
877 . "DVIS = " . join (' ', @dvis_list) . "\n"
878 # This next isn't strictly needed now -- the
879 # places that look here could easily be changed
880 # to look in info_TEXINFOS. But this is probably
881 # better, in case noinst_TEXINFOS is ever
883 . "TEXINFOS = " . $contents{'info_TEXINFOS'} . "\n\n");
885 # Do some error checking.
886 &require_file_with_line ('info_TEXINFOS', $FOREIGN, 'texinfo.tex');
889 # Handle any man pages.
892 &am_line_error ('MANS', "\`MANS' is an anachronism; use \`man_MANS'")
893 if defined $contents{'MANS'};
894 return if ! defined $contents{'man_MANS'};
896 # We generate the manpage install code by hand to avoid the use of
897 # basename in the generated Makefile.
898 local (@mans) = split (/\s+/, $contents{'man_MANS'});
899 local (%sections, %inames, %secmap, %fullsecmap);
902 # FIXME: statement without effect:
903 /^(.*)\.([0-9])([a-z]*)$/;
907 $fullsecmap{$1} = $2 . $3;
910 # We don't really need this, but we use it in case we ever want to
911 # support noinst_MANS.
912 $output_vars .= "MANS = " . $contents{'man_MANS'} . "\n";
914 # Generate list of install dirs.
915 $output_rules .= "install-man: \$(MANS)\n";
916 foreach (keys %sections)
918 push (@installdirs, '$(mandir)/man' . $_);
919 $output_rules .= ("\t" . '$(top_srcdir)/mkinstalldirs $(mandir)/man'
922 push (@phony, 'install-man');
924 # Generate install target.
926 foreach $key (keys %inames)
928 $_ = $install_man_format;
929 s/\@SECTION\@/$secmap{$key}/g;
930 s/\@MAN\@/$inames{$key}/g;
931 s/\@FULLSECT\@/$fullsecmap{$key}/g;
932 s/\@MANBASE\@/$key/g;
935 $output_rules .= "\n";
937 $output_rules .= "uninstall-man:\n";
938 foreach $key (keys %inames)
940 $_ = $uninstall_man_format;
941 s/\@SECTION\@/$secmap{$key}/g;
942 s/\@MAN\@/$inames{$key}/g;
943 s/\@FULLSECT\@/$fullsecmap{$key}/g;
944 s/\@MANBASE\@/$key/g;
947 $output_rules .= "\n";
948 push (@phony, 'uninstall-man');
950 $output_vars .= &file_contents ('mans-vars');
952 if (! defined $options{'no-installman'})
954 push (@install_data, 'install-man');
955 push (@uninstall, 'uninstall-man');
956 push (@all, '$(MANS)');
960 # Handle DATA variables.
963 &am_install_var ('data', 'DATA', 'data', 'sysconf',
964 'sharedstate', 'localstate', 'pkgdata',
971 local ($tagging) = 0;
973 push (@phony, 'tags');
974 if (defined $contents{'SUBDIRS'})
976 $output_rules .= &file_contents ('tags');
979 elsif ($dir_holds_sources || defined $contents{'ETAGS_ARGS'})
981 $output_rules .= &file_contents ('tags-subd');
987 $output_rules .= &file_contents ('tags-clean');
988 push (@clean, 'tags');
989 &push_phony_cleaners ('tags');
993 # Every Makefile must define some sort of TAGS rule.
994 # Otherwise, it would be possible for a top-level "make TAGS"
995 # to fail because some subdirectory failed.
996 $output_rules .= "tags: TAGS\nTAGS:\n\n";
1000 # Generate actual 'dist' (or dist-shar) rule.
1001 sub handle_dist_worker
1003 local ($distshar) = @_;
1004 local ($target) = $distshar ? 'dist-shar' : 'dist';
1006 $output_rules .= $target . ': $(DEP_DISTFILES)' . "\n";
1008 # Initialization; only at top level.
1009 if ($relative_dir eq '.')
1011 if ($strictness >= $GNITS)
1013 # For Gnits users, this is pretty handy. Look at 15 lines
1014 # in case some explanatory text is desirable.
1015 $output_rules .= ' @if sed 15q NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \\
1016 echo "NEWS not updated; not releasing" 1>&2; \\
1024 # Create dist directory.
1027 chmod 777 $(distdir)
1030 # Only run automake in `dist' target if --include-deps not
1031 # specified. That way the recipient of a distribution can run
1032 # "make dist" and not need Automake.
1033 if ($cmdline_use_dependencies)
1037 # We need an absolute path for --output-dir. Thus the
1039 ' distdir=`cd $(distdir) && pwd` \\
1041 && automake --include-deps --output-dir=$$distdir --strictness='
1042 # Set strictness of output.
1043 . $strictness_name . "\n"
1048 # In loop, test for file existence because sometimes a file gets
1049 # included in DISTFILES twice. For example this happens when a
1050 # single source file is used in building more than one program.
1051 # Also, there are situations in which "ln" can fail. For instance
1052 # a file to distribute could actually be a cross-filesystem
1053 # symlink -- this can easily happen if "gettextize" was run on the
1054 # distribution. Note that DISTFILES can contain a wildcard (for
1055 # info files, sigh), so we must use the echo trick.
1057 $output_rules .= ' @for file in `cd $(srcdir) && echo $(DISTFILES)`; do \\
1058 test -f $(distdir)/$$file \\
1059 || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \\
1060 || cp -p $(srcdir)/$$file $(distdir)/$$file; \\
1064 # If we have SUBDIRS, create all dist subdirectories and do
1066 if (defined $contents{'SUBDIRS'})
1068 # Test for directory existence here because previous automake
1069 # invocation might have created some directories.
1070 $output_rules .= ' for subdir in $(SUBDIRS); do \\
1071 test -d $(distdir)/$$subdir \\
1072 || mkdir $(distdir)/$$subdir \\
1074 chmod 777 $(distdir)/$$subdir; \\
1075 (cd $$subdir && $(MAKE) dist) || exit 1; \\
1080 # Make verbatim copies of some subdirectories if required. This
1081 # is a hack which might go away.
1082 if (defined $contents{'DIST_SUBDIRS'})
1084 &am_line_error ('DIST_SUBDIRS',
1085 "\`DIST_SUBDIRS' is deprecated; make a new \`Makefile.am' instead");
1087 $output_rules .= ' @for dir in $(DIST_SUBDIRS); do \\
1088 echo copying directory $$dir; \\
1089 tar chf - $$dir | (cd $(distdir) && tar xBpf -); \\
1095 if ($relative_dir eq '.')
1097 $output_rules .= ' chmod -R a+r $(distdir)' . "\n\t";
1100 $output_rules .= 'shar $(distdir) | gzip > $(distdir).shar.gz';
1104 $output_rules .= 'tar chozf $(distdir).tar.gz $(distdir)';
1106 $output_rules .= "\n\t" . 'rm -rf $(distdir)' . "\n";
1109 push (@phony, $target);
1112 # Handle 'dist' target.
1115 # Set up maint_charset.
1116 $local_maint_charset = $contents{'MAINT_CHARSET'}
1117 if defined $contents{'MAINT_CHARSET'};
1118 $maint_charset = $local_maint_charset
1119 if $relative_dir eq '.';
1123 "\`DIST_OTHER' is an anachronism; use \`EXTRA_DIST' instead")
1124 if defined $contents{'DIST_OTHER'};
1126 if (defined $contents{'DIST_CHARSET'})
1128 &am_line_error ('DIST_CHARSET',
1129 "DIST_CHARSET defined but no MAINT_CHARSET defined")
1130 if ! $local_maint_charset;
1131 if ($relative_dir eq '.')
1133 $dist_charset = $contents{'DIST_CHARSET'}
1137 &am_line_error ('DIST_CHARSET',
1138 "DIST_CHARSET can only be defined at top level");
1142 # Look for common files that should be included in distribution.
1144 foreach $cfile (@common_files)
1146 if (-f ($relative_dir . "/" . $cfile))
1148 &push_dist_common ($cfile);
1152 # Keys of %dist_common are names of files to distributed. We put
1153 # README first because it then becomes easier to make a
1154 # Usenet-compliant shar file (in these, README must be first).
1155 # FIXME do more ordering of files here.
1157 if (defined $dist_common{'README'})
1159 push (@coms, 'README');
1160 undef $dist_common{'README'};
1162 push (@coms, sort keys %dist_common);
1164 &pretty_print ("DIST_COMMON =", "", @coms);
1165 $output_vars .= "\n";
1168 $output_vars .= &file_contents ('dist-vars');
1170 # Put these things in rules section so it is easier for whoever
1171 # reads Makefile.in.
1172 if ($relative_dir eq '.')
1174 $output_rules .= "\n" . 'distdir = $(PACKAGE)-$(VERSION)' . "\n";
1178 $output_rules .= ("\nsubdir = " . $relative_dir . "\n"
1179 . 'distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)'
1183 # Generate 'dist' target, and maybe dist-shar.
1184 &handle_dist_worker (0);
1185 &handle_dist_worker (1) if defined $options{'dist-shar'};
1188 # Handle auto-dependency code.
1189 sub handle_dependencies
1191 if ($use_dependencies)
1193 # Include GNU-make-specific auto-dep code.
1194 if ($dir_holds_sources)
1196 &pretty_print ('DEP_FILES =', "", sort keys %dep_files);
1197 $output_rules .= &file_contents ('depend');
1202 # Include any auto-generated deps that are present.
1203 if (-d ($relative_dir . "/.deps") && -f ($relative_dir . "/.deps/.P"))
1206 local ($gpat) = $relative_dir . "/.deps/*.P";
1208 foreach $depfile (<${gpat}>)
1210 if (! open (DEP_FILE, $depfile))
1212 &am_error ("couldn't open \`$depfile': $!");
1215 print "automake: reading $depfile\n" if $verbose;
1217 # Slurp entire file.
1218 $output_rules .= join ('', <DEP_FILE>);
1223 $output_rules .= "\n";
1228 # Handle subdirectories.
1231 if (! defined $contents{'SUBDIRS'})
1234 ("ud_GNU_GETTEXT in configure.in but SUBDIRS not defined")
1235 if $seen_gettext && $relative_dir eq '.';
1239 &require_file_with_conf_line ($ac_gettext_line, $FOREIGN, 'ABOUT-NLS')
1242 return if ! defined $contents{'SUBDIRS'};
1244 # Make sure each directory mentioned in SUBDIRS actually exists.
1246 foreach $dir (split (/\s+/, $contents{'SUBDIRS'}))
1248 # Skip directories substituted by configure.
1249 next if $dir =~ /^\@.*\@$/;
1250 &am_line_error ('SUBDIRS',
1251 "required directory $relative_dir/$dir does not exist")
1252 if ! -d $relative_dir . '/' . $dir;
1255 $output_rules .= &file_contents ('subdirs');
1257 # Push a bunch of phony targets.
1259 foreach $phonies ('-data', '-exec', 'dirs')
1261 push (@phony, 'install' . $phonies . '-recursive');
1262 push (@phony, 'uninstall' . $phonies . '-recursive');
1264 foreach $phonies ('all', 'check', 'installcheck', 'info', 'dvi')
1266 push (@phony, $phonies . '-recursive');
1268 &push_phony_cleaners ('recursive');
1270 push (@check, "check-recursive");
1271 push (@installcheck, "installcheck-recursive");
1272 push (@info, "info-recursive");
1273 push (@dvi, "dvi-recursive");
1275 $recursive_install = 1;
1278 # Handle remaking and configure stuff.
1279 sub handle_configure
1281 # If SUBDIRS defined, require AC_PROG_MAKE_SET.
1282 &am_line_error ('SUBDIRS', "AC_PROG_MAKE_SET must be used in configure.in")
1283 if defined $contents{'SUBDIRS'} && ! $seen_make_set;
1285 local ($top_reldir);
1286 if ($relative_dir ne '.')
1289 $output_rules .= &file_contents ('remake-subd');
1290 $top_reldir = '../';
1294 if (-f 'aclocal.m4')
1296 $output_vars .= "ACLOCAL = aclocal.m4\n";
1297 &push_dist_common ('aclocal.m4');
1299 $output_rules .= &file_contents ('remake');
1301 # Look for some files we need.
1302 &require_config_file ($FOREIGN, 'install-sh');
1303 &require_file ($FOREIGN, 'mkinstalldirs');
1306 ("\`install.sh' is an anachronism; use \`install-sh' instead")
1307 if -f $relative_dir . '/install.sh';
1309 # If we have a configure header, require it.
1312 # FIXME this restriction should be lifted.
1313 # FIXME first see if it is even needed as-is.
1314 &am_conf_line_error ($config_header_line,
1315 "argument to AC_CONFIG_HEADER contains \`/'\n")
1316 if ($config_header =~ /\//);
1318 &require_file_with_conf_line ($config_header_line,
1319 $FOREIGN, $config_header);
1321 # Header defined and in this directory.
1322 if (-f 'acconfig.h')
1324 $output_vars .= "ACCONFIG = acconfig.h\n";
1325 &push_dist_common ('acconfig.h');
1327 if (-f $config_name . '.top')
1329 $output_vars .= "CONFIG_TOP = ${config_name}.top\n";
1330 &push_dist_common ($config_name . '.top');
1332 if (-f $config_name . '.bot')
1334 $output_vars .= "CONFIG_BOT = ${config_name}.bot\n";
1335 &push_dist_common ($config_name . '.bot');
1338 &push_dist_common ('stamp-h.in');
1340 $output_rules .= &file_contents ('remake-hdr');
1341 $output_vars .= "CONFIG_HEADER_IN = ${config_header}\n";
1347 &am_line_error ('CONFIG_HEADER',
1348 "\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'")
1349 if defined $contents{'CONFIG_HEADER'};
1351 # Generate CONFIG_HEADER define, and define interally.
1352 $output_vars .= "CONFIG_HEADER = ${top_builddir}/${config_name}\n"
1354 $contents{'CONFIG_HEADER'} = "${top_builddir}/${config_name}"
1357 # Now look for other files in this directory which must be remade
1358 # by config.status, and generate rules for them.
1359 local ($file, $local, $input);
1360 foreach $file (@other_input_files)
1362 # Skip files not in this directory, any Makefile, and the
1363 # config header. These last two must be handled specially.
1364 next unless &dirname ($file) eq $relative_dir;
1365 next if $file eq $top_builddir . '/' . $config_name;
1366 ($local = $file) =~ s/^.*\///;
1367 next if $local eq 'Makefile';
1369 if ($local =~ /^(.*):(.*)$/)
1371 # This is the ":" syntax of AC_OUTPUT.
1378 $input = $local . '.in';
1380 # FIXME when using autoconf ":" syntax, should we set CONFIG_FILES
1382 $output_rules .= ($local . ': '
1383 . '$(top_builddir)/config.status ' . $input . "\n"
1385 . 'cd $(top_builddir) && CONFIG_FILES='
1386 . ($relative_dir eq '.' ? '' : '$(subdir)/')
1387 . '$@ CONFIG_HEADERS= ./config.status'
1390 &require_file_with_conf_line ($ac_output_line, $FOREIGN,
1398 &am_install_var ('header', 'HEADERS', 'include',
1399 'oldinclude', 'pkginclude',
1405 return if ! $seen_gettext || $relative_dir ne '.';
1407 # As of 0.10.6, gettext still wants @INTLSUB@ and @POSUB@ in
1408 # SUBDIRS. This is going to change in a future version. So for
1409 # now we simply do no checking.
1410 if (0 && defined $contents{'SUBDIRS'})
1414 "ud_GNU_GETTEXT in configure.in but \`po' not in SUBDIRS")
1415 if $contents{'SUBDIRS'} !~ /\bpo\b/;
1418 "ud_GNU_GETTEXT in configure.in but \`intl' not in SUBDIRS")
1419 if $contents{'SUBDIRS'} !~ /\bintl\b/;
1422 # Ensure that each language in ALL_LINGUAS has a .po file, and
1423 # each po file is mentioned in ALL_LINGUAS.
1426 local (%linguas) = ();
1427 grep ($linguas{$_} = 1, split (/\s+/, $all_linguas));
1434 &am_line_error ($all_linguas_line,
1435 ("po/$_.po exists but \`$_' not in \`ALL_LINGUAS'"))
1439 foreach (keys %linguas)
1441 &am_line_error ($all_linguas_line,
1442 "$_ in \`ALL_LINGUAS' but po/$_.po does not exist")
1448 &am_error ("ud_GNU_GETTEXT in configure.in but \`ALL_LINGUAS' not defined");
1452 # Handle footer elements.
1455 if ($contents{'SOURCES'})
1457 &pretty_print ('SOURCES =', "",
1458 split (/\s+/, $contents{'SOURCES'}));
1460 if ($contents{'OBJECTS'})
1462 &pretty_print ('OBJECTS =', "",
1463 split (/\s+/, $contents{'OBJECTS'}));
1465 if ($contents{'SOURCES'} || $contents{'OBJECTS'})
1467 $output_vars .= "\n";
1470 if (defined $contents{'SUFFIXES'})
1472 push (@suffixes, '$(SUFFIXES)');
1475 $output_trailer .= ".SUFFIXES:\n";
1478 $output_trailer .= ".SUFFIXES: " . join (' ', @suffixes) . "\n";
1480 $output_trailer .= &file_contents ('footer');
1483 # Deal with installdirs target.
1484 sub handle_installdirs
1486 # GNU Makefile standards recommend this.
1487 $output_rules .= ("installdirs:"
1488 . ($recursive_install
1489 ? " installdirs-recursive\n"
1491 push (@phony, 'installdirs');
1494 &pretty_print_rule ("\t\$(top_srcdir)/mkinstalldirs ", "\t\t",
1497 $output_rules .= "\n";
1500 # There are several targets which need to be merged. This is because
1501 # their complete definition is compiled from many parts. Note that we
1502 # avoid double colon rules, otherwise we'd use them instead.
1503 sub handle_merge_targets
1505 push (@all, 'Makefile');
1506 push (@all, $config_name)
1507 if $config_name && &dirname ($config_name) eq $relative_dir;
1509 &do_one_merge_target ('info', @info);
1510 &do_one_merge_target ('dvi', @dvi);
1512 if (! defined $contents{'SUBDIRS'} || $relative_dir ne '.')
1514 # 'check' must depend on 'all', but not at top level.
1516 unshift (@check, 'all');
1517 unshift (@install, 'all');
1519 &do_one_merge_target ('check', @check);
1520 &do_one_merge_target ('installcheck', @installcheck);
1522 # Handle the various install targets specially. We do this so
1523 # that (eg) "make install-exec" will run "install-exec-recursive"
1524 # if required, but "make install" won't run it twice. Step one is
1525 # to see if the user specified local versions of any of the
1526 # targets we handle. "all" is treated as one of these since
1527 # "install" can run it.
1528 push (@install_exec, 'install-exec-local')
1529 if defined $contents{'install-exec-local'};
1530 push (@install_data, 'install-data-local')
1531 if defined $contents{'install-data-local'};
1532 push (@uninstall, 'uninstall-local')
1533 if defined $contents{'uninstall-local'};
1534 push (@all, 'all-local')
1535 if defined $contents{'all-local'};
1537 if (defined $contents{'install-local'})
1539 &am_line_error ('install-local',
1540 "use \`install-data' or \`install-exec', not \`install'");
1543 # Step two: if we are doing recursive makes, write out the
1544 # appropriate rules.
1546 if ($recursive_install)
1548 push (@install, 'install-recursive');
1552 $output_rules .= ('all-am: '
1555 @all = ('all-recursive', 'all-am');
1556 push (@phony, 'all-am');
1560 @all = ('all-recursive');
1564 $output_rules .= ('install-exec-am: '
1565 . join (' ', @install_exec)
1567 @install_exec = ('install-exec-recursive', 'install-exec-am');
1568 push (@install, 'install-exec-am');
1569 push (@phony, 'install-exec-am');
1573 @install_exec = ('install-exec-recursive');
1577 $output_rules .= ('install-data-am: '
1578 . join (' ', @install_data)
1580 @install_data = ('install-data-recursive', 'install-data-am');
1581 push (@install, 'install-data-am');
1582 push (@phony, 'install-data-am');
1586 @install_data = ('install-data-recursive');
1590 $output_rules .= ('uninstall-am: '
1591 . join (' ', @uninstall)
1593 @uninstall = ('uninstall-recursive', 'uninstall-am');
1594 push (@phony, 'uninstall-am');
1598 @uninstall = ('uninstall-recursive');
1602 # Step three: print definitions users can use.
1603 $output_rules .= ("install-exec: "
1604 . join (' ', @install_exec)
1606 push (@install, 'install-exec') if !$recursive_install;
1607 push (@phony, 'install-exec');
1609 $output_rules .= ("install-data: "
1610 . join (' ', @install_data)
1612 push (@install, 'install-data') if !$recursive_install;
1613 push (@phony, 'install-data');
1615 # If no dependencies for 'install', add 'all'. Why? That way
1616 # "make install" at top level of distclean'd distribution won't
1617 # fail because stuff in 'lib' fails to build.
1618 push (@install, 'all') if ! @install;
1619 $output_rules .= ('install: '
1620 . join (' ', @install)
1621 # Use "@:" as empty command so nothing prints.
1625 . join (' ', @uninstall)
1627 push (@phony, 'install', 'uninstall');
1629 $output_rules .= ('all: '
1632 push (@phony, 'all');
1634 # Generate the new 'install-strip' target.
1635 $output_rules .= ("install-strip:\n\t"
1636 . '$(MAKE) INSTALL_PROGRAM=\'$(INSTALL_PROGRAM) -s\' install'
1640 # Helper for handle_merge_targets.
1641 sub do_one_merge_target
1643 local ($name, @values) = @_;
1645 if (defined $contents{$name . '-local'})
1647 # User defined local form of target. So include it.
1648 push (@values, $name . '-local');
1649 push (@phony, $name . '-local');
1652 $output_rules .= $name . ":";
1655 $output_rules .= ' ' . join (' ', @values);
1657 $output_rules .= "\n\n";
1658 push (@phony, $name);
1661 # Handle all 'clean' targets.
1664 push (@clean, 'generic');
1665 $output_rules .= &file_contents ('clean');
1666 &push_phony_cleaners ('generic');
1668 local ($target) = $recursive_install ? 'clean-am' : 'clean';
1669 &do_one_clean_target ($target, 'mostly', '', @clean);
1670 &do_one_clean_target ($target, '', 'mostly', @clean);
1671 &do_one_clean_target ($target, 'dist', '', @clean);
1672 &do_one_clean_target ($target, 'maintainer-', 'dist', @clean);
1674 push (@phony, 'clean', 'mostlyclean', 'distclean', 'maintainer-clean');
1677 if ($recursive_install)
1679 @deps = ('am', 'recursive');
1680 &do_one_clean_target ('', 'mostly', '', @deps);
1681 &do_one_clean_target ('', '', '', @deps);
1682 &do_one_clean_target ('', 'dist', '', @deps);
1683 &do_one_clean_target ('', 'maintainer-', '', @deps);
1687 # Helper for handle_clean.
1688 sub do_one_clean_target
1690 local ($target, $name, $last_name, @deps) = @_;
1692 # Special case: if target not passed, then don't generate
1693 # dependency on next "lower" clean target (eg no
1694 # clean<-mostlyclean derivation). In this case the target is
1695 # implicitly known to be 'clean'.
1696 local ($flag) = $target;
1697 $target = 'clean' if ! $flag;
1699 grep (($_ = $name . 'clean-' . $_) && 0, @deps);
1702 if ($last_name || $name ne 'mostly')
1704 push (@deps, $last_name . $target . " ");
1707 # FIXME not sure if I like the tabs here.
1708 &pretty_print_rule ($name . $target . ": ", "\t\t", @deps);
1710 # FIXME shouldn't we really print these messages before running
1712 if ($name . $target eq 'maintainer-clean')
1714 # Print a special warning.
1716 ("\t\@echo \"This command is intended for maintainers to use;\"\n"
1717 . "\t\@echo \"it deletes files that may require special "
1718 . "tools to rebuild.\"\n");
1720 $output_rules .= "\trm -f config.status\n"
1721 if $relative_dir eq '.';
1723 elsif ($name . $target eq 'distclean')
1725 $output_rules .= "\trm -f config.status\n";
1727 $output_rules .= "\n";
1730 # Handle .PHONY target.
1733 &pretty_print_rule ('.PHONY:', "", @phony);
1734 $output_rules .= "\n";
1737 # Handle TESTS variable.
1740 return if ! defined $contents{'TESTS'};
1742 &push_dist_common (split (/\s+/, $contents{'TESTS'}));
1743 push (@check, 'check-TESTS');
1744 push (@phony, 'check-TESTS');
1745 # FIXME use $(SHELL) here? That is what Ulrich suggests. Maybe a
1746 # new macro, $(TEST_SHELL), a la $(CONFIG_SHELL)? For now we just
1747 # execute the file directly; this allows test files which are
1748 # compiled -- a possibly useful feature.
1749 $output_rules .= 'check-TESTS:
1750 @failed=0; all=0; \\
1751 srcdir=$(srcdir); export srcdir; \\
1752 for tst in $(TESTS); do \\
1753 all=`expr $$all + 1`; \\
1754 if test -f $$tst; then dir=.; \\
1755 else dir="$(srcdir)"; fi; \\
1756 if $$dir/$$tst; then \\
1757 echo "PASS: $$tst"; \\
1759 failed=`expr $$failed + 1`; \\
1760 echo "FAIL: $$tst"; \\
1763 if test "$$failed" -eq 0; then \\
1764 echo "========================"; \\
1765 echo "All $$all tests passed"; \\
1766 echo "========================"; \\
1768 echo "$$failed of $$all tests failed"; \\
1773 ################################################################
1775 # Scan configure.in for interesting things.
1776 # FIXME ensure VERSION, PACKAGE are set.
1779 open (CONFIGURE, 'configure.in')
1780 || die "automake: couldn't open \`configure.in': $!\n";
1781 print "automake: reading configure.in\n" if $verbose;
1783 # Reinitialize libsources here. This isn't really necessary,
1784 # since we currently assume there is only one configure.in. But
1785 # that won't always be the case.
1788 local ($in_ac_output, @make_list) = 0;
1789 local ($seen_arg_prog) = 0;
1790 local ($libobj_iter);
1793 # Remove comments from current line.
1797 # Populate libobjs array.
1798 if (/AC_FUNC_ALLOCA/)
1800 $libsources{'alloca.c'} = 1;
1802 elsif (/AC_FUNC_GETLOADAVG/)
1804 $libsources{'getloadavg.c'} = 1;
1806 elsif (/AC_FUNC_MEMCMP/)
1808 $libsources{'memcmp.c'} = 1;
1810 elsif (/AC_STRUCT_ST_BLOCKS/)
1812 $libsources{'fileblocks.c'} = 1;
1814 elsif (/(AC|fp)_FUNC_FNMATCH/)
1816 # AC_FUNC_FNMATCH is just wishful thinking at this point.
1817 $libsources{'fnmatch.c'} = 1;
1819 elsif (/AC_REPLACE_FUNCS\s*\((.*)\)/)
1821 foreach (split (/\s+/, $1))
1823 $libsources{$_ . '.c'} = 1;
1826 elsif (/LIBOBJS="(.*)\s+\$LIBOBJS"/
1827 || /LIBOBJS="\$LIBOBJS\s+(.*)"/)
1829 foreach $libobj_iter (split (/\s+/, $1))
1831 if ($libobj_iter =~ /^(.*)\.o$/)
1833 $libsources{$1 . '.c'} = 1;
1838 # Process the AC_OUTPUT macro.
1839 if (! $in_ac_output && s/AC_OUTPUT\s*\(\[?//)
1842 $ac_output_line = $.;
1846 $in_ac_output = 0 if s/[\]\),].*$//;
1848 # Look at potential Makefile.am's.
1854 push (@make_list, $_);
1858 push (@other_input_files, $_);
1863 if (/AC_CONFIG_AUX_DIR\(([^)]+)\)/)
1865 @config_aux_path = $1;
1868 # Check for ansi2knr.
1869 $fp_c_prototypes = 1 if /fp_C_PROTOTYPES/;
1871 # Check for NLS support.
1872 if (/ud_GNU_GETTEXT/)
1875 $ac_gettext_line = $.;
1878 # Look for ALL_LINGUAS.
1879 if (/ALL_LINGUAS="(.*)"$/ || /ALL_LINGUAS=(.*)$/)
1883 $all_linguas_line = $.;
1886 # Handle configuration headers.
1887 if (/AC_CONFIG_HEADER\s*\((.*)\)/)
1889 $config_header_line = $.;
1891 if ($config_name =~ /^([^:]+):(.+)$/)
1894 $config_header = $2;
1898 $config_header = $config_name . '.in';
1902 $seen_canonical = 1 if /AC_CANONICAL_(HOST|SYSTEM)/;
1903 $seen_canonical = 1 if /AC_CHECK_TOOL/;
1904 $seen_path_xtra = 1 if /AC_PATH_XTRA/;
1906 # Sometimes it is desirable to explicitly set YACC. For
1907 # instance some people don't want to use bison.
1908 $seen_prog_yacc = 1 if (/AC_PROG_YACC/
1909 || /AC_SUBST\(YACC\)/
1910 || /AC_(PATH|CHECK)_PROGS?\(YACC/);
1912 # Some things required by Automake. FIXME We only really
1913 # require AC_ARG_PROGRAM if any program is installed.
1914 $seen_make_set = 1 if /AC_PROG_MAKE_SET/;
1915 $seen_prog_install = 1 if ! $seen_prog_install && /AC_PROG_INSTALL/;
1916 $seen_prog_install = 2 if ! $seen_prog_install && /fp_PROG_INSTALL/;
1917 $seen_arg_prog = 1 if /AC_ARG_PROGRAM/;
1918 $seen_ranlib = 1 if /AC_PROG_RANLIB/;
1921 # Set input files if not specified by user.
1922 @input_files = @make_list if (! @input_files);
1924 &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in")
1925 unless $seen_arg_prog;
1930 ################################################################
1932 # Do any extra checking for GNU standards.
1933 sub check_gnu_standards
1935 &require_file ($GNU, 'ChangeLog');
1937 if ($relative_dir eq '.')
1939 # In top level (or only) directory.
1940 &require_file ($GNU, 'INSTALL', 'NEWS', 'README', 'COPYING',
1945 # Do any extra checking for GNITS standards.
1946 sub check_gnits_standards
1948 if ($strictness >= $GNITS && -f $relative_dir . '/COPYING.LIB')
1951 ("\`${relative_dir}/COPYING.LIB' disallowed by Gnits standards");
1954 if ($relative_dir eq '.')
1956 # In top level (or only) directory.
1957 &require_file ($GNITS, 'THANKS');
1961 ################################################################
1963 # Pretty-print something. HEAD is what should be printed at the
1964 # beginning of the first line, FILL is what should be printed at the
1965 # beginning of every subsequent line.
1966 sub pretty_print_internal
1968 local ($head, $fill, @values) = @_;
1970 local ($column) = length ($head);
1971 local ($result) = $head;
1973 # Fill length is number of characters. However, each Tab
1974 # character counts for eight. So we count the number of Tabs and
1976 local ($fill_length) = length ($fill);
1977 $fill_length += 7 * ($fill =~ tr/\t/\t/d);
1982 # "71" because we also print a space.
1983 if ($column + length ($_) > 71)
1985 $result .= " \\\n" . $fill;
1986 $column = $fill_length;
1990 $result .= ' ' unless ($bol);
1992 $column += length ($_) + 1;
2000 # Pretty-print something and append to output_vars.
2003 $output_vars .= &pretty_print_internal (@_);
2006 # Pretty-print something and append to output_rules.
2007 sub pretty_print_rule
2009 $output_rules .= &pretty_print_internal (@_);
2013 ################################################################
2015 # Read Makefile.am and set up %contents. Simultaneously copy lines
2016 # from Makefile.am into $output_trailer or $output_vars as
2017 # appropriate. NOTE we put rules in the trailer section. We want
2018 # user rules to come after our generated stuff.
2021 local ($amfile) = @_;
2023 # Compute relative location of the top object directory.
2024 local (@topdir) = ();
2025 foreach (split (/\//, $relative_dir))
2027 next if $_ eq '.' || $_ eq '';
2034 push (@topdir, '..');
2037 @topdir = ('.') if ! @topdir;
2039 $top_builddir = join ('/', @topdir);
2041 ($build_rx = $top_builddir) =~ s/(\W)/\\$1/g;
2042 local ($header_vars) =
2043 &file_contents_with_transform
2044 ('s/\@top_builddir\@/' . $build_rx . '/g',
2047 open (AM_FILE, $amfile) || die "automake: couldn't open \`$amfile': $!\n";
2048 print "automake: reading $amfile\n" if $verbose;
2050 $output_vars .= ("# Makefile.in generated automatically by automake "
2051 . $VERSION . " from Makefile.am\n");
2053 # Generate copyright for generated Makefile.in.
2054 $output_vars .= $gen_copyright;
2056 local ($saw_bk) = 0;
2057 local ($was_rule) = 0;
2058 local ($spacing) = '';
2059 local ($comment) = '';
2060 local ($last_var_name) = '';
2064 if (/$IGNORE_PATTERN/o)
2066 # Merely delete comments beginning with two hashes.
2068 elsif (/$WHITE_PATTERN/o)
2070 # Stick a single white line before the incoming macro or rule.
2073 elsif (/$COMMENT_PATTERN/o)
2075 # Stick comments before the incoming macro or rule.
2076 $comment .= $spacing . $_;
2085 $output_vars .= $comment . "\n" . $header_vars;
2089 local ($is_ok_macro);
2092 if (/$IGNORE_PATTERN/o)
2094 # Merely delete comments beginning with two hashes.
2096 elsif (/$WHITE_PATTERN/o)
2098 # Stick a single white line before the incoming macro or rule.
2101 elsif (/$COMMENT_PATTERN/o)
2103 # Stick comments before the incoming macro or rule.
2104 $comment .= $spacing . $_;
2111 $output_trailer .= $_;
2118 # Chop newline and backslash if this line is
2119 # continued. FIXME maybe ensure trailing whitespace
2123 $contents{$last_var_name} .= $_;
2126 elsif (/$RULE_PATTERN/o)
2128 # warn "** Saw rule .$1.\n";
2131 # Value here doesn't matter; for targets we only note
2134 $content_lines{$1} = $.;
2135 $output_trailer .= $comment . $spacing . $_;
2136 $comment = $spacing = '';
2139 elsif (($is_ok_macro = /$MACRO_PATTERN/o)
2140 || /$BOGUS_MACRO_PATTERN/o)
2142 # Found a macro definition.
2144 $last_var_name = $1;
2145 if (substr ($2, -1) eq "\\")
2147 $contents{$1} = substr ($2, 0, length ($2) - 1);
2153 $content_lines{$1} = $.;
2154 $output_vars .= $comment . $spacing . $_;
2155 $comment = $spacing = '';
2159 &am_line_error ($., "bad macro name \`$1'")
2164 # This isn't an error; it is probably a continued rule.
2165 # In fact, this is what we assume.
2167 $output_trailer .= $comment . $spacing . $_;
2168 $comment = $spacing = '';
2175 $output_trailer .= $comment;
2178 ################################################################
2180 sub initialize_global_constants
2182 # Associative array of standard directory names. Entry is TRUE if
2183 # corresponding directory should be installed during
2184 # 'install-exec' phase.
2202 # Helper text for dealing with man pages.
2203 $install_man_format =
2204 ' @sect=@SECTION@; \\
2205 inst=`echo "@MANBASE@" | sed \'$(transform)\'`.@FULLSECT@; \\
2206 echo installing @MAN@ as $(mandir)/man$$sect/$$inst; \\
2207 $(INSTALL_DATA) $(srcdir)/@MAN@ $(mandir)/man$$sect/$$inst
2210 $uninstall_man_format =
2211 ' inst=`echo "@MANBASE@" | sed \'$(transform)\'`.@FULLSECT@; \\
2212 rm -f $(mandir)/man@SECTION@/$$inst
2215 # Commonly found files we look for and automatically include in
2219 "README", "THANKS", "TODO", "NEWS", "COPYING", "COPYING.LIB",
2220 "INSTALL", "ABOUT-NLS", "ChangeLog", "configure", "configure.in",
2221 "config.guess", "config.sub", "AUTHORS", "BACKLOG", "ABOUT-GNU"
2224 # Commonly used files we auto-include, but only sometimes.
2227 "version.texi", "aclocal.m4", "acconfig.h", "config.h.top",
2228 "config.h.bot", "stamp-h.in", "mdate-sh", "ansi2knr.c",
2229 "ansi2knr.1", 'stamp-vti', "mkinstalldirs", "install-sh"
2233 --amdir=DIR directory storing config files
2234 --foreign same as --strictness=foreign
2235 --gnits same as --strictness=gnits
2236 --gnu same as --strictness=gnu
2237 --help print this help, then exit
2238 --include-deps include generated dependencies in Makefile.in
2239 --add-missing add missing standard files to package
2240 --output-dir=DIR put generated Makefile.in's into DIR
2241 --strictness=LEVEL set strictness level. LEVEL is foreign, gnu, gnits
2242 --verbose verbosely list files processed
2243 --version print version number, then exit\n";
2245 # Copyright on generated Makefile.ins.
2247 # Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
2248 # This Makefile.in is free software; the Free Software Foundation
2249 # gives unlimited permission to copy, distribute and modify it.
2253 # (Re)-Initialize per-Makefile.am variables.
2254 sub initialize_per_input
2256 # These two variables are used when generating each Makefile.in.
2257 # They hold the Makefile.in until it is ready to be printed.
2260 $output_trailer = '';
2262 # Suffixes found during a run.
2265 # This holds the contents of a Makefile.am, as parsed by
2269 # This holds the line numbers at which various elements of
2270 # %contents are defined.
2271 %content_lines = ();
2273 # This holds the "relative directory" of the current Makefile.in.
2274 # Eg for src/Makefile.in, this is "src".
2277 # Directory where output files go. Actually, output files are
2278 # relative to this directory.
2279 $output_directory = '.';
2281 # This holds a list of files that are included in the
2285 # List of dependencies for the obvious targets.
2300 # These are pretty obvious, too. They are used to define the
2301 # SOURCES and OBJECTS variables.
2305 # TRUE if current directory holds any C source files. (Actually
2306 # holds object extension, but this information is encapsulated in
2307 # the function get_object_extension).
2308 $dir_holds_sources = '';
2310 # TRUE if install targets should work recursively.
2311 $recursive_install = 0;
2316 # Strictness levels.
2317 $strictness = $default_strictness;
2318 $strictness_name = $default_strictness_name;
2320 # Options from AUTOMAKE_OPTIONS.
2323 # Whether or not dependencies are handled. Can be further changed
2324 # in handle_options.
2325 $use_dependencies = $cmdline_use_dependencies;
2328 $local_maint_charset = $maint_charset;
2332 ################################################################
2334 # Return contents of a file from $am_dir, automatically skipping
2335 # macros or rules which are already known. Runs command on each line
2336 # as it is read; this command can modify $_.
2337 sub file_contents_with_transform
2339 local ($command, $basename) = @_;
2340 local ($file) = $am_dir . '/' . $basename . '.am';
2342 open (FC_FILE, $file)
2343 || die "automake: installation error: cannot open \`$file'\n";
2345 # print "automake: reading $file\n" if $verbose;
2347 local ($was_rule) = 0;
2348 local ($result_vars) = '';
2349 local ($result_rules) = '';
2350 local ($comment) = '';
2351 local ($spacing) = "\n";
2352 local ($skipping) = 0;
2358 if (/$IGNORE_PATTERN/o)
2360 # Merely delete comments beginning with two hashes.
2362 elsif (/$WHITE_PATTERN/o)
2364 # Stick a single white line before the incoming macro or rule.
2367 elsif (/$COMMENT_PATTERN/o)
2369 # Stick comments before the incoming macro or rule.
2370 $comment .= $spacing . $_;
2377 $result_rules .= $_ if ! $skipping;
2381 $result_vars .= $_ if ! $skipping;
2385 elsif (/$RULE_PATTERN/o)
2387 # warn "** Found rule .$1.\n";
2390 $skipping = defined $contents{$1};
2391 # warn "** Skip $skipping\n" if $skipping;
2392 $result_rules .= $comment . $spacing . $_ if ! $skipping;
2393 $comment = $spacing = '';
2396 elsif (/$MACRO_PATTERN/o)
2398 # warn "** Found macro .$1.\n";
2399 # Found a variable reference.
2401 $skipping = defined $contents{$1};
2402 # warn "** Skip $skipping\n" if $skipping;
2403 $result_vars .= $comment . $spacing . $_ if ! $skipping;
2404 $comment = $spacing = '';
2409 # This isn't an error; it is probably a continued rule.
2410 # In fact, this is what we assume.
2412 $result_rules .= $comment . $spacing . $_ if ! $skipping;
2413 $comment = $spacing = '';
2419 return $result_vars . $result_rules . $comment;
2422 # Like file_contents_with_transform, but no transform.
2425 return &file_contents_with_transform ('', @_);
2428 # Handle `where_HOW' variable magic. Does all lookups, generates
2429 # install code,and possibly generates code to define the primary
2430 # variable. The first argument is the name of the .am file to munge,
2431 # the second argument is the primary variable (eg HEADERS), and all
2432 # subsequent arguments are possible installation locations. Returns
2433 # list of all values of all _HOW targets.
2435 # FIXME this should be rewritten to be cleaner. It should be broken
2436 # up into multiple functions.
2438 # Usage is: am_install_var (OPTION..., file, HOW, where...)
2443 local ($do_all, $do_clean) = (1, 0);
2446 if ($args[0] eq '-clean')
2450 elsif ($args[0] eq '-no-all')
2454 elsif ($args[0] !~ /^-/)
2460 local ($file, $primary, @prefixes) = @args;
2463 local (@result) = ();
2465 # Now that configure substitutions are allowed in where_HOW
2466 # variables, it is an error to actually define the primary.
2467 &am_line_error ($primary, "\`$primary' is an anachronism")
2468 if defined $contents{$primary};
2471 # Look for misspellings. It is an error to have a variable ending
2472 # in a "reserved" suffix whose prefix is unknown, eg
2473 # "bni_PROGRAMS". However, unusual prefixes are allowed if a
2474 # variable of the same name (with "dir" appended) exists. For
2475 # instance, if the variable "zardir" is defined, then
2476 # "zar_PROGRAMS" becomes valid. This is to provide a little extra
2477 # flexibility in those cases which need it. Perhaps it should be
2478 # disallowed in the Gnits case? The problem is, sometimes it is
2479 # useful to put things in a subdir of eg pkgdatadir, perhaps even
2481 local (%valid, $varname);
2482 grep ($valid{$_} = 0, @prefixes);
2483 $valid{'EXTRA'} = 0;
2484 foreach $varname (keys %contents)
2486 if ($varname =~ /^(.*)_$primary$/)
2488 if (! defined $valid{$1} && ! defined $contents{$1 . 'dir'})
2490 &am_line_error ($varname, "invalid variable \"$varname\"");
2494 # Ensure all extended prefixes are actually used.
2499 # We never want to examine EXTRA_blah.
2500 undef $valid{'EXTRA'};
2502 local ($clean_file) = $file . '-clean';
2505 foreach $X (keys %valid)
2507 $one_name = $X . '_' . $primary;
2508 if (defined $contents{$one_name})
2510 # Append actual contents of where_PRIMARY variable to
2513 foreach $rcurs (split (/\s+/, $contents{$one_name}))
2515 # Skip configure substitutions. Possibly bogus.
2516 next if $rcurs =~ /^\@.*\@$/;
2517 push (@result, $rcurs);
2523 &file_contents_with_transform ('s/\@DIR\@/' . $X . '/go',
2526 push (@clean, $X . $primary);
2527 &push_phony_cleaners ($X . $primary);
2532 push (@check, '$(' . $one_name . ')');
2536 push (@used, '$(' . $one_name . ')');
2538 if ($X eq 'noinst' || $X eq 'check')
2540 # Objects in noinst_FOO or check_FOO never get
2546 &file_contents_with_transform ('s/\@DIR\@/' . $X . '/go',
2549 push (@uninstall, 'uninstall-' . $X . $primary);
2550 push (@phony, 'uninstall-' . $X . $primary);
2551 push (@installdirs, '$(' . $X . 'dir)');
2552 if ($exec_dir_p{$X})
2554 push (@install_exec, 'install-' . $X . $primary);
2555 push (@phony, 'install-' . $X . $primary);
2559 push (@install_data, 'install-' . $X . $primary);
2560 push (@phony, 'install-' . $X . $primary);
2568 &pretty_print ($primary . ' =', '', @used);
2569 $output_vars .= "\n";
2572 # Push here because PRIMARY might be configure time determined.
2573 push (@all, '$(' . $primary . ')')
2574 if $do_all && @used;
2576 push (@result, split (/\s+/, $contents{'EXTRA_' . $primary}))
2577 if defined $contents{'EXTRA_' . $primary};
2583 ################################################################
2585 # Verify that the file must exist in the current directory.
2586 # Usage: require_file (isconfigure, line_number, strictness, file)
2587 # strictness is the strictness level at which this file becomes
2589 sub require_file_internal
2591 local ($is_configure, $line, $mystrict, @files) = @_;
2592 local ($file, $fullfile);
2594 foreach $file (@files)
2596 $fullfile = $relative_dir . "/" . $file;
2600 &push_dist_common ($file);
2602 elsif ($strictness >= $mystrict)
2604 # Only install missing files according to our desired
2606 if ($add_missing && -f ($am_dir . '/' . $file))
2608 # Install the missing file. Symlink if we can, copy
2610 if ($symlink_exists)
2612 symlink ($am_dir . '/' . $file, $fullfile);
2616 system ('cp', $am_dir . '/' . $file, $fullfile);
2619 # FIXME this is a hack. Should have am_warn.
2620 local ($save) = $exit_status;
2625 "required file \"$fullfile\" not found; installing");
2631 "required file \"$fullfile\" not found; installing");
2633 $exit_status = $save;
2637 # Only an error if strictness constraint violated.
2641 ($line, "required file \"$fullfile\" not found");
2646 ($line, "required file \"$fullfile\" not found");
2653 # Like require_file_with_line, but error messages refer to
2654 # configure.in, not the current Makefile.am.
2655 sub require_file_with_conf_line
2657 &require_file_internal (1, @_);
2660 sub require_file_with_line
2662 &require_file_internal (0, @_);
2667 &require_file_internal (0, '', @_);
2670 # Require a file that is also required by Autoconf. Looks in
2671 # configuration path, as specified by AC_CONFIG_AUX_DIR.
2672 sub require_config_file
2674 local ($mystrict, @files) = @_;
2675 local ($file, $dir);
2678 foreach $file (@files)
2681 foreach $dir (@config_aux_path)
2683 $fullfile = $dir . "/" . $file;
2688 &push_dist_common ($file) if $dir eq $relative_dir;
2694 if ($strictness >= $mystrict)
2696 # Only install missing files according to our desired
2698 if ($add_missing && -f ($am_dir . '/' . $file))
2700 # Install the missing file. Symlink if we can, copy
2702 if ($symlink_exists)
2704 symlink ($am_dir . '/' . $file, $fullfile);
2708 system ('cp', $am_dir . '/' . $file, $fullfile);
2711 # FIXME this is a hack. Should have am_warn.
2712 local ($save) = $exit_status;
2714 ("required file \"$fullfile\" not found; installing");
2715 $exit_status = $save;
2719 # Only an error if strictness constraint violated.
2720 &am_error ("required file \"$fullfile\" not found");
2727 ################################################################
2729 # Push a list of files onto dist_common.
2730 sub push_dist_common
2732 local (@files) = @_;
2735 foreach $file (@files)
2737 $dist_common{$file} = 1;
2741 # Push a list of clean targets onto phony.
2742 sub push_phony_cleaners
2746 foreach $target ('mostly', 'dist', '', 'maintainer-')
2748 push (@phony, $target . 'clean-' . $base);
2755 $strictness_name = $_[0];
2756 if ($strictness_name eq 'gnu')
2760 elsif ($strictness_name eq 'gnits')
2762 $strictness = $GNITS;
2764 elsif ($strictness_name eq 'foreign')
2766 $strictness = $FOREIGN;
2770 die "automake: level \`$strictness_name' not recognized\n";
2775 ################################################################
2777 # Return directory name of file.
2783 ($sub = $file) =~ s,/+[^/]+$,,g;
2784 $sub = '.' if $sub eq $file;
2791 local ($dirname) = @_;
2792 system ("mkdir", $dirname);
2795 ################################################################
2797 # Print an error message and set exit status.
2800 warn "automake: ${am_file}.am: ", join (' ', @_), "\n";
2806 local ($symbol, @args) = @_;
2810 # If SYMBOL not already a line number, look it up in Makefile.am.
2811 $symbol = $content_lines{$symbol} unless $symbol =~ /^\d+$/;
2812 $symbol .= ': ' if $symbol;
2813 warn "${am_file}.am:", $symbol, join (' ', @args), "\n";
2822 # Like am_error, but while scanning configure.in.
2825 # FIXME can run in subdirs.
2826 warn "automake: configure.in: ", join (' ', @_), "\n";
2830 # Error message with line number referring to configure.in.
2831 sub am_conf_line_error
2833 local ($line, @args) = @_;
2837 warn "configure.in: $line: ", join (' ', @args), "\n";
2842 &am_conf_error (@args);
2846 # Tell user where our aclocal.m4 is, but only once.
2847 sub keyed_aclocal_warning
2850 warn "automake: macro \`$key' can be found in ${am_dir}/aclocal.m4\n";
2853 # Print usage information.
2856 print "Usage: automake [OPTION] ... [Makefile]...\n";
2858 print "\nFiles which are automatically distributed, if found:\n";
2859 $~ = "USAGE_FORMAT";
2860 local (@lcomm) = sort ((@common_files, @common_sometimes));
2861 local ($one, $two, $three, $four);
2864 $one = shift @lcomm;
2865 $two = @lcomm ? shift @lcomm : '';
2866 $three = @lcomm ? shift @lcomm : '';
2867 $four = @lcomm ? shift @lcomm : '';
2874 format USAGE_FORMAT =
2875 @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<
2876 $one, $two, $three, $four