xref: /PHP-8.1/sapi/cgi/config9.m4 (revision b64a1822)
1PHP_ARG_ENABLE([cgi],,
2  [AS_HELP_STRING([--disable-cgi],
3    [Disable building CGI version of PHP])],
4  [yes],
5  [no])
6
7dnl CGI setup.
8AC_MSG_CHECKING(for CGI build)
9if test "$PHP_CGI" != "no"; then
10    AC_MSG_RESULT(yes)
11
12    AC_MSG_CHECKING([for sun_len in sys/un.h])
13    AC_EGREP_HEADER([sun_len], [sys/un.h],
14      [AC_MSG_RESULT([yes])
15       AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
16        [Define if sockaddr_un in sys/un.h contains a sun_len component])],
17      AC_MSG_RESULT([no]))
18
19    AC_MSG_CHECKING([whether cross-process locking is required by accept()])
20    case "`uname -sr`" in
21      IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0)
22        AC_MSG_RESULT([yes])
23        AC_DEFINE([USE_LOCKING], [1],
24          [Define if cross-process locking is required by accept()])
25      ;;
26      *)
27        AC_MSG_RESULT([no])
28      ;;
29    esac
30
31    PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
32
33    dnl Set filename.
34    case $host_alias in
35      *cygwin* )
36        SAPI_CGI_PATH=sapi/cgi/php-cgi.exe
37        ;;
38      * )
39        SAPI_CGI_PATH=sapi/cgi/php-cgi
40        ;;
41    esac
42
43    dnl Select SAPI.
44    PHP_SELECT_SAPI(cgi, program, cgi_main.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, '$(SAPI_CGI_PATH)')
45
46    case $host_alias in
47      *aix*)
48        if test "$php_sapi_module" = "shared"; then
49          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)"
50        else
51          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)"
52        fi
53        ;;
54      *darwin*)
55        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)"
56      ;;
57      *)
58        BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
59      ;;
60    esac
61
62    dnl Expose to Makefile.
63    PHP_SUBST(SAPI_CGI_PATH)
64    PHP_SUBST(BUILD_CGI)
65
66    PHP_OUTPUT(sapi/cgi/php-cgi.1)
67else
68  AC_MSG_RESULT(no)
69fi
70