]> granicus.if.org Git - php/commitdiff
- Moved CGI specific lines from configure.in to sapi/cgi/config9.m4
authorfoobar <sniper@php.net>
Mon, 21 Oct 2002 03:12:27 +0000 (03:12 +0000)
committerfoobar <sniper@php.net>
Mon, 21 Oct 2002 03:12:27 +0000 (03:12 +0000)
  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
configure.in
sapi/cgi/config.m4 [deleted file]
sapi/cgi/config9.m4 [new file with mode: 0644]

index 1f32e375c89340066870f308c1e21b9d5ce73c75..dc193d341a12fac168d24a6f6b8396545df1349a 100644 (file)
@@ -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
 ])
index 76016d349a3c75be7e920716f68546adc2f6e2b8..51e7b810a6cef54a0995467f42a20d9a430e6c87 100644 (file)
@@ -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 (file)
index ce1f00a..0000000
+++ /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 <unistd.h>
-#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 (file)
index 0000000..0fc6f5a
--- /dev/null
@@ -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 <unistd.h>
+#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