3 # Generate build_info.c.
5 # Copyright (C) 2009 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 my $file = shift @ARGV;
29 my $data = parse_config();
35 my (%block, @defines, %feature);
37 open(my $fh, '<', $file) or die "Cannot open $file: $!";
38 my $cfg = do { local $/; <$fh> };
41 while ($cfg =~ /^\ *? (\w+) (?:\s+?)? (\w+?)? \s*$/gmx) {
42 $feature{$1} = $2 || '_MISSING';
45 while ($cfg =~ /^(\ *? \#\w+? \s+? (\w+) .+ \#\w+)/gmsx) {
60 my ($block, $defines, $feature) =
61 map $_[0]->{$_}, qw(block defines feature);
63 print do { local $/; <DATA> }, "\n";
65 const char* (compiled_features[]) =
70 foreach my $define (@$defines) {
71 if (!exists $block->{$define}) {
74 "+$feature->{$define}",
76 "-$feature->{$define}",
86 print join "\n", @output;
98 /* Autogenerated by build_info.pl - DO NOT EDIT */
100 /* This stores global variables that are initialized with
101 preprocessor declarations for output with the --version flag.
103 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
104 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. */