xref: /PHP-5.5/sapi/cgi/config9.m4 (revision c940aab7)
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
11AC_MSG_CHECKING(for CGI build)
12if test "$PHP_CGI" != "no"; then
13    AC_MSG_RESULT(yes)
14    AC_MSG_CHECKING([for socklen_t in sys/socket.h])
15    AC_EGREP_HEADER([socklen_t], [sys/socket.h],
16      [AC_MSG_RESULT([yes])
17       AC_DEFINE([HAVE_SOCKLEN_T], [1],
18        [Define if the socklen_t typedef is in sys/socket.h])],
19      AC_MSG_RESULT([no]))
20
21    AC_MSG_CHECKING([for sun_len in sys/un.h])
22    AC_EGREP_HEADER([sun_len], [sys/un.h],
23      [AC_MSG_RESULT([yes])
24       AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
25        [Define if sockaddr_un in sys/un.h contains a sun_len component])],
26      AC_MSG_RESULT([no]))
27
28    AC_MSG_CHECKING([whether cross-process locking is required by accept()])
29    case "`uname -sr`" in
30      IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0)
31        AC_MSG_RESULT([yes])
32        AC_DEFINE([USE_LOCKING], [1],
33          [Define if cross-process locking is required by accept()])
34      ;;
35      *)
36        AC_MSG_RESULT([no])
37      ;;
38    esac
39
40    PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
41
42    dnl Set filename
43    case $host_alias in
44      *cygwin* )
45        SAPI_CGI_PATH=sapi/cgi/php-cgi.exe
46        ;;
47      * )
48        SAPI_CGI_PATH=sapi/cgi/php-cgi
49        ;;
50    esac
51
52    dnl Select SAPI
53    PHP_SELECT_SAPI(cgi, program, cgi_main.c fastcgi.c,, '$(SAPI_CGI_PATH)')
54
55    case $host_alias in
56      *aix*)
57        if test "$php_sapi_module" = "shared"; then
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/.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_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
59        else
60          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_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
61        fi
62        ;;
63      *darwin*)
64        BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CGI_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_BINARY_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
68      ;;
69    esac
70
71    dnl Expose to Makefile
72    PHP_SUBST(SAPI_CGI_PATH)
73    PHP_SUBST(BUILD_CGI)
74
75    PHP_OUTPUT(sapi/cgi/php-cgi.1)
76else
77  AC_MSG_RESULT(yes)
78fi
79