1dnl 2dnl Check if flush should be called explicitly after buffered io 3dnl 4AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], ac_cv_flush_io,[ 5AC_RUN_IFELSE([AC_LANG_SOURCE([[ 6#include <stdio.h> 7#include <stdlib.h> 8#ifdef HAVE_UNISTD_H 9#include <unistd.h> 10#endif 11#include <string.h> 12 13int main(int argc, char **argv) 14{ 15 char *filename = tmpnam(NULL); 16 char buffer[64]; 17 int result = 0; 18 19 FILE *fp = fopen(filename, "wb"); 20 if (NULL == fp) 21 return 0; 22 fputs("line 1\n", fp); 23 fputs("line 2\n", fp); 24 fclose(fp); 25 26 fp = fopen(filename, "rb+"); 27 if (NULL == fp) 28 return 0; 29 fgets(buffer, sizeof(buffer), fp); 30 fputs("line 3\n", fp); 31 rewind(fp); 32 fgets(buffer, sizeof(buffer), fp); 33 if (0 != strcmp(buffer, "line 1\n")) 34 result = 1; 35 fgets(buffer, sizeof(buffer), fp); 36 if (0 != strcmp(buffer, "line 3\n")) 37 result = 1; 38 fclose(fp); 39 unlink(filename); 40 41 exit(result); 42} 43]])],[ 44 ac_cv_flush_io=no 45],[ 46 ac_cv_flush_io=yes 47],[ 48 ac_cv_flush_io=no 49])]) 50if test "$ac_cv_flush_io" = "yes"; then 51 AC_DEFINE(HAVE_FLUSHIO, 1, [Define if flush should be called explicitly after a buffered io.]) 52fi 53 54PHP_ARG_WITH([external-libcrypt], 55 [for external libcrypt or libxcrypt], 56 [AS_HELP_STRING([--with-external-libcrypt], 57 [Use external libcrypt or libxcrypt])], 58 [no], 59 [no]) 60 61if test "$PHP_EXTERNAL_LIBCRYPT" != "no"; then 62 PHP_CHECK_FUNC(crypt, crypt) 63 PHP_CHECK_FUNC(crypt_r, crypt) 64 AC_CHECK_HEADERS(crypt.h) 65 if test "$ac_cv_func_crypt_r" = "yes"; then 66 PHP_CRYPT_R_STYLE 67 fi 68 69 AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[ 70 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 71#include <string.h> 72 73#if HAVE_UNISTD_H 74#include <unistd.h> 75#endif 76 77#if HAVE_CRYPT_H 78#include <crypt.h> 79#endif 80 81#include <stdlib.h> 82#include <string.h> 83 84int main(void) { 85#if HAVE_CRYPT 86 char *encrypted = crypt("rasmuslerdorf","rl"); 87 return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M"); 88#else 89 return 1; 90#endif 91}]])],[ 92 ac_cv_crypt_des=yes 93],[ 94 ac_cv_crypt_des=no 95],[ 96 ac_cv_crypt_des=yes 97])]) 98 99 AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[ 100 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 101#include <string.h> 102 103#if HAVE_UNISTD_H 104#include <unistd.h> 105#endif 106 107#if HAVE_CRYPT_H 108#include <crypt.h> 109#endif 110 111#include <stdlib.h> 112#include <string.h> 113 114int main(void) { 115#if HAVE_CRYPT 116 char *encrypted = crypt("rasmuslerdorf","_J9..rasm"); 117 return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc"); 118#else 119 return 1; 120#endif 121}]])],[ 122 ac_cv_crypt_ext_des=yes 123 ],[ 124 ac_cv_crypt_ext_des=no 125 ],[ 126 ac_cv_crypt_ext_des=no 127 ])]) 128 129 AC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[ 130 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 131#include <string.h> 132 133#if HAVE_UNISTD_H 134#include <unistd.h> 135#endif 136 137#if HAVE_CRYPT_H 138#include <crypt.h> 139#endif 140 141#include <stdlib.h> 142#include <string.h> 143 144int main(void) { 145#if HAVE_CRYPT 146 char salt[15], answer[40]; 147 char *encrypted; 148 149 salt[0]='$'; salt[1]='1'; salt[2]='$'; 150 salt[3]='r'; salt[4]='a'; salt[5]='s'; 151 salt[6]='m'; salt[7]='u'; salt[8]='s'; 152 salt[9]='l'; salt[10]='e'; salt[11]='$'; 153 salt[12]='\0'; 154 strcpy(answer,salt); 155 strcat(answer,"rISCgZzpwk3UhDidwXvin0"); 156 encrypted = crypt("rasmuslerdorf",salt); 157 return !encrypted || strcmp(encrypted,answer); 158#else 159 return 1; 160#endif 161}]])],[ 162 ac_cv_crypt_md5=yes 163 ],[ 164 ac_cv_crypt_md5=no 165 ],[ 166 ac_cv_crypt_md5=no 167 ])]) 168 169 AC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[ 170 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 171#include <string.h> 172 173#if HAVE_UNISTD_H 174#include <unistd.h> 175#endif 176 177#if HAVE_CRYPT_H 178#include <crypt.h> 179#endif 180 181#include <stdlib.h> 182#include <string.h> 183 184int main(void) { 185#if HAVE_CRYPT 186 char salt[30], answer[70]; 187 char *encrypted; 188 189 salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0'; 190 strcat(salt,"rasmuslerd............"); 191 strcpy(answer,salt); 192 strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra"); 193 encrypted = crypt("rasmuslerdorf",salt); 194 return !encrypted || strcmp(encrypted,answer); 195#else 196 return 1; 197#endif 198}]])],[ 199 ac_cv_crypt_blowfish=yes 200 ],[ 201 ac_cv_crypt_blowfish=no 202 ],[ 203 ac_cv_crypt_blowfish=no 204 ])]) 205 206 AC_CACHE_CHECK(for SHA512 crypt, ac_cv_crypt_sha512,[ 207 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 208#include <string.h> 209 210#if HAVE_UNISTD_H 211#include <unistd.h> 212#endif 213 214#if HAVE_CRYPT_H 215#include <crypt.h> 216#endif 217 218#include <stdlib.h> 219#include <string.h> 220 221int main(void) { 222#if HAVE_CRYPT 223 char salt[21], answer[21+86]; 224 char *encrypted; 225 226 strcpy(salt,"\$6\$rasmuslerdorf\$"); 227 strcpy(answer, salt); 228 strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/"); 229 encrypted = crypt("rasmuslerdorf",salt); 230 return !encrypted || strcmp(encrypted,answer); 231#else 232 return 1; 233#endif 234 }]])],[ 235 ac_cv_crypt_sha512=yes 236 ],[ 237 ac_cv_crypt_sha512=no 238 ],[ 239 ac_cv_crypt_sha512=no 240 ])]) 241 242 AC_CACHE_CHECK(for SHA256 crypt, ac_cv_crypt_sha256,[ 243 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 244#include <string.h> 245 246#if HAVE_UNISTD_H 247#include <unistd.h> 248#endif 249 250#if HAVE_CRYPT_H 251#include <crypt.h> 252#endif 253 254#include <stdlib.h> 255#include <string.h> 256 257int main(void) { 258#if HAVE_CRYPT 259 char salt[21], answer[21+43]; 260 char *encrypted; 261 262 strcpy(salt,"\$5\$rasmuslerdorf\$"); 263 strcpy(answer, salt); 264 strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23"); 265 encrypted = crypt("rasmuslerdorf",salt); 266 return !encrypted || strcmp(encrypted,answer); 267#else 268 return 1; 269#endif 270}]])],[ 271 ac_cv_crypt_sha256=yes 272 ],[ 273 ac_cv_crypt_sha256=no 274 ],[ 275 ac_cv_crypt_sha256=no 276 ])]) 277 278 279 if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "$ac_cv_crypt_md5" = "no" || test "$ac_cv_crypt_sha512" = "no" || test "$ac_cv_crypt_sha256" = "no" || test "$ac_cv_func_crypt_r" != "yes"; then 280 AC_MSG_ERROR([Cannot use external libcrypt as some algo are missing]) 281 fi 282 283 AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r]) 284else 285 AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 1, [Whether PHP has to use its own crypt_r]) 286 287 PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c) 288fi 289 290dnl 291dnl Check for __attribute__ ((__aligned__)) support in the compiler 292dnl 293AC_CACHE_CHECK(whether the compiler supports aligned attribute, ac_cv_attribute_aligned,[ 294AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 295]],[[ 296 unsigned char test[32] __attribute__ ((__aligned__ (__alignof__ (int)))); 297]])],[ 298 ac_cv_attribute_aligned=yes 299],[ 300 ac_cv_attribute_aligned=no 301])]) 302if test "$ac_cv_attribute_aligned" = "yes"; then 303 AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [whether the compiler supports __attribute__ ((__aligned__))]) 304fi 305 306if test "$cross_compiling" = yes ; then 307 case $host_alias in 308 *linux*) 309 AC_DEFINE([HAVE_FNMATCH], 1, 310 [Define to 1 if your system has a working POSIX `fnmatch' 311 function.]) 312 ;; 313 esac 314else 315 AC_FUNC_FNMATCH 316fi 317 318dnl 319dnl Check if there is a support means of creating a new process and defining 320dnl which handles it receives 321dnl 322AC_CHECK_FUNCS(fork CreateProcess, [ 323 php_can_support_proc_open=yes 324 break 325],[ 326 php_can_support_proc_open=no 327]) 328AC_MSG_CHECKING([if your OS can spawn processes with inherited handles]) 329if test "$php_can_support_proc_open" = "yes"; then 330 AC_MSG_RESULT(yes) 331 AC_DEFINE(PHP_CAN_SUPPORT_PROC_OPEN,1, [Define if your system has fork/vfork/CreateProcess]) 332else 333 AC_MSG_RESULT(no) 334fi 335 336PHP_ENABLE_CHROOT_FUNC=no 337case "$PHP_SAPI" in 338 embed) 339 PHP_ENABLE_CHROOT_FUNC=yes 340 ;; 341 342 none) 343 for PROG in $PHP_BINARIES; do 344 case "$PROG" in 345 cgi|cli|phpdbg) 346 PHP_ENABLE_CHROOT_FUNC=yes 347 ;; 348 349 *) 350 PHP_ENABLE_CHROOT_FUNC=no 351 break 352 ;; 353 esac 354 done 355 ;; 356esac 357 358if test "$PHP_ENABLE_CHROOT_FUNC" = "yes"; then 359 AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) 360fi 361 362dnl 363dnl Detect library functions needed by php dns_xxx functions 364dnl ext/standard/php_dns.h will collect these in a single define 365dnl HAVE_FULL_DNS_FUNCS 366dnl 367PHP_CHECK_FUNC(res_nsearch, resolv, bind, socket) 368PHP_CHECK_FUNC(res_ndestroy, resolv, bind, socket) 369PHP_CHECK_FUNC(dns_search, resolv, bind, socket) 370PHP_CHECK_FUNC(dn_expand, resolv, bind, socket) 371PHP_CHECK_FUNC(dn_skipname, resolv, bind, socket) 372 373dnl 374dnl These are old deprecated functions 375dnl 376 377PHP_CHECK_FUNC(res_search, resolv, bind, socket) 378 379dnl 380dnl Check for strptime() 381dnl 382AC_CACHE_CHECK(whether strptime() declaration fails, ac_cv_strptime_decl_fails,[ 383AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 384#include <time.h> 385]],[[ 386#ifndef HAVE_STRPTIME 387#error no strptime() on this platform 388#else 389/* use invalid strptime() declaration to see if it fails to compile */ 390int strptime(const char *s, const char *format, struct tm *tm); 391#endif 392]])],[ 393 ac_cv_strptime_decl_fails=no 394],[ 395 ac_cv_strptime_decl_fails=yes 396])]) 397if test "$ac_cv_strptime_decl_fails" = "yes"; then 398 AC_DEFINE([HAVE_STRPTIME_DECL_FAILS], 1, [whether strptime() declaration fails]) 399fi 400 401dnl 402dnl Check for arc4random on BSD systems 403dnl 404AC_CHECK_DECLS([arc4random_buf]) 405 406dnl 407dnl Check for CCRandomGenerateBytes 408dnl header absent in previous macOs releases 409dnl 410AC_CHECK_HEADERS([CommonCrypto/CommonRandom.h], [], [], 411[ 412 #include <sys/types.h> 413 #include <Availability.h> 414 #include <CommonCrypto/CommonCryptoError.h> 415]) 416 417dnl 418dnl Check for argon2 419dnl 420PHP_ARG_WITH([password-argon2], 421 [for Argon2 support], 422 [AS_HELP_STRING([[--with-password-argon2]], 423 [Include Argon2 support in password_*])]) 424 425if test "$PHP_PASSWORD_ARGON2" != "no"; then 426 PKG_CHECK_MODULES([ARGON2], [libargon2]) 427 PHP_EVAL_INCLINE($ARGON2_CFLAGS) 428 PHP_EVAL_LIBLINE($ARGON2_LIBS) 429 430 AC_DEFINE(HAVE_ARGON2LIB, 1, [ ]) 431fi 432 433dnl 434dnl net_get_interfaces 435dnl 436AC_CHECK_HEADERS([net/if.h],[], [], 437[ 438 #ifdef HAVE_SYS_SOCKET_H 439 #include <sys/socket.h> 440 #endif 441 #include <net/if.h> 442]) 443AC_MSG_CHECKING([for usable getifaddrs]) 444AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 445 #include <sys/types.h> 446 #include <ifaddrs.h> 447]],[[ 448 struct ifaddrs *interfaces; 449 if (!getifaddrs(&interfaces)) { 450 freeifaddrs(interfaces); 451 } 452]])], [ac_have_getifaddrs=yes], [ac_have_getifaddrs=no]) 453if test "$ac_have_getifaddrs" = "yes" ; then 454 AC_DEFINE(HAVE_GETIFADDRS, 1, [whether getifaddrs is present and usable]) 455 AC_MSG_RESULT(yes) 456else 457 AC_MSG_RESULT(no) 458fi 459 460dnl 461dnl Setup extension sources 462dnl 463PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \ 464 datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \ 465 flock_compat.c formatted_print.c fsock.c head.c html.c image.c \ 466 info.c iptc.c link.c mail.c math.c md5.c metaphone.c \ 467 microtime.c pack.c pageinfo.c quot_print.c \ 468 soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \ 469 var.c versioning.c assert.c strnatcmp.c levenshtein.c \ 470 incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \ 471 http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \ 472 var_unserializer.c ftok.c sha1.c user_filters.c uuencode.c \ 473 filters.c proc_open.c streamsfuncs.c http.c password.c \ 474 net.c hrtime.c crc32_x86.c libavifinfo/avifinfo.c,,, 475 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) 476 477PHP_ADD_BUILD_DIR($ext_builddir/libavifinfo) 478 479PHP_ADD_MAKEFILE_FRAGMENT 480PHP_INSTALL_HEADERS([ext/standard/]) 481