doc: factor ifnottex/iftex examples
[bison.git] / build-aux / update-package-copyright-year
blobad27b0ce1b616f5664db0f364b52c37e9f50ed92
1 #!/usr/bin/perl -0777 -pi
3 # In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
5 # Copyright (C) 2010-2015, 2018-2020 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 <http://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";