Skip to content

Commit b97a60c

Browse files
authored
Autotools: Check Apache version with apxs and HTTPD_VERSION variable (php#15476)
The apxs -q HTTPD_VERSION variable is available since Apache 2.4.17. This change obsoletes the PHP_AP_EXTRACT_VERSION macro and checks the version in the config.m4 file directly. Version is checked against the dotted format instead of the version number.
1 parent edcd6cc commit b97a60c

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
189189
symbol anymore and requires at least libxml2 2.9.4.
190190
- Autoconf macro PHP_SETUP_ICONV doesn't define the HAVE_ICONV symbol
191191
anymore.
192+
- Autoconf macro PHP_AP_EXTRACT_VERSION is obsolete (use the
193+
'apxs -q HTTPD_VERSION').
192194
- Autoconf macro PHP_OUTPUT is obsolete (use AC_CONFIG_FILES).
193195
- Autoconf macro PHP_PROG_SETUP now accepts an argument to set the minimum
194196
required PHP version during the build.

build/php.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,8 @@ dnl PHP_AP_EXTRACT_VERSION(/path/httpd)
20302030
dnl
20312031
dnl This macro is used to get a comparable version for Apache.
20322032
dnl
2033-
AC_DEFUN([PHP_AP_EXTRACT_VERSION],[
2033+
AC_DEFUN([PHP_AP_EXTRACT_VERSION], [m4_warn([obsolete],
2034+
[The macro 'PHP_AP_EXTRACT_VERSION' is obsolete. Use 'apxs -q HTTPD_VERSION'])
20342035
AS_IF([test -x "$1"], [
20352036
ac_output=$($1 -v 2>&1 | grep version | $SED -e 's/Oracle-HTTP-//')
20362037
ac_IFS=$IFS

sapi/apache2handler/config.m4

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,19 @@ if test "$PHP_APXS2" != "no"; then
5353
AS_CASE([$flag], [-D*], [APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag"])
5454
done
5555

56-
dnl Check Apache version.
57-
PHP_AP_EXTRACT_VERSION([$APXS_HTTPD])
58-
AS_VERSION_COMPARE([$APACHE_VERSION], [2004000],
56+
dnl Check Apache version. The HTTPD_VERSION was added in Apache 2.4.17.
57+
dnl Earlier versions can use the Apache HTTP Server command-line utility.
58+
APACHE_VERSION=$($APXS -q HTTPD_VERSION 2>/dev/null)
59+
AS_VAR_IF([APACHE_VERSION],, [
60+
ac_output=$($APXS_HTTPD -v 2>&1 | grep version | $SED -e 's/Oracle-HTTP-//')
61+
ac_IFS=$IFS
62+
IFS="- /.
63+
"
64+
set $ac_output
65+
IFS=$ac_IFS
66+
APACHE_VERSION="$4.$5.$6"
67+
])
68+
AS_VERSION_COMPARE([$APACHE_VERSION], [2.4.0],
5969
[AC_MSG_ERROR([Please note that Apache version >= 2.4 is required])])
6070

6171
APXS_LIBEXECDIR='$(INSTALL_ROOT)'$($APXS -q LIBEXECDIR)

0 commit comments

Comments
 (0)