]> git.saurik.com Git - bison.git/blame - build-aux/update-package-copyright-year
build: look for Perl in configure.
[bison.git] / build-aux / update-package-copyright-year
CommitLineData
8ebc7dca
JD
1#!/usr/bin/perl -0777 -pi
2
3# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
4
c932d613 5# Copyright (C) 2010-2012 Free Software Foundation, Inc.
8ebc7dca
JD
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
20use strict;
21use warnings;
22
23my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
24if (!$this_year || $this_year !~ m/^\d{4}$/)
25 {
26 my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
27 $this_year = $year + 1900;
28 }
29my $old_re = <<'EOF'
30 (
31 MACRO\(
32 \[PACKAGE_COPYRIGHT_YEAR],
33 \s*\[
34 )
35 (\d{4})
36 (?=])
37EOF
38 ;
39foreach 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 }