5 eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
8 # aclocal - create aclocal.m4 by scanning configure.ac
10 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
11 # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 3, or (at your option)
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 # Written by Tom Tromey <tromey@redhat.com>, and
27 # Alexandre Duret-Lutz <adl@gnu.org>.
31 my $perllibdir = $ENV{'perllibdir'} || '@datadir@/@PACKAGE@-@APIVERSION@';
32 unshift @INC, (split '@PATH_SEPARATOR@', $perllibdir);
38 use Automake::General;
39 use Automake::Configure_ac;
40 use Automake::Channels;
41 use Automake::ChannelDefs;
43 use Automake::FileUtils;
50 # Include paths for searching macros. We search macros in this order:
51 # user-supplied directories first, then the directory containing the
52 # automake macros, and finally the system-wide directories for
53 # third-party macro. @user_includes can be augmented with -I.
54 # @system_includes can be augmented with the `dirlist' file. Also
55 # --acdir will reset both @automake_includes and @system_includes.
56 my @user_includes = ();
57 my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
58 my @system_includes = ('@datadir@/aclocal');
60 # Whether we should copy M4 file in $user_includes[0].
69 # configure.ac or configure.in.
73 my $output_file = 'aclocal.m4';
78 # Modification time of the youngest dependency.
79 my $greatest_mtime = 0;
81 # Which macros have been seen.
84 # Remember the order into which we scanned the files.
85 # It's important to output the contents of aclocal.m4 in the opposite order.
86 # (Definitions in first files we have scanned should override those from
87 # later files. So they must appear last in the output.)
90 # Map macro names to file names.
93 # Ditto, but records the last definition of each macro as returned by --trace.
94 my %map_traced_defs = ();
96 # Map basenames to macro names.
99 # Map file names to file contents.
100 my %file_contents = ();
102 # Map file names to file types.
104 use constant FT_USER => 1;
105 use constant FT_AUTOMAKE => 2;
106 use constant FT_SYSTEM => 3;
108 # Map file names to included files (transitively closed).
109 my %file_includes = ();
111 # Files which have already been added.
114 # Files that have already been scanned.
115 my %scanned_configure_dep = ();
117 # Serial numbers, for files that have one.
118 # The key is the basename of the file,
119 # the value is the serial number represented as a list.
122 # Matches a macro definition.
123 # AC_DEFUN([macroname], ...)
125 # AC_DEFUN(macroname, ...)
126 # When macroname is `['-quoted , we accept any character in the name,
127 # except `]'. Otherwise macroname stops on the first `]', `,', `)',
128 # or `\n' encountered.
130 "(?:AU_ALIAS|A[CU]_DEFUN|AC_DEFUN_ONCE)\\((?:\\[([^]]+)\\]|([^],)\n]+))";
132 # Matches an AC_REQUIRE line.
133 my $ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
135 # Matches an m4_include line.
136 my $m4_include_rx = "(m4_|m4_s|s)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
138 # Match a serial number.
139 my $serial_line_rx = '^#\s*serial\s+(\S*)';
140 my $serial_number_rx = '^\d+(?:\.\d+)*$';
143 # Set by trace_used_macros.
146 # If set, names a temporary file that must be erased on abnormal exit.
149 ################################################################
151 # Erase temporary file ERASE_ME. Handle signals.
158 verb "caught SIG$sig, bailing out";
160 if (defined $erase_me && -e $erase_me && !unlink ($erase_me))
162 fatal "could not remove `$erase_me': $!";
166 # reraise default handler.
169 $SIG{$sig} = 'DEFAULT';
174 $SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp';
177 # Check macros in acinclude.m4. If one is not used, warn.
178 sub check_acinclude ()
180 foreach my $key (keys %map)
182 # FIXME: should print line number of acinclude.m4.
183 msg ('syntax', "warning: macro `$key' defined in "
184 . "acinclude.m4 but never used")
185 if $map{$key} eq 'acinclude.m4' && ! exists $macro_seen{$key};
195 %map_traced_defs = ();
200 %scanned_configure_dep = ();
206 # install_file ($SRC, $DEST)
207 sub install_file ($$)
209 my ($src, $dest) = @_;
213 || !exists $file_contents{$dest}
214 || $file_contents{$src} ne $file_contents{$dest})
218 msg 'note', "overwriting `$dest' with `$src'";
223 msg 'note', "installing `$dest' from `$src'";
228 if (! defined $diff_dest)
230 # $dest does not exist. We create an empty one just to
231 # run diff, and we erase it afterward. Using the real
232 # the destination file (rather than a temporary file) is
233 # good when diff is run with options that display the
236 # If creating $dest fails, fall back to /dev/null. At
237 # least one diff implementation (Tru64's) cannot deal
238 # with /dev/null. However working around this is not
239 # worth the trouble since nobody run aclocal on a
240 # read-only tree anyway.
242 my $f = new IO::File "> $dest";
246 $diff_dest = '/dev/null';
254 my @cmd = (@diff_command, $diff_dest, $src);
256 verb "running: @cmd";
257 my $res = system (@cmd);
258 Automake::FileUtils::handle_exec_errors "@cmd", 1
264 xsystem ('cp', $src, $dest);
269 # Compare two lists of numbers.
270 sub list_compare (\@\@)
278 return (0 == @r) ? 0 : -1;
284 elsif ($l[0] < $r[0])
288 elsif ($l[0] > $r[0])
297 ################################################################
299 # scan_m4_dirs($TYPE, @DIRS)
300 # --------------------------
301 # Scan all M4 files installed in @DIRS for new macro definitions.
302 # Register each file as of type $TYPE (one of the FT_* constants).
303 sub scan_m4_dirs ($@)
305 my ($type, @dirlist) = @_;
307 foreach my $m4dir (@dirlist)
309 if (! opendir (DIR, $m4dir))
311 fatal "couldn't open directory `$m4dir': $!";
314 # We reverse the directory contents so that foo2.m4 gets
315 # used in preference to foo1.m4.
316 foreach my $file (reverse sort grep (! /^\./, readdir (DIR)))
318 # Only examine .m4 files.
319 next unless $file =~ /\.m4$/;
321 # Skip some files when running out of srcdir.
322 next if $file eq 'aclocal.m4';
324 my $fullfile = File::Spec->canonpath ("$m4dir/$file");
325 &scan_file ($type, $fullfile, 'aclocal');
331 # Scan all the installed m4 files and construct a map.
334 # First, scan configure.ac. It may contain macro definitions,
335 # or may include other files that define macros.
336 &scan_file (FT_USER, $configure_ac, 'aclocal');
338 # Then, scan acinclude.m4 if it exists.
339 if (-f 'acinclude.m4')
341 &scan_file (FT_USER, 'acinclude.m4', 'aclocal');
344 # Finally, scan all files in our search paths.
345 scan_m4_dirs (FT_USER, @user_includes);
346 scan_m4_dirs (FT_AUTOMAKE, @automake_includes);
347 scan_m4_dirs (FT_SYSTEM, @system_includes);
349 # Construct a new function that does the searching. We use a
350 # function (instead of just evaluating $search in the loop) so that
351 # "die" is correctly and easily propagated if run.
352 my $search = "sub search {\nmy \$found = 0;\n";
353 foreach my $key (reverse sort keys %map)
355 $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { & add_macro ("' . $key
356 . '"); $found = 1; }' . "\n");
358 $search .= "return \$found;\n};\n";
360 prog_error "$@\n search is $search" if $@;
363 ################################################################
365 # Add a macro to the output.
370 # Ignore unknown required macros. Either they are not really
371 # needed (e.g., a conditional AC_REQUIRE), in which case aclocal
372 # should be quiet, or they are needed and Autoconf itself will
373 # complain when we trace for macro usage later.
374 return unless defined $map{$macro};
376 verb "saw macro $macro";
377 $macro_seen{$macro} = 1;
378 &add_file ($map{$macro});
381 # scan_configure_dep ($file)
382 # --------------------------
383 # Scan a configure dependency (configure.ac, or separate m4 files)
384 # for uses of known macros and AC_REQUIREs of possibly unknown macros.
385 # Recursively scan m4_included files.
386 sub scan_configure_dep ($)
389 # Do not scan a file twice.
391 if exists $scanned_configure_dep{$file};
392 $scanned_configure_dep{$file} = 1;
394 my $mtime = mtime $file;
395 $greatest_mtime = $mtime if $greatest_mtime < $mtime;
397 my $contents = exists $file_contents{$file} ?
398 $file_contents{$file} : contents $file;
403 foreach (split ("\n", $contents))
406 # Remove comments from current line.
409 # Avoid running all the following regexes on white lines.
412 while (/$m4_include_rx/go)
414 my $ifile = $2 || $3;
415 # Skip missing `sinclude'd files.
416 next if $1 ne 'm4_' && ! -f $ifile;
420 while (/$ac_require_rx/go)
422 push (@rlist, $1 || $2);
425 # The search function is constructed dynamically by
426 # scan_m4_files. The last parenthetical match makes sure we
427 # don't match things that look like macro assignments or
429 if (! &search && /(^|\s+)(AM_[A-Z0-9_]+)($|[^\]\)=A-Z0-9_])/)
431 # Macro not found, but AM_ prefix found.
432 # Make this just a warning, because we do not know whether
433 # the macro is actually used (it could be called conditionally).
434 msg ('unsupported', "$file:$line",
435 "warning: macro `$2' not found in library");
439 add_macro ($_) foreach (@rlist);
440 &scan_configure_dep ($_) foreach @ilist;
445 # Add $FILE to output.
450 # Only add a file once.
451 return if ($file_added{$file});
452 $file_added{$file} = 1;
454 scan_configure_dep $file;
457 # Point to the documentation for underquoted AC_DEFUN only once.
458 my $underquoted_manual_once = 0;
460 # scan_file ($TYPE, $FILE, $WHERE)
461 # --------------------------------
462 # Scan a single M4 file ($FILE), and all files it includes.
463 # Return the list of included files.
464 # $TYPE is one of FT_USER, FT_AUTOMAKE, or FT_SYSTEM, depending
465 # on where the file comes from.
466 # $WHERE is the location to use in the diagnostic if the file
470 my ($type, $file, $where) = @_;
471 my $basename = basename $file;
473 # Do not scan the same file twice.
474 return @{$file_includes{$file}} if exists $file_includes{$file};
475 # Prevent potential infinite recursion (if two files include each other).
476 return () if exists $file_contents{$file};
478 unshift @file_order, $file;
480 $file_type{$file} = $type;
482 fatal "$where: file `$file' does not exist" if ! -e $file;
484 my $fh = new Automake::XFile $file;
491 my $serial_older = 0;
493 while ($_ = $fh->getline)
501 if ($line =~ /$serial_line_rx/go)
504 if ($number !~ /$serial_number_rx/go)
506 msg ('syntax', "$file:$.",
507 "warning: ill-formed serial number `$number', "
508 . "expecting a version string with only digits and dots");
512 # aclocal removes all definitions from M4 file with the
513 # same basename if a greater serial number is found.
514 # Encountering a serial after some macros will undefine
516 msg ('syntax', "$file:$.",
517 'the serial number must appear before any macro definition');
519 # We really care about serials only for non-automake macros
520 # and when --install is used. But the above diagnostics are
521 # made regardless of this, because not using --install is
522 # not a reason not the fix macro files.
523 elsif ($install && $type != FT_AUTOMAKE)
526 my @new = split (/\./, $number);
528 verb "$file:$.: serial $number";
530 if (!exists $serial{$basename}
531 || list_compare (@new, @{$serial{$basename}}) > 0)
533 # Delete any definition we knew from the old macro.
534 foreach my $def (@{$invmap{$basename}})
536 verb "$file:$.: ignoring previous definition of $def";
539 $invmap{$basename} = [];
540 $serial{$basename} = \@new;
549 # Remove comments from current line.
550 # Do not do it earlier, because the serial line is a comment.
551 $line =~ s/\bdnl\b.*$//;
554 while ($line =~ /$ac_defun_rx/go)
559 msg ('syntax', "$file:$.", "warning: underquoted definition of $2"
560 . "\n run info '(automake)Extending aclocal'\n"
561 . " or see http://sources.redhat.com/automake/"
562 . "automake.html#Extending-aclocal")
563 unless $underquoted_manual_once;
564 $underquoted_manual_once = 1;
567 # If this macro does not have a serial and we have already
568 # seen a macro with the same basename earlier, we should
569 # ignore the macro (don't exit immediately so we can still
570 # diagnose later #serial numbers and underquoted macros).
571 $serial_older ||= ($type != FT_AUTOMAKE
572 && !$serial_seen && exists $serial{$basename});
574 my $macro = $1 || $2;
575 if (!$serial_older && !defined $map{$macro})
577 verb "found macro $macro in $file: $.";
578 $map{$macro} = $file;
579 push @{$invmap{$basename}}, $macro;
583 # Note: we used to give an error here if we saw a
584 # duplicated macro. However, this turns out to be
585 # extremely unpopular. It causes actual problems which
586 # are hard to work around, especially when you must
587 # mix-and-match tool versions.
588 verb "ignoring macro $macro in $file: $.";
592 while ($line =~ /$m4_include_rx/go)
594 my $ifile = $2 || $3;
595 # Skip missing `sinclude'd files.
596 next if $1 ne 'm4_' && ! -f $ifile;
597 push (@inc_files, $ifile);
598 $inc_lines{$ifile} = $.;
602 # Ignore any file that has an old serial (or no serial if we know
603 # another one with a serial).
606 ($type != FT_AUTOMAKE && !$serial_seen && exists $serial{$basename}));
608 $file_contents{$file} = $contents;
610 # For some reason I don't understand, it does not work
611 # to do `map { scan_file ($_, ...) } @inc_files' below.
612 # With Perl 5.8.2 it undefines @inc_files.
613 my @copy = @inc_files;
614 my @all_inc_files = (@inc_files,
615 map { scan_file ($type, $_,
616 "$file:$inc_lines{$_}") } @copy);
617 $file_includes{$file} = \@all_inc_files;
618 return @all_inc_files;
621 # strip_redundant_includes (%FILES)
622 # ---------------------------------
623 # Each key in %FILES is a file that must be present in the output.
624 # However some of these files might already include other files in %FILES,
625 # so there is no point in including them another time.
626 # This removes items of %FILES which are already included by another file.
627 sub strip_redundant_includes (%)
631 # Always include acinclude.m4, even if it does not appear to be used.
632 $files{'acinclude.m4'} = 1 if -f 'acinclude.m4';
633 # File included by $configure_ac are redundant.
634 $files{$configure_ac} = 1;
636 # Files at the end of @file_order should override those at the beginning,
637 # so it is important to preserve these trailing files. We can remove
638 # a file A if it is going to be output before a file B that includes
639 # file A, not the converse.
640 foreach my $file (reverse @file_order)
642 next unless exists $files{$file};
643 foreach my $ifile (@{$file_includes{$file}})
645 next unless exists $files{$ifile};
646 delete $files{$ifile};
647 verb "$ifile is already included by $file";
651 # configure.ac is implicitly included.
652 delete $files{$configure_ac};
657 sub trace_used_macros ()
659 my %files = map { $map{$_} => 1 } keys %macro_seen;
660 %files = strip_redundant_includes %files;
662 my $traces = ($ENV{AUTOM4TE} || 'autom4te');
663 $traces .= " --language Autoconf-without-aclocal-m4 ";
664 # All candidate files.
665 $traces .= join (' ',
667 (grep { exists $files{$_} } @file_order))) . " ";
668 # All candidate macros.
669 $traces .= join (' ',
670 (map { "--trace='$_:\$f::\$n::\$1'" }
674 '_AM_AUTOCONF_VERSION')),
675 # Do not trace $1 for all other macros as we do
676 # not need it and it might contains harmful
677 # characters (like newlines).
678 (map { "--trace='$_:\$f::\$n'" } (keys %macro_seen)));
680 verb "running $traces $configure_ac";
682 my $tracefh = new Automake::XFile ("$traces $configure_ac |");
686 while ($_ = $tracefh->getline)
689 my ($file, $macro, $arg1) = split (/::/);
691 $traced{$macro} = 1 if exists $macro_seen{$macro};
693 $map_traced_defs{$arg1} = $file
694 if ($macro eq 'AC_DEFUN'
695 || $macro eq 'AC_DEFUN_ONCE'
696 || $macro eq 'AU_DEFUN');
698 $ac_version = $arg1 if $macro eq '_AM_AUTOCONF_VERSION';
706 sub scan_configure ()
708 # Make sure we include acinclude.m4 if it exists.
709 if (-f 'acinclude.m4')
711 add_file ('acinclude.m4');
713 scan_configure_dep ($configure_ac);
716 ################################################################
719 # Return 0 iff some files were installed locally.
720 sub write_aclocal ($@)
722 my ($output_file, @macros) = @_;
726 # Get the list of files containing definitions for the macros used.
727 # (Filter out unused macro definitions with $map_traced_defs. This
728 # can happen when an Autoconf macro is conditionally defined:
729 # aclocal sees the potential definition, but this definition is
730 # actually never processed and the Autoconf implementation is used
735 if (exists $map_traced_defs{$m}
736 && $map{$m} eq $map_traced_defs{$m});
738 # Do not explicitly include a file that is already indirectly included.
739 %files = strip_redundant_includes %files;
743 for my $file (grep { exists $files{$_} } @file_order)
745 # Check the time stamp of this file, and of all files it includes.
746 for my $ifile ($file, @{$file_includes{$file}})
748 my $mtime = mtime $ifile;
749 $greatest_mtime = $mtime if $greatest_mtime < $mtime;
752 # If the file to add looks like outside the project, copy it
753 # to the output. The regex catches filenames starting with
754 # things like `/', `\', or `c:\'.
755 if ($file_type{$file} != FT_USER
756 || $file =~ m,^(?:\w:)?[\\/],)
758 if (!$install || $file_type{$file} != FT_SYSTEM)
760 # Copy the file into aclocal.m4.
761 $output .= $file_contents{$file} . "\n";
765 # Install the file (and any file it includes).
767 for my $ifile (@{$file_includes{$file}}, $file)
769 $dest = "$user_includes[0]/" . basename $ifile;
770 verb "installing $ifile to $dest";
771 install_file ($ifile, $dest);
778 # Otherwise, simply include the file.
779 $output .= "m4_include([$file])\n";
785 verb "running aclocal anew, because some files were installed locally";
789 # Nothing to output?!
790 # FIXME: Shouldn't we diagnose this?
791 return 1 if ! length ($output);
795 # Do not use "$output_file" here for the same reason we do not
796 # use it in the header below. autom4te will output the name of
797 # the file in the diagnostic anyway.
798 $output = "m4_ifndef([AC_AUTOCONF_VERSION],
799 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
800 m4_if(AC_AUTOCONF_VERSION, [$ac_version],,
801 [m4_warning([this file was generated for autoconf $ac_version.
802 You have another version of autoconf. It may work, but is not guaranteed to.
803 If you have problems, you may need to regenerate the build system entirely.
804 To do so, use the procedure documented by the package, typically `autoreconf'.])])
809 # We used to print `# $output_file generated automatically etc.' But
810 # this creates spurious differences when using autoreconf. Autoreconf
811 # creates aclocal.m4t and then rename it to aclocal.m4, but the
812 # rebuild rules generated by Automake create aclocal.m4 directly --
813 # this would gives two ways to get the same file, with a different
814 # name in the header.
815 $output = "# generated automatically by aclocal $VERSION -*- Autoconf -*-
817 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
818 # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
819 # This file is free software; the Free Software Foundation
820 # gives unlimited permission to copy and/or distribute it,
821 # with or without modifications, as long as this notice is preserved.
823 # This program is distributed in the hope that it will be useful,
824 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
825 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
826 # PARTICULAR PURPOSE.
830 # We try not to update $output_file unless necessary, because
831 # doing so invalidate Autom4te's cache and therefore slows down
832 # tools called after aclocal.
834 # We need to overwrite $output_file in the following situations.
835 # * The --force option is in use.
836 # * One of the dependencies is younger.
837 # (Not updating $output_file in this situation would cause
838 # make to call aclocal in loop.)
839 # * The contents of the current file are different from what
842 && $greatest_mtime < mtime ($output_file)
843 && $output eq contents ($output_file))
845 verb "$output_file unchanged";
849 verb "writing $output_file";
853 if (-e $output_file && !unlink $output_file)
855 fatal "could not remove `$output_file': $!";
857 my $out = new Automake::XFile "> $output_file";
863 ################################################################
865 # Print usage and exit.
870 print "Usage: aclocal [OPTIONS] ...
872 Generate `aclocal.m4' by scanning `configure.ac' or `configure.in'
875 --acdir=DIR directory holding config files (for debugging)
876 --diff[=COMMAND] run COMMAND [diff -u] on M4 files that would be
877 changed (implies --install and --dry-run)
878 --dry-run pretend to, but do not actually update any file
879 --force always update output file
880 --help print this help, then exit
881 -I DIR add directory to search list for .m4 files
882 --install copy third-party files to the first -I directory
883 --output=FILE put output in FILE (default aclocal.m4)
884 --print-ac-dir print name of directory holding m4 files, then exit
885 --verbose don't be silent
886 --version print version number, then exit
887 -W, --warnings=CATEGORY report the warnings falling in CATEGORY
889 Warning categories include:
890 `syntax' dubious syntactic constructs (default)
891 `unsupported' unknown macros (default)
892 `all' all the warnings (default)
893 `no-CATEGORY' turn off warnings in CATEGORY
894 `none' turn off all the warnings
895 `error' treat warnings as errors
897 Report bugs to <bug-automake\@gnu.org>.\n";
902 # Print version and exit.
906 aclocal (GNU $PACKAGE) $VERSION
907 Copyright (C) 2008 Free Software Foundation, Inc.
908 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
909 This is free software: you are free to change and redistribute it.
910 There is NO WARRANTY, to the extent permitted by law.
912 Written by Tom Tromey <tromey\@redhat.com>
913 and Alexandre Duret-Lutz <adl\@gnu.org>.
918 # Parse command line.
919 sub parse_arguments ()
921 my $print_and_exit = 0;
926 'acdir=s' => sub # Setting --acdir overrides both the
927 { # automake (versioned) directory and the
928 # public (unversioned) system directory.
929 @automake_includes = ();
930 @system_includes = ($_[1])
932 'diff:s' => \$diff_command,
933 'dry-run' => \$dry_run,
934 'force' => \$force_output,
935 'I=s' => \@user_includes,
936 'install' => \$install,
937 'output=s' => \$output_file,
938 'print-ac-dir' => \$print_and_exit,
939 'verbose' => sub { setup_channel 'verb', silent => 0; },
940 'W|warnings=s' => \&parse_warnings,
943 Getopt::Long::config ("bundling", "pass_through");
945 # See if --version or --help is used. We want to process these before
946 # anything else because the GNU Coding Standards require us to
947 # `exit 0' after processing these options, and we can't guarantee this
948 # if we treat other options first. (Handling other options first
949 # could produce error diagnostics, and in this condition it is
950 # confusing if aclocal does `exit 0'.)
951 my %cli_options_1st_pass =
953 'version' => \&version,
954 'help' => sub { usage(0); },
955 # Recognize all other options (and their arguments) but do nothing.
956 map { $_ => sub {} } (keys %cli_options)
958 my @ARGV_backup = @ARGV;
959 Getopt::Long::GetOptions %cli_options_1st_pass
961 @ARGV = @ARGV_backup;
963 # Now *really* process the options. This time we know that --help
964 # and --version are not present, but we specify them nonetheless so
965 # that ambiguous abbreviation are diagnosed.
966 Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {}
972 for my $k (keys %cli_options)
976 map { $argopts{(length ($_) == 1)
977 ? "-$_" : "--$_" } = 1; } (split (/\|/, $1));
980 if (exists $argopts{$ARGV[0]})
982 fatal ("option `$ARGV[0]' requires an argument\n"
983 . "Try `$0 --help' for more information.");
987 fatal ("unrecognized option `$ARGV[0]'\n"
988 . "Try `$0 --help' for more information.");
994 print "@system_includes\n";
998 if (defined $diff_command)
1000 $diff_command = 'diff -u' if $diff_command eq '';
1001 @diff_command = split (' ', $diff_command);
1006 if ($install && !@user_includes)
1008 fatal ("--install should copy macros in the directory indicated by the"
1009 . "\nfirst -I option, but no -I was supplied.");
1012 if (! -d $system_includes[0])
1014 # By default $(datadir)/aclocal doesn't exist. We don't want to
1015 # get an error in the case where we are searching the default
1016 # directory and it hasn't been created. (We know
1017 # @system_includes has its default value if @automake_includes
1018 # is not empty, because --acdir is the only way to change this.)
1019 @system_includes = () if @automake_includes;
1023 # Finally, adds any directory listed in the `dirlist' file.
1024 if (open (DIRLIST, "$system_includes[0]/dirlist"))
1030 # strip off newlines and end-of-line comments
1033 foreach my $dir (glob)
1035 push (@system_includes, $dir) if -d $dir;
1043 ################################################################
1045 parse_WARNINGS; # Parse the WARNINGS environment variable.
1047 $configure_ac = require_configure_ac;
1049 # We may have to rerun aclocal if some file have been installed, but
1050 # it should not happen more than once. The reason we must run again
1051 # is that once the file has been moved from /usr/share/aclocal/ to the
1052 # local m4/ directory it appears at a new place in the search path,
1053 # hence it should be output at a different position in aclocal.m4. If
1054 # we did not rerun aclocal, the next run of aclocal would produce a
1055 # different aclocal.m4.
1060 prog_error "Too many loops." if $loop > 2;
1066 my %macro_traced = trace_used_macros;
1067 last if write_aclocal ($output_file, keys %macro_traced);
1074 ### Setup "GNU" style for perl-mode and cperl-mode.
1076 ## perl-indent-level: 2
1077 ## perl-continued-statement-offset: 2
1078 ## perl-continued-brace-offset: 0
1079 ## perl-brace-offset: 0
1080 ## perl-brace-imaginary-offset: 0
1081 ## perl-label-offset: -2
1082 ## cperl-indent-level: 2
1083 ## cperl-brace-offset: 0
1084 ## cperl-continued-brace-offset: 0
1085 ## cperl-label-offset: -2
1086 ## cperl-extra-newline-before-brace: t
1087 ## cperl-merge-trailing-else: nil
1088 ## cperl-continued-statement-offset: 2