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/>.
25 my $file = shift @ARGV;
28 my $data = parse_config();
39 open(my $fh, '<', "$file.in") or die "Cannot open $file.in: $!";
44 if ($list eq $choice) {
47 push @$features, [$choice_key, $choice];
51 } elsif (/^([A-Za-z0-9_-]+) \s+ choice:\s*$/x) {
57 if (/^([A-Za-z0-9_-]+) \s+ (.*)$/x) {
58 push @$list, [$1, $2];
60 croak "Can't parse line: $_";
64 if ($list eq $choice) {
65 push @$features, [$choice_key, $choice];
77 open(my $fh, '>', "$file") or die "Cannot open $file: $!";
79 print $fh do { local $/; <DATA> }, "\n";
81 const char *compiled_features[] =
85 foreach my $feature (sort { $a->[0] cmp $b->[0] } @$features) {
86 my ($name, $check) = @$feature;
88 if (ref $check eq 'ARRAY') {
89 my ($ch_name, $ch_check) = @{ shift @$check };
94 foreach my $choice (@$check) {
95 ($ch_name, $ch_check) = @$choice;
130 /* Autogenerated by build_info.pl - DO NOT EDIT */
132 /* This stores global variables that are initialized with
133 preprocessor declarations for output with the --version flag.
135 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
136 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. */