helly Wed Oct 2 08:52:54 2002 EDT Modified files: /php4 acinclude.m4 configure.in Log: Check for C99 conformance of snprintf. #This way we force using internal version if a broken library is used. #E.g. length parameter is broken, return value or default precision wrong. Index: php4/acinclude.m4 diff -u php4/acinclude.m4:1.209 php4/acinclude.m4:1.210 --- php4/acinclude.m4:1.209 Wed Oct 2 04:32:26 2002 +++ php4/acinclude.m4 Wed Oct 2 08:52:53 2002 @@ -1,4 +1,4 @@ -dnl $Id: acinclude.m4,v 1.209 2002/10/02 08:32:26 sas Exp $ +dnl $Id: acinclude.m4,v 1.210 2002/10/02 12:52:53 helly Exp $ dnl dnl This file contains local autoconf functions. @@ -1164,7 +1164,7 @@ ]) dnl -dnl Check for broken sprintf() +dnl Check for broken sprintf(), C99 conformance dnl AC_DEFUN(PHP_AC_BROKEN_SPRINTF,[ AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[ @@ -1177,9 +1177,42 @@ ]) ]) if test "$ac_cv_broken_sprintf" = "yes"; then - AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [ ]) + AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [Whether sprintf is C99 conform]) else - AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [ ]) + AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [Whether sprintf is C99 conform]) + fi +]) + +dnl +dnl Check for broken snprintf(), C99 conformance +dnl +AC_DEFUN(PHP_AC_BROKEN_SNPRINTF,[ + AC_CACHE_CHECK(whether snprintf is broken, ac_cv_broken_snprintf,[ + AC_TRY_RUN([ +#define NULL (0L) +main() { + char buf[20]; + int res = 0; + res = res || (snprintf(buf, 2, "marcus") != 6); + res = res || (buf[1] != '\0'); + res = res || (snprintf(buf, 0, "boerger") != 7); + res = res || (buf[0] != 'm'); + res = res || (snprintf(NULL, 0, "boerger") != 7); + res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8); + exit(res); +} + ],[ + ac_cv_broken_snprintf=no + ],[ + ac_cv_broken_snprintf=yes + ],[ + ac_cv_broken_snprintf=no + ]) + ]) + if test "$ac_cv_broken_snprintf" = "yes"; then + AC_DEFINE(PHP_BROKEN_SNPRINTF, 1, [Whether snprintf is C99 conform]) + else + AC_DEFINE(PHP_BROKEN_SNPRINTF, 0, [Whether snprintf is C99 conform]) fi ]) Index: php4/configure.in diff -u php4/configure.in:1.376 php4/configure.in:1.377 --- php4/configure.in:1.376 Mon Sep 30 22:47:52 2002 +++ php4/configure.in Wed Oct 2 08:52:53 2002 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.376 2002/10/01 02:47:52 sniper Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.377 2002/10/02 12:52:53 helly Exp $ -*- sh -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -493,6 +493,7 @@ AC_FUNC_UTIME_NULL AC_FUNC_ALLOCA PHP_AC_BROKEN_SPRINTF +PHP_AC_BROKEN_SNPRINTF PHP_DECLARED_TIMEZONE PHP_TIME_R_TYPE PHP_READDIR_R_TYPE
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php