|
| 1 | +From: =?utf-8?b?T25kxZllaiBTdXLDvQ==?= < [email protected]> |
| 2 | +Date: Sun, 17 Aug 2025 08:49:03 +0200 |
| 3 | +Subject: Fix autoconf errors |
| 4 | + |
| 5 | +--- |
| 6 | + Zend/Zend.m4 | 5 ++++ |
| 7 | + Zend/acinclude.m4 | 7 ++++- |
| 8 | + Zend/zend_sprintf.c | 2 +- |
| 9 | + acinclude.m4 | 69 ++++++++++++++++++++++++++++++++------------------ |
| 10 | + configure.in | 2 ++ |
| 11 | + ext/curl/config.m4 | 2 ++ |
| 12 | + ext/standard/config.m4 | 23 +++++++++++++++++ |
| 13 | + 7 files changed, 83 insertions(+), 27 deletions(-) |
| 14 | + |
| 15 | +diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 |
| 16 | +index 9a7d38e..a9263bd 100644 |
| 17 | +--- a/Zend/Zend.m4 |
| 18 | ++++ b/Zend/Zend.m4 |
| 19 | +@@ -110,6 +110,7 @@ dnl test whether double cast to long preserves least significant bits |
| 20 | + AC_MSG_CHECKING(whether double cast to long preserves least significant bits) |
| 21 | + |
| 22 | + AC_TRY_RUN([ |
| 23 | ++#include <stdlib.h> |
| 24 | + #include <limits.h> |
| 25 | + |
| 26 | + int main() |
| 27 | +@@ -247,6 +248,7 @@ dnl this also does the logarithmic test for ZEND_MM. |
| 28 | + AC_MSG_CHECKING(for MM alignment and log values) |
| 29 | + |
| 30 | + AC_TRY_RUN([ |
| 31 | ++#include <stdlib.h> |
| 32 | + #include <stdio.h> |
| 33 | + |
| 34 | + typedef union _mm_align_test { |
| 35 | +@@ -341,6 +343,9 @@ AC_MSG_CHECKING(for memory allocation using mmap("/dev/zero")) |
| 36 | + AC_TRY_RUN([ |
| 37 | + #include <sys/types.h> |
| 38 | + #include <sys/stat.h> |
| 39 | ++#if HAVE_UNISTD_H |
| 40 | ++#include <unistd.h> |
| 41 | ++#endif |
| 42 | + #include <fcntl.h> |
| 43 | + #include <sys/mman.h> |
| 44 | + #include <stdlib.h> |
| 45 | +diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 |
| 46 | +index 7fa8c99..40d34e5 100644 |
| 47 | +--- a/Zend/acinclude.m4 |
| 48 | ++++ b/Zend/acinclude.m4 |
| 49 | +@@ -67,7 +67,12 @@ dnl Check for broken sprintf() |
| 50 | + dnl |
| 51 | + AC_DEFUN([AC_ZEND_BROKEN_SPRINTF],[ |
| 52 | + AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[ |
| 53 | +- AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[ |
| 54 | ++ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
| 55 | ++#include <stdlib.h> |
| 56 | ++#include <stdio.h> |
| 57 | ++ ]],[[ |
| 58 | ++char buf[20]; exit(sprintf(buf,"testing 123")!=11) |
| 59 | ++ ]])],[ |
| 60 | + ac_cv_broken_sprintf=no |
| 61 | + ],[ |
| 62 | + ac_cv_broken_sprintf=yes |
| 63 | +diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c |
| 64 | +index efa21ac..998e181 100644 |
| 65 | +--- a/Zend/zend_sprintf.c |
| 66 | ++++ b/Zend/zend_sprintf.c |
| 67 | +@@ -28,7 +28,7 @@ |
| 68 | + #endif |
| 69 | + |
| 70 | + #if ZEND_BROKEN_SPRINTF |
| 71 | +-int zend_sprintf(char *buffer, const char *format, ...) |
| 72 | ++ZEND_API int zend_sprintf(char *buffer, const char *format, ...) |
| 73 | + { |
| 74 | + va_list args; |
| 75 | + |
| 76 | +diff --git a/acinclude.m4 b/acinclude.m4 |
| 77 | +index ebfc80d..fffa0a9 100644 |
| 78 | +--- a/acinclude.m4 |
| 79 | ++++ b/acinclude.m4 |
| 80 | +@@ -1172,7 +1172,7 @@ AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[ |
| 81 | + AC_TRY_RUN([ |
| 82 | + #include <time.h> |
| 83 | + |
| 84 | +-main() { |
| 85 | ++int main() { |
| 86 | + char buf[27]; |
| 87 | + struct tm t; |
| 88 | + time_t old = 0; |
| 89 | +@@ -1188,7 +1188,7 @@ return (1); |
| 90 | + ],[ |
| 91 | + AC_TRY_RUN([ |
| 92 | + #include <time.h> |
| 93 | +-main() { |
| 94 | ++int main() { |
| 95 | + struct tm t, *s; |
| 96 | + time_t old = 0; |
| 97 | + char buf[27], *p; |
| 98 | +@@ -1220,13 +1220,14 @@ dnl PHP_DOES_PWRITE_WORK |
| 99 | + dnl internal |
| 100 | + AC_DEFUN([PHP_DOES_PWRITE_WORK],[ |
| 101 | + AC_TRY_RUN([ |
| 102 | ++#include <stdlib.h> |
| 103 | + #include <sys/types.h> |
| 104 | + #include <sys/stat.h> |
| 105 | + #include <fcntl.h> |
| 106 | + #include <unistd.h> |
| 107 | + #include <errno.h> |
| 108 | + $1 |
| 109 | +- main() { |
| 110 | ++ int main() { |
| 111 | + int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); |
| 112 | + |
| 113 | + if (fd < 0) exit(1); |
| 114 | +@@ -1250,13 +1251,14 @@ dnl internal |
| 115 | + AC_DEFUN([PHP_DOES_PREAD_WORK],[ |
| 116 | + echo test > conftest_in |
| 117 | + AC_TRY_RUN([ |
| 118 | ++#include <stdlib.h> |
| 119 | + #include <sys/types.h> |
| 120 | + #include <sys/stat.h> |
| 121 | + #include <fcntl.h> |
| 122 | + #include <unistd.h> |
| 123 | + #include <errno.h> |
| 124 | + $1 |
| 125 | +- main() { |
| 126 | ++ int main() { |
| 127 | + char buf[3]; |
| 128 | + int fd = open("conftest_in", O_RDONLY); |
| 129 | + if (fd < 0) exit(1); |
| 130 | +@@ -1362,6 +1364,7 @@ AC_DEFUN([PHP_READDIR_R_TYPE],[ |
| 131 | + AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[ |
| 132 | + AC_TRY_RUN([ |
| 133 | + #define _REENTRANT |
| 134 | ++#include <stdlib.h> |
| 135 | + #include <sys/types.h> |
| 136 | + #include <dirent.h> |
| 137 | + |
| 138 | +@@ -1369,7 +1372,7 @@ AC_DEFUN([PHP_READDIR_R_TYPE],[ |
| 139 | + #define PATH_MAX 1024 |
| 140 | + #endif |
| 141 | + |
| 142 | +-main() { |
| 143 | ++int main() { |
| 144 | + DIR *dir; |
| 145 | + char entry[sizeof(struct dirent)+PATH_MAX]; |
| 146 | + struct dirent *pentry = (struct dirent *) &entry; |
| 147 | +@@ -1485,7 +1488,12 @@ dnl Check for broken sprintf(), C99 conformance |
| 148 | + dnl |
| 149 | + AC_DEFUN([PHP_AC_BROKEN_SPRINTF],[ |
| 150 | + AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[ |
| 151 | +- AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[ |
| 152 | ++ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
| 153 | ++#include <stdlib.h> |
| 154 | ++#include <stdio.h> |
| 155 | ++ ]],[[ |
| 156 | ++char buf[20]; exit(sprintf(buf,"testing 123")!=11) |
| 157 | ++ ]])],[ |
| 158 | + ac_cv_broken_sprintf=no |
| 159 | + ],[ |
| 160 | + ac_cv_broken_sprintf=yes |
| 161 | +@@ -1507,22 +1515,26 @@ dnl Check for broken snprintf(), C99 conformance |
| 162 | + dnl |
| 163 | + AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[ |
| 164 | + AC_CACHE_CHECK(whether snprintf is broken, ac_cv_broken_snprintf,[ |
| 165 | +- AC_TRY_RUN([ |
| 166 | ++ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
| 167 | ++#include <stdlib.h> |
| 168 | ++#include <stdio.h> |
| 169 | ++ |
| 170 | ++#ifndef NULL |
| 171 | + #define NULL (0L) |
| 172 | +-main() { |
| 173 | +- char buf[20]; |
| 174 | +- int res = 0; |
| 175 | +- res = res || (snprintf(buf, 2, "marcus") != 6); |
| 176 | +- res = res || (buf[1] != '\0'); |
| 177 | +- /* Implementations may consider this as an encoding error */ |
| 178 | +- snprintf(buf, 0, "boerger"); |
| 179 | +- /* However, they MUST ignore the pointer */ |
| 180 | +- res = res || (buf[0] != 'm'); |
| 181 | +- res = res || (snprintf(NULL, 0, "boerger") != 7); |
| 182 | +- res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8); |
| 183 | +- exit(res); |
| 184 | +-} |
| 185 | +- ],[ |
| 186 | ++#endif |
| 187 | ++ ]],[[ |
| 188 | ++char buf[20]; |
| 189 | ++int res = 0; |
| 190 | ++res = res || (snprintf(buf, 2, "marcus") != 6); |
| 191 | ++res = res || (buf[1] != '\0'); |
| 192 | ++/* Implementations may consider this as an encoding error */ |
| 193 | ++snprintf(buf, 0, "boerger"); |
| 194 | ++/* However, they MUST ignore the pointer */ |
| 195 | ++res = res || (buf[0] != 'm'); |
| 196 | ++res = res || (snprintf(NULL, 0, "boerger") != 7); |
| 197 | ++res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8); |
| 198 | ++exit(res) |
| 199 | ++ ]])],[ |
| 200 | + ac_cv_broken_snprintf=no |
| 201 | + ],[ |
| 202 | + ac_cv_broken_snprintf=yes |
| 203 | +@@ -1708,7 +1720,13 @@ AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND], [ |
| 204 | + AC_MSG_CHECKING([for broken libc stdio]) |
| 205 | + AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[ |
| 206 | + AC_TRY_RUN([ |
| 207 | ++#include <stdlib.h> |
| 208 | + #include <stdio.h> |
| 209 | ++ |
| 210 | ++#if HAVE_UNISTD_H |
| 211 | ++#include <unistd.h> |
| 212 | ++#endif |
| 213 | ++ |
| 214 | + int main(int argc, char *argv[]) |
| 215 | + { |
| 216 | + FILE *fp; |
| 217 | +@@ -1775,6 +1793,7 @@ AC_TRY_COMPILE([ |
| 218 | + dnl even newer glibcs have a different seeker definition... |
| 219 | + AC_TRY_RUN([ |
| 220 | + #define _GNU_SOURCE |
| 221 | ++#include <stdlib.h> |
| 222 | + #include <stdio.h> |
| 223 | + |
| 224 | + struct cookiedata { |
| 225 | +@@ -1792,7 +1811,7 @@ int seeker(void *cookie, __off64_t *position, int whence) |
| 226 | + |
| 227 | + cookie_io_functions_t funcs = {reader, writer, seeker, closer}; |
| 228 | + |
| 229 | +-main() { |
| 230 | ++int main() { |
| 231 | + struct cookiedata g = { 0 }; |
| 232 | + FILE *fp = fopencookie(&g, "r", funcs); |
| 233 | + |
| 234 | +@@ -1909,7 +1928,7 @@ AC_DEFUN([PHP_CHECK_FUNC_LIB],[ |
| 235 | + if test "$found" = "yes"; then |
| 236 | + ac_libs=$LIBS |
| 237 | + LIBS="$LIBS -l$2" |
| 238 | +- AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no]) |
| 239 | ++ AC_TRY_RUN([int main() { return (0); }],[found=yes],[found=no],[found=no]) |
| 240 | + LIBS=$ac_libs |
| 241 | + fi |
| 242 | + |
| 243 | +@@ -2643,7 +2662,7 @@ uname -a: `uname -a` |
| 244 | + |
| 245 | + X |
| 246 | + cat >conftest.$ac_ext <<X |
| 247 | +-main() |
| 248 | ++int main() |
| 249 | + { |
| 250 | + exit(0); |
| 251 | + } |
| 252 | +@@ -2883,7 +2902,7 @@ AC_DEFUN([PHP_TEST_WRITE_STDOUT],[ |
| 253 | + |
| 254 | + #define TEXT "This is the test message -- " |
| 255 | + |
| 256 | +-main() |
| 257 | ++int main() |
| 258 | + { |
| 259 | + int n; |
| 260 | + |
| 261 | +diff --git a/configure.in b/configure.in |
| 262 | +index 64b0615..abb3a34 100644 |
| 263 | +--- a/configure.in |
| 264 | ++++ b/configure.in |
| 265 | +@@ -696,6 +696,8 @@ AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo, |
| 266 | + [AC_TRY_LINK([#include <netdb.h>], |
| 267 | + [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);], |
| 268 | + AC_TRY_RUN([ |
| 269 | ++#include <stdlib.h> |
| 270 | ++#include <string.h> |
| 271 | + #include <netdb.h> |
| 272 | + #include <sys/types.h> |
| 273 | + #ifndef AF_INET |
| 274 | +diff --git a/ext/curl/config.m4 b/ext/curl/config.m4 |
| 275 | +index f785770..67ef69a 100644 |
| 276 | +--- a/ext/curl/config.m4 |
| 277 | ++++ b/ext/curl/config.m4 |
| 278 | +@@ -61,6 +61,7 @@ if test "$PHP_CURL" != "no"; then |
| 279 | + AC_PROG_CPP |
| 280 | + AC_MSG_CHECKING([for openssl support in libcurl]) |
| 281 | + AC_TRY_RUN([ |
| 282 | ++#include <string.h> |
| 283 | + #include <curl/curl.h> |
| 284 | + |
| 285 | + int main(int argc, char *argv[]) |
| 286 | +@@ -88,6 +89,7 @@ int main(int argc, char *argv[]) |
| 287 | + |
| 288 | + AC_MSG_CHECKING([for gnutls support in libcurl]) |
| 289 | + AC_TRY_RUN([ |
| 290 | ++#include <string.h> |
| 291 | + #include <curl/curl.h> |
| 292 | + |
| 293 | + int main(int argc, char *argv[]) |
| 294 | +diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 |
| 295 | +index 6e0c921..87f6cb3 100644 |
| 296 | +--- a/ext/standard/config.m4 |
| 297 | ++++ b/ext/standard/config.m4 |
| 298 | +@@ -7,6 +7,11 @@ AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], |
| 299 | + AC_TRY_RUN( [ |
| 300 | + #include <stdio.h> |
| 301 | + #include <stdlib.h> |
| 302 | ++#include <string.h> |
| 303 | ++ |
| 304 | ++#if HAVE_UNISTD_H |
| 305 | ++#include <unistd.h> |
| 306 | ++#endif |
| 307 | + |
| 308 | + int main(int argc, char **argv) |
| 309 | + { |
| 310 | +@@ -61,6 +66,9 @@ fi |
| 311 | + |
| 312 | + AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[ |
| 313 | + AC_TRY_RUN([ |
| 314 | ++#include <stdlib.h> |
| 315 | ++#include <string.h> |
| 316 | ++ |
| 317 | + #if HAVE_UNISTD_H |
| 318 | + #include <unistd.h> |
| 319 | + #endif |
| 320 | +@@ -86,6 +94,9 @@ int main() { |
| 321 | + |
| 322 | + AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[ |
| 323 | + AC_TRY_RUN([ |
| 324 | ++#include <stdlib.h> |
| 325 | ++#include <string.h> |
| 326 | ++ |
| 327 | + #if HAVE_UNISTD_H |
| 328 | + #include <unistd.h> |
| 329 | + #endif |
| 330 | +@@ -111,6 +122,9 @@ int main() { |
| 331 | + |
| 332 | + AC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[ |
| 333 | + AC_TRY_RUN([ |
| 334 | ++#include <stdlib.h> |
| 335 | ++#include <string.h> |
| 336 | ++ |
| 337 | + #if HAVE_UNISTD_H |
| 338 | + #include <unistd.h> |
| 339 | + #endif |
| 340 | +@@ -146,6 +160,9 @@ int main() { |
| 341 | + |
| 342 | + AC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[ |
| 343 | + AC_TRY_RUN([ |
| 344 | ++#include <stdlib.h> |
| 345 | ++#include <string.h> |
| 346 | ++ |
| 347 | + #if HAVE_UNISTD_H |
| 348 | + #include <unistd.h> |
| 349 | + #endif |
| 350 | +@@ -178,6 +195,9 @@ int main() { |
| 351 | + |
| 352 | + AC_CACHE_CHECK(for SHA512 crypt, ac_cv_crypt_sha512,[ |
| 353 | + AC_TRY_RUN([ |
| 354 | ++#include <stdlib.h> |
| 355 | ++#include <string.h> |
| 356 | ++ |
| 357 | + #if HAVE_UNISTD_H |
| 358 | + #include <unistd.h> |
| 359 | + #endif |
| 360 | +@@ -209,6 +229,9 @@ int main() { |
| 361 | + |
| 362 | + AC_CACHE_CHECK(for SHA256 crypt, ac_cv_crypt_sha256,[ |
| 363 | + AC_TRY_RUN([ |
| 364 | ++#include <stdlib.h> |
| 365 | ++#include <string.h> |
| 366 | ++ |
| 367 | + #if HAVE_UNISTD_H |
| 368 | + #include <unistd.h> |
| 369 | + #endif |
0 commit comments