2001-08-31 21:32:13 +08:00
|
|
|
#! @PERL@
|
|
|
|
# -*- Perl -*-
|
|
|
|
# @configure_input@
|
|
|
|
|
2002-04-20 02:59:59 +08:00
|
|
|
eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
|
2001-08-31 21:32:13 +08:00
|
|
|
if 0;
|
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
# autoheader -- create 'config.h.in' from 'configure.ac'.
|
2004-01-15 02:36:58 +08:00
|
|
|
|
2016-02-07 09:08:27 +08:00
|
|
|
# Copyright (C) 1992-1994, 1996, 1998-2016 Free Software Foundation,
|
2011-01-05 07:13:09 +08:00
|
|
|
# Inc.
|
1993-08-02 06:27:47 +08:00
|
|
|
|
2007-07-21 07:11:49 +08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
1993-08-02 06:27:47 +08:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
Update License to GPLv3+ including new Autoconf Exception.
* NEWS, README: Update licensing information.
* COPYING.EXCEPTION: New file.
* Makefile.am (EXTRA_DIST): Distribute it.
* cfg.mk (autom4te-update): Remove copyright change warning.
* lib/autoconf/autoconf.m4, lib/autoconf/autoheader.m4,
lib/autoconf/autoscan.m4, lib/autoconf/autotest.m4,
lib/autoconf/autoupdate.m4, lib/autoconf/c.m4,
lib/autoconf/erlang.m4, lib/autoconf/fortran.m4,
lib/autoconf/functions.m4, lib/autoconf/general.m4,
lib/autoconf/headers.m4, lib/autoconf/lang.m4,
lib/autoconf/libs.m4, lib/autoconf/oldnames.m4,
lib/autoconf/programs.m4, lib/autoconf/specific.m4,
lib/autoconf/status.m4, lib/autoconf/types.m4,
lib/autotest/autotest.m4, lib/autotest/general.m4,
lib/autotest/specific.m4, lib/m4sugar/foreach.m4,
lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4: Update exception
statement, bump to GPLv3.
* bin/autoconf.as, bin/autoheader.in, bin/autom4te.in,
bin/autoreconf.in, bin/autoscan.in, bin/autoupdate.in,
bin/ifnames.in: Bump to GPLv3+, adjust --version output
to reflect the GPLv3+ and the Autoconf Exception.
* lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm,
lib/Autom4te/General.pm, lib/Autom4te/Request.pm,
lib/autom4te.in, lib/autoscan/autoscan.pre,
lib/emacs/autoconf-mode.el, lib/emacs/autotest-mode.el,
lib/freeze.mk, tests/atlocal.in, tests/autoscan.at,
tests/autotest.at, tests/base.at, tests/c.at,
tests/compile.at, tests/erlang.at, tests/foreign.at,
tests/fortran.at, tests/local.at, tests/m4sh.at,
tests/m4sugar.at, tests/mktests.sh, tests/semantics.at,
tests/statesave.m4, tests/suite.at, tests/tools.at,
tests/torture.at, tests/wrapper.as: Bump to GPLv3+.
2009-09-10 01:53:31 +08:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
1993-08-02 06:27:47 +08:00
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
Update License to GPLv3+ including new Autoconf Exception.
* NEWS, README: Update licensing information.
* COPYING.EXCEPTION: New file.
* Makefile.am (EXTRA_DIST): Distribute it.
* cfg.mk (autom4te-update): Remove copyright change warning.
* lib/autoconf/autoconf.m4, lib/autoconf/autoheader.m4,
lib/autoconf/autoscan.m4, lib/autoconf/autotest.m4,
lib/autoconf/autoupdate.m4, lib/autoconf/c.m4,
lib/autoconf/erlang.m4, lib/autoconf/fortran.m4,
lib/autoconf/functions.m4, lib/autoconf/general.m4,
lib/autoconf/headers.m4, lib/autoconf/lang.m4,
lib/autoconf/libs.m4, lib/autoconf/oldnames.m4,
lib/autoconf/programs.m4, lib/autoconf/specific.m4,
lib/autoconf/status.m4, lib/autoconf/types.m4,
lib/autotest/autotest.m4, lib/autotest/general.m4,
lib/autotest/specific.m4, lib/m4sugar/foreach.m4,
lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4: Update exception
statement, bump to GPLv3.
* bin/autoconf.as, bin/autoheader.in, bin/autom4te.in,
bin/autoreconf.in, bin/autoscan.in, bin/autoupdate.in,
bin/ifnames.in: Bump to GPLv3+, adjust --version output
to reflect the GPLv3+ and the Autoconf Exception.
* lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm,
lib/Autom4te/General.pm, lib/Autom4te/Request.pm,
lib/autom4te.in, lib/autoscan/autoscan.pre,
lib/emacs/autoconf-mode.el, lib/emacs/autotest-mode.el,
lib/freeze.mk, tests/atlocal.in, tests/autoscan.at,
tests/autotest.at, tests/base.at, tests/c.at,
tests/compile.at, tests/erlang.at, tests/foreign.at,
tests/fortran.at, tests/local.at, tests/m4sh.at,
tests/m4sugar.at, tests/mktests.sh, tests/semantics.at,
tests/statesave.m4, tests/suite.at, tests/tools.at,
tests/torture.at, tests/wrapper.as: Bump to GPLv3+.
2009-09-10 01:53:31 +08:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1993-08-02 06:27:47 +08:00
|
|
|
|
|
|
|
# Written by Roland McGrath.
|
2001-08-31 21:32:13 +08:00
|
|
|
# Rewritten in Perl by Akim Demaille.
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
{
|
2009-02-25 00:27:15 +08:00
|
|
|
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
|
|
|
|
unshift @INC, "$pkgdatadir";
|
2003-02-28 18:11:07 +08:00
|
|
|
|
|
|
|
# Override SHELL. On DJGPP SHELL may not be set to a shell
|
|
|
|
# that can handle redirection and quote arguments correctly,
|
|
|
|
# e.g.: COMMAND.COM. For DJGPP always use the shell that configure
|
|
|
|
# has detected.
|
|
|
|
$ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
|
2001-08-31 21:32:13 +08:00
|
|
|
}
|
|
|
|
|
2003-08-20 20:52:18 +08:00
|
|
|
use Autom4te::ChannelDefs;
|
|
|
|
use Autom4te::Channels;
|
2003-08-21 14:55:41 +08:00
|
|
|
use Autom4te::Configure_ac;
|
2003-08-20 20:52:18 +08:00
|
|
|
use Autom4te::FileUtils;
|
2001-08-31 21:32:13 +08:00
|
|
|
use Autom4te::General;
|
2001-09-05 15:06:40 +08:00
|
|
|
use Autom4te::XFile;
|
2001-08-31 21:32:13 +08:00
|
|
|
use strict;
|
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
# Using 'do FILE', we need 'local' vars.
|
2001-08-31 21:32:13 +08:00
|
|
|
use vars qw ($config_h %verbatim %symbol);
|
|
|
|
|
|
|
|
# Lib files.
|
2002-06-13 01:26:19 +08:00
|
|
|
my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
|
2001-08-31 21:32:13 +08:00
|
|
|
local $config_h;
|
|
|
|
my $config_h_in;
|
2002-07-17 16:30:42 +08:00
|
|
|
my @prepend_include;
|
2001-08-31 21:32:13 +08:00
|
|
|
my @include;
|
|
|
|
|
|
|
|
|
2001-08-31 21:33:10 +08:00
|
|
|
# $HELP
|
|
|
|
# -----
|
2008-08-26 23:28:15 +08:00
|
|
|
$help = "Usage: $0 [OPTION]... [TEMPLATE-FILE]
|
1999-01-08 11:38:59 +08:00
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
Create a template file of C '\#define' statements for 'configure' to
|
|
|
|
use. To this end, scan TEMPLATE-FILE, or 'configure.ac' if present,
|
|
|
|
or else 'configure.in'.
|
1999-01-08 11:38:59 +08:00
|
|
|
|
2000-05-03 19:22:50 +08:00
|
|
|
-h, --help print this help, then exit
|
|
|
|
-V, --version print version number, then exit
|
|
|
|
-v, --verbose verbosely report processing
|
2001-08-31 21:32:13 +08:00
|
|
|
-d, --debug don\'t remove temporary files
|
2001-09-20 22:55:49 +08:00
|
|
|
-f, --force consider all files obsolete
|
2000-05-03 19:22:50 +08:00
|
|
|
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
|
|
|
|
|
2003-08-22 01:31:25 +08:00
|
|
|
" . Autom4te::ChannelDefs::usage () . "
|
2000-07-19 17:03:53 +08:00
|
|
|
|
2001-10-20 14:51:41 +08:00
|
|
|
Library directories:
|
2002-07-17 16:30:42 +08:00
|
|
|
-B, --prepend-include=DIR prepend directory DIR to search path
|
|
|
|
-I, --include=DIR append directory DIR to search path
|
2001-10-20 14:51:41 +08:00
|
|
|
|
2001-08-31 21:32:13 +08:00
|
|
|
Report bugs to <bug-autoconf\@gnu.org>.
|
2009-01-27 02:39:43 +08:00
|
|
|
GNU Autoconf home page: <http://www.gnu.org/software/autoconf/>.
|
|
|
|
General help using GNU software: <http://www.gnu.org/gethelp/>.
|
2003-08-22 01:31:25 +08:00
|
|
|
";
|
2000-07-19 17:03:53 +08:00
|
|
|
|
1993-08-02 06:27:47 +08:00
|
|
|
|
2001-08-31 21:33:10 +08:00
|
|
|
# $VERSION
|
|
|
|
# --------
|
2003-10-10 17:18:56 +08:00
|
|
|
$version = "autoheader (@PACKAGE_NAME@) @VERSION@
|
2007-01-05 00:43:06 +08:00
|
|
|
Copyright (C) @RELEASE_YEAR@ Free Software Foundation, Inc.
|
Update License to GPLv3+ including new Autoconf Exception.
* NEWS, README: Update licensing information.
* COPYING.EXCEPTION: New file.
* Makefile.am (EXTRA_DIST): Distribute it.
* cfg.mk (autom4te-update): Remove copyright change warning.
* lib/autoconf/autoconf.m4, lib/autoconf/autoheader.m4,
lib/autoconf/autoscan.m4, lib/autoconf/autotest.m4,
lib/autoconf/autoupdate.m4, lib/autoconf/c.m4,
lib/autoconf/erlang.m4, lib/autoconf/fortran.m4,
lib/autoconf/functions.m4, lib/autoconf/general.m4,
lib/autoconf/headers.m4, lib/autoconf/lang.m4,
lib/autoconf/libs.m4, lib/autoconf/oldnames.m4,
lib/autoconf/programs.m4, lib/autoconf/specific.m4,
lib/autoconf/status.m4, lib/autoconf/types.m4,
lib/autotest/autotest.m4, lib/autotest/general.m4,
lib/autotest/specific.m4, lib/m4sugar/foreach.m4,
lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4: Update exception
statement, bump to GPLv3.
* bin/autoconf.as, bin/autoheader.in, bin/autom4te.in,
bin/autoreconf.in, bin/autoscan.in, bin/autoupdate.in,
bin/ifnames.in: Bump to GPLv3+, adjust --version output
to reflect the GPLv3+ and the Autoconf Exception.
* lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm,
lib/Autom4te/General.pm, lib/Autom4te/Request.pm,
lib/autom4te.in, lib/autoscan/autoscan.pre,
lib/emacs/autoconf-mode.el, lib/emacs/autotest-mode.el,
lib/freeze.mk, tests/atlocal.in, tests/autoscan.at,
tests/autotest.at, tests/base.at, tests/c.at,
tests/compile.at, tests/erlang.at, tests/foreign.at,
tests/fortran.at, tests/local.at, tests/m4sh.at,
tests/m4sugar.at, tests/mktests.sh, tests/semantics.at,
tests/statesave.m4, tests/suite.at, tests/tools.at,
tests/torture.at, tests/wrapper.as: Bump to GPLv3+.
2009-09-10 01:53:31 +08:00
|
|
|
License GPLv3+/Autoconf: GNU GPL version 3 or later
|
|
|
|
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
|
2007-08-21 05:12:33 +08:00
|
|
|
This is free software: you are free to change and redistribute it.
|
2006-10-17 04:58:44 +08:00
|
|
|
There is NO WARRANTY, to the extent permitted by law.
|
|
|
|
|
|
|
|
Written by Roland McGrath and Akim Demaille.
|
2003-08-22 01:31:25 +08:00
|
|
|
";
|
2001-08-31 21:33:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
## ---------- ##
|
|
|
|
## Routines. ##
|
|
|
|
## ---------- ##
|
2000-03-31 16:20:09 +08:00
|
|
|
|
2001-08-31 21:32:13 +08:00
|
|
|
|
|
|
|
# parse_args ()
|
|
|
|
# -------------
|
|
|
|
# Process any command line arguments.
|
|
|
|
sub parse_args ()
|
2000-03-31 16:20:09 +08:00
|
|
|
{
|
2001-08-31 21:32:13 +08:00
|
|
|
my $srcdir;
|
2001-09-05 15:06:02 +08:00
|
|
|
|
2003-08-22 01:31:25 +08:00
|
|
|
parse_WARNINGS;
|
|
|
|
getopt ('I|include=s' => \@include,
|
2002-07-17 16:30:42 +08:00
|
|
|
'B|prepend-include=s' => \@prepend_include,
|
2003-08-22 01:31:25 +08:00
|
|
|
'W|warnings=s' => \&parse_warnings);
|
2001-08-31 21:32:13 +08:00
|
|
|
|
|
|
|
if (! @ARGV)
|
|
|
|
{
|
2003-08-21 14:55:41 +08:00
|
|
|
my $configure_ac = require_configure_ac;
|
2001-08-31 21:32:13 +08:00
|
|
|
push @ARGV, $configure_ac;
|
|
|
|
}
|
2000-03-31 16:20:09 +08:00
|
|
|
}
|
|
|
|
|
2001-08-31 21:32:13 +08:00
|
|
|
|
|
|
|
## -------------- ##
|
|
|
|
## Main program. ##
|
|
|
|
## -------------- ##
|
|
|
|
|
|
|
|
mktmpdir ('ah');
|
2003-08-27 19:35:08 +08:00
|
|
|
switch_warning 'obsolete';
|
2001-08-31 21:32:13 +08:00
|
|
|
parse_args;
|
|
|
|
|
2000-05-03 19:22:50 +08:00
|
|
|
# Preach.
|
2002-07-17 16:30:42 +08:00
|
|
|
my $config_h_top = find_file ("config.h.top?",
|
2002-10-16 14:38:50 +08:00
|
|
|
reverse (@prepend_include), @include);
|
2002-07-17 16:30:42 +08:00
|
|
|
my $config_h_bot = find_file ("config.h.bot?",
|
2002-10-16 14:38:50 +08:00
|
|
|
reverse (@prepend_include), @include);
|
2002-07-17 16:30:42 +08:00
|
|
|
my $acconfig_h = find_file ("acconfig.h?",
|
2002-10-16 14:38:50 +08:00
|
|
|
reverse (@prepend_include), @include);
|
2001-08-31 21:32:13 +08:00
|
|
|
if ($config_h_top || $config_h_bot || $acconfig_h)
|
|
|
|
{
|
|
|
|
my $msg = << "END";
|
2012-09-21 16:51:36 +08:00
|
|
|
Using auxiliary files such as 'acconfig.h', 'config.h.bot'
|
|
|
|
and 'config.h.top', to define templates for 'config.h.in'
|
2000-05-03 19:22:50 +08:00
|
|
|
is deprecated and discouraged.
|
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
Using the third argument of 'AC_DEFINE_UNQUOTED' and
|
|
|
|
'AC_DEFINE' allows one to define a template without
|
|
|
|
'acconfig.h':
|
2000-05-03 19:22:50 +08:00
|
|
|
|
2003-08-27 19:35:08 +08:00
|
|
|
AC_DEFINE([NEED_FUNC_MAIN], 1,
|
2012-09-21 16:51:36 +08:00
|
|
|
[Define if a function 'main' is needed.])
|
2000-05-03 19:22:50 +08:00
|
|
|
|
|
|
|
More sophisticated templates can also be produced, see the
|
|
|
|
documentation.
|
2001-08-31 21:32:13 +08:00
|
|
|
END
|
|
|
|
$msg =~ s/^ /WARNING: /gm;
|
2003-08-27 19:35:08 +08:00
|
|
|
msg 'obsolete', $msg;
|
2001-08-31 21:32:13 +08:00
|
|
|
}
|
1993-08-02 06:27:47 +08:00
|
|
|
|
2000-05-27 01:45:10 +08:00
|
|
|
# Set up autoconf.
|
2004-08-20 14:17:21 +08:00
|
|
|
my $autoconf = "'$autom4te' --language=autoconf ";
|
Proper file name escaping in Autoconf programs and Perl modules.
This includes escaping of characters special to the shell
as well as special to Perl, e.g., leading `<' or `>'.
For example, when $file starts with `>', `open ">$file"'
wrongly tries to append to a different file.
* bin/autoconf.as: Fix quoting for autom4te options.
* lib/Autom4te/General.pm (shell_quote): New function, taken
from coreutils, written by Jim Meyering.
(mktmpdir): Use it.
* bin/autom4te.in (files_to_options, handle_m4): Use shell_quote
and open_quote.
* bin/autoreconf.in (parse_args): Likewise.
* bin/autoscan.in (main): Likewise.
* bin/autoupdate.in (main): Likewise.
* bin/autoheader.in: Likewise, fixing old insufficient escaping.
* bin/ifnames.in: Likewise, XFile usage fixes.
* tests/tools.at (autom4te and whitespace in file names): Extend
test. Test twice, with special characters allowed on w32, and the
rest. Test leading and trailing whitespace, for `open_quote'.
(autotools and whitespace in file names): New, analogous test.
Reported by Paul Eggert and Benoit Sigoure, additional suggestions
by Russ Allbery and Eric Blake.
2007-12-08 18:46:43 +08:00
|
|
|
$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
|
|
|
|
$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
|
2001-08-31 21:32:13 +08:00
|
|
|
$autoconf .= ' --debug' if $debug;
|
2001-08-31 21:33:10 +08:00
|
|
|
$autoconf .= ' --force' if $force;
|
|
|
|
$autoconf .= ' --verbose' if $verbose;
|
2000-05-27 01:45:10 +08:00
|
|
|
|
|
|
|
# ----------------------- #
|
|
|
|
# Real work starts here. #
|
|
|
|
# ----------------------- #
|
2000-03-14 01:26:21 +08:00
|
|
|
|
2000-03-30 00:48:00 +08:00
|
|
|
# Source what the traces are trying to tell us.
|
2003-08-22 01:50:11 +08:00
|
|
|
verb "$me: running $autoconf to trace from $ARGV[0]";
|
Proper file name escaping in Autoconf programs and Perl modules.
This includes escaping of characters special to the shell
as well as special to Perl, e.g., leading `<' or `>'.
For example, when $file starts with `>', `open ">$file"'
wrongly tries to append to a different file.
* bin/autoconf.as: Fix quoting for autom4te options.
* lib/Autom4te/General.pm (shell_quote): New function, taken
from coreutils, written by Jim Meyering.
(mktmpdir): Use it.
* bin/autom4te.in (files_to_options, handle_m4): Use shell_quote
and open_quote.
* bin/autoreconf.in (parse_args): Likewise.
* bin/autoscan.in (main): Likewise.
* bin/autoupdate.in (main): Likewise.
* bin/autoheader.in: Likewise, fixing old insufficient escaping.
* bin/ifnames.in: Likewise, XFile usage fixes.
* tests/tools.at (autom4te and whitespace in file names): Extend
test. Test twice, with special characters allowed on w32, and the
rest. Test leading and trailing whitespace, for `open_quote'.
(autotools and whitespace in file names): New, analogous test.
Reported by Paul Eggert and Benoit Sigoure, additional suggestions
by Russ Allbery and Eric Blake.
2007-12-08 18:46:43 +08:00
|
|
|
my $quoted_tmp = shell_quote ($tmp);
|
2002-10-22 19:14:44 +08:00
|
|
|
xsystem ("$autoconf"
|
2002-09-29 00:39:22 +08:00
|
|
|
# If you change this list, update the
|
2012-09-21 16:51:36 +08:00
|
|
|
# 'Autoheader-preselections' section of autom4te.in.
|
2002-10-22 19:14:44 +08:00
|
|
|
. ' --trace AC_CONFIG_HEADERS:\'$$config_h ||= \'"\'"\'$1\'"\'"\';\''
|
|
|
|
. ' --trace AH_OUTPUT:\'$$verbatim{\'"\'"\'$1\'"\'"\'} = \'"\'"\'$2\'"\'"\';\''
|
|
|
|
. ' --trace AC_DEFINE_TRACE_LITERAL:\'$$symbol{\'"\'"\'$1\'"\'"\'} = 1;\''
|
Proper file name escaping in Autoconf programs and Perl modules.
This includes escaping of characters special to the shell
as well as special to Perl, e.g., leading `<' or `>'.
For example, when $file starts with `>', `open ">$file"'
wrongly tries to append to a different file.
* bin/autoconf.as: Fix quoting for autom4te options.
* lib/Autom4te/General.pm (shell_quote): New function, taken
from coreutils, written by Jim Meyering.
(mktmpdir): Use it.
* bin/autom4te.in (files_to_options, handle_m4): Use shell_quote
and open_quote.
* bin/autoreconf.in (parse_args): Likewise.
* bin/autoscan.in (main): Likewise.
* bin/autoupdate.in (main): Likewise.
* bin/autoheader.in: Likewise, fixing old insufficient escaping.
* bin/ifnames.in: Likewise, XFile usage fixes.
* tests/tools.at (autom4te and whitespace in file names): Extend
test. Test twice, with special characters allowed on w32, and the
rest. Test leading and trailing whitespace, for `open_quote'.
(autotools and whitespace in file names): New, analogous test.
Reported by Paul Eggert and Benoit Sigoure, additional suggestions
by Russ Allbery and Eric Blake.
2007-12-08 18:46:43 +08:00
|
|
|
. " " . shell_quote ($ARGV[0]) . " >$quoted_tmp/traces.pl");
|
2001-08-31 21:32:13 +08:00
|
|
|
|
|
|
|
local (%verbatim, %symbol);
|
2012-09-21 16:51:36 +08:00
|
|
|
debug "$me: 'do'ing $tmp/traces.pl:\n" . `sed 's/^/| /' $quoted_tmp/traces.pl`;
|
2001-08-31 21:32:13 +08:00
|
|
|
do "$tmp/traces.pl";
|
|
|
|
warn "couldn't parse $tmp/traces.pl: $@" if $@;
|
2004-12-13 15:15:04 +08:00
|
|
|
unless ($config_h)
|
|
|
|
{
|
|
|
|
error "error: AC_CONFIG_HEADERS not found in $ARGV[0]";
|
|
|
|
exit 1;
|
|
|
|
}
|
2000-03-30 00:48:00 +08:00
|
|
|
|
|
|
|
# We template only the first CONFIG_HEADER.
|
2001-08-31 21:32:13 +08:00
|
|
|
$config_h =~ s/ .*//;
|
1994-08-10 02:35:50 +08:00
|
|
|
# Support "outfile[:infile]", defaulting infile="outfile.in".
|
2001-08-31 21:32:13 +08:00
|
|
|
($config_h, $config_h_in) = split (':', $config_h, 2);
|
|
|
|
$config_h_in ||= "$config_h.in";
|
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
# %SYMBOL might contain things like 'F77_FUNC(name,NAME)', but we keep
|
2001-08-31 21:34:01 +08:00
|
|
|
# only the name of the macro.
|
|
|
|
%symbol = map { s/\(.*//; $_ => 1 } keys %symbol;
|
|
|
|
|
2016-02-07 04:56:55 +08:00
|
|
|
my $out = new Autom4te::XFile ("$tmp/config.hin", ">");
|
1994-08-10 02:35:50 +08:00
|
|
|
|
1993-08-02 06:27:47 +08:00
|
|
|
# Don't write "do not edit" -- it will get copied into the
|
|
|
|
# config.h, which it's ok to edit.
|
2001-08-31 21:32:13 +08:00
|
|
|
print $out "/* $config_h_in. Generated from $ARGV[0] by autoheader. */\n";
|
1993-08-02 06:27:47 +08:00
|
|
|
|
2000-05-03 19:22:50 +08:00
|
|
|
# Dump the top.
|
2001-08-31 21:32:54 +08:00
|
|
|
if ($config_h_top)
|
|
|
|
{
|
2016-02-07 04:56:55 +08:00
|
|
|
my $in = new Autom4te::XFile ($config_h_top, "<");
|
2001-08-31 21:32:54 +08:00
|
|
|
while ($_ = $in->getline)
|
|
|
|
{
|
2001-08-31 21:33:10 +08:00
|
|
|
print $out $_;
|
2001-08-31 21:32:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
# Dump 'acconfig.h', except for its bottom portion.
|
2001-08-31 21:32:54 +08:00
|
|
|
if ($acconfig_h)
|
|
|
|
{
|
2016-02-07 04:56:55 +08:00
|
|
|
my $in = new Autom4te::XFile ($acconfig_h, "<");
|
2001-08-31 21:32:54 +08:00
|
|
|
while ($_ = $in->getline)
|
|
|
|
{
|
|
|
|
last if /\@BOTTOM\@/;
|
|
|
|
next if /\@TOP\@/;
|
2001-08-31 21:33:10 +08:00
|
|
|
print $out $_;
|
2001-08-31 21:32:54 +08:00
|
|
|
}
|
|
|
|
}
|
1993-08-02 06:27:47 +08:00
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
# Dump the templates from 'configure.ac'.
|
2001-08-31 21:32:13 +08:00
|
|
|
foreach (sort keys %verbatim)
|
|
|
|
{
|
2002-10-22 19:14:44 +08:00
|
|
|
print $out "\n$verbatim{$_}\n";
|
2001-08-31 21:32:13 +08:00
|
|
|
}
|
|
|
|
|
2012-09-21 16:51:36 +08:00
|
|
|
# Dump bottom portion of 'acconfig.h'.
|
2001-08-31 21:32:54 +08:00
|
|
|
if ($acconfig_h)
|
|
|
|
{
|
2016-02-07 04:56:55 +08:00
|
|
|
my $in = new Autom4te::XFile ($acconfig_h, "<");
|
2001-08-31 21:32:54 +08:00
|
|
|
my $dump = 0;
|
|
|
|
while ($_ = $in->getline)
|
|
|
|
{
|
2001-08-31 21:33:10 +08:00
|
|
|
print $out $_ if $dump;
|
2001-08-31 21:32:54 +08:00
|
|
|
$dump = 1 if /\@BOTTOM\@/;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Dump the bottom.
|
|
|
|
if ($config_h_bot)
|
|
|
|
{
|
2016-02-07 04:56:55 +08:00
|
|
|
my $in = new Autom4te::XFile ($config_h_bot, "<");
|
2001-08-31 21:32:54 +08:00
|
|
|
while ($_ = $in->getline)
|
|
|
|
{
|
2001-08-31 21:33:10 +08:00
|
|
|
print $out $_;
|
2001-08-31 21:32:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-31 21:32:13 +08:00
|
|
|
$out->close;
|
|
|
|
|
2001-08-31 21:32:54 +08:00
|
|
|
# Check that all the symbols have a template.
|
|
|
|
{
|
2016-02-07 04:56:55 +08:00
|
|
|
my $in = new Autom4te::XFile ("$tmp/config.hin", "<");
|
2002-10-16 14:38:50 +08:00
|
|
|
my $suggest_ac_define = 1;
|
2001-08-31 21:32:54 +08:00
|
|
|
while ($_ = $in->getline)
|
|
|
|
{
|
|
|
|
my ($symbol) = /^\#\s*\w+\s+(\w+)/
|
|
|
|
or next;
|
|
|
|
delete $symbol{$symbol};
|
|
|
|
}
|
|
|
|
foreach (sort keys %symbol)
|
|
|
|
{
|
2003-08-27 19:35:08 +08:00
|
|
|
msg 'syntax', "warning: missing template: $_";
|
2002-10-16 14:38:50 +08:00
|
|
|
if ($suggest_ac_define)
|
|
|
|
{
|
2003-08-27 19:35:08 +08:00
|
|
|
msg 'syntax', "Use AC_DEFINE([$_], [], [Description])";
|
2002-10-16 14:38:50 +08:00
|
|
|
$suggest_ac_define = 0;
|
|
|
|
}
|
|
|
|
|
2001-08-31 21:32:54 +08:00
|
|
|
}
|
|
|
|
exit 1
|
|
|
|
if keys %symbol;
|
|
|
|
}
|
2001-08-31 21:32:13 +08:00
|
|
|
|
2005-01-27 18:53:41 +08:00
|
|
|
update_file ("$tmp/config.hin", "$config_h_in", $force);
|
2002-07-03 04:31:22 +08:00
|
|
|
|
|
|
|
### Setup "GNU" style for perl-mode and cperl-mode.
|
|
|
|
## Local Variables:
|
|
|
|
## perl-indent-level: 2
|
|
|
|
## perl-continued-statement-offset: 2
|
|
|
|
## perl-continued-brace-offset: 0
|
|
|
|
## perl-brace-offset: 0
|
|
|
|
## perl-brace-imaginary-offset: 0
|
|
|
|
## perl-label-offset: -2
|
|
|
|
## cperl-indent-level: 2
|
|
|
|
## cperl-brace-offset: 0
|
|
|
|
## cperl-continued-brace-offset: 0
|
|
|
|
## cperl-label-offset: -2
|
|
|
|
## cperl-extra-newline-before-brace: t
|
|
|
|
## cperl-merge-trailing-else: nil
|
|
|
|
## cperl-continued-statement-offset: 2
|
|
|
|
## End:
|