diff --git a/acinclude.m4 b/acinclude.m4 index ac2bf55563f..37e1f21d251 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2712,3 +2712,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 1e65073e927..ef91543db2c 100644 --- a/configure.in +++ b/configure.in @@ -286,6 +286,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 af0cee2800f..4f335059866 100644 --- a/sapi/cgi/config9.m4 +++ b/sapi/cgi/config9.m4 @@ -10,36 +10,6 @@ AC_ARG_ENABLE(cgi, PHP_SAPI_CGI=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 @@ -82,8 +52,6 @@ if test "$PHP_SAPI" = "default"; then esac PHP_SUBST(SAPI_CGI_PATH) - PHP_TEST_WRITE_STDOUT - INSTALL_IT="@echo \"Installing PHP CGI into: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php\$(program_suffix)\$(EXEEXT)" PHP_SELECT_SAPI(cgi, program, fastcgi.c cgi_main.c getopt.c, , '$(SAPI_CGI_PATH)')