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