xref: /PHP-7.4/ext/standard/config.m4 (revision aa405b7d)
18d3f8ca1SPeter Kokotdnl
2257de2baSStig Bakkendnl Check if flush should be called explicitly after buffered io
3397c76d7SAlexander Feldmandnl
4397c76d7SAlexander FeldmanAC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], ac_cv_flush_io,[
5397c76d7SAlexander FeldmanAC_RUN_IFELSE([AC_LANG_SOURCE([[
6a0a2b24dSJani Taskinen#include <stdio.h>
74371945bSPeter Kokot#include <stdlib.h>
8397c76d7SAlexander Feldman#include <string.h>
9397c76d7SAlexander Feldman#include <unistd.h>
10*aa405b7dSNikita Popov
11*aa405b7dSNikita Popovint main(int argc, char **argv)
12397c76d7SAlexander Feldman{
13397c76d7SAlexander Feldman	char *filename = tmpnam(NULL);
14397c76d7SAlexander Feldman	char buffer[64];
15397c76d7SAlexander Feldman	int result = 0;
16397c76d7SAlexander Feldman
17397c76d7SAlexander Feldman	FILE *fp = fopen(filename, "wb");
1883497327SAnatol Belski	if (NULL == fp)
19397c76d7SAlexander Feldman		return 0;
20397c76d7SAlexander Feldman	fputs("line 1\n", fp);
21397c76d7SAlexander Feldman	fputs("line 2\n", fp);
22397c76d7SAlexander Feldman	fclose(fp);
23397c76d7SAlexander Feldman
24397c76d7SAlexander Feldman	fp = fopen(filename, "rb+");
2583497327SAnatol Belski	if (NULL == fp)
26397c76d7SAlexander Feldman		return 0;
27397c76d7SAlexander Feldman	fgets(buffer, sizeof(buffer), fp);
28397c76d7SAlexander Feldman	fputs("line 3\n", fp);
29397c76d7SAlexander Feldman	rewind(fp);
30397c76d7SAlexander Feldman	fgets(buffer, sizeof(buffer), fp);
31397c76d7SAlexander Feldman	if (0 != strcmp(buffer, "line 1\n"))
32397c76d7SAlexander Feldman		result = 1;
33397c76d7SAlexander Feldman	fgets(buffer, sizeof(buffer), fp);
34397c76d7SAlexander Feldman	if (0 != strcmp(buffer, "line 3\n"))
35397c76d7SAlexander Feldman		result = 1;
36397c76d7SAlexander Feldman	fclose(fp);
37397c76d7SAlexander Feldman	unlink(filename);
38397c76d7SAlexander Feldman
39397c76d7SAlexander Feldman	exit(result);
40397c76d7SAlexander Feldman}
41397c76d7SAlexander Feldman]])],[
42397c76d7SAlexander Feldman  ac_cv_flush_io=no
434371945bSPeter Kokot],[
44afdaee9eSSascha Schumann  ac_cv_flush_io=yes
45397c76d7SAlexander Feldman],[
46afdaee9eSSascha Schumann  ac_cv_flush_io=no
47397c76d7SAlexander Feldman])])
48afdaee9eSSascha Schumannif test "$ac_cv_flush_io" = "yes"; then
49397c76d7SAlexander Feldman  AC_DEFINE(HAVE_FLUSHIO, 1, [Define if flush should be called explicitly after a buffered io.])
50a0a2b24dSJani Taskinenfi
51a0a2b24dSJani Taskinen
52a0a2b24dSJani Taskinendnl
53397c76d7SAlexander Feldmandnl Check for crypt() capabilities
542c0ad3eeSStig Bakkendnl
552c0ad3eeSStig Bakkenif test "$ac_cv_func_crypt" = "no"; then
562c0ad3eeSStig Bakken  AC_CHECK_LIB(crypt, crypt, [
57a0a2b24dSJani Taskinen    LIBS="-lcrypt $LIBS -lcrypt"
58f9f4644aSfoobar    AC_DEFINE(HAVE_CRYPT, 1, [ ])
59f9f4644aSfoobar  ])
60f9f4644aSfoobarfi
61f9f4644aSfoobar
62a0a2b24dSJani TaskinenAC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
6383497327SAnatol Belski  AC_RUN_IFELSE([AC_LANG_SOURCE([[
64a0a2b24dSJani Taskinen#include <string.h>
654371945bSPeter Kokot
66*aa405b7dSNikita Popov#if HAVE_UNISTD_H
67*aa405b7dSNikita Popov#include <unistd.h>
6872b2d1c9Sfoobar#endif
6972b2d1c9Sfoobar
7072b2d1c9Sfoobar#if HAVE_CRYPT_H
7172b2d1c9Sfoobar#include <crypt.h>
7230c81ea5SRasmus Lerdorf#endif
7330c81ea5SRasmus Lerdorf
7430c81ea5SRasmus Lerdorfint main() {
7530c81ea5SRasmus Lerdorf#if HAVE_CRYPT
76ccd215a5SAnton Blanchard	char *encrypted = crypt("rasmuslerdorf","rl");
772c0ad3eeSStig Bakken	return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M");
78ccd215a5SAnton Blanchard#else
79*aa405b7dSNikita Popov	return 1;
802c0ad3eeSStig Bakken#endif
81*aa405b7dSNikita Popov}]])],[
822c0ad3eeSStig Bakken  ac_cv_crypt_des=yes
834371945bSPeter Kokot],[
84a0a2b24dSJani Taskinen  ac_cv_crypt_des=no
85a0a2b24dSJani Taskinen],[
86a0a2b24dSJani Taskinen  ac_cv_crypt_des=yes
87a0a2b24dSJani Taskinen])])
88a0a2b24dSJani Taskinen
89a0a2b24dSJani TaskinenAC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
902c0ad3eeSStig Bakken  AC_RUN_IFELSE([AC_LANG_SOURCE([[
91a0a2b24dSJani Taskinen#include <string.h>
924371945bSPeter Kokot
93*aa405b7dSNikita Popov#if HAVE_UNISTD_H
94*aa405b7dSNikita Popov#include <unistd.h>
9572b2d1c9Sfoobar#endif
9672b2d1c9Sfoobar
9772b2d1c9Sfoobar#if HAVE_CRYPT_H
9872b2d1c9Sfoobar#include <crypt.h>
9930c81ea5SRasmus Lerdorf#endif
10030c81ea5SRasmus Lerdorf
10130c81ea5SRasmus Lerdorfint main() {
10230c81ea5SRasmus Lerdorf#if HAVE_CRYPT
103ccd215a5SAnton Blanchard	char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
1042c0ad3eeSStig Bakken	return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc");
105ccd215a5SAnton Blanchard#else
106*aa405b7dSNikita Popov	return 1;
1072c0ad3eeSStig Bakken#endif
108*aa405b7dSNikita Popov}]])],[
1092c0ad3eeSStig Bakken  ac_cv_crypt_ext_des=yes
1104371945bSPeter Kokot],[
111a0a2b24dSJani Taskinen  ac_cv_crypt_ext_des=no
112a0a2b24dSJani Taskinen],[
113a0a2b24dSJani Taskinen  ac_cv_crypt_ext_des=no
114a0a2b24dSJani Taskinen])])
115a0a2b24dSJani Taskinen
116a0a2b24dSJani TaskinenAC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[
1172c0ad3eeSStig BakkenAC_RUN_IFELSE([AC_LANG_SOURCE([[
118a0a2b24dSJani Taskinen#include <string.h>
1194371945bSPeter Kokot
120*aa405b7dSNikita Popov#if HAVE_UNISTD_H
121*aa405b7dSNikita Popov#include <unistd.h>
12272b2d1c9Sfoobar#endif
12372b2d1c9Sfoobar
12472b2d1c9Sfoobar#if HAVE_CRYPT_H
12572b2d1c9Sfoobar#include <crypt.h>
12630c81ea5SRasmus Lerdorf#endif
12730c81ea5SRasmus Lerdorf
12830c81ea5SRasmus Lerdorfint main() {
12930c81ea5SRasmus Lerdorf#if HAVE_CRYPT
130ccd215a5SAnton Blanchard	char salt[15], answer[40];
1312c0ad3eeSStig Bakken	char *encrypted;
132ccd215a5SAnton Blanchard
133ccd215a5SAnton Blanchard	salt[0]='$'; salt[1]='1'; salt[2]='$';
1342c0ad3eeSStig Bakken	salt[3]='r'; salt[4]='a'; salt[5]='s';
13583497327SAnatol Belski	salt[6]='m'; salt[7]='u'; salt[8]='s';
136ccd215a5SAnton Blanchard	salt[9]='l'; salt[10]='e'; salt[11]='$';
137ccd215a5SAnton Blanchard	salt[12]='\0';
138ccd215a5SAnton Blanchard	strcpy(answer,salt);
139ccd215a5SAnton Blanchard	strcat(answer,"rISCgZzpwk3UhDidwXvin0");
140ccd215a5SAnton Blanchard	encrypted = crypt("rasmuslerdorf",salt);
141ccd215a5SAnton Blanchard	return !encrypted || strcmp(encrypted,answer);
142ccd215a5SAnton Blanchard#else
143*aa405b7dSNikita Popov	return 1;
1442c0ad3eeSStig Bakken#endif
145*aa405b7dSNikita Popov}]])],[
1462c0ad3eeSStig Bakken  ac_cv_crypt_md5=yes
1474371945bSPeter Kokot],[
148a0a2b24dSJani Taskinen  ac_cv_crypt_md5=no
149a0a2b24dSJani Taskinen],[
150a0a2b24dSJani Taskinen  ac_cv_crypt_md5=no
151a0a2b24dSJani Taskinen])])
152a0a2b24dSJani Taskinen
153a0a2b24dSJani TaskinenAC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[
1542c0ad3eeSStig BakkenAC_RUN_IFELSE([AC_LANG_SOURCE([[
155a0a2b24dSJani Taskinen#include <string.h>
1564371945bSPeter Kokot
157*aa405b7dSNikita Popov#if HAVE_UNISTD_H
158*aa405b7dSNikita Popov#include <unistd.h>
15972b2d1c9Sfoobar#endif
16072b2d1c9Sfoobar
16172b2d1c9Sfoobar#if HAVE_CRYPT_H
16272b2d1c9Sfoobar#include <crypt.h>
16330c81ea5SRasmus Lerdorf#endif
16430c81ea5SRasmus Lerdorf
16530c81ea5SRasmus Lerdorfint main() {
16630c81ea5SRasmus Lerdorf#if HAVE_CRYPT
167ccd215a5SAnton Blanchard	char salt[30], answer[70];
1682c0ad3eeSStig Bakken	char *encrypted;
169ccd215a5SAnton Blanchard
170ccd215a5SAnton Blanchard	salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
171ccd215a5SAnton Blanchard	strcat(salt,"rasmuslerd............");
172ccd215a5SAnton Blanchard	strcpy(answer,salt);
173ccd215a5SAnton Blanchard	strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
174ccd215a5SAnton Blanchard	encrypted = crypt("rasmuslerdorf",salt);
175ccd215a5SAnton Blanchard	return !encrypted || strcmp(encrypted,answer);
176ccd215a5SAnton Blanchard#else
177*aa405b7dSNikita Popov	return 1;
1782c0ad3eeSStig Bakken#endif
179*aa405b7dSNikita Popov}]])],[
1802c0ad3eeSStig Bakken  ac_cv_crypt_blowfish=yes
1814371945bSPeter Kokot],[
182a0a2b24dSJani Taskinen  ac_cv_crypt_blowfish=no
183a0a2b24dSJani Taskinen],[
184a0a2b24dSJani Taskinen  ac_cv_crypt_blowfish=no
185a0a2b24dSJani Taskinen])])
186a0a2b24dSJani Taskinen
187a0a2b24dSJani TaskinenAC_CACHE_CHECK(for SHA512 crypt, ac_cv_crypt_sha512,[
1881e820ecaSPierre JoyeAC_RUN_IFELSE([AC_LANG_SOURCE([[
1898f9ab04dSFelipe Pena#include <string.h>
1904371945bSPeter Kokot
191*aa405b7dSNikita Popov#if HAVE_UNISTD_H
192*aa405b7dSNikita Popov#include <unistd.h>
1939001b403SPierre Joye#endif
1949001b403SPierre Joye
1959001b403SPierre Joye#if HAVE_CRYPT_H
1969001b403SPierre Joye#include <crypt.h>
1979001b403SPierre Joye#endif
1989001b403SPierre Joye
1999001b403SPierre Joyeint main() {
2009001b403SPierre Joye#if HAVE_CRYPT
201ccd215a5SAnton Blanchard	char salt[21], answer[21+86];
2029001b403SPierre Joye	char *encrypted;
203ccd215a5SAnton Blanchard
204ccd215a5SAnton Blanchard	strcpy(salt,"\$6\$rasmuslerdorf\$");
2052e692b22SMichael Wallner	strcpy(answer, salt);
206ccd215a5SAnton Blanchard	strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/");
207ccd215a5SAnton Blanchard	encrypted = crypt("rasmuslerdorf",salt);
208ccd215a5SAnton Blanchard	return !encrypted || strcmp(encrypted,answer);
209ccd215a5SAnton Blanchard#else
210*aa405b7dSNikita Popov	return 1;
2119001b403SPierre Joye#endif
212*aa405b7dSNikita Popov}]])],[
2139001b403SPierre Joye  ac_cv_crypt_sha512=yes
2144371945bSPeter Kokot],[
2158f9ab04dSFelipe Pena  ac_cv_crypt_sha512=no
2169001b403SPierre Joye],[
2178f9ab04dSFelipe Pena  ac_cv_crypt_sha512=no
2189001b403SPierre Joye])])
2198f9ab04dSFelipe Pena
2209001b403SPierre JoyeAC_CACHE_CHECK(for SHA256 crypt, ac_cv_crypt_sha256,[
2219001b403SPierre JoyeAC_RUN_IFELSE([AC_LANG_SOURCE([[
2228f9ab04dSFelipe Pena#include <string.h>
2234371945bSPeter Kokot
224*aa405b7dSNikita Popov#if HAVE_UNISTD_H
225*aa405b7dSNikita Popov#include <unistd.h>
2269001b403SPierre Joye#endif
2279001b403SPierre Joye
2289001b403SPierre Joye#if HAVE_CRYPT_H
2299001b403SPierre Joye#include <crypt.h>
2309001b403SPierre Joye#endif
2319001b403SPierre Joye
2329001b403SPierre Joyeint main() {
2339001b403SPierre Joye#if HAVE_CRYPT
234ccd215a5SAnton Blanchard	char salt[21], answer[21+43];
2359001b403SPierre Joye	char *encrypted;
236ccd215a5SAnton Blanchard
237ccd215a5SAnton Blanchard	strcpy(salt,"\$5\$rasmuslerdorf\$");
2382e692b22SMichael Wallner	strcpy(answer, salt);
239ccd215a5SAnton Blanchard	strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23");
240ccd215a5SAnton Blanchard	encrypted = crypt("rasmuslerdorf",salt);
241ccd215a5SAnton Blanchard	return !encrypted || strcmp(encrypted,answer);
242ccd215a5SAnton Blanchard#else
243*aa405b7dSNikita Popov	return 1;
2449001b403SPierre Joye#endif
245*aa405b7dSNikita Popov}]])],[
2469001b403SPierre Joye  ac_cv_crypt_sha256=yes
2474371945bSPeter Kokot],[
2488f9ab04dSFelipe Pena  ac_cv_crypt_sha256=no
2499001b403SPierre Joye],[
2508f9ab04dSFelipe Pena  ac_cv_crypt_sha256=no
2519001b403SPierre Joye])])
2528f9ab04dSFelipe Pena
2539001b403SPierre Joye
2549001b403SPierre Joyednl
2559001b403SPierre Joyednl If one of them is missing, use our own implementation, portable code is then possible
2561e820ecaSPierre Joyednl
2571e820ecaSPierre Joyeif 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 "x$php_crypt_r" = "x0"; then
2581e820ecaSPierre Joye
259a142c274SNikita Popov  dnl
260f732d74fSJohannes Schlüter  dnl Check for __alignof__ support in the compiler
261f732d74fSJohannes Schlüter  dnl
262f732d74fSJohannes Schlüter  AC_CACHE_CHECK(whether the compiler supports __alignof__, ac_cv_alignof_exists,[
263f732d74fSJohannes Schlüter  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
264466c122aSJohannes Schlüter  ]],[[
2654371945bSPeter Kokot    int align = __alignof__(int);
2664371945bSPeter Kokot  ]])],[
267466c122aSJohannes Schlüter    ac_cv_alignof_exists=yes
2684371945bSPeter Kokot  ],[
269f732d74fSJohannes Schlüter    ac_cv_alignof_exists=no
270f732d74fSJohannes Schlüter  ])])
271f732d74fSJohannes Schlüter  if test "$ac_cv_alignof_exists" = "yes"; then
272f732d74fSJohannes Schlüter    AC_DEFINE([HAVE_ALIGNOF], 1, [whether the compiler supports __alignof__])
273f732d74fSJohannes Schlüter  fi
274f732d74fSJohannes Schlüter
275f732d74fSJohannes Schlüter  AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 1, [Whether PHP has to use its own crypt_r for blowfish, des, ext des and md5])
276f732d74fSJohannes Schlüter
2771e820ecaSPierre Joye  PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c)
2781e820ecaSPierre Joyeelse
2799001b403SPierre Joye  AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r for blowfish, des and ext des])
280a0a2b24dSJani Taskinenfi
2811e820ecaSPierre Joye
282a0a2b24dSJani Taskinendnl
2831e57766bSRasmus Lerdorfdnl Check for __attribute__ ((__aligned__)) support in the compiler
28483497327SAnatol Belskidnl
285be7a50b9SNikita PopovAC_CACHE_CHECK(whether the compiler supports aligned attribute, ac_cv_attribute_aligned,[
286be7a50b9SNikita PopovAC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
287be7a50b9SNikita Popov]],[[
2884371945bSPeter Kokot  unsigned char test[32] __attribute__ ((__aligned__ (__alignof__ (int))));
2894371945bSPeter Kokot]])],[
290be7a50b9SNikita Popov  ac_cv_attribute_aligned=yes
2914371945bSPeter Kokot],[
292be7a50b9SNikita Popov  ac_cv_attribute_aligned=no
293be7a50b9SNikita Popov])])
294be7a50b9SNikita Popovif test "$ac_cv_attribute_aligned" = "yes"; then
295be7a50b9SNikita Popov  AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [whether the compiler supports __attribute__ ((__aligned__))])
296be7a50b9SNikita Popovfi
297be7a50b9SNikita Popov
298be7a50b9SNikita Popovdnl
299be7a50b9SNikita Popovdnl Check for available functions
300a0a2b24dSJani Taskinendnl
301a0a2b24dSJani Taskinendnl log2 could be used to improve the log function, however it requires C99. The
302a0a2b24dSJani Taskinendnl check for log2 should be turned on, as soon as we support C99.
303e206409aSAnatol BelskiAC_CHECK_FUNCS(asinh acosh atanh log1p hypot)
304e206409aSAnatol BelskiAC_FUNC_FNMATCH
305714d825bSChristian Schmidt
30683497327SAnatol Belskidnl
307ecc1dce8SRasmus Lerdorfdnl Check if there is a support means of creating a new process and defining
308a0a2b24dSJani Taskinendnl which handles it receives
309a0a2b24dSJani Taskinendnl
310a0a2b24dSJani TaskinenAC_CHECK_FUNCS(fork CreateProcess, [
311a0a2b24dSJani Taskinen  php_can_support_proc_open=yes
312a0a2b24dSJani Taskinen  break
313befa2374SRasmus Lerdorf],[
314a0a2b24dSJani Taskinen  php_can_support_proc_open=no
315a0a2b24dSJani Taskinen])
316befa2374SRasmus LerdorfAC_MSG_CHECKING([if your OS can spawn processes with inherited handles])
317befa2374SRasmus Lerdorfif test "$php_can_support_proc_open" = "yes"; then
318a0a2b24dSJani Taskinen  AC_MSG_RESULT(yes)
319befa2374SRasmus Lerdorf  AC_DEFINE(PHP_CAN_SUPPORT_PROC_OPEN,1, [Define if your system has fork/vfork/CreateProcess])
320a0a2b24dSJani Taskinenelse
321a0a2b24dSJani Taskinen  AC_MSG_RESULT(no)
322a0a2b24dSJani Taskinenfi
323a0a2b24dSJani Taskinen
324a0a2b24dSJani TaskinenPHP_ENABLE_CHROOT_FUNC=no
3251a314027SWez Furlongcase "$PHP_SAPI" in
3262acc3862SAnatol Belski  embed)
3272acc3862SAnatol Belski    PHP_ENABLE_CHROOT_FUNC=yes
3282acc3862SAnatol Belski  ;;
3292acc3862SAnatol Belski
3302acc3862SAnatol Belski  none)
3312acc3862SAnatol Belski    for PROG in $PHP_BINARIES; do
3322acc3862SAnatol Belski      case "$PROG" in
3332acc3862SAnatol Belski        cgi|cli|phpdbg)
3342acc3862SAnatol Belski          PHP_ENABLE_CHROOT_FUNC=yes
335be11b354SJoe Watkins        ;;
3362acc3862SAnatol Belski
3372acc3862SAnatol Belski        *)
3382acc3862SAnatol Belski          PHP_ENABLE_CHROOT_FUNC=no
3392acc3862SAnatol Belski          break
3402acc3862SAnatol Belski        ;;
3412acc3862SAnatol Belski      esac
3422acc3862SAnatol Belski   done
3432acc3862SAnatol Belski  ;;
3442acc3862SAnatol Belskiesac
3452acc3862SAnatol Belski
3462acc3862SAnatol Belskiif test "$PHP_ENABLE_CHROOT_FUNC" = "yes"; then
3472acc3862SAnatol Belski  AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function])
3482acc3862SAnatol Belskifi
3495275b603Sfoobar
3505275b603Sfoobardnl
3515275b603Sfoobardnl Detect library functions needed by php dns_xxx functions
3523ca6344eSMarcus Boergerdnl ext/standard/php_dns.h will collect these in a single define
3533ca6344eSMarcus Boergerdnl HAVE_FULL_DNS_FUNCS
35405065346SScott MacVicardnl
3553ca6344eSMarcus BoergerPHP_CHECK_FUNC(res_nsearch, resolv, bind, socket)
35605065346SScott MacVicarPHP_CHECK_FUNC(res_ndestroy, resolv, bind, socket)
357486fc042SAnatol BelskiPHP_CHECK_FUNC(dns_search, resolv, bind, socket)
35805065346SScott MacVicarPHP_CHECK_FUNC(dn_expand, resolv, bind, socket)
3593ca6344eSMarcus BoergerPHP_CHECK_FUNC(dn_skipname, resolv, bind, socket)
3608911ba1cSScott MacVicar
3618911ba1cSScott MacVicardnl
3628911ba1cSScott MacVicardnl These are old deprecated functions
36305065346SScott MacVicardnl
3648911ba1cSScott MacVicar
3658911ba1cSScott MacVicarPHP_CHECK_FUNC(res_search, resolv, bind, socket)
36605065346SScott MacVicar
3673ca6344eSMarcus Boergerdnl
368a0a2b24dSJani Taskinendnl Check for strptime()
369a0a2b24dSJani Taskinendnl
370a0a2b24dSJani TaskinenAC_CACHE_CHECK(whether strptime() declaration fails, ac_cv_strptime_decl_fails,[
3710584dc01SAntony DovgalAC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3724371945bSPeter Kokot#include <time.h>
3730584dc01SAntony Dovgal]],[[
3744371945bSPeter Kokot#ifndef HAVE_STRPTIME
3750584dc01SAntony Dovgal#error no strptime() on this platform
3760584dc01SAntony Dovgal#else
3770584dc01SAntony Dovgal/* use invalid strptime() declaration to see if it fails to compile */
3780584dc01SAntony Dovgalint strptime(const char *s, const char *format, struct tm *tm);
3790584dc01SAntony Dovgal#endif
3800584dc01SAntony Dovgal]])],[
3814371945bSPeter Kokot  ac_cv_strptime_decl_fails=no
382a0a2b24dSJani Taskinen],[
383a0a2b24dSJani Taskinen  ac_cv_strptime_decl_fails=yes
384a0a2b24dSJani Taskinen])])
385a0a2b24dSJani Taskinenif test "$ac_cv_strptime_decl_fails" = "yes"; then
3860584dc01SAntony Dovgal  AC_DEFINE([HAVE_STRPTIME_DECL_FAILS], 1, [whether strptime() declaration fails])
3870584dc01SAntony Dovgalfi
3880584dc01SAntony Dovgal
3890584dc01SAntony Dovgaldnl
390a0a2b24dSJani Taskinendnl Check for i18n capabilities
391a0a2b24dSJani Taskinendnl
392a0a2b24dSJani TaskinenAC_CHECK_HEADERS([wchar.h])
393a0a2b24dSJani TaskinenAC_CHECK_FUNCS([mblen])
3940a01eae0SPeter KokotAC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t],[
395a0a2b24dSJani TaskinenAC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3964371945bSPeter Kokot#ifdef HAVE_WCHAR_H
397a0a2b24dSJani Taskinen# include <wchar.h>
398a0a2b24dSJani Taskinen#endif
399a0a2b24dSJani Taskinen]],[[
4004371945bSPeter Kokotmbstate_t a;
4013121116aSMichael Wallner]])],[
4024371945bSPeter Kokot  ac_cv_type_mbstate_t=yes
403a0a2b24dSJani Taskinen],[
404a0a2b24dSJani Taskinen  ac_cv_type_mbstate_t=no
405a0a2b24dSJani Taskinen])])
406a0a2b24dSJani Taskinenif test "$ac_cv_type_mbstate_t" = "yes"; then
407a0a2b24dSJani Taskinen  AC_DEFINE([HAVE_MBSTATE_T], 1, [Define if your system has mbstate_t in wchar.h])
408a0a2b24dSJani Taskinenfi
409a0a2b24dSJani Taskinen
41010961114SMoriyoshi Koizumidnl
411377ffeb5SPierre Joyednl Check for atomic operation API availability in Solaris
412377ffeb5SPierre Joyednl
413377ffeb5SPierre JoyeAC_CHECK_HEADERS([atomic.h])
414377ffeb5SPierre Joye
415377ffeb5SPierre Joyednl
416faf835beSLeighdnl Check for arc4random on BSD systems
417faf835beSLeighdnl
418faf835beSLeighAC_CHECK_DECLS([arc4random_buf])
419faf835beSLeigh
420faf835beSLeighdnl
421c2551a74SCharles R. Portwood IIdnl Check for argon2
422c2551a74SCharles R. Portwood IIdnl
423c2551a74SCharles R. Portwood IIPHP_ARG_WITH([password-argon2],
4240d4d8eabSCharles R. Portwood II  [for Argon2 support],
4257672f8beSTom Van Looy  [AS_HELP_STRING([[--with-password-argon2[=DIR]]],
426b719aa41SPeter Kokot    [Include Argon2 support in password_*. DIR is the Argon2 shared library
427bcfccdd9SCharles R. Portwood II    path])])
428d883f65dSCharles R. Portwood II
429bcfccdd9SCharles R. Portwood IIif test "$PHP_PASSWORD_ARGON2" != "no"; then
430d883f65dSCharles R. Portwood II  AC_MSG_CHECKING([for Argon2 library])
431f4aa3a46SCharles R. Portwood II  for i in $PHP_PASSWORD_ARGON2 /usr /usr/local ; do
432bcfccdd9SCharles R. Portwood II    if test -r $i/include/argon2.h; then
433bcfccdd9SCharles R. Portwood II      ARGON2_DIR=$i;
434f4aa3a46SCharles R. Portwood II      AC_MSG_RESULT(found in $i)
435bcfccdd9SCharles R. Portwood II      break
436bcfccdd9SCharles R. Portwood II    fi
437bcfccdd9SCharles R. Portwood II  done
438bcfccdd9SCharles R. Portwood II
439bcfccdd9SCharles R. Portwood II  if test -z "$ARGON2_DIR"; then
440f4aa3a46SCharles R. Portwood II    AC_MSG_RESULT([not found])
441bcfccdd9SCharles R. Portwood II    AC_MSG_ERROR([Please ensure the argon2 header and library are installed])
442f4aa3a46SCharles R. Portwood II  fi
4439bedcb7aSCharles R. Portwood II
444bcfccdd9SCharles R. Portwood II  PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR)
445bcfccdd9SCharles R. Portwood II  PHP_ADD_INCLUDE($ARGON2_DIR/include)
446498716c2SCharles R. Portwood II
447498716c2SCharles R. Portwood II  AC_CHECK_LIB(argon2, argon2id_hash_raw, [
44855277a66SCharles R. Portwood II    LIBS="$LIBS -largon2"
449498716c2SCharles R. Portwood II    AC_DEFINE(HAVE_ARGON2LIB, 1, [ Define to 1 if you have the <argon2.h> header file ])
45055277a66SCharles R. Portwood II  ], [
451498716c2SCharles R. Portwood II    AC_MSG_ERROR([Problem with libargon2.(a|so). Please verify that Argon2 header and libraries >= 20161029 are installed])
452bcfccdd9SCharles R. Portwood II  ])
453c2551a74SCharles R. Portwood IIfi
4547ca5a7d8SSara Golemon
4557ca5a7d8SSara Golemondnl
4567ca5a7d8SSara Golemondnl net_get_interfaces
457a95e8b80SDavid Carlierdnl
458a95e8b80SDavid CarlierAC_CHECK_HEADERS([net/if.h],[], [],
459a95e8b80SDavid Carlier[
460a95e8b80SDavid Carlier  #ifdef HAVE_SYS_SOCKET_H
461a95e8b80SDavid Carlier  #include <sys/socket.h>
462a95e8b80SDavid Carlier  #endif
463a95e8b80SDavid Carlier  #include <net/if.h>
464a95e8b80SDavid Carlier])
4657ca5a7d8SSara GolemonAC_MSG_CHECKING([for usable getifaddrs])
4664371945bSPeter KokotAC_LINK_IFELSE([AC_LANG_PROGRAM([[
467d3fec3bfSMatteo Beccati  #include <sys/types.h>
4687ca5a7d8SSara Golemon  #include <ifaddrs.h>
4694371945bSPeter Kokot]],[[
4707ca5a7d8SSara Golemon  struct ifaddrs *interfaces;
4717ca5a7d8SSara Golemon  if (!getifaddrs(&interfaces)) {
4727ca5a7d8SSara Golemon      freeifaddrs(interfaces);
4737ca5a7d8SSara Golemon  }
4744371945bSPeter Kokot]])], [ac_have_getifaddrs=yes], [ac_have_getifaddrs=no])
4757ca5a7d8SSara Golemonif test "$ac_have_getifaddrs" = "yes" ; then
4767ca5a7d8SSara Golemon  AC_DEFINE(HAVE_GETIFADDRS, 1, [whether getifaddrs is present and usable])
4777ca5a7d8SSara Golemon  AC_MSG_RESULT(yes)
4787ca5a7d8SSara Golemonelse
4797ca5a7d8SSara Golemon  AC_MSG_RESULT(no)
4807ca5a7d8SSara Golemonfi
4817ca5a7d8SSara Golemon
482a0a2b24dSJani Taskinendnl
483a0a2b24dSJani Taskinendnl Setup extension sources
484a0a2b24dSJani Taskinendnl
485f93096ecSfoobarPHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \
486f93096ecSfoobar                            cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
487f93096ecSfoobar                            flock_compat.c formatted_print.c fsock.c head.c html.c image.c \
488f93096ecSfoobar                            info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \
489eba6e7ceSLeigh                            microtime.c pack.c pageinfo.c quot_print.c rand.c mt_rand.c \
490aa3eee1dSJani Taskinen                            soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \
491ae492897SJani Taskinen                            var.c versioning.c assert.c strnatcmp.c levenshtein.c \
492f93096ecSfoobar                            incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \
493f93096ecSfoobar                            http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \
49417b9b2dcSIlia Alshanetsky                            var_unserializer.c ftok.c sha1.c user_filters.c uuencode.c \
495bc54d139SSammyK                            filters.c proc_open.c streamsfuncs.c http.c password.c \
49683497327SAnatol Belski                            random.c net.c hrtime.c,,,
497b9463489SAnatol Belski			    -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
4989d9d39a0SSascha Schumann
4999d9d39a0SSascha SchumannPHP_ADD_MAKEFILE_FRAGMENT
5007243d31aSfoobarPHP_INSTALL_HEADERS([ext/standard/])
501