xref: /PHP-5.3/sapi/cgi/config9.m4 (revision 2bc631fb)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_ENABLE(cgi,,
6[  --disable-cgi           Disable building CGI version of PHP], yes, no)
7
8dnl
9dnl CGI setup
10dnl
11if test "$PHP_SAPI" = "default"; then
12  AC_MSG_CHECKING(whether to build CGI binary)
13  if test "$PHP_CGI" != "no"; then
14    AC_MSG_RESULT(yes)
15
16    AC_MSG_CHECKING([for socklen_t in sys/socket.h])
17    AC_EGREP_HEADER([socklen_t], [sys/socket.h],
18      [AC_MSG_RESULT([yes])
19       AC_DEFINE([HAVE_SOCKLEN_T], [1],
20        [Define if the socklen_t typedef is in sys/socket.h])],
21      AC_MSG_RESULT([no]))
22
23    AC_MSG_CHECKING([for sun_len in sys/un.h])
24    AC_EGREP_HEADER([sun_len], [sys/un.h],
25      [AC_MSG_RESULT([yes])
26       AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
27        [Define if sockaddr_un in sys/un.h contains a sun_len component])],
28      AC_MSG_RESULT([no]))
29
30    AC_MSG_CHECKING([whether cross-process locking is required by accept()])
31    case "`uname -sr`" in
32      IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0)
33        AC_MSG_RESULT([yes])
34        AC_DEFINE([USE_LOCKING], [1],
35          [Define if cross-process locking is required by accept()])
36      ;;
37      *)
38        AC_MSG_RESULT([no])
39      ;;
40    esac
41
42    PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
43
44    dnl Set filename
45    case $host_alias in
46      *cygwin* )
47        SAPI_CGI_PATH=sapi/cgi/php-cgi.exe
48        ;;
49      * )
50        SAPI_CGI_PATH=sapi/cgi/php-cgi
51        ;;
52    esac
53    PHP_SUBST(SAPI_CGI_PATH)
54
55    dnl Set install target and select SAPI
56    INSTALL_IT="@echo \"Installing PHP CGI binary: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php-cgi\$(program_suffix)\$(EXEEXT)"
57    PHP_SELECT_SAPI(cgi, program, cgi_main.c fastcgi.c,, '$(SAPI_CGI_PATH)')
58
59    case $host_alias in
60      *aix*)
61        BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_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_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
62        ;;
63      *darwin*)
64        BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
65      ;;
66      *)
67        BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
68      ;;
69    esac
70
71    PHP_SUBST(BUILD_CGI)
72
73  elif test "$PHP_CLI" != "no"; then
74    AC_MSG_RESULT(no)
75    OVERALL_TARGET=
76    PHP_SAPI=cli
77  else
78    AC_MSG_ERROR([No SAPIs selected.])
79  fi
80fi
81