Annotation of embedaddon/php/ext/standard/config.m4, revision 1.1.1.2
1.1.1.2 ! misho 1: dnl $Id$ -*- autoconf -*-
1.1 misho 2:
3: dnl
4: dnl Check if flush should be called explicitly after buffered io
5: dnl
6: AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], ac_cv_flush_io,[
7: AC_TRY_RUN( [
8: #include <stdio.h>
9: #include <stdlib.h>
10:
11: int main(int argc, char **argv)
12: {
13: char *filename = tmpnam(NULL);
14: char buffer[64];
15: int result = 0;
16:
17: FILE *fp = fopen(filename, "wb");
18: if (NULL == fp)
19: return 0;
20: fputs("line 1\n", fp);
21: fputs("line 2\n", fp);
22: fclose(fp);
23:
24: fp = fopen(filename, "rb+");
25: if (NULL == fp)
26: return 0;
27: fgets(buffer, sizeof(buffer), fp);
28: fputs("line 3\n", fp);
29: rewind(fp);
30: fgets(buffer, sizeof(buffer), fp);
31: if (0 != strcmp(buffer, "line 1\n"))
32: result = 1;
33: fgets(buffer, sizeof(buffer), fp);
34: if (0 != strcmp(buffer, "line 3\n"))
35: result = 1;
36: fclose(fp);
37: unlink(filename);
38:
39: exit(result);
40: }
41: ],[
42: ac_cv_flush_io=no
43: ],[
44: ac_cv_flush_io=yes
45: ],[
46: ac_cv_flush_io=no
47: ])])
48: if test "$ac_cv_flush_io" = "yes"; then
49: AC_DEFINE(HAVE_FLUSHIO, 1, [Define if flush should be called explicitly after a buffered io.])
50: fi
51:
52: dnl
53: dnl Check for crypt() capabilities
54: dnl
55: if test "$ac_cv_func_crypt" = "no"; then
56: AC_CHECK_LIB(crypt, crypt, [
57: LIBS="-lcrypt $LIBS -lcrypt"
58: AC_DEFINE(HAVE_CRYPT, 1, [ ])
59: ])
60: fi
61:
62: AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
63: AC_TRY_RUN([
64: #if HAVE_UNISTD_H
65: #include <unistd.h>
66: #endif
67:
68: #if HAVE_CRYPT_H
69: #include <crypt.h>
70: #endif
71:
72: main() {
73: #if HAVE_CRYPT
74: exit (strcmp((char *)crypt("rasmuslerdorf","rl"),"rl.3StKT.4T8M"));
75: #else
76: exit(0);
77: #endif
78: }],[
79: ac_cv_crypt_des=yes
80: ],[
81: ac_cv_crypt_des=no
82: ],[
83: ac_cv_crypt_des=yes
84: ])])
85:
86: AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
87: AC_TRY_RUN([
88: #if HAVE_UNISTD_H
89: #include <unistd.h>
90: #endif
91:
92: #if HAVE_CRYPT_H
93: #include <crypt.h>
94: #endif
95:
96: main() {
97: #if HAVE_CRYPT
98: exit (strcmp((char *)crypt("rasmuslerdorf","_J9..rasm"),"_J9..rasmBYk8r9AiWNc"));
99: #else
100: exit(0);
101: #endif
102: }],[
103: ac_cv_crypt_ext_des=yes
104: ],[
105: ac_cv_crypt_ext_des=no
106: ],[
107: ac_cv_crypt_ext_des=no
108: ])])
109:
110: AC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[
111: AC_TRY_RUN([
112: #if HAVE_UNISTD_H
113: #include <unistd.h>
114: #endif
115:
116: #if HAVE_CRYPT_H
117: #include <crypt.h>
118: #endif
119:
120: main() {
121: #if HAVE_CRYPT
122: char salt[15], answer[40];
123:
124: salt[0]='$'; salt[1]='1'; salt[2]='$';
125: salt[3]='r'; salt[4]='a'; salt[5]='s';
126: salt[6]='m'; salt[7]='u'; salt[8]='s';
127: salt[9]='l'; salt[10]='e'; salt[11]='$';
128: salt[12]='\0';
129: strcpy(answer,salt);
130: strcat(answer,"rISCgZzpwk3UhDidwXvin0");
131: exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
132: #else
133: exit(0);
134: #endif
135: }],[
136: ac_cv_crypt_md5=yes
137: ],[
138: ac_cv_crypt_md5=no
139: ],[
140: ac_cv_crypt_md5=no
141: ])])
142:
143: AC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[
144: AC_TRY_RUN([
145: #if HAVE_UNISTD_H
146: #include <unistd.h>
147: #endif
148:
149: #if HAVE_CRYPT_H
150: #include <crypt.h>
151: #endif
152:
153: main() {
154: #if HAVE_CRYPT
155: char salt[30], answer[70];
156:
157: salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
158: strcat(salt,"rasmuslerd............");
159: strcpy(answer,salt);
160: strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
161: exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
162: #else
163: exit(0);
164: #endif
165: }],[
166: ac_cv_crypt_blowfish=yes
167: ],[
168: ac_cv_crypt_blowfish=no
169: ],[
170: ac_cv_crypt_blowfish=no
171: ])])
172:
173: AC_CACHE_CHECK(for SHA512 crypt, ac_cv_crypt_SHA512,[
174: AC_TRY_RUN([
175: #if HAVE_UNISTD_H
176: #include <unistd.h>
177: #endif
178:
179: #if HAVE_CRYPT_H
180: #include <crypt.h>
181: #endif
182:
183: main() {
184: #if HAVE_CRYPT
185: char salt[30], answer[80];
186:
187: salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]='$'; salt[4]='b'; salt[5]='a'; salt[6]='r'; salt[7]='\0';
188: strcpy(answer, salt);
189: strcpy(&answer[29],"$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.");
190: exit (strcmp((char *)crypt("foo",salt),answer));
191: #else
192: exit(0);
193: #endif
194: }],[
195: ac_cv_crypt_SHA512=yes
196: ],[
197: ac_cv_crypt_SHA512=no
198: ],[
199: ac_cv_crypt_SHA512=no
200: ])])
201:
202: AC_CACHE_CHECK(for SHA256 crypt, ac_cv_crypt_SHA256,[
203: AC_TRY_RUN([
204: #if HAVE_UNISTD_H
205: #include <unistd.h>
206: #endif
207:
208: #if HAVE_CRYPT_H
209: #include <crypt.h>
210: #endif
211:
212: main() {
213: #if HAVE_CRYPT
214: char salt[30], answer[80];
215: salt[0]='$'; salt[1]='5'; salt[2]='$'; salt[3]='$'; salt[4]='s'; salt[5]='a'; salt[6]='l'; salt[7]='t'; salt[8]='s'; salt[9]='t'; salt[10]='r'; salt[11]='i'; salt[12]='n'; salt[13]='g'; salt[14]='\0';
216: strcat(salt,"");
217: strcpy(answer, salt);
218: strcpy(&answer[29], "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5");
219: exit (strcmp((char *)crypt("foo",salt),answer));
220: #else
221: exit(0);
222: #endif
223: }],[
224: ac_cv_crypt_SHA256=yes
225: ],[
226: ac_cv_crypt_SHA256=no
227: ],[
228: ac_cv_crypt_SHA256=no
229: ])])
230:
231:
232: dnl
233: dnl If one of them is missing, use our own implementation, portable code is then possible
234: dnl
235: if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "x$php_crypt_r" = "x0"; then
236:
237: dnl
238: dnl Check for __alignof__ support in the compiler
239: dnl
240: AC_CACHE_CHECK(whether the compiler supports __alignof__, ac_cv_alignof_exists,[
241: AC_TRY_COMPILE([
242: ],[
243: int align = __alignof__(int);
244: ],[
245: ac_cv_alignof_exists=yes
246: ],[
247: ac_cv_alignof_exists=no
248: ])])
249: if test "$ac_cv_alignof_exists" = "yes"; then
250: AC_DEFINE([HAVE_ALIGNOF], 1, [whether the compiler supports __alignof__])
251: fi
252:
253: dnl
254: dnl Check for __attribute__ ((__aligned__)) support in the compiler
255: dnl
256: AC_CACHE_CHECK(whether the compiler supports aligned attribute, ac_cv_attribute_aligned,[
257: AC_TRY_COMPILE([
258: ],[
259: unsigned char test[32] __attribute__ ((__aligned__ (__alignof__ (int))));
260: ],[
261: ac_cv_attribute_aligned=yes
262: ],[
263: ac_cv_attribute_aligned=no
264: ])])
265: if test "$ac_cv_attribute_aligned" = "yes"; then
266: AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [whether the compiler supports __attribute__ ((__aligned__))])
267: fi
268:
269:
270: 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])
271: AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, 1, [Whether the system supports standard DES salt])
272: AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, 1, [Whether the system supports BlowFish salt])
273: AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, 1, [Whether the system supports extended DES salt])
274: AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, 1, [Whether the system supports MD5 salt])
275: AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, 1, [Whether the system supports SHA512 salt])
276: AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, 1, [Whether the system supports SHA256 salt])
277:
278: PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c)
279: else
280: if test "$ac_cv_crypt_des" = "yes"; then
281: ac_result=1
282: ac_crypt_des=1
283: else
284: ac_result=0
285: ac_crypt_des=0
286: fi
287: AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, $ac_result, [Whether the system supports standard DES salt])
288:
289: if test "$ac_cv_crypt_blowfish" = "yes"; then
290: ac_result=1
291: ac_crypt_blowfish=1
292: else
293: ac_result=0
294: ac_crypt_blowfish=0
295: fi
296: AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, $ac_result, [Whether the system supports BlowFish salt])
297:
298: if test "$ac_cv_crypt_ext_des" = "yes"; then
299: ac_result=1
300: ac_crypt_edes=1
301: else
302: ac_result=0
303: ac_crypt_edes=0
304: fi
305: AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, $ac_result, [Whether the system supports extended DES salt])
306:
307: if test "$ac_cv_crypt_md5" = "yes"; then
308: ac_result=1
309: ac_crypt_md5=1
310: else
311: ac_result=0
312: ac_crypt_md5=0
313: fi
314: AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, $ac_result, [Whether the system supports MD5 salt])
315:
316: if test "$ac_cv_crypt_sha512" = "yes"; then
317: ac_result=1
318: ac_crypt_sha512=1
319: else
320: ac_result=0
321: ac_crypt_sha512=0
322: fi
323: AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, $ac_result, [Whether the system supports SHA512 salt])
324:
325: if test "$ac_cv_crypt_sha256" = "yes"; then
326: ac_result=1
327: ac_crypt_sha256=1
328: else
329: ac_result=0
330: ac_crypt_sha256=0
331: fi
332: AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, $ac_result, [Whether the system supports SHA256 salt])
333:
334: AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r for blowfish, des and ext des])
335: fi
336:
337: dnl
338: dnl Check for available functions
339: dnl
340: AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
341: AC_FUNC_FNMATCH
342:
343: dnl
344: dnl Check if there is a support means of creating a new process
345: dnl and defining which handles it receives
346: dnl
347: AC_CHECK_FUNCS(fork CreateProcess, [
348: php_can_support_proc_open=yes
349: break
350: ],[
351: php_can_support_proc_open=no
352: ])
353: AC_MSG_CHECKING([if your OS can spawn processes with inherited handles])
354: if test "$php_can_support_proc_open" = "yes"; then
355: AC_MSG_RESULT(yes)
356: AC_DEFINE(PHP_CAN_SUPPORT_PROC_OPEN,1, [Define if your system has fork/vfork/CreateProcess])
357: else
358: AC_MSG_RESULT(no)
359: fi
360:
361: if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "cli" || test "$PHP_SAPI" = "embed"; then
362: AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function])
363: fi
364:
365: dnl
366: dnl Detect library functions needed by php dns_xxx functions
367: dnl ext/standard/php_dns.h will collect these in a single define: HAVE_FULL_DNS_FUNCS
368: dnl
369: PHP_CHECK_FUNC(res_nsearch, resolv, bind, socket)
370: PHP_CHECK_FUNC(dns_search, resolv, bind, socket)
371: PHP_CHECK_FUNC(dn_expand, resolv, bind, socket)
372: PHP_CHECK_FUNC(dn_skipname, resolv, bind, socket)
373:
374: dnl
375: dnl These are old deprecated functions
376: dnl
377:
378: PHP_CHECK_FUNC(res_search, resolv, bind, socket)
379:
380: dnl
381: dnl Check if atof() accepts NAN
382: dnl
383: AC_CACHE_CHECK(whether atof() accepts NAN, ac_cv_atof_accept_nan,[
384: AC_TRY_RUN([
385: #include <math.h>
386: #include <stdlib.h>
387:
388: #ifdef HAVE_ISNAN
389: #define zend_isnan(a) isnan(a)
390: #elif defined(HAVE_FPCLASS)
391: #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
392: #else
393: #define zend_isnan(a) 0
394: #endif
395:
396: int main(int argc, char** argv)
397: {
398: return zend_isnan(atof("NAN")) ? 0 : 1;
399: }
400: ],[
401: ac_cv_atof_accept_nan=yes
402: ],[
403: ac_cv_atof_accept_nan=no
404: ],[
405: ac_cv_atof_accept_nan=no
406: ])])
407: if test "$ac_cv_atof_accept_nan" = "yes"; then
408: AC_DEFINE([HAVE_ATOF_ACCEPTS_NAN], 1, [whether atof() accepts NAN])
409: fi
410:
411: dnl
412: dnl Check if atof() accepts INF
413: dnl
414: AC_CACHE_CHECK(whether atof() accepts INF, ac_cv_atof_accept_inf,[
415: AC_TRY_RUN([
416: #include <math.h>
417: #include <stdlib.h>
418:
419: #ifdef HAVE_ISINF
420: #define zend_isinf(a) isinf(a)
421: #elif defined(INFINITY)
422: /* Might not work, but is required by ISO C99 */
423: #define zend_isinf(a) (((a)==INFINITY)?1:0)
424: #elif defined(HAVE_FPCLASS)
425: #define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
426: #else
427: #define zend_isinf(a) 0
428: #endif
429:
430: int main(int argc, char** argv)
431: {
432: return zend_isinf(atof("INF")) && zend_isinf(atof("-INF")) ? 0 : 1;
433: }
434: ],[
435: ac_cv_atof_accept_inf=yes
436: ],[
437: ac_cv_atof_accept_inf=no
438: ],[
439: ac_cv_atof_accept_inf=no
440: ])])
441: if test "$ac_cv_atof_accept_inf" = "yes"; then
442: AC_DEFINE([HAVE_ATOF_ACCEPTS_INF], 1, [whether atof() accepts INF])
443: fi
444:
445: dnl
446: dnl Check if HUGE_VAL == INF
447: dnl
448: AC_CACHE_CHECK(whether HUGE_VAL == INF, ac_cv_huge_val_inf,[
449: AC_TRY_RUN([
450: #include <math.h>
451: #include <stdlib.h>
452:
453: #ifdef HAVE_ISINF
454: #define zend_isinf(a) isinf(a)
455: #elif defined(INFINITY)
456: /* Might not work, but is required by ISO C99 */
457: #define zend_isinf(a) (((a)==INFINITY)?1:0)
458: #elif defined(HAVE_FPCLASS)
459: #define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
460: #else
461: #define zend_isinf(a) 0
462: #endif
463:
464: int main(int argc, char** argv)
465: {
466: return zend_isinf(HUGE_VAL) ? 0 : 1;
467: }
468: ],[
469: ac_cv_huge_val_inf=yes
470: ],[
471: ac_cv_huge_val_inf=no
472: ],[
473: ac_cv_huge_val_inf=yes
474: ])])
475: dnl This is the most probable fallback so we assume yes in case of cross compile.
476: if test "$ac_cv_huge_val_inf" = "yes"; then
477: AC_DEFINE([HAVE_HUGE_VAL_INF], 1, [whether HUGE_VAL == INF])
478: fi
479:
480: dnl
481: dnl Check if HUGE_VAL + -HUGEVAL == NAN
482: dnl
483: AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
484: AC_TRY_RUN([
485: #include <math.h>
486: #include <stdlib.h>
487:
488: #ifdef HAVE_ISNAN
489: #define zend_isnan(a) isnan(a)
490: #elif defined(HAVE_FPCLASS)
491: #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
492: #else
493: #define zend_isnan(a) 0
494: #endif
495:
496: int main(int argc, char** argv)
497: {
498: #if defined(__sparc__) && !(__GNUC__ >= 3)
499: /* prevent bug #27830 */
500: return 1;
501: #else
502: return zend_isnan(HUGE_VAL + -HUGE_VAL) ? 0 : 1;
503: #endif
504: }
505: ],[
506: ac_cv_huge_val_nan=yes
507: ],[
508: ac_cv_huge_val_nan=no
509: ],[
510: ac_cv_huge_val_nan=yes
511: ])])
512: dnl This is the most probable fallback so we assume yes in case of cross compile.
513: if test "$ac_cv_huge_val_nan" = "yes"; then
514: AC_DEFINE([HAVE_HUGE_VAL_NAN], 1, [whether HUGE_VAL + -HUGEVAL == NAN])
515: fi
516:
517: dnl
518: dnl Check for strptime()
519: dnl
520: AC_CACHE_CHECK(whether strptime() declaration fails, ac_cv_strptime_decl_fails,[
521: AC_TRY_COMPILE([
522: #include <time.h>
523: ],[
524: #ifndef HAVE_STRPTIME
525: #error no strptime() on this platform
526: #else
527: /* use invalid strptime() declaration to see if it fails to compile */
528: int strptime(const char *s, const char *format, struct tm *tm);
529: #endif
530: ],[
531: ac_cv_strptime_decl_fails=no
532: ],[
533: ac_cv_strptime_decl_fails=yes
534: ])])
535: if test "$ac_cv_strptime_decl_fails" = "yes"; then
536: AC_DEFINE([HAVE_STRPTIME_DECL_FAILS], 1, [whether strptime() declaration fails])
537: fi
538:
539: dnl
540: dnl Check for i18n capabilities
541: dnl
542: AC_CHECK_HEADERS([wchar.h])
543: AC_CHECK_FUNCS([mblen])
544: AC_CHECK_FUNCS([mbrlen mbsinit],,,[
545: #ifdef HAVE_WCHAR_H
546: # include <wchar.h>
547: #endif
548: ])
549: AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t],[
550: AC_TRY_COMPILE([
551: #ifdef HAVE_WCHAR_H
552: # include <wchar.h>
553: #endif
554: ],[
555: int __tmp__() { mbstate_t a; }
556: ],[
557: ac_cv_type_mbstate_t=yes
558: ],[
559: ac_cv_type_mbstate_t=no
560: ])])
561: if test "$ac_cv_type_mbstate_t" = "yes"; then
562: AC_DEFINE([HAVE_MBSTATE_T], 1, [Define if your system has mbstate_t in wchar.h])
563: fi
564:
565: dnl
566: dnl Check for atomic operation API availability in Solaris
567: dnl
568: AC_CHECK_HEADERS([atomic.h])
569:
570: dnl
571: dnl Setup extension sources
572: dnl
573: PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \
574: cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
575: flock_compat.c formatted_print.c fsock.c head.c html.c image.c \
576: info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \
577: microtime.c pack.c pageinfo.c quot_print.c rand.c \
578: soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \
579: var.c versioning.c assert.c strnatcmp.c levenshtein.c \
580: incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \
581: http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \
582: var_unserializer.c ftok.c sha1.c user_filters.c uuencode.c \
583: filters.c proc_open.c streamsfuncs.c http.c)
584:
585: PHP_ADD_MAKEFILE_FRAGMENT
586: PHP_INSTALL_HEADERS([ext/standard/])
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>