1dnl 2dnl $Id$ 3dnl 4 5PHP_ARG_ENABLE(cli,, 6[ --disable-cli Disable building CLI version of PHP 7 (this forces --without-pear)], yes, no) 8 9AC_CHECK_FUNCS(setproctitle) 10 11AC_CHECK_HEADERS([sys/pstat.h]) 12 13AC_CACHE_CHECK([for PS_STRINGS], [cli_cv_var_PS_STRINGS], 14[AC_TRY_LINK( 15[#include <machine/vmparam.h> 16#include <sys/exec.h> 17], 18[PS_STRINGS->ps_nargvstr = 1; 19PS_STRINGS->ps_argvstr = "foo";], 20[cli_cv_var_PS_STRINGS=yes], 21[cli_cv_var_PS_STRINGS=no])]) 22if test "$cli_cv_var_PS_STRINGS" = yes ; then 23 AC_DEFINE([HAVE_PS_STRINGS], [], [Define to 1 if the PS_STRINGS thing exists.]) 24fi 25 26AC_MSG_CHECKING(for CLI build) 27if test "$PHP_CLI" != "no"; then 28 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cli/Makefile.frag) 29 30 dnl Set filename 31 SAPI_CLI_PATH=sapi/cli/php 32 33 dnl Select SAPI 34 PHP_SELECT_SAPI(cli, program, php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, '$(SAPI_CLI_PATH)') 35 36 case $host_alias in 37 *aix*) 38 if test "$php_sapi_module" = "shared"; then 39 BUILD_CLI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_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_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)" 40 else 41 BUILD_CLI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_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_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)" 42 fi 43 ;; 44 *darwin*) 45 BUILD_CLI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)" 46 ;; 47 *netware*) 48 BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -Lnetware -lphp7lib -o \$(SAPI_CLI_PATH)" 49 ;; 50 *) 51 BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)" 52 ;; 53 esac 54 55 dnl Set executable for tests 56 PHP_EXECUTABLE="\$(top_builddir)/\$(SAPI_CLI_PATH)" 57 PHP_SUBST(PHP_EXECUTABLE) 58 59 dnl Expose to Makefile 60 PHP_SUBST(SAPI_CLI_PATH) 61 PHP_SUBST(BUILD_CLI) 62 63 PHP_OUTPUT(sapi/cli/php.1) 64 65 PHP_INSTALL_HEADERS([sapi/cli/cli.h]) 66fi 67AC_MSG_RESULT($PHP_CLI) 68