Skip to content

Commit b092f3f

Browse files
authored
Require Autoconf 2.71 or newer (#21159)
This updates the minimum required Autoconf version to 2.71. - Autoconf versions 2.70 started supporting C11 standards. - Autoconf 2.71 was released soon after 2.70 providing some bugfixes. Changes: - Removed obsolete AC_PROG_CC_C99 macro. In Autoconf 2.70 and later this is done by the AC_PROG_CC macro. - m4_normalize is not needed for AC_CHECK_HEADERS and AC_CHECK_FUNCTIONS macros anymore, as the argument is normalized internally by Autoconf in these newer versions. - Adjusted C11 check in configure.ac and added check also in phpize mode. Extensions using PHP headers should be also built with some C11-compliant compiler. - Removed ac_cv_header_sys_types_h_makedev hack for AC_HEADER_MAJOR macro when using Autoconf versions prior to 2.70. - Replaced AC_CONFIG_MACRO_DIR with preferred AC_CONFIG_MACRO_DIRS. This also enables using --runstatedir configure option in the future.
1 parent ffce4af commit b092f3f

7 files changed

Lines changed: 30 additions & 32 deletions

File tree

‎UPGRADING.INTERNALS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ PHP 8.7 INTERNALS UPGRADE NOTES
2121
2. Build system changes
2222
========================
2323

24+
- Unix build system changes:
25+
. Autoconf minimum required version upgraded to 2.71.
26+
2427
========================
2528
3. Module changes
2629
========================

‎Zend/Zend.m4‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ dnl
133133
AC_DEFUN([ZEND_INIT], [dnl
134134
AC_REQUIRE([AC_PROG_CC])
135135
136-
AC_CHECK_HEADERS(m4_normalize([
136+
AC_CHECK_HEADERS([
137137
cpuid.h
138138
libproc.h
139-
]))
139+
])
140140
141141
dnl Check for library functions.
142-
AC_CHECK_FUNCS(m4_normalize([
142+
AC_CHECK_FUNCS([
143143
getpid
144144
gettid
145145
kill
@@ -151,7 +151,7 @@ AC_CHECK_FUNCS(m4_normalize([
151151
pthread_getthrds_np
152152
pthread_stackseg_np
153153
strnlen
154-
]))
154+
])
155155
156156
AC_CHECK_DECL([clock_gettime_nsec_np],
157157
[AC_DEFINE([HAVE_CLOCK_GETTIME_NSEC_NP], [1],

‎configure.ac‎

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ m4_include([Zend/Zend.m4])
2222
dnl Basic autoconf initialization, generation of config.nice.
2323
dnl ----------------------------------------------------------------------------
2424

25-
AC_PREREQ([2.68])
25+
AC_PREREQ([2.71])
2626
AC_INIT([PHP],[8.7.0-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net])
2727
AC_CONFIG_SRCDIR([main/php_version.h])
28-
AC_CONFIG_MACRO_DIR([build])
28+
AC_CONFIG_MACRO_DIRS([build])
2929
AC_CONFIG_AUX_DIR([build])
3030
AC_PRESERVE_HELP_ORDER
3131

@@ -120,11 +120,14 @@ dnl ----------------------------------------------------------------------------
120120

121121
PKG_PROG_PKG_CONFIG
122122
AC_PROG_CC([cc gcc])
123+
124+
dnl Check if C compiler accepts C11.
125+
AS_CASE([$ac_prog_cc_stdc], [c99|c89|no],
126+
[AC_MSG_ERROR([C compiler would not accept C11 code.])])
127+
123128
PHP_DETECT_ICC
124129
PHP_DETECT_SUNCC
125130

126-
dnl AC_PROG_CC_C99 is obsolete with autoconf >= 2.70 yet necessary for <= 2.69.
127-
m4_version_prereq([2.70],,[AC_PROG_CC_C99])
128131
AC_PROG_CPP
129132
AC_USE_SYSTEM_EXTENSIONS
130133
AC_PROG_LN_S
@@ -135,17 +138,6 @@ AS_VAR_IF([cross_compiling], [yes],
135138
AC_MSG_RESULT([$BUILD_CC])],
136139
[BUILD_CC=$CC])
137140

138-
dnl The macro AC_PROG_CC_C99 sets the shell variable ac_cv_prog_cc_c99 to 'no'
139-
dnl if the compiler does not support C99.i.e. does not support any of _Bool,
140-
dnl flexible arrays, inline, long long int, mixed code and declarations,
141-
dnl named initialization of structs, restrict, varargs macros, variable
142-
dnl declarations in for loops and variable length arrays.
143-
dnl
144-
dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/C-Compiler.html
145-
if test "$ac_cv_prog_cc_c99" = no; then
146-
AC_MSG_ERROR([C compiler would not accept C99 code])
147-
fi
148-
149141
dnl Support systems with system libraries in e.g. /usr/lib64.
150142
PHP_ARG_WITH([libdir],
151143
[for system library directory],
@@ -380,7 +372,7 @@ dnl Then headers.
380372
dnl ----------------------------------------------------------------------------
381373

382374
dnl QNX requires unix.h to allow functions in libunix to work properly.
383-
AC_CHECK_HEADERS(m4_normalize([
375+
AC_CHECK_HEADERS([
384376
dirent.h
385377
sys/param.h
386378
sys/types.h
@@ -428,7 +420,7 @@ AC_CHECK_HEADERS(m4_normalize([
428420
nmmintrin.h
429421
wmmintrin.h
430422
immintrin.h
431-
]),,, [dnl
423+
],,, [dnl
432424
#ifdef HAVE_SYS_PARAM_H
433425
#include <sys/param.h>
434426
#endif
@@ -452,8 +444,6 @@ PHP_BROKEN_GETCWD
452444
AS_VAR_IF([GCC], [yes], [PHP_BROKEN_GCC_STRLEN_OPT])
453445

454446
dnl Detect the headers required to use makedev, major, and minor.
455-
dnl Autoconf <= 2.69 didn't check glibc 2.25 deprecated macros in sys/types.h.
456-
m4_version_prereq([2.70],,[ac_cv_header_sys_types_h_makedev=no])
457447
AC_HEADER_MAJOR
458448

459449
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -546,7 +536,7 @@ PHP_CHECK_VARIABLE_ATTRIBUTE([aligned])
546536
dnl Checks for library functions.
547537
dnl ----------------------------------------------------------------------------
548538

549-
AC_CHECK_FUNCS(m4_normalize([
539+
AC_CHECK_FUNCS([
550540
alphasort
551541
asctime_r
552542
asprintf
@@ -609,7 +599,7 @@ AC_CHECK_FUNCS(m4_normalize([
609599
usleep
610600
utime
611601
vasprintf
612-
]))
602+
])
613603

614604
PHP_ARG_ENABLE([system-glob],
615605
[whether to use the system glob function],

‎ext/ldap/config.m4‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ if test "$PHP_LDAP" != "no"; then
132132

133133
dnl Solaris 2.8 claims to be 2004 API, but doesn't have ldap_parse_reference()
134134
dnl nor ldap_start_tls_s()
135-
AC_CHECK_FUNCS(m4_normalize([
135+
AC_CHECK_FUNCS([
136136
ldap_control_find
137137
ldap_extended_operation_s
138138
ldap_parse_extended_result
@@ -142,7 +142,7 @@ if test "$PHP_LDAP" != "no"; then
142142
ldap_refresh_s
143143
ldap_start_tls_s
144144
ldap_whoami_s
145-
]))
145+
])
146146

147147
dnl Sanity check
148148
AC_CHECK_FUNC([ldap_sasl_bind_s],,

‎ext/pcntl/config.m4‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if test "$PHP_PCNTL" != "no"; then
99
[AC_MSG_FAILURE([ext/pcntl: required function $function() not found.])])
1010
done
1111

12-
AC_CHECK_FUNCS(m4_normalize([
12+
AC_CHECK_FUNCS([
1313
forkx
1414
getcpuid
1515
getpriority
@@ -26,7 +26,7 @@ if test "$PHP_PCNTL" != "no"; then
2626
waitid
2727
wait6
2828
syscall
29-
]))
29+
])
3030

3131
AC_CHECK_FUNCS([WIFCONTINUED],,
3232
[AC_CHECK_DECL([WIFCONTINUED], [AC_DEFINE([HAVE_WIFCONTINUED], [1])],,

‎ext/posix/config.m4‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if test "$PHP_POSIX" = "yes"; then
1212
[$ext_shared],,
1313
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
1414

15-
AC_CHECK_FUNCS(m4_normalize([
15+
AC_CHECK_FUNCS([
1616
ctermid
1717
eaccess
1818
getgrgid_r
@@ -28,7 +28,7 @@ if test "$PHP_POSIX" = "yes"; then
2828
seteuid
2929
setrlimit
3030
setsid
31-
]))
31+
])
3232

3333
dnl Check for makedev. If it's defined as a macro, AC_CHECK_FUNCS won't work.
3434
dnl Required headers are included by the AC_HEADER_MAJOR logic.

‎scripts/phpize.m4‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ m4_include([build/php_cxx_compile_stdcxx.m4])
1515
m4_include([build/php.m4])
1616
m4_include([build/pkg.m4])
1717

18-
AC_PREREQ([2.68])
18+
AC_PREREQ([2.71])
1919
AC_INIT
2020
AC_CONFIG_SRCDIR([config.m4])
2121
AC_CONFIG_AUX_DIR([build])
@@ -36,6 +36,11 @@ PHP_INIT_BUILD_SYSTEM
3636

3737
PKG_PROG_PKG_CONFIG
3838
AC_PROG_CC([cc gcc])
39+
40+
dnl Check if C compiler accepts C11.
41+
AS_CASE([$ac_prog_cc_stdc], [c99|c89|no],
42+
[AC_MSG_ERROR([C compiler would not accept C11 code.])])
43+
3944
PHP_DETECT_ICC
4045
PHP_DETECT_SUNCC
4146

0 commit comments

Comments
 (0)