glr2.cc: semantic_option: use a symbol
[bison.git] / build-aux / update-package-copyright-year
blob9ad0ba12bb7eeec1f1a54cad9ca5b352192b01d4
1 #!/usr/bin/perl -0777 -pi
3 # In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
5 # Copyright (C) 2010-2015, 2018-2021 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, or (at your option)
10 # 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 <https://www.gnu.org/licenses/>.
20 use strict;
21 use warnings;
23 my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
24 if (!$this_year || $this_year !~ m/^\d{4}$/)
26 my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
27 $this_year = $year + 1900;
29 my $old_re = <<'EOF'
31 MACRO\(
32 \[PACKAGE_COPYRIGHT_YEAR],
33 \s*\[
35 (\d{4})
36 (?=])
37 EOF
39 foreach my $macro ("AC_DEFINE", "AC_SUBST")
41 my $this_old_re = $old_re;
42 $this_old_re =~ s/MACRO/$macro/;
43 if (!s/$this_old_re/$1$this_year/x)
45 print STDERR
46 "$ARGV: warning: failed to update PACKAGE_COPYRIGHT_YEAR in"
47 . " $macro.\n";