Update configure probes for CFLAGS needed for ARM CRC instructions.
[pgsql.git] / src / tools / version_stamp.pl
blob3743ece29963381ef0125902fddb63ab6dfcb0c3
1 #! /usr/bin/perl
3 #################################################################
4 # version_stamp.pl -- update version stamps throughout the source tree
6 # Copyright (c) 2008-2024, PostgreSQL Global Development Group
8 # src/tools/version_stamp.pl
9 #################################################################
12 # This script updates the version stamp in configure.ac, and also in assorted
13 # other files wherein it's not convenient to obtain the version number from
14 # configure's output. Note that you still have to run autoconf afterward
15 # to regenerate configure from the updated configure.ac.
17 # Usage: cd to top of source tree and issue
18 # src/tools/version_stamp.pl MINORVERSION
19 # where MINORVERSION can be a minor release number (0, 1, etc), or
20 # "devel", "alphaN", "betaN", "rcN".
23 use strict;
24 use warnings FATAL => 'all';
26 # Major version is hard-wired into the script. We update it when we branch
27 # a new development version.
28 my $majorversion = 18;
30 # Validate argument and compute derived variables
31 my $minor = shift;
32 defined($minor) || die "$0: missing required argument: minor-version\n";
34 my ($dotneeded);
36 if ($minor =~ m/^\d+$/)
38 $dotneeded = 1;
40 elsif ($minor eq "devel")
42 $dotneeded = 0;
44 elsif ($minor =~ m/^alpha\d+$/)
46 $dotneeded = 0;
48 elsif ($minor =~ m/^beta\d+$/)
50 $dotneeded = 0;
52 elsif ($minor =~ m/^rc\d+$/)
54 $dotneeded = 0;
56 else
58 die "$0: minor-version must be N, devel, alphaN, betaN, or rcN\n";
61 my $fullversion;
63 # Create various required forms of the version number
64 if ($dotneeded)
66 $fullversion = $majorversion . "." . $minor;
68 else
70 $fullversion = $majorversion . $minor;
73 # Get the autoconf version number for eventual nag message
74 # (this also ensures we're in the right directory)
76 my $aconfver = "";
77 open(my $fh, '<', "configure.ac") || die "could not read configure.ac: $!\n";
78 while (<$fh>)
80 if (m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], \[m4_fatal/
83 $aconfver = $1;
84 last;
87 close($fh);
88 $aconfver ne ""
89 || die "could not find autoconf version number in configure.ac\n";
91 # Update configure.ac and other files that contain version numbers
93 my $fixedfiles = "";
95 sed_file("configure.ac",
96 "-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'"
98 sed_file("meson.build",
99 qq{-e "/^project(/,/^)/ s/ version: '[0-9a-z.]*',/ version: '$fullversion',/"}
102 print "Stamped these files with version number $fullversion:\n$fixedfiles";
103 print "Don't forget to run autoconf $aconfver before committing.\n";
105 exit 0;
107 sub sed_file
109 my ($filename, $sedargs) = @_;
110 my ($tmpfilename) = $filename . ".tmp";
112 system("sed $sedargs $filename >$tmpfilename") == 0
113 or die "sed failed: $?";
114 system("mv $tmpfilename $filename") == 0
115 or die "mv failed: $?";
117 $fixedfiles .= "\t$filename\n";
118 return;