From 9d21dd450df6de6792a05930024f9768ef087dde Mon Sep 17 00:00:00 2001 From: foobar Date: Mon, 21 Oct 2002 03:12:27 +0000 Subject: [PATCH] - Moved CGI specific lines from configure.in to sapi/cgi/config9.m4 which is 'executed' last of the SAPI config.m4's. - Added --disable-cgi option. (was possible only with above change) - Made the sed check to not test for the possibly working sed on Solaris since that would make the test quite useless. (compile would still fail) # That sed check is not enabled yet..need to know whether we fail # during configure or just put out a warning about possible non-working # sed. As even plain ./configure doesn't work in most cases, I think # it would be better to just fail during configure and let the users # fix their paths/install GNU sed. --- acinclude.m4 | 4 +- configure.in | 8 +-- sapi/cgi/config.m4 | 78 ----------------------------- sapi/cgi/config9.m4 | 118 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 84 deletions(-) delete mode 100644 sapi/cgi/config.m4 create mode 100644 sapi/cgi/config9.m4 diff --git a/acinclude.m4 b/acinclude.m4 index 1f32e375c8..dc193d341a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1777,9 +1777,8 @@ $debug || } _max=0 _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do + for _sed in $_sed_list; do test ! -f ${_sed} && break cat /dev/null > "$tmp/sed.in" _count=0 @@ -1811,6 +1810,7 @@ if test -z "$ac_cv_path_sed"; then AC_MSG_ERROR([Could not find working sed on this system. Please install GNU sed.]) else SED=$ac_cv_path_sed + PHP_SUBST(SED) AC_MSG_RESULT([$SED]) fi ]) diff --git a/configure.in b/configure.in index 76016d349a..51e7b810a6 100644 --- a/configure.in +++ b/configure.in @@ -127,6 +127,9 @@ dnl AC_PROG_CXXCPP dnl check for -R, etc. switch PHP_RUNPATH_SWITCH +dnl check for working sed (disabled for now, waiting for comments) +dnl PHP_PROG_SED + AC_PROG_RANLIB AC_PROG_LN_S AC_PROG_AWK @@ -223,10 +226,7 @@ PHP_CONFIGURE_PART(Configuring SAPI modules) esyscmd(./scripts/config-stubs sapi) -if test "$PHP_SAPI" = "default"; then - PHP_SELECT_SAPI(cgi, program, cgi_main.c getopt.c,,'$(SAPI_CGI_PATH)') -fi - +dnl Show which main SAPI was selected AC_MSG_CHECKING([for chosen SAPI module]) AC_MSG_RESULT([$PHP_SAPI]) diff --git a/sapi/cgi/config.m4 b/sapi/cgi/config.m4 deleted file mode 100644 index ce1f00aef3..0000000000 --- a/sapi/cgi/config.m4 +++ /dev/null @@ -1,78 +0,0 @@ -dnl -dnl $Id$ -dnl - -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 - PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag) - SAPI_CGI_PATH=sapi/cgi/php-cgi - PHP_SUBST(SAPI_CGI_PATH) - - PHP_TEST_WRITE_STDOUT - -PHP_ARG_ENABLE(force-cgi-redirect,whether to force Apache CGI redirect, -[ --enable-force-cgi-redirect - Enable the security check for internal server - redirects. You should use this if you are - running the CGI version with Apache. ], no, no) - - if test "$PHP_FORCE_CGI_REDIRECT" = "yes"; then - REDIRECT=1 - else - REDIRECT=0 - fi - AC_DEFINE_UNQUOTED(FORCE_CGI_REDIRECT,$REDIRECT,[ ]) - -PHP_ARG_ENABLE(discard-path,whether to discard path_info + path_translated, -[ --enable-discard-path If this is enabled, the PHP CGI binary - can safely be placed outside of the - web tree and people will not be able - to circumvent .htaccess security. ], no, no) - - if test "$PHP_DISCARD_PATH" = "yes"; then - DISCARD_PATH=1 - else - DISCARD_PATH=0 - fi - AC_DEFINE_UNQUOTED(DISCARD_PATH, $DISCARD_PATH, [ ]) - - INSTALL_IT="\$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/php-cgi" - - case $host_alias in - *darwin*) - BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" - ;; - *) - BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" - ;; - esac - PHP_SUBST(BUILD_CGI) -fi diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4 new file mode 100644 index 0000000000..0fc6f5a63e --- /dev/null +++ b/sapi/cgi/config9.m4 @@ -0,0 +1,118 @@ +dnl +dnl $Id$ +dnl + +AC_ARG_ENABLE(cgi, +[ --disable-cgi Disable building CGI version of PHP], +[ + PHP_SAPI_CGI=$enableval +],[ + PHP_SAPI_CGI=yes +]) + +AC_ARG_ENABLE(force-cgi-redirect, +[ --enable-force-cgi-redirect + Enable the security check for internal server + redirects. You should use this if you are + running the CGI version with Apache.], +[ + PHP_FORCE_CGI_REDIRECT=$enableval +],[ + PHP_FORCE_CGI_REDIRECT=no +]) + +AC_ARG_ENABLE(discard-path, +[ --enable-discard-path If this is enabled, the PHP CGI binary + can safely be placed outside of the + web tree and people will not be able + to circumvent .htaccess security.], +[ + PHP_DISCARD_PATH=$enableval +],[ + PHP_DISCARD_PATH=no +]) + + +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 + AC_MSG_RESULT(yes) + + PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag) + SAPI_CGI_PATH=sapi/cgi/php-cgi + 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 + else + REDIRECT=0 + fi + AC_DEFINE_UNQUOTED(FORCE_CGI_REDIRECT,$REDIRECT,[ ]) + AC_MSG_RESULT($PHP_FORCE_CGI_REDIRECT) + + + AC_MSG_CHECKING(whether to discard path_info + path_translated) + if test "$PHP_DISCARD_PATH" = "yes"; then + DISCARD_PATH=1 + else + DISCARD_PATH=0 + fi + AC_DEFINE_UNQUOTED(DISCARD_PATH, $DISCARD_PATH, [ ]) + AC_MSG_RESULT($PHP_DISCARD_PATH) + + + INSTALL_IT="\$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/php-cgi" + PHP_SELECT_SAPI(cgi, program, cgi_main.c getopt.c,,'$(SAPI_CGI_PATH)') + + case $host_alias in + *darwin*) + BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" + ;; + *) + BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" + ;; + esac + + PHP_SUBST(BUILD_CGI) + + elif test "$PHP_SAPI_CLI" != "no"; then + AC_MSG_RESULT(no) + OVERALL_TARGET= + PHP_SAPI=cli + else + AC_MSG_ERROR([No SAPIs selected.]) + fi +fi -- 2.50.1