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 = ('.', '..', '../..');
105 $config_aux_dir = '';
107 # Whether AC_PROG_MAKE_SET has been seen in configure.in.
110 # Whether ud_GNU_GETTEXT has been seen in configure.in.
112 # Line number at which ud_GNU_GETTEXT seen.
113 $ac_gettext_line = 0;
115 # Whether ALL_LINGUAS has been seen.
119 # Line number at which it appears.
120 $all_linguas_line = 0;
122 # 1 if AC_PROG_INSTALL seen, 2 if fp_PROG_INSTALL seen.
123 $seen_prog_install = 0;
125 # 1 if any scripts installed, 0 otherwise.
126 $scripts_installed = 0;
128 # Whether AC_PATH_XTRA has been seen in configure.in.
131 # Whether YACC variable has been seen in configure.in.
134 # TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM). The presence of
135 # AC_CHECK_TOOL also sets this.
138 # TRUE if we've seen AC_PROG_RANLIB.
141 # TRUE if we've seen AC_ARG_PROGRAM.
144 # TRUE if we've seen gm_PROG_LIBTOOL or AC_PROG_LIBTOOL.
148 # Charsets used by maintainer and in distribution. MAINT_CHARSET is
149 # handled in a funny way: if seen in the top-level Makefile.am, it is
150 # used for every directory which does not specify a different value.
151 # The rationale here is that some directories (eg gettext) might be
152 # distributions of other packages, and thus require their own charset
153 # info. However, the DIST_CHARSET must be the same for the entire
154 # package; it can only be set at top-level.
155 # FIXME this yields bugs when rebuilding. What to do? Always
156 # read (and sometimes discard) top-level Makefile.am?
158 $dist_charset = 'utf8'; # recode doesn't support this yet.
162 &initialize_global_constants;
164 # Parse command line.
165 &parse_arguments (@ARGV);
167 # Do configure.in scan only once.
170 die "automake: no \`Makefile.am' found or specified\n"
173 # Now do all the work on each file.
174 foreach $am_file (@input_files)
176 # FIXME should support the AC_OUTPUT ":" syntax here.
177 if (! -f ($am_file . '.am'))
179 &am_error ('no such file');
183 &generate_makefile ($am_file);
187 if ($seen_prog_install <= $scripts_installed)
189 &am_conf_error (($scripts_installed ? 'fp_PROG_INSTALL' : 'AC_PROG_INSTALL')
190 . " must be used in configure.in");
191 &keyed_aclocal_warning ('fp_PROG_INSTALL')
192 if $scripts_installed;
198 ################################################################
200 # Parse command line.
203 local (@arglist) = @_;
206 &set_strictness ('gnu');
210 if ($arglist[0] eq "--version")
212 print "Automake version $VERSION\n";
215 elsif ($arglist[0] eq "--help")
219 elsif ($arglist[0] =~ /^--amdir=(.+)$/)
223 elsif ($arglist[0] eq '--amdir')
225 &require_argument (@arglist);
227 $am_dir = $arglist[0];
229 elsif ($arglist[0] =~ /^--strictness=(.+)$/)
231 &set_strictness ($1);
233 elsif ($arglist[0] eq '--gnu')
235 &set_strictness ('gnu');
237 elsif ($arglist[0] eq '--gnits')
239 &set_strictness ('gnits');
241 elsif ($arglist[0] eq '--foreign')
243 &set_strictness ('foreign');
245 elsif ($arglist[0] eq '--strictness')
247 &require_argument (@arglist);
249 &set_strictness ($arglist[0]);
251 elsif ($arglist[0] eq '--include-deps')
253 $cmdline_use_dependencies = 0;
255 elsif ($arglist[0] =~ /^--output-dir=(.*)$/)
257 # Set output directory.
258 $output_directory = $1;
260 elsif ($arglist[0] eq '--output-dir')
262 &require_argument (@arglist);
264 $output_directory = $arglist[0];
266 elsif ($arglist[0] eq '--add-missing')
270 elsif ($arglist[0] eq '--verbose')
274 elsif ($arglist[0] eq '--')
276 # Stop option processing.
278 push (@input_files, @arglist);
281 elsif ($arglist[0] =~ /^-/)
283 die "automake: unrecognized option -- \`$arglist[0]'\n";
287 push (@input_files, $arglist[0]);
293 # Take global strictness from whatever we currently have set.
294 $default_strictness = $strictness;
295 $default_strictness_name = $strictness_name;
298 # Ensure argument exists, or die.
301 local ($arg, @arglist) = @_;
302 die "automake: no argument given for option \`$arg'\n"
306 ################################################################
308 # Generate a Makefile.in given the name of the corresponding Makefile.
309 sub generate_makefile
311 local ($makefile) = @_;
313 print "automake: creating ", $makefile, ".in\n" if $verbose;
315 &initialize_per_input;
316 $relative_dir = &dirname ($makefile);
318 # AC_CANONICAL_HOST and AC_CANONICAL_SYSTEM need config.guess and
320 &require_config_file ($FOREIGN, 'config.guess', 'config.sub')
321 if $relative_dir eq '.' && $seen_canonical;
323 # We still need Makefile.in here, because sometimes the `dist'
324 # target doesn't re-run automake.
325 &push_dist_common ('Makefile.in', 'Makefile.am');
326 push (@sources, '$(SOURCES)') if defined $contents{'SOURCES'};
327 push (@objects, '$(OBJECTS)') if defined $contents{'OBJECTS'};
329 # This is always the default target. This gives us freedom to do
330 # things in whatever order is convenient.
331 $output_rules .= "default: all\n\n";
332 push (@phony, 'default');
334 &read_am_file ($makefile . '.am');
337 # Check first, because we might modify some state.
338 &check_gnu_standards;
339 &check_gnits_standards;
347 # Re-init SOURCES and OBJECTS. FIXME other code shouldn't depend
348 # on this (but currently does).
349 $contents{'SOURCES'} = join (' ', @sources);
350 $contents{'OBJECTS'} = join (' ', @objects);
359 &handle_dependencies;
362 &handle_merge_targets;
367 if (! -d ($output_directory . '/' . $relative_dir))
369 &mkdir ($output_directory . '/' . $relative_dir);
371 if (! open (GM_FILE, "> " . $output_directory . '/' . $makefile . ".in"))
373 warn "automake: ${am_file}.in: cannot open: $!\n";
378 print GM_FILE $output_vars;
379 print GM_FILE $output_rules;
380 print GM_FILE $output_trailer;
385 ################################################################
387 # Handle AUTOMAKE_OPTIONS variable.
390 return if ! defined $contents{'AUTOMAKE_OPTIONS'};
392 foreach (split (/\s+/, $contents{'AUTOMAKE_OPTIONS'}))
395 if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
397 &set_strictness ($_);
399 elsif ($_ eq 'no-installman' || $_ eq 'ansi2knr' || $_ eq 'dist-shar')
401 # Explicitly recognize these.
403 elsif ($_ eq 'no-dependencies')
405 $use_dependencies = 0;
407 elsif (/[0-9]+\.?[0-9]+/)
409 # Got a version number. Is the syntax too strict?
412 &am_line_error ('AUTOMAKE_OPTIONS',
413 "require version $_, only have $VERSION");
419 &am_line_error ('AUTOMAKE_OPTIONS',
420 'option ', $_, 'not recognized');
425 # Return object extension. Just once, put some code into the output.
426 sub get_object_extension
428 if (! $dir_holds_sources)
432 if (defined $contents{'CONFIG_HEADER'})
434 ($xform = &dirname ($contents{'CONFIG_HEADER'}))
436 $xform = '-I' . $xform;
438 $xform = 's/\@CONFIG_INCLUDE_SPEC\@/' . $xform . '/go';
439 $output_vars .= &file_contents_with_transform ($xform,
441 $output_rules .= &file_contents ('compile');
442 &push_phony_cleaners ('compile');
444 # If using X, include some extra variable definitions. NOTE
445 # we don't want to force these into CFLAGS or anything,
446 # because not all programs will necessarily use X.
449 $output_vars .= ("X_CFLAGS = \@X_CFLAGS\@\n"
450 . "X_LIBS = \@X_LIBS\@\n"
451 . "X_EXTRA_LIBS = \@X_EXTRA_LIBS\@\n"
452 . "X_PRE_LIBS = \@X_PRE_LIBS\@\n");
455 # Check for automatic de-ANSI-fication.
456 $dir_holds_sources = '.o';
457 push (@suffixes, '.c', '.o');
458 push (@clean, 'compile');
460 if (defined $options{'ansi2knr'})
462 if (! $fp_c_prototypes)
464 &am_line_error ('AUTOMAKE_OPTIONS',
465 "option \`ansi2knr' in use but \`fp_C_PROTOTYPES' not in configure.in");
466 &keyed_aclocal_warning ('fp_C_PROTOTYPES');
467 # Only give this error once.
468 $fp_c_prototypes = 1;
471 $dir_holds_sources = '$o';
472 push (@suffixes, '._c', '._o');
474 &require_file_with_line ('AUTOMAKE_OPTIONS', $FOREIGN,
475 'ansi2knr.c', 'ansi2knr.1');
477 $output_vars .= &file_contents ('kr-vars');
478 $output_rules .= &file_contents ('compile-kr');
479 $output_rules .= &file_contents ('clean-kr');
482 &push_phony_cleaners ('kr');
485 return $dir_holds_sources;
488 # Handle SOURCE->OBJECT transform for one program or library.
489 sub handle_source_transform
491 local ($one_file, $obj) = @_;
492 local ($objpat) = $obj;
493 $objpat =~ s/(\W)/\\$1/g;
495 # Look for file_SOURCES and file_OBJECTS.
496 if (defined $contents{$one_file . "_SOURCES"})
498 if (! defined $contents{$one_file . "_OBJECTS"})
500 # Turn sources into objects.
501 local (@files) = split (/\s+/, $contents{$one_file . "_SOURCES"});
502 local (@result) = ();
505 # Skip header files, including C++-ish ones.
508 # Skip things that look like macro references.
509 next if /^\$\(.*\)$/;
510 next if /^\$\{.*\}$/;
511 # Skip things that look like configure substitutions.
514 # One wonders how this can happen. But, apparently,
515 # it can. I believe it happens when nothing precedes
516 # a backslash-newline on a line -- the \s+ regexp
517 # doesn't match the newline. Anyway, skip empty
518 # strings. See tests/depend.test for an example of
519 # how to trigger this code.
524 # Automatically include generated .c file in
526 &push_dist_common ($1 . '.c');
529 # Transform source files into .o files.
532 s/\.[cCmylfs]$/$obj/g;
535 # Transform .o or $o file into .P file (for automatic
538 $dep_files{'$(srcdir)/.deps/' . $_} = 1;
541 &pretty_print ($one_file . "_OBJECTS =", "", @result);
545 &am_line_error ($one_file . '_OBJECTS',
546 $one_file . '_OBJECTS', 'should not be defined');
549 push (@sources, '$(' . $one_file . "_SOURCES)");
550 push (@objects, '$(' . $one_file . "_OBJECTS)");
554 $output_vars .= ($one_file . "_SOURCES = " . $one_file . ".c\n"
555 . $one_file . "_OBJECTS = ". $one_file
557 push (@sources, $one_file . '.c');
558 push (@objects, $one_file . $obj);
559 $dep_files{'$(srcdir)/.deps/' . $one_file . '.P'} = 1;
562 if (defined $contents{'CONFIG_HEADER'})
564 $output_rules .= ('$(' . $one_file . "_OBJECTS): "
565 . $contents{'CONFIG_HEADER'} . "\n");
571 # Special-case @ALLOCA@ and @LIBOBJS@ in _LDADD or _LIBADD variables.
572 sub handle_lib_objects
576 die "programming error in handle_lib_objects"
577 if ! defined $contents{$var};
579 # We recognize certain things that are commonly put in LIBADD or
583 foreach $lsearch (split (/\s+/, $contents{$var}))
585 # Automatically handle @LIBOBJS@ and @ALLOCA@. Basically this
586 # means adding entries to dep_files.
587 if ($lsearch eq '@LIBOBJS@')
589 local ($iter, $rewrite);
590 foreach $iter (keys %libsources)
592 if ($iter ne 'alloca.c')
594 ($rewrite = $iter) =~ s/\.c$/.P/;
595 $dep_files{'$(srcdir)/.deps/' . $rewrite} = 1;
596 &require_file_with_line ($var, $FOREIGN, $iter);
600 elsif ($lsearch eq '@ALLOCA@')
602 &am_line_error ($var,
603 "\@ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'")
604 if ! defined $libsources{'alloca.c'};
605 $dep_files{'$(srcdir)/.deps/alloca.P'} = 1;
606 &require_file_with_line ($var, $FOREIGN, 'alloca.c');
614 local (@proglist) = &am_install_var ('-clean',
615 'programs', 'PROGRAMS',
616 'bin', 'sbin', 'libexec', 'pkglib',
618 return if ! @proglist;
620 # If a program is installed, this is required. We only want this
621 # error to appear once.
622 &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in")
623 unless $seen_arg_prog;
626 local ($obj) = &get_object_extension;
627 local ($one_file, $xname, $munge);
629 foreach $one_file (@proglist)
631 # Canonicalize names.
632 ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c;
633 if ($xname ne $one_file)
636 foreach $xt ('_LDADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES')
638 &am_line_error ($one_file . $xt,
639 "invalid variable \`" . $one_file . $xt
640 . "'; should be \`" . $xname . $xt . "'")
641 if defined $contents{$one_file . $xt};
645 &handle_source_transform ($xname, $obj);
647 if (defined $contents{$xname . "_LDADD"})
649 &handle_lib_objects ($xname . '_LDADD');
653 # User didn't define prog_LDADD override. So do it.
654 $output_vars .= $xname . '_LDADD = $(LDADD)' . "\n";
658 &file_contents_with_transform
659 ('s/\@PROGRAM\@/' . $one_file . '/go;'
660 . 's/\@XPROGRAM\@/' . $xname . '/go;',
664 &handle_lib_objects ('LDADD')
665 if defined $contents{'LDADD'};
671 local (@liblist) = &am_install_var ('-no-all', '-clean',
672 'libraries', 'LIBRARIES',
673 'lib', 'pkglib', 'noinst', 'check');
674 return if ! @liblist;
678 # libtool requires some files.
679 &require_conf_file_with_conf_line ($libtool_line, $FOREIGN,
680 'config.sub', 'config.guess',
683 elsif (! $seen_ranlib)
685 # FIXME need am_line_error here. But we don't know which
686 # variable exists. Must add a loop... No. Must have
687 # am_install_var return a hash. Otherwise the user could add
688 # install directories that we'd never find.
689 &am_error ("library requires either \`AC_PROG_RANLIB' or `gm_PROG_LIBTOOL' in configure.in");
690 # Only get this error once.
694 # Generate _LIBFILES variables. Too bad we can't do this in
696 local ($onedir, $onelib);
698 foreach $onedir ('lib', 'pkglib', 'noinst')
700 if (defined $contents{$onedir . '_LIBRARIES'})
703 foreach $onelib (split (/\s+/, $contents{$onedir . '_LIBRARIES'}))
705 push (@outlist, 'lib' . $onelib . '.a');
707 &pretty_print ($onedir . '_LIBFILES =', "", @outlist);
710 push (@all, '$(LIBFILES)');
712 local ($obj) = &get_object_extension;
714 foreach $onelib (@liblist)
716 if (defined $contents{$onelib . '_LIBADD'})
718 &handle_lib_objects ($onelib . '_LIBADD');
722 # Generate support for conditional object inclusion in
724 $output_vars .= $onelib . "_LIBADD =\n";
727 &handle_source_transform ($onelib, $obj);
730 &file_contents_with_transform ('s/\@LIBRARY\@/' . $onelib . '/go',
734 # Turn "foo" into "libfoo.a" and include macro definition.
735 grep (($_ = 'lib' . $_ . '.a') && 0, @liblist);
737 if (! defined $contents{'LIBFILES'})
739 &pretty_print ('LIBFILES = ', "", @liblist);
744 $output_vars .= ('AR = $(LIBTOOL) archive' . "\n"
745 . 'RANLIB = $(LIBTOOL) ranlib' . "\n"
746 . 'LCOMPILE = $(LIBTOOL) compile $(DEFS) $(INCLUDES)'
747 . ' $(CPPFLAGS) $(CFLAGS)' . "\n");
751 $output_vars .= ('AR = ar' . "\n"
752 . 'RANLIB = @RANLIB@' . "\n");
759 # NOTE we no longer automatically clean SCRIPTS, because it is
760 # useful to sometimes distribute scripts verbatim. This happens
761 # eg in Automake itself.
762 $scripts_installed = &am_install_var ('scripts', 'SCRIPTS',
763 'bin', 'sbin', 'libexec', 'pkgdata',
766 # We really only want a boolean value.
767 $scripts_installed = 1 if $scripts_installed;
769 if ($scripts_installed)
771 # If a program is installed, this is required. We only want this
772 # error to appear once.
773 &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in")
774 unless $seen_arg_prog;
779 # Search a file for a "version.texi" Texinfo include. Return the name
780 # of the include file if found, or the empty string if not. A
781 # "version.texi" file is actually any file whose name matches
783 sub grep_for_vers_texi
785 local ($filename) = @_;
787 if (! open (TEXI, $filename))
789 &am_error ("couldn't open \`$filename': $!");
792 print "automake: reading $filename\n" if $verbose;
796 if (/^\@include\s+(vers[^.]*\.texi)\s*$/)
808 # Handle all Texinfo source.
811 &am_line_error ('TEXINFOS',
812 "\`TEXINFOS' is an anachronism; use \`info_TEXINFOS'")
813 if defined $contents{'TEXINFOS'};
814 return if (! defined $contents{'info_TEXINFOS'}
815 && ! defined $contents{'html_TEXINFOS'});
817 local (@texis) = split (/\s+/, $contents{'info_TEXINFOS'});
819 local (@infos_list, @info_deps_list, @dvis_list, @texi_deps);
820 local ($infobase, $info_cursor);
824 local ($tc_cursor, @texi_cleans);
826 foreach $info_cursor (@texis)
828 ($infobase = $info_cursor) =~ s/\.texi$//;
830 # If 'version.texi' is referenced by input file, then include
831 # automatic versioning capability.
833 = &grep_for_vers_texi ($relative_dir . "/" . $info_cursor);
836 &am_error ("\`$vtexi', included in \`$info_cursor', also included in \`$versions{$vtexi}'")
837 if (defined $versions{$vtexi});
838 $versions{$vtexi} = $info_cursor;
840 # We number the stamp-vti files. This is doable since the
841 # actual names don't matter much. We only number starting
842 # with the second one, so that the common case looks nice.
843 $vti = 'vti' . ($done ? $done : '');
844 &push_dist_common ($vtexi, 'stamp-' . $vti);
848 &require_conf_file_with_line ('info_TEXINFOS', $FOREIGN,
854 &file_contents_with_transform
855 ('s/\@TEXI\@/' . $info_cursor . '/g; '
856 . 's/\@VTI\@/' . $vti . '/g; '
857 . 's/\@VTEXI\@/' . $vtexi . '/g;'
858 . 's,\@MDDIR\@,' . $config_aux_dir . ',g;',
861 &push_phony_cleaners ($vti);
864 # If user specified file_TEXINFOS, then use that as explicit
867 push (@texi_deps, $info_cursor);
868 push (@texi_deps, $vtexi) if $vtexi;
869 if (defined $contents{$infobase . "_TEXINFOS"})
871 push (@texi_deps, "\$" . $infobase . '_TEXINFOS');
872 &push_dist_common ("\$" . $infobase . '_TEXINFOS');
875 $output_rules .= ("\n" . $infobase . ".info: "
876 . join (' ', @texi_deps) . "\n\n");
878 push (@infos_list, $infobase . '.info*');
879 push (@info_deps_list, $infobase . '.info');
880 push (@dvis_list, $infobase . '.dvi');
882 # Generate list of things to clean for this target. We do
883 # this explicitly because otherwise too many things could be
884 # removed. In particular the ".log" extension might
885 # reasonably be used in other contexts by the user.
886 foreach $tc_cursor ('aux', 'cp', 'cps', 'dvi', 'fn', 'fns',
887 'ky', 'log', 'pg', 'toc', 'tp', 'vr', 'op')
889 push (@texi_cleans, $infobase . '.' . $tc_cursor);
894 $output_vars .= &file_contents ('texinfos-vars');
895 $output_rules .= &file_contents ('texinfos');
896 push (@phony, 'install-info', 'uninstall-info');
899 $output_rules .= "\nmostlyclean-info:\n";
900 &pretty_print_rule ("\trm -f", "\t ", @texi_cleans);
901 $output_rules .= ("\nclean-info:\n\ndistclean-info:\n\n"
902 . "maintainer-clean-info:\n\t"
903 . 'rm -f $(INFOS)' . "\n");
904 &push_phony_cleaners ('info');
906 push (@suffixes, '.texi', '.info', '.dvi');
907 push (@uninstall, 'uninstall-info');
908 push (@clean, 'info');
909 push (@info, '$(INFO_DEPS)');
910 push (@dvi, '$(DVIS)');
911 push (@installdirs, '$(infodir)');
912 unshift (@install_data, 'install-info');
914 # Make sure documentation is made and installed first. Use
915 # $(INFO_DEPS), not 'info', because otherwise recursive makes get
916 # run twice during "make all".
917 unshift (@all, '$(INFO_DEPS)');
919 $output_vars .= ("INFOS = " . join (' ', @infos_list) . "\n"
920 . "INFO_DEPS = " . join (' ', @info_deps_list) . "\n"
921 . "DVIS = " . join (' ', @dvis_list) . "\n"
922 # This next isn't strictly needed now -- the
923 # places that look here could easily be changed
924 # to look in info_TEXINFOS. But this is probably
925 # better, in case noinst_TEXINFOS is ever
927 . "TEXINFOS = " . $contents{'info_TEXINFOS'} . "\n\n");
929 # Do some error checking.
930 &require_file_with_line ('info_TEXINFOS', $FOREIGN, 'texinfo.tex');
933 # Handle any man pages.
936 &am_line_error ('MANS', "\`MANS' is an anachronism; use \`man_MANS'")
937 if defined $contents{'MANS'};
938 return if ! defined $contents{'man_MANS'};
940 # We generate the manpage install code by hand to avoid the use of
941 # basename in the generated Makefile.
942 local (@mans) = split (/\s+/, $contents{'man_MANS'});
943 local (%sections, %inames, %secmap, %fullsecmap);
946 # FIXME: statement without effect:
947 /^(.*)\.([0-9])([a-z]*)$/;
951 $fullsecmap{$1} = $2 . $3;
954 # We don't really need this, but we use it in case we ever want to
955 # support noinst_MANS.
956 $output_vars .= "MANS = " . $contents{'man_MANS'} . "\n";
958 # Generate list of install dirs.
959 $output_rules .= "install-man: \$(MANS)\n";
960 foreach (keys %sections)
962 push (@installdirs, '$(mandir)/man' . $_);
963 $output_rules .= ("\t" . $config_aux_dir
964 . 'mkinstalldirs $(mandir)/man'
967 push (@phony, 'install-man');
969 # Generate install target.
971 foreach $key (keys %inames)
973 $_ = $install_man_format;
974 s/\@SECTION\@/$secmap{$key}/g;
975 s/\@MAN\@/$inames{$key}/g;
976 s/\@FULLSECT\@/$fullsecmap{$key}/g;
977 s/\@MANBASE\@/$key/g;
980 $output_rules .= "\n";
982 $output_rules .= "uninstall-man:\n";
983 foreach $key (keys %inames)
985 $_ = $uninstall_man_format;
986 s/\@SECTION\@/$secmap{$key}/g;
987 s/\@MAN\@/$inames{$key}/g;
988 s/\@FULLSECT\@/$fullsecmap{$key}/g;
989 s/\@MANBASE\@/$key/g;
992 $output_rules .= "\n";
993 push (@phony, 'uninstall-man');
995 $output_vars .= &file_contents ('mans-vars');
997 if (! defined $options{'no-installman'})
999 push (@install_data, 'install-man');
1000 push (@uninstall, 'uninstall-man');
1001 push (@all, '$(MANS)');
1005 # Handle DATA variables.
1008 &am_install_var ('data', 'DATA', 'data', 'sysconf',
1009 'sharedstate', 'localstate', 'pkgdata',
1016 local ($tagging) = 0;
1018 push (@phony, 'tags');
1019 if (defined $contents{'SUBDIRS'})
1021 $output_rules .= &file_contents ('tags');
1024 elsif ($dir_holds_sources || defined $contents{'ETAGS_ARGS'})
1026 $output_rules .= &file_contents ('tags-subd');
1032 $output_rules .= &file_contents ('tags-clean');
1033 push (@clean, 'tags');
1034 &push_phony_cleaners ('tags');
1038 # Every Makefile must define some sort of TAGS rule.
1039 # Otherwise, it would be possible for a top-level "make TAGS"
1040 # to fail because some subdirectory failed.
1041 $output_rules .= "tags: TAGS\nTAGS:\n\n";
1045 # Generate actual 'dist' (or dist-shar) rule.
1046 sub handle_dist_worker
1048 local ($distshar) = @_;
1049 local ($target) = $distshar ? 'dist-shar' : 'dist';
1051 $output_rules .= $target . ': $(DEP_DISTFILES)' . "\n";
1053 # Initialization; only at top level.
1054 if ($relative_dir eq '.')
1056 if ($strictness >= $GNITS)
1058 # For Gnits users, this is pretty handy. Look at 15 lines
1059 # in case some explanatory text is desirable.
1060 $output_rules .= ' @if sed 15q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \\
1061 echo "NEWS not updated; not releasing" 1>&2; \\
1069 # Create dist directory.
1072 chmod 777 $(distdir)
1075 # Only run automake in `dist' target if --include-deps not
1076 # specified. That way the recipient of a distribution can run
1077 # "make dist" and not need Automake.
1078 if ($cmdline_use_dependencies)
1082 # We need an absolute path for --output-dir. Thus the
1084 ' distdir=`cd $(distdir) && pwd` \\
1086 && automake --include-deps --output-dir=$$distdir --strictness='
1087 # Set strictness of output.
1088 . $strictness_name . "\n"
1093 # In loop, test for file existence because sometimes a file gets
1094 # included in DISTFILES twice. For example this happens when a
1095 # single source file is used in building more than one program.
1096 # Also, there are situations in which "ln" can fail. For instance
1097 # a file to distribute could actually be a cross-filesystem
1098 # symlink -- this can easily happen if "gettextize" was run on the
1099 # distribution. Note that DISTFILES can contain a wildcard (for
1100 # info files, sigh), so we must use the echo trick.
1101 $output_rules .= ' @for file in `cd $(srcdir) && echo $(DISTFILES)`; do \\
1102 test -f $(distdir)/$$file \\
1103 || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \\
1104 || cp -p $(srcdir)/$$file $(distdir)/$$file; \\
1108 # If we have SUBDIRS, create all dist subdirectories and do
1110 if (defined $contents{'SUBDIRS'})
1112 # Test for directory existence here because previous automake
1113 # invocation might have created some directories.
1114 $output_rules .= ' for subdir in $(SUBDIRS); do \\
1115 test -d $(distdir)/$$subdir \\
1116 || mkdir $(distdir)/$$subdir \\
1118 chmod 777 $(distdir)/$$subdir; \\
1119 (cd $$subdir && $(MAKE) dist) || exit 1; \\
1124 # If the target `dist-local' exists, run it now. This allows
1125 # users to do random weird things to the distribution before it is
1127 if (defined $contents{'dist-local'})
1129 $output_rules .= "\t\$(MAKE) dist-local\n";
1133 if ($relative_dir eq '.')
1135 $output_rules .= ' chmod -R a+r $(distdir)' . "\n\t";
1138 $output_rules .= 'shar $(distdir) | gzip > $(distdir).shar.gz';
1142 $output_rules .= 'tar chozf $(distdir).tar.gz $(distdir)';
1144 $output_rules .= "\n\t" . 'rm -rf $(distdir)' . "\n";
1147 push (@phony, $target);
1150 # Handle 'dist' target.
1153 # Set up maint_charset.
1154 $local_maint_charset = $contents{'MAINT_CHARSET'}
1155 if defined $contents{'MAINT_CHARSET'};
1156 $maint_charset = $local_maint_charset
1157 if $relative_dir eq '.';
1159 if (defined $contents{'DIST_CHARSET'})
1161 &am_line_error ('DIST_CHARSET',
1162 "DIST_CHARSET defined but no MAINT_CHARSET defined")
1163 if ! $local_maint_charset;
1164 if ($relative_dir eq '.')
1166 $dist_charset = $contents{'DIST_CHARSET'}
1170 &am_line_error ('DIST_CHARSET',
1171 "DIST_CHARSET can only be defined at top level");
1175 # Look for common files that should be included in distribution.
1177 foreach $cfile (@common_files)
1179 if (-f ($relative_dir . "/" . $cfile))
1181 &push_dist_common ($cfile);
1185 # Keys of %dist_common are names of files to distributed. We put
1186 # README first because it then becomes easier to make a
1187 # Usenet-compliant shar file (in these, README must be first).
1188 # FIXME do more ordering of files here.
1190 if (defined $dist_common{'README'})
1192 push (@coms, 'README');
1193 undef $dist_common{'README'};
1195 push (@coms, sort keys %dist_common);
1197 &pretty_print ("DIST_COMMON =", "", @coms);
1198 $output_vars .= "\n";
1201 $output_vars .= &file_contents ('dist-vars');
1203 # Put these things in rules section so it is easier for whoever
1204 # reads Makefile.in.
1205 if ($relative_dir eq '.')
1207 $output_rules .= "\n" . 'distdir = $(PACKAGE)-$(VERSION)' . "\n";
1211 $output_rules .= ("\nsubdir = " . $relative_dir . "\n"
1212 . 'distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)'
1216 # Generate 'dist' target, and maybe dist-shar.
1217 &handle_dist_worker (0);
1218 &handle_dist_worker (1) if defined $options{'dist-shar'};
1221 # Handle auto-dependency code.
1222 sub handle_dependencies
1224 if ($use_dependencies)
1226 # Include GNU-make-specific auto-dep code.
1227 if ($dir_holds_sources)
1229 &pretty_print ('DEP_FILES =', "", sort keys %dep_files);
1230 $output_rules .= &file_contents ('depend');
1235 # Include any auto-generated deps that are present.
1236 if (-d ($relative_dir . "/.deps") && -f ($relative_dir . "/.deps/.P"))
1239 local ($gpat) = $relative_dir . "/.deps/*.P";
1241 foreach $depfile (<${gpat}>)
1243 if (! open (DEP_FILE, $depfile))
1245 &am_error ("couldn't open \`$depfile': $!");
1248 print "automake: reading $depfile\n" if $verbose;
1250 # Slurp entire file.
1251 $output_rules .= join ('', <DEP_FILE>);
1256 $output_rules .= "\n";
1261 # Handle subdirectories.
1264 if (! defined $contents{'SUBDIRS'})
1267 ("ud_GNU_GETTEXT in configure.in but SUBDIRS not defined")
1268 if $seen_gettext && $relative_dir eq '.';
1272 &require_file_with_conf_line ($ac_gettext_line, $FOREIGN, 'ABOUT-NLS')
1275 return if ! defined $contents{'SUBDIRS'};
1277 # Make sure each directory mentioned in SUBDIRS actually exists.
1279 foreach $dir (split (/\s+/, $contents{'SUBDIRS'}))
1281 # Skip directories substituted by configure.
1282 next if $dir =~ /^\@.*\@$/;
1283 &am_line_error ('SUBDIRS',
1284 "required directory $relative_dir/$dir does not exist")
1285 if ! -d $relative_dir . '/' . $dir;
1288 $output_rules .= &file_contents ('subdirs');
1290 # Push a bunch of phony targets.
1292 foreach $phonies ('-data', '-exec', 'dirs')
1294 push (@phony, 'install' . $phonies . '-recursive');
1295 push (@phony, 'uninstall' . $phonies . '-recursive');
1297 foreach $phonies ('all', 'check', 'installcheck', 'info', 'dvi')
1299 push (@phony, $phonies . '-recursive');
1301 &push_phony_cleaners ('recursive');
1303 push (@check, "check-recursive");
1304 push (@installcheck, "installcheck-recursive");
1305 push (@info, "info-recursive");
1306 push (@dvi, "dvi-recursive");
1308 $recursive_install = 1;
1311 # Handle remaking and configure stuff.
1312 sub handle_configure
1314 # If SUBDIRS defined, require AC_PROG_MAKE_SET.
1315 &am_line_error ('SUBDIRS', "AC_PROG_MAKE_SET must be used in configure.in")
1316 if defined $contents{'SUBDIRS'} && ! $seen_make_set;
1318 local ($top_reldir);
1319 if ($relative_dir ne '.')
1322 $output_rules .= &file_contents ('remake-subd');
1323 $top_reldir = '../';
1327 if (-f 'aclocal.m4')
1329 $output_vars .= "ACLOCAL = aclocal.m4\n";
1330 &push_dist_common ('aclocal.m4');
1332 $output_rules .= &file_contents ('remake');
1334 # Look for some files we need.
1335 &require_config_file ($FOREIGN, 'install-sh', 'mkinstalldirs');
1338 ("\`install.sh' is an anachronism; use \`install-sh' instead")
1339 if -f $relative_dir . '/install.sh';
1341 # If we have a configure header, require it.
1344 # FIXME this restriction should be lifted.
1345 # FIXME first see if it is even needed as-is.
1346 &am_conf_line_error ($config_header_line,
1347 "argument to AC_CONFIG_HEADER contains \`/'\n")
1348 if ($config_header =~ /\//);
1350 &require_file_with_conf_line ($config_header_line,
1351 $FOREIGN, $config_header);
1353 # Header defined and in this directory.
1354 if (-f 'acconfig.h')
1356 $output_vars .= "ACCONFIG = acconfig.h\n";
1357 &push_dist_common ('acconfig.h');
1359 if (-f $config_name . '.top')
1361 $output_vars .= "CONFIG_TOP = ${config_name}.top\n";
1362 &push_dist_common ($config_name . '.top');
1364 if (-f $config_name . '.bot')
1366 $output_vars .= "CONFIG_BOT = ${config_name}.bot\n";
1367 &push_dist_common ($config_name . '.bot');
1370 &push_dist_common ('stamp-h.in');
1372 $output_rules .= &file_contents ('remake-hdr');
1373 $output_vars .= "CONFIG_HEADER_IN = ${config_header}\n";
1379 &am_line_error ('CONFIG_HEADER',
1380 "\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'")
1381 if defined $contents{'CONFIG_HEADER'};
1383 # Generate CONFIG_HEADER define, and define interally.
1384 $output_vars .= "CONFIG_HEADER = ${top_builddir}/${config_name}\n"
1386 $contents{'CONFIG_HEADER'} = "${top_builddir}/${config_name}"
1389 # Now look for other files in this directory which must be remade
1390 # by config.status, and generate rules for them.
1391 local ($file, $local, $input);
1392 foreach $file (@other_input_files)
1394 # Skip files not in this directory, any Makefile, and the
1395 # config header. These last two must be handled specially.
1396 next unless &dirname ($file) eq $relative_dir;
1397 next if $file eq $top_builddir . '/' . $config_name;
1398 ($local = $file) =~ s/^.*\///;
1399 next if $local eq 'Makefile';
1401 if ($local =~ /^(.*):(.*)$/)
1403 # This is the ":" syntax of AC_OUTPUT.
1410 $input = $local . '.in';
1412 # FIXME when using autoconf ":" syntax, should we set CONFIG_FILES
1414 $output_rules .= ($local . ': '
1415 . '$(top_builddir)/config.status ' . $input . "\n"
1417 . 'cd $(top_builddir) && CONFIG_FILES='
1418 . ($relative_dir eq '.' ? '' : '$(subdir)/')
1419 . '$@ CONFIG_HEADERS= ./config.status'
1422 &require_file_with_conf_line ($ac_output_line, $FOREIGN,
1430 &am_install_var ('header', 'HEADERS', 'include',
1431 'oldinclude', 'pkginclude',
1437 return if ! $seen_gettext || $relative_dir ne '.';
1439 # As of 0.10.6, gettext still wants @INTLSUB@ and @POSUB@ in
1440 # SUBDIRS. This is going to change in a future version. So for
1441 # now we simply do no checking.
1442 if (0 && defined $contents{'SUBDIRS'})
1446 "ud_GNU_GETTEXT in configure.in but \`po' not in SUBDIRS")
1447 if $contents{'SUBDIRS'} !~ /\bpo\b/;
1450 "ud_GNU_GETTEXT in configure.in but \`intl' not in SUBDIRS")
1451 if $contents{'SUBDIRS'} !~ /\bintl\b/;
1454 # Ensure that each language in ALL_LINGUAS has a .po file, and
1455 # each po file is mentioned in ALL_LINGUAS.
1458 local (%linguas) = ();
1459 grep ($linguas{$_} = 1, split (/\s+/, $all_linguas));
1466 &am_line_error ($all_linguas_line,
1467 ("po/$_.po exists but \`$_' not in \`ALL_LINGUAS'"))
1471 foreach (keys %linguas)
1473 &am_line_error ($all_linguas_line,
1474 "$_ in \`ALL_LINGUAS' but po/$_.po does not exist")
1480 &am_error ("ud_GNU_GETTEXT in configure.in but \`ALL_LINGUAS' not defined");
1484 # Handle footer elements.
1487 if ($contents{'SOURCES'})
1489 &pretty_print ('SOURCES =', "",
1490 split (/\s+/, $contents{'SOURCES'}));
1492 if ($contents{'OBJECTS'})
1494 &pretty_print ('OBJECTS =', "",
1495 split (/\s+/, $contents{'OBJECTS'}));
1497 if ($contents{'SOURCES'} || $contents{'OBJECTS'})
1499 $output_vars .= "\n";
1502 if (defined $contents{'SUFFIXES'})
1504 push (@suffixes, '$(SUFFIXES)');
1507 $output_trailer .= ".SUFFIXES:\n";
1510 $output_trailer .= ".SUFFIXES: " . join (' ', @suffixes) . "\n";
1512 $output_trailer .= &file_contents ('footer');
1515 # Deal with installdirs target.
1516 sub handle_installdirs
1518 # GNU Makefile standards recommend this.
1519 $output_rules .= ("installdirs:"
1520 . ($recursive_install
1521 ? " installdirs-recursive\n"
1523 push (@phony, 'installdirs');
1526 &pretty_print_rule ("\t$config_aux_dir/mkinstalldirs ", "\t\t",
1529 $output_rules .= "\n";
1532 # There are several targets which need to be merged. This is because
1533 # their complete definition is compiled from many parts. Note that we
1534 # avoid double colon rules, otherwise we'd use them instead.
1535 sub handle_merge_targets
1537 push (@all, 'Makefile');
1538 push (@all, $config_name)
1539 if $config_name && &dirname ($config_name) eq $relative_dir;
1541 &do_one_merge_target ('info', @info);
1542 &do_one_merge_target ('dvi', @dvi);
1544 if (! defined $contents{'SUBDIRS'} || $relative_dir ne '.')
1546 # 'check' must depend on 'all', but not at top level.
1548 unshift (@check, 'all');
1549 unshift (@install, 'all');
1551 &do_one_merge_target ('check', @check);
1552 &do_one_merge_target ('installcheck', @installcheck);
1554 # Handle the various install targets specially. We do this so
1555 # that (eg) "make install-exec" will run "install-exec-recursive"
1556 # if required, but "make install" won't run it twice. Step one is
1557 # to see if the user specified local versions of any of the
1558 # targets we handle. "all" is treated as one of these since
1559 # "install" can run it.
1560 push (@install_exec, 'install-exec-local')
1561 if defined $contents{'install-exec-local'};
1562 push (@install_data, 'install-data-local')
1563 if defined $contents{'install-data-local'};
1564 push (@uninstall, 'uninstall-local')
1565 if defined $contents{'uninstall-local'};
1566 push (@all, 'all-local')
1567 if defined $contents{'all-local'};
1569 if (defined $contents{'install-local'})
1571 &am_line_error ('install-local',
1572 "use \`install-data' or \`install-exec', not \`install'");
1575 # Step two: if we are doing recursive makes, write out the
1576 # appropriate rules.
1578 if ($recursive_install)
1580 push (@install, 'install-recursive');
1584 $output_rules .= ('all-am: '
1587 @all = ('all-recursive', 'all-am');
1588 push (@phony, 'all-am');
1592 @all = ('all-recursive');
1596 $output_rules .= ('install-exec-am: '
1597 . join (' ', @install_exec)
1599 @install_exec = ('install-exec-recursive', 'install-exec-am');
1600 push (@install, 'install-exec-am');
1601 push (@phony, 'install-exec-am');
1605 @install_exec = ('install-exec-recursive');
1609 $output_rules .= ('install-data-am: '
1610 . join (' ', @install_data)
1612 @install_data = ('install-data-recursive', 'install-data-am');
1613 push (@install, 'install-data-am');
1614 push (@phony, 'install-data-am');
1618 @install_data = ('install-data-recursive');
1622 $output_rules .= ('uninstall-am: '
1623 . join (' ', @uninstall)
1625 @uninstall = ('uninstall-recursive', 'uninstall-am');
1626 push (@phony, 'uninstall-am');
1630 @uninstall = ('uninstall-recursive');
1634 # Step three: print definitions users can use.
1635 $output_rules .= ("install-exec: "
1636 . join (' ', @install_exec)
1638 push (@install, 'install-exec') if !$recursive_install;
1639 push (@phony, 'install-exec');
1641 $output_rules .= ("install-data: "
1642 . join (' ', @install_data)
1644 push (@install, 'install-data') if !$recursive_install;
1645 push (@phony, 'install-data');
1647 # If no dependencies for 'install', add 'all'. Why? That way
1648 # "make install" at top level of distclean'd distribution won't
1649 # fail because stuff in 'lib' fails to build.
1650 push (@install, 'all') if ! @install;
1651 $output_rules .= ('install: '
1652 . join (' ', @install)
1653 # Use "@:" as empty command so nothing prints.
1657 . join (' ', @uninstall)
1659 push (@phony, 'install', 'uninstall');
1661 $output_rules .= ('all: '
1664 push (@phony, 'all');
1666 # Generate the new 'install-strip' target.
1667 $output_rules .= ("install-strip:\n\t"
1668 . '$(MAKE) INSTALL_PROGRAM=\'$(INSTALL_PROGRAM) -s\' install'
1672 # Helper for handle_merge_targets.
1673 sub do_one_merge_target
1675 local ($name, @values) = @_;
1677 if (defined $contents{$name . '-local'})
1679 # User defined local form of target. So include it.
1680 push (@values, $name . '-local');
1681 push (@phony, $name . '-local');
1684 $output_rules .= $name . ":";
1687 $output_rules .= ' ' . join (' ', @values);
1689 $output_rules .= "\n\n";
1690 push (@phony, $name);
1693 # Handle all 'clean' targets.
1696 push (@clean, 'generic');
1697 $output_rules .= &file_contents ('clean');
1698 &push_phony_cleaners ('generic');
1700 local ($target) = $recursive_install ? 'clean-am' : 'clean';
1701 &do_one_clean_target ($target, 'mostly', '', @clean);
1702 &do_one_clean_target ($target, '', 'mostly', @clean);
1703 &do_one_clean_target ($target, 'dist', '', @clean);
1704 &do_one_clean_target ($target, 'maintainer-', 'dist', @clean);
1706 push (@phony, 'clean', 'mostlyclean', 'distclean', 'maintainer-clean');
1709 if ($recursive_install)
1711 @deps = ('am', 'recursive');
1712 &do_one_clean_target ('', 'mostly', '', @deps);
1713 &do_one_clean_target ('', '', '', @deps);
1714 &do_one_clean_target ('', 'dist', '', @deps);
1715 &do_one_clean_target ('', 'maintainer-', '', @deps);
1719 # Helper for handle_clean.
1720 sub do_one_clean_target
1722 local ($target, $name, $last_name, @deps) = @_;
1724 # Special case: if target not passed, then don't generate
1725 # dependency on next "lower" clean target (eg no
1726 # clean<-mostlyclean derivation). In this case the target is
1727 # implicitly known to be 'clean'.
1728 local ($flag) = $target;
1729 $target = 'clean' if ! $flag;
1731 grep (($_ = $name . 'clean-' . $_) && 0, @deps);
1734 if ($last_name || $name ne 'mostly')
1736 push (@deps, $last_name . $target . " ");
1739 # FIXME not sure if I like the tabs here.
1740 &pretty_print_rule ($name . $target . ": ", "\t\t", @deps);
1742 # FIXME shouldn't we really print these messages before running
1744 if ($name . $target eq 'maintainer-clean')
1746 # Print a special warning.
1748 ("\t\@echo \"This command is intended for maintainers to use;\"\n"
1749 . "\t\@echo \"it deletes files that may require special "
1750 . "tools to rebuild.\"\n");
1752 $output_rules .= "\trm -f config.status\n"
1753 if $relative_dir eq '.';
1755 elsif ($name . $target eq 'distclean')
1757 $output_rules .= "\trm -f config.status\n";
1759 $output_rules .= "\n";
1762 # Handle .PHONY target.
1765 &pretty_print_rule ('.PHONY:', "", @phony);
1766 $output_rules .= "\n";
1769 # Handle TESTS variable.
1772 return if ! defined $contents{'TESTS'};
1774 &push_dist_common (split (/\s+/, $contents{'TESTS'}));
1775 push (@check, 'check-TESTS');
1776 push (@phony, 'check-TESTS');
1777 # FIXME use $(SHELL) here? That is what Ulrich suggests. Maybe a
1778 # new macro, $(TEST_SHELL), a la $(CONFIG_SHELL)? For now we just
1779 # execute the file directly; this allows test files which are
1780 # compiled -- a possibly useful feature.
1781 $output_rules .= 'check-TESTS:
1782 @failed=0; all=0; \\
1783 srcdir=$(srcdir); export srcdir; \\
1784 for tst in $(TESTS); do \\
1785 all=`expr $$all + 1`; \\
1786 if test -f $$tst; then dir=.; \\
1787 else dir="$(srcdir)"; fi; \\
1788 if $$dir/$$tst; then \\
1789 echo "PASS: $$tst"; \\
1791 failed=`expr $$failed + 1`; \\
1792 echo "FAIL: $$tst"; \\
1795 if test "$$failed" -eq 0; then \\
1796 echo "========================"; \\
1797 echo "All $$all tests passed"; \\
1798 echo "========================"; \\
1800 echo "$$failed of $$all tests failed"; \\
1805 ################################################################
1807 # Scan configure.in for interesting things.
1808 # FIXME ensure VERSION, PACKAGE are set.
1811 open (CONFIGURE, 'configure.in')
1812 || die "automake: couldn't open \`configure.in': $!\n";
1813 print "automake: reading configure.in\n" if $verbose;
1815 # Reinitialize libsources here. This isn't really necessary,
1816 # since we currently assume there is only one configure.in. But
1817 # that won't always be the case.
1820 local ($in_ac_output, @make_list) = 0;
1821 local ($libobj_iter);
1824 # Remove comments from current line.
1828 # Populate libobjs array.
1829 if (/AC_FUNC_ALLOCA/)
1831 $libsources{'alloca.c'} = 1;
1833 elsif (/AC_FUNC_GETLOADAVG/)
1835 $libsources{'getloadavg.c'} = 1;
1837 elsif (/AC_FUNC_MEMCMP/)
1839 $libsources{'memcmp.c'} = 1;
1841 elsif (/AC_STRUCT_ST_BLOCKS/)
1843 $libsources{'fileblocks.c'} = 1;
1845 elsif (/(AC|fp)_FUNC_FNMATCH/)
1847 # AC_FUNC_FNMATCH is just wishful thinking at this point.
1848 $libsources{'fnmatch.c'} = 1;
1850 elsif (/AC_REPLACE_FUNCS\s*\((.*)\)/)
1852 foreach (split (/\s+/, $1))
1854 $libsources{$_ . '.c'} = 1;
1857 elsif (/LIBOBJS="(.*)\s+\$LIBOBJS"/
1858 || /LIBOBJS="\$LIBOBJS\s+(.*)"/)
1860 foreach $libobj_iter (split (/\s+/, $1))
1862 if ($libobj_iter =~ /^(.*)\.o$/)
1864 $libsources{$1 . '.c'} = 1;
1869 # Process the AC_OUTPUT macro.
1870 if (! $in_ac_output && s/AC_OUTPUT\s*\(\[?//)
1873 $ac_output_line = $.;
1877 $in_ac_output = 0 if s/[\]\),].*$//;
1879 # Look at potential Makefile.am's.
1885 push (@make_list, $_);
1889 push (@other_input_files, $_);
1894 if (/AC_CONFIG_AUX_DIR\(([^)]+)\)/)
1896 @config_aux_path = $1;
1899 # Check for ansi2knr.
1900 $fp_c_prototypes = 1 if /fp_C_PROTOTYPES/;
1902 # Check for NLS support.
1903 if (/ud_GNU_GETTEXT/)
1906 $ac_gettext_line = $.;
1909 # Look for ALL_LINGUAS.
1910 if (/ALL_LINGUAS="(.*)"$/ || /ALL_LINGUAS=(.*)$/)
1914 $all_linguas_line = $.;
1917 # Handle configuration headers.
1918 if (/AC_CONFIG_HEADER\s*\((.*)\)/)
1920 $config_header_line = $.;
1922 if ($config_name =~ /^([^:]+):(.+)$/)
1925 $config_header = $2;
1929 $config_header = $config_name . '.in';
1933 $seen_canonical = 1 if /AC_CANONICAL_(HOST|SYSTEM)/;
1934 $seen_canonical = 1 if /AC_CHECK_TOOL/;
1935 $seen_path_xtra = 1 if /AC_PATH_XTRA/;
1937 # Sometimes it is desirable to explicitly set YACC. For
1938 # instance some people don't want to use bison.
1939 $seen_prog_yacc = 1 if (/AC_PROG_YACC/
1940 || /AC_SUBST\(YACC\)/
1941 || /AC_(PATH|CHECK)_PROGS?\(YACC/);
1943 # Some things required by Automake.
1944 $seen_make_set = 1 if /AC_PROG_MAKE_SET/;
1945 $seen_prog_install = 1 if ! $seen_prog_install && /AC_PROG_INSTALL/;
1946 $seen_prog_install = 2 if ! $seen_prog_install && /fp_PROG_INSTALL/;
1947 $seen_arg_prog = 1 if /AC_ARG_PROGRAM/;
1948 $seen_ranlib = 1 if /AC_PROG_RANLIB/;
1950 if (/AC_PROG_LIBTOOL/ || /gm_PROG_LIBTOOL/)
1957 # Set input files if not specified by user.
1958 @input_files = @make_list if (! @input_files);
1963 ################################################################
1965 # Do any extra checking for GNU standards.
1966 sub check_gnu_standards
1968 &require_file ($GNU, 'ChangeLog');
1970 if ($relative_dir eq '.')
1972 # In top level (or only) directory.
1973 &require_file ($GNU, 'INSTALL', 'NEWS', 'README', 'COPYING',
1978 # Do any extra checking for GNITS standards.
1979 sub check_gnits_standards
1981 if ($strictness >= $GNITS && -f $relative_dir . '/COPYING.LIB')
1984 ("\`${relative_dir}/COPYING.LIB' disallowed by Gnits standards");
1987 if ($relative_dir eq '.')
1989 # In top level (or only) directory.
1990 &require_file ($GNITS, 'THANKS');
1994 ################################################################
1996 # Pretty-print something. HEAD is what should be printed at the
1997 # beginning of the first line, FILL is what should be printed at the
1998 # beginning of every subsequent line.
1999 sub pretty_print_internal
2001 local ($head, $fill, @values) = @_;
2003 local ($column) = length ($head);
2004 local ($result) = $head;
2006 # Fill length is number of characters. However, each Tab
2007 # character counts for eight. So we count the number of Tabs and
2009 local ($fill_length) = length ($fill);
2010 $fill_length += 7 * ($fill =~ tr/\t/\t/d);
2015 # "71" because we also print a space.
2016 if ($column + length ($_) > 71)
2018 $result .= " \\\n" . $fill;
2019 $column = $fill_length;
2023 $result .= ' ' unless ($bol);
2025 $column += length ($_) + 1;
2033 # Pretty-print something and append to output_vars.
2036 $output_vars .= &pretty_print_internal (@_);
2039 # Pretty-print something and append to output_rules.
2040 sub pretty_print_rule
2042 $output_rules .= &pretty_print_internal (@_);
2046 ################################################################
2048 # Read Makefile.am and set up %contents. Simultaneously copy lines
2049 # from Makefile.am into $output_trailer or $output_vars as
2050 # appropriate. NOTE we put rules in the trailer section. We want
2051 # user rules to come after our generated stuff.
2054 local ($amfile) = @_;
2056 # Compute relative location of the top object directory.
2057 local (@topdir) = ();
2058 foreach (split (/\//, $relative_dir))
2060 next if $_ eq '.' || $_ eq '';
2067 push (@topdir, '..');
2070 @topdir = ('.') if ! @topdir;
2072 $top_builddir = join ('/', @topdir);
2074 ($build_rx = $top_builddir) =~ s/(\W)/\\$1/g;
2075 local ($header_vars) =
2076 &file_contents_with_transform
2077 ('s/\@top_builddir\@/' . $build_rx . '/g',
2080 open (AM_FILE, $amfile) || die "automake: couldn't open \`$amfile': $!\n";
2081 print "automake: reading $amfile\n" if $verbose;
2083 $output_vars .= ("# Makefile.in generated automatically by automake "
2084 . $VERSION . " from Makefile.am\n");
2086 # Generate copyright for generated Makefile.in.
2087 $output_vars .= $gen_copyright;
2089 local ($saw_bk) = 0;
2090 local ($was_rule) = 0;
2091 local ($spacing) = '';
2092 local ($comment) = '';
2093 local ($last_var_name) = '';
2097 if (/$IGNORE_PATTERN/o)
2099 # Merely delete comments beginning with two hashes.
2101 elsif (/$WHITE_PATTERN/o)
2103 # Stick a single white line before the incoming macro or rule.
2106 elsif (/$COMMENT_PATTERN/o)
2108 # Stick comments before the incoming macro or rule.
2109 $comment .= $spacing . $_;
2118 $output_vars .= $comment . "\n" . $header_vars;
2122 local ($is_ok_macro);
2125 if (/$IGNORE_PATTERN/o)
2127 # Merely delete comments beginning with two hashes.
2129 elsif (/$WHITE_PATTERN/o)
2131 # Stick a single white line before the incoming macro or rule.
2134 elsif (/$COMMENT_PATTERN/o)
2136 # Stick comments before the incoming macro or rule.
2137 $comment .= $spacing . $_;
2144 $output_trailer .= $_;
2151 # Chop newline and backslash if this line is
2152 # continued. FIXME maybe ensure trailing whitespace
2156 $contents{$last_var_name} .= $_;
2159 elsif (/$RULE_PATTERN/o)
2161 # warn "** Saw rule .$1.\n";
2164 # Value here doesn't matter; for targets we only note
2167 $content_lines{$1} = $.;
2168 $output_trailer .= $comment . $spacing . $_;
2169 $comment = $spacing = '';
2172 elsif (($is_ok_macro = /$MACRO_PATTERN/o)
2173 || /$BOGUS_MACRO_PATTERN/o)
2175 # Found a macro definition.
2177 $last_var_name = $1;
2178 if (substr ($2, -1) eq "\\")
2180 $contents{$1} = substr ($2, 0, length ($2) - 1);
2186 $content_lines{$1} = $.;
2187 $output_vars .= $comment . $spacing . $_;
2188 $comment = $spacing = '';
2192 &am_line_error ($., "bad macro name \`$1'")
2197 # This isn't an error; it is probably a continued rule.
2198 # In fact, this is what we assume.
2200 $output_trailer .= $comment . $spacing . $_;
2201 $comment = $spacing = '';
2208 $output_trailer .= $comment;
2211 ################################################################
2213 sub initialize_global_constants
2215 # Associative array of standard directory names. Entry is TRUE if
2216 # corresponding directory should be installed during
2217 # 'install-exec' phase.
2235 # Helper text for dealing with man pages.
2236 $install_man_format =
2237 ' @sect=@SECTION@; \\
2238 inst=`echo "@MANBASE@" | sed \'$(transform)\'`.@FULLSECT@; \\
2239 echo installing @MAN@ as $(mandir)/man$$sect/$$inst; \\
2240 $(INSTALL_DATA) $(srcdir)/@MAN@ $(mandir)/man$$sect/$$inst
2243 $uninstall_man_format =
2244 ' inst=`echo "@MANBASE@" | sed \'$(transform)\'`.@FULLSECT@; \\
2245 rm -f $(mandir)/man@SECTION@/$$inst
2248 # Commonly found files we look for and automatically include in
2252 "README", "THANKS", "TODO", "NEWS", "COPYING", "COPYING.LIB",
2253 "INSTALL", "ABOUT-NLS", "ChangeLog", "configure", "configure.in",
2254 "config.guess", "config.sub", "AUTHORS", "BACKLOG", "ABOUT-GNU"
2257 # Commonly used files we auto-include, but only sometimes.
2260 "version.texi", "aclocal.m4", "acconfig.h", "config.h.top",
2261 "config.h.bot", "stamp-h.in", "mdate-sh", "ansi2knr.c",
2262 "ansi2knr.1", 'stamp-vti', "mkinstalldirs", "install-sh"
2266 --amdir=DIR directory storing config files
2267 --foreign same as --strictness=foreign
2268 --gnits same as --strictness=gnits
2269 --gnu same as --strictness=gnu
2270 --help print this help, then exit
2271 --include-deps include generated dependencies in Makefile.in
2272 --add-missing add missing standard files to package
2273 --output-dir=DIR put generated Makefile.in's into DIR
2274 --strictness=LEVEL set strictness level. LEVEL is foreign, gnu, gnits
2275 --verbose verbosely list files processed
2276 --version print version number, then exit\n";
2278 # Copyright on generated Makefile.ins.
2280 # Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
2281 # This Makefile.in is free software; the Free Software Foundation
2282 # gives unlimited permission to copy, distribute and modify it.
2286 # (Re)-Initialize per-Makefile.am variables.
2287 sub initialize_per_input
2289 # These two variables are used when generating each Makefile.in.
2290 # They hold the Makefile.in until it is ready to be printed.
2293 $output_trailer = '';
2295 # Suffixes found during a run.
2298 # This holds the contents of a Makefile.am, as parsed by
2302 # This holds the line numbers at which various elements of
2303 # %contents are defined.
2304 %content_lines = ();
2306 # This holds the "relative directory" of the current Makefile.in.
2307 # Eg for src/Makefile.in, this is "src".
2310 # Directory where output files go. Actually, output files are
2311 # relative to this directory.
2312 $output_directory = '.';
2314 # This holds a list of files that are included in the
2318 # List of dependencies for the obvious targets.
2333 # These are pretty obvious, too. They are used to define the
2334 # SOURCES and OBJECTS variables.
2338 # TRUE if current directory holds any C source files. (Actually
2339 # holds object extension, but this information is encapsulated in
2340 # the function get_object_extension).
2341 $dir_holds_sources = '';
2343 # TRUE if install targets should work recursively.
2344 $recursive_install = 0;
2349 # Strictness levels.
2350 $strictness = $default_strictness;
2351 $strictness_name = $default_strictness_name;
2353 # Options from AUTOMAKE_OPTIONS.
2356 # Whether or not dependencies are handled. Can be further changed
2357 # in handle_options.
2358 $use_dependencies = $cmdline_use_dependencies;
2361 $local_maint_charset = $maint_charset;
2365 ################################################################
2367 # Return contents of a file from $am_dir, automatically skipping
2368 # macros or rules which are already known. Runs command on each line
2369 # as it is read; this command can modify $_.
2370 sub file_contents_with_transform
2372 local ($command, $basename) = @_;
2373 local ($file) = $am_dir . '/' . $basename . '.am';
2375 open (FC_FILE, $file)
2376 || die "automake: installation error: cannot open \`$file'\n";
2378 # print "automake: reading $file\n" if $verbose;
2380 local ($was_rule) = 0;
2381 local ($result_vars) = '';
2382 local ($result_rules) = '';
2383 local ($comment) = '';
2384 local ($spacing) = "\n";
2385 local ($skipping) = 0;
2391 if (/$IGNORE_PATTERN/o)
2393 # Merely delete comments beginning with two hashes.
2395 elsif (/$WHITE_PATTERN/o)
2397 # Stick a single white line before the incoming macro or rule.
2400 elsif (/$COMMENT_PATTERN/o)
2402 # Stick comments before the incoming macro or rule.
2403 $comment .= $spacing . $_;
2410 $result_rules .= $_ if ! $skipping;
2414 $result_vars .= $_ if ! $skipping;
2418 elsif (/$RULE_PATTERN/o)
2420 # warn "** Found rule .$1.\n";
2423 $skipping = defined $contents{$1};
2424 # warn "** Skip $skipping\n" if $skipping;
2425 $result_rules .= $comment . $spacing . $_ if ! $skipping;
2426 $comment = $spacing = '';
2429 elsif (/$MACRO_PATTERN/o)
2431 # warn "** Found macro .$1.\n";
2432 # Found a variable reference.
2434 $skipping = defined $contents{$1};
2435 # warn "** Skip $skipping\n" if $skipping;
2436 $result_vars .= $comment . $spacing . $_ if ! $skipping;
2437 $comment = $spacing = '';
2442 # This isn't an error; it is probably a continued rule.
2443 # In fact, this is what we assume.
2445 $result_rules .= $comment . $spacing . $_ if ! $skipping;
2446 $comment = $spacing = '';
2452 return $result_vars . $result_rules . $comment;
2455 # Like file_contents_with_transform, but no transform.
2458 return &file_contents_with_transform ('', @_);
2461 # Handle `where_HOW' variable magic. Does all lookups, generates
2462 # install code,and possibly generates code to define the primary
2463 # variable. The first argument is the name of the .am file to munge,
2464 # the second argument is the primary variable (eg HEADERS), and all
2465 # subsequent arguments are possible installation locations. Returns
2466 # list of all values of all _HOW targets.
2468 # FIXME this should be rewritten to be cleaner. It should be broken
2469 # up into multiple functions.
2471 # Usage is: am_install_var (OPTION..., file, HOW, where...)
2476 local ($do_all, $do_clean) = (1, 0);
2479 if ($args[0] eq '-clean')
2483 elsif ($args[0] eq '-no-all')
2487 elsif ($args[0] !~ /^-/)
2493 local ($file, $primary, @prefixes) = @args;
2496 local (@result) = ();
2498 # Now that configure substitutions are allowed in where_HOW
2499 # variables, it is an error to actually define the primary.
2500 &am_line_error ($primary, "\`$primary' is an anachronism")
2501 if defined $contents{$primary};
2504 # Look for misspellings. It is an error to have a variable ending
2505 # in a "reserved" suffix whose prefix is unknown, eg
2506 # "bni_PROGRAMS". However, unusual prefixes are allowed if a
2507 # variable of the same name (with "dir" appended) exists. For
2508 # instance, if the variable "zardir" is defined, then
2509 # "zar_PROGRAMS" becomes valid. This is to provide a little extra
2510 # flexibility in those cases which need it. Perhaps it should be
2511 # disallowed in the Gnits case? The problem is, sometimes it is
2512 # useful to put things in a subdir of eg pkgdatadir, perhaps even
2514 local (%valid, $varname);
2515 grep ($valid{$_} = 0, @prefixes);
2516 $valid{'EXTRA'} = 0;
2517 foreach $varname (keys %contents)
2519 if ($varname =~ /^(.*)_$primary$/)
2521 if (! defined $valid{$1} && ! defined $contents{$1 . 'dir'})
2523 &am_line_error ($varname, "invalid variable \"$varname\"");
2527 # Ensure all extended prefixes are actually used.
2532 # We never want to examine EXTRA_blah.
2533 undef $valid{'EXTRA'};
2535 local ($clean_file) = $file . '-clean';
2538 foreach $X (keys %valid)
2540 $one_name = $X . '_' . $primary;
2541 if (defined $contents{$one_name})
2543 # Append actual contents of where_PRIMARY variable to
2546 foreach $rcurs (split (/\s+/, $contents{$one_name}))
2548 # Skip configure substitutions. Possibly bogus.
2549 next if $rcurs =~ /^\@.*\@$/;
2550 push (@result, $rcurs);
2556 &file_contents_with_transform ('s/\@DIR\@/' . $X . '/go',
2559 push (@clean, $X . $primary);
2560 &push_phony_cleaners ($X . $primary);
2565 push (@check, '$(' . $one_name . ')');
2569 push (@used, '$(' . $one_name . ')');
2571 if ($X eq 'noinst' || $X eq 'check')
2573 # Objects in noinst_FOO or check_FOO never get
2579 &file_contents_with_transform ('s/\@DIR\@/' . $X . '/go',
2582 push (@uninstall, 'uninstall-' . $X . $primary);
2583 push (@phony, 'uninstall-' . $X . $primary);
2584 push (@installdirs, '$(' . $X . 'dir)');
2585 if ($exec_dir_p{$X})
2587 push (@install_exec, 'install-' . $X . $primary);
2588 push (@phony, 'install-' . $X . $primary);
2592 push (@install_data, 'install-' . $X . $primary);
2593 push (@phony, 'install-' . $X . $primary);
2601 &pretty_print ($primary . ' =', '', @used);
2602 $output_vars .= "\n";
2605 # Push here because PRIMARY might be configure time determined.
2606 push (@all, '$(' . $primary . ')')
2607 if $do_all && @used;
2613 ################################################################
2615 # This variable is local to the "require file" set of functions.
2616 @require_file_paths = ();
2618 # Verify that the file must exist in the current directory. Usage:
2619 # require_file (isconfigure, line_number, strictness, file) strictness
2620 # is the strictness level at which this file becomes required. Must
2621 # set require_file_paths before calling this function.
2622 # require_file_paths is set to hold a single directory (the one in
2623 # which the first file was found) before return.
2624 sub require_file_internal
2626 local ($is_configure, $line, $mystrict, @files) = @_;
2627 local ($file, $fullfile);
2628 local ($found_it, $errfile);
2631 foreach $file (@files)
2634 foreach $dir (@require_file_paths)
2636 $fullfile = $dir . "/" . $file;
2638 # Use different name for "error filename". Otherwise on
2639 # an error the bad file will be reported as eg
2640 # `../../install-sh' when using the default
2642 $errfile = $fullfile unless $errfile;
2647 &push_dist_common ($file) if $dir eq $relative_dir;
2655 # Prune the path list.
2656 @require_file_paths = $save_dir;
2660 if ($strictness >= $mystrict)
2662 # Only install missing files according to our desired
2664 if ($add_missing && -f ($am_dir . '/' . $file))
2666 # Install the missing file. Symlink if we can, copy
2668 if ($symlink_exists)
2670 symlink ($am_dir . '/' . $file, $errfile);
2674 system ('cp', $am_dir . '/' . $file, $errfile);
2677 # FIXME this is a hack. Should have am_warn.
2678 local ($save) = $exit_status;
2683 "required file \"$errfile\" not found; installing");
2689 "required file \"$errfile\" not found; installing");
2691 $exit_status = $save;
2695 # Only an error if strictness constraint violated.
2699 ($line, "required file \"$errfile\" not found");
2704 ($line, "required file \"$errfile\" not found");
2712 # Like require_file_with_line, but error messages refer to
2713 # configure.in, not the current Makefile.am.
2714 sub require_file_with_conf_line
2716 @require_file_paths = $relative_dir;
2717 &require_file_internal (1, @_);
2720 sub require_file_with_line
2722 @require_file_paths = $relative_dir;
2723 &require_file_internal (0, @_);
2728 @require_file_paths = $relative_dir;
2729 &require_file_internal (0, '', @_);
2732 # Require a file that is also required by Autoconf. Looks in
2733 # configuration path, as specified by AC_CONFIG_AUX_DIR.
2734 sub require_config_file
2736 @require_file_paths = @config_aux_path;
2737 &require_file_internal (0, '', @_);
2738 local ($dir) = $require_file_paths[0];
2739 @config_aux_path = @require_file_paths;
2742 $config_aux_dir = '.';
2746 $config_aux_dir = '$(top_srcdir)/' . $dir;
2750 # Assumes that the line number is in Makefile.am.
2751 sub require_conf_file_with_line
2753 @require_file_paths = @config_aux_path;
2754 &require_file_internal (0, @_);
2755 local ($dir) = $require_file_paths[0];
2756 @config_aux_path = @require_file_paths;
2759 $config_aux_dir = '.';
2763 $config_aux_dir = '$(top_srcdir)/' . $dir;
2767 # Assumes that the line number is in Makefile.am.
2768 sub require_conf_file_with_conf_line
2770 @require_file_paths = @config_aux_path;
2771 &require_file_internal (1, @_);
2772 local ($dir) = $require_file_paths[0];
2773 @config_aux_path = @require_file_paths;
2776 $config_aux_dir = '.';
2780 $config_aux_dir = '$(top_srcdir)/' . $dir;
2784 ################################################################
2786 # Push a list of files onto dist_common.
2787 sub push_dist_common
2789 local (@files) = @_;
2792 foreach $file (@files)
2794 $dist_common{$file} = 1;
2798 # Push a list of clean targets onto phony.
2799 sub push_phony_cleaners
2803 foreach $target ('mostly', 'dist', '', 'maintainer-')
2805 push (@phony, $target . 'clean-' . $base);
2812 $strictness_name = $_[0];
2813 if ($strictness_name eq 'gnu')
2817 elsif ($strictness_name eq 'gnits')
2819 $strictness = $GNITS;
2821 elsif ($strictness_name eq 'foreign')
2823 $strictness = $FOREIGN;
2827 die "automake: level \`$strictness_name' not recognized\n";
2832 ################################################################
2834 # Return directory name of file.
2840 ($sub = $file) =~ s,/+[^/]+$,,g;
2841 $sub = '.' if $sub eq $file;
2848 local ($dirname) = @_;
2849 system ("mkdir", $dirname);
2852 ################################################################
2854 # Print an error message and set exit status.
2857 warn "automake: ${am_file}.am: ", join (' ', @_), "\n";
2863 local ($symbol, @args) = @_;
2867 # If SYMBOL not already a line number, look it up in Makefile.am.
2868 $symbol = $content_lines{$symbol} unless $symbol =~ /^\d+$/;
2869 $symbol .= ': ' if $symbol;
2870 warn "${am_file}.am:", $symbol, join (' ', @args), "\n";
2879 # Like am_error, but while scanning configure.in.
2882 # FIXME can run in subdirs.
2883 warn "automake: configure.in: ", join (' ', @_), "\n";
2887 # Error message with line number referring to configure.in.
2888 sub am_conf_line_error
2890 local ($line, @args) = @_;
2894 warn "configure.in: $line: ", join (' ', @args), "\n";
2899 &am_conf_error (@args);
2903 # Tell user where our aclocal.m4 is, but only once.
2904 sub keyed_aclocal_warning
2907 warn "automake: macro \`$key' can be found in ${am_dir}/aclocal.m4\n";
2910 # Print usage information.
2913 print "Usage: automake [OPTION] ... [Makefile]...\n";
2915 print "\nFiles which are automatically distributed, if found:\n";
2916 $~ = "USAGE_FORMAT";
2917 local (@lcomm) = sort ((@common_files, @common_sometimes));
2918 local ($one, $two, $three, $four);
2921 $one = shift @lcomm;
2922 $two = @lcomm ? shift @lcomm : '';
2923 $three = @lcomm ? shift @lcomm : '';
2924 $four = @lcomm ? shift @lcomm : '';
2931 format USAGE_FORMAT =
2932 @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<
2933 $one, $two, $three, $four