1dnl config.m4 for sapi cgi 2 3PHP_ARG_ENABLE(cgi,, 4[ --disable-cgi Disable building CGI version of PHP], yes, no) 5 6dnl 7dnl CGI setup 8dnl 9AC_MSG_CHECKING(for CGI build) 10if test "$PHP_CGI" != "no"; then 11 AC_MSG_RESULT(yes) 12 AC_MSG_CHECKING([for socklen_t in sys/socket.h]) 13 AC_EGREP_HEADER([socklen_t], [sys/socket.h], 14 [AC_MSG_RESULT([yes]) 15 AC_DEFINE([HAVE_SOCKLEN_T], [1], 16 [Define if the socklen_t typedef is in sys/socket.h])], 17 AC_MSG_RESULT([no])) 18 19 AC_MSG_CHECKING([for sun_len in sys/un.h]) 20 AC_EGREP_HEADER([sun_len], [sys/un.h], 21 [AC_MSG_RESULT([yes]) 22 AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1], 23 [Define if sockaddr_un in sys/un.h contains a sun_len component])], 24 AC_MSG_RESULT([no])) 25 26 AC_MSG_CHECKING([whether cross-process locking is required by accept()]) 27 case "`uname -sr`" in 28 IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0) 29 AC_MSG_RESULT([yes]) 30 AC_DEFINE([USE_LOCKING], [1], 31 [Define if cross-process locking is required by accept()]) 32 ;; 33 *) 34 AC_MSG_RESULT([no]) 35 ;; 36 esac 37 38 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag) 39 40 dnl Set filename 41 case $host_alias in 42 *cygwin* ) 43 SAPI_CGI_PATH=sapi/cgi/php-cgi.exe 44 ;; 45 * ) 46 SAPI_CGI_PATH=sapi/cgi/php-cgi 47 ;; 48 esac 49 50 dnl Select SAPI 51 PHP_SELECT_SAPI(cgi, program, cgi_main.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, '$(SAPI_CGI_PATH)') 52 53 case $host_alias in 54 *aix*) 55 if test "$php_sapi_module" = "shared"; then 56 BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CGI_OBJS) | sed 's/\([A-Za-z0-9_]*\)\.lo/.libs\/\1.o/g'\` | \$(AWK) '{ if (((\$\$2 == \"T\") || (\$\$2 == \"D\") || (\$\$2 == \"B\")) && (substr(\$\$3,1,1) != \".\")) { print \$\$3 } }' | sort -u >> php.sym && \$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) -Wl,-brtl -Wl,-bE:php.sym \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" 57 else 58 BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CGI_OBJS) | sed 's/\([A-Za-z0-9_]*\)\.lo/\1.o/g'\` | \$(AWK) '{ if (((\$\$2 == \"T\") || (\$\$2 == \"D\") || (\$\$2 == \"B\")) && (substr(\$\$3,1,1) != \".\")) { print \$\$3 } }' | sort -u >> php.sym && \$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) -Wl,-brtl -Wl,-bE:php.sym \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" 59 fi 60 ;; 61 *darwin*) 62 BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" 63 ;; 64 *) 65 BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" 66 ;; 67 esac 68 69 dnl Expose to Makefile 70 PHP_SUBST(SAPI_CGI_PATH) 71 PHP_SUBST(BUILD_CGI) 72 73 PHP_OUTPUT(sapi/cgi/php-cgi.1) 74else 75 AC_MSG_RESULT(no) 76fi 77