]> git.saurik.com Git - bison.git/blob - build-aux/update-package-copyright-year
c++: fix position operator signatures
[bison.git] / build-aux / update-package-copyright-year
1 #!/usr/bin/perl -0777 -pi
2
3 # In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
4
5 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
6 #
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.
11 #
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.
16 #
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/>.
19
20 use strict;
21 use warnings;
22
23 my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
24 if (!$this_year || $this_year !~ m/^\d{4}$/)
25 {
26 my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
27 $this_year = $year + 1900;
28 }
29 my $old_re = <<'EOF'
30 (
31 MACRO\(
32 \[PACKAGE_COPYRIGHT_YEAR],
33 \s*\[
34 )
35 (\d{4})
36 (?=])
37 EOF
38 ;
39 foreach my $macro ("AC_DEFINE", "AC_SUBST")
40 {
41 my $this_old_re = $old_re;
42 $this_old_re =~ s/MACRO/$macro/;
43 if (!s/$this_old_re/$1$this_year/x)
44 {
45 print STDERR
46 "$ARGV: warning: failed to update PACKAGE_COPYRIGHT_YEAR in"
47 . " $macro.\n";
48 }
49 }