Skip to content

Commit afd52f9

Browse files
committed
Refactor AC_INIT in configure.ac and PHP versions
Since Autoconf 2.53 the AC_INIT call with only a single argument has been made obsolete and now includes several other optional arguments to make installation experience a bit better by providing program version and links to the project in the `./configure -h` output. This patch also updates win build version. The phpize.m4 AC_INIT has been updated with the call without arguments.
1 parent 3eae4f6 commit afd52f9

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

buildconf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ debug=0
99
# Go to project root.
1010
cd $(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
1111

12-
eval $(grep '^PHP_EXTRA_VERSION=' configure.ac)
13-
case "$PHP_EXTRA_VERSION" in
14-
*-dev)
12+
php_extra_version=$(grep '^AC_INIT(' configure.ac)
13+
case "$php_extra_version" in
14+
*-dev*)
1515
dev=1
1616
;;
1717
*)

configure.ac

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ dnl Basic autoconf initialization, generation of config.nice.
88
dnl -------------------------------------------------------------------------
99

1010
AC_PREREQ([2.68])
11-
AC_INIT([main/php_version.h])
11+
AC_INIT([PHP],[7.4.0-dev],[https://bugs.php.net],[php],[https://www.php.net])
12+
AC_CONFIG_SRCDIR([main/php_version.h])
1213
AC_CONFIG_AUX_DIR([build])
1314
AC_PRESERVE_HELP_ORDER
1415

@@ -99,10 +100,13 @@ extern "C++" {
99100
#endif /* PHP_CONFIG_H */
100101
])
101102

102-
PHP_MAJOR_VERSION=7
103-
PHP_MINOR_VERSION=4
104-
PHP_RELEASE_VERSION=0
105-
PHP_EXTRA_VERSION="-dev"
103+
ac_IFS=$IFS; IFS="."
104+
set $(echo AC_PACKAGE_VERSION | $SED 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/')
105+
IFS=$ac_IFS
106+
PHP_MAJOR_VERSION=[$]1
107+
PHP_MINOR_VERSION=[$]2
108+
PHP_RELEASE_VERSION=[$]3
109+
PHP_EXTRA_VERSION=[$]4
106110
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
107111
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
108112

scripts/phpize.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
dnl This file becomes configure.ac for self-contained extensions.
22

33
AC_PREREQ([2.68])
4-
AC_INIT(config.m4)
4+
AC_INIT
5+
AC_CONFIG_SRCDIR([config.m4])
56
AC_CONFIG_AUX_DIR([build])
67
AC_PRESERVE_HELP_ORDER
78

win32/build/confutils.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,17 @@ var PHP_VERSION_STRING = "7.3.0";
105105
function get_version_numbers()
106106
{
107107
var cin = file_get_contents("configure.ac");
108+
var regex = /AC_INIT.+(\d+)\.(\d+)\.(\d+)([^\,^\]]*).+/g;
108109

109-
if (cin.match(new RegExp("PHP_MAJOR_VERSION=(\\d+)"))) {
110+
if (cin.match(new RegExp(regex))) {
110111
PHP_VERSION = RegExp.$1;
112+
PHP_MINOR_VERSION = RegExp.$2;
113+
PHP_RELEASE_VERSION = RegExp.$3;
114+
PHP_EXTRA_VERSION = RegExp.$4;
111115
}
112-
if (cin.match(new RegExp("PHP_MINOR_VERSION=(\\d+)"))) {
113-
PHP_MINOR_VERSION = RegExp.$1;
114-
}
115-
if (cin.match(new RegExp("PHP_RELEASE_VERSION=(\\d+)"))) {
116-
PHP_RELEASE_VERSION = RegExp.$1;
117-
}
118-
PHP_VERSION_STRING = PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION;
119116

120-
if (cin.match(new RegExp("PHP_EXTRA_VERSION=\"([^\"]+)\""))) {
121-
PHP_EXTRA_VERSION = RegExp.$1;
122-
if (PHP_EXTRA_VERSION.length) {
123-
PHP_VERSION_STRING += PHP_EXTRA_VERSION;
124-
}
125-
}
117+
PHP_VERSION_STRING = PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION + PHP_EXTRA_VERSION;
118+
126119
DEFINE('PHP_VERSION_STRING', PHP_VERSION_STRING);
127120
}
128121

0 commit comments

Comments
 (0)