From: Antony Dovgal Date: Tue, 20 Feb 2007 20:11:11 +0000 (+0000) Subject: MFH: move PHP_TEST_WRITE_STDOUT to acinclude.m4 and use it in configure.in X-Git-Tag: php-5.2.2RC1~348 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43d788ec330af2512408896c4325ce2144ba14a5;p=php MFH: move PHP_TEST_WRITE_STDOUT to acinclude.m4 and use it in configure.in --- diff --git a/acinclude.m4 b/acinclude.m4 index 751835fab8..11dcad5917 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2645,3 +2645,33 @@ php_cv_crypt_r_style=struct_crypt_data_gnu_source) AC_MSG_ERROR([Unable to detect data struct used by crypt_r]) fi ]) + +AC_DEFUN([PHP_TEST_WRITE_STDOUT],[ + AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[ + AC_TRY_RUN([ +#ifdef HAVE_UNISTD_H +#include +#endif + +#define TEXT "This is the test message -- " + +main() +{ + int n; + + n = write(1, TEXT, sizeof(TEXT)-1); + return (!(n == sizeof(TEXT)-1)); +} + ],[ + ac_cv_write_stdout=yes + ],[ + ac_cv_write_stdout=no + ],[ + ac_cv_write_stdout=no + ]) + ]) + if test "$ac_cv_write_stdout" = "yes"; then + AC_DEFINE(PHP_WRITE_STDOUT, 1, [whether write(2) works]) + fi +]) + diff --git a/configure.in b/configure.in index d3fa73e274..da4bc76d8a 100644 --- a/configure.in +++ b/configure.in @@ -288,6 +288,9 @@ PHP_EBCDIC dnl Check whether the system byte ordering is bigendian PHP_C_BIGENDIAN +dnl Check whether writing to stdout works +PHP_TEST_WRITE_STDOUT + dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary dnl and source packages. This should be harmless on other OSs. if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4 index b31adabacc..816cec799d 100644 --- a/sapi/cgi/config9.m4 +++ b/sapi/cgi/config9.m4 @@ -50,36 +50,6 @@ AC_ARG_ENABLE(path-info-check, PHP_ENABLE_PATHINFO_CHECK=yes ]) -AC_DEFUN([PHP_TEST_WRITE_STDOUT],[ - AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[ - AC_TRY_RUN([ -#ifdef HAVE_UNISTD_H -#include -#endif - -#define TEXT "This is the test message -- " - -main() -{ - int n; - - n = write(1, TEXT, sizeof(TEXT)-1); - return (!(n == sizeof(TEXT)-1)); -} - ],[ - ac_cv_write_stdout=yes - ],[ - ac_cv_write_stdout=no - ],[ - ac_cv_write_stdout=no - ]) - ]) - if test "$ac_cv_write_stdout" = "yes"; then - AC_DEFINE(PHP_WRITE_STDOUT, 1, [whether write(2) works]) - fi -]) - - if test "$PHP_SAPI" = "default"; then AC_MSG_CHECKING(for CGI build) if test "$PHP_SAPI_CGI" != "no"; then @@ -96,8 +66,6 @@ if test "$PHP_SAPI" = "default"; then esac PHP_SUBST(SAPI_CGI_PATH) - PHP_TEST_WRITE_STDOUT - AC_MSG_CHECKING(whether to force Apache CGI redirect) if test "$PHP_FORCE_CGI_REDIRECT" = "yes"; then REDIRECT=1