1PHP_ARG_ENABLE([cli], 2 [for CLI build], 3 [AS_HELP_STRING([--disable-cli], 4 [Disable building CLI version of PHP (this forces --without-pear)])], 5 [yes], 6 [no]) 7 8if test "$PHP_CLI" != "no"; then 9 AC_CHECK_FUNCS([setproctitle]) 10 11 AC_CHECK_HEADERS([sys/pstat.h]) 12 13 AC_CACHE_CHECK([for PS_STRINGS], [php_cv_var_PS_STRINGS], 14 [AC_LINK_IFELSE([AC_LANG_PROGRAM([ 15 #include <machine/vmparam.h> 16 #include <sys/exec.h> 17 ], 18 [ 19 PS_STRINGS->ps_nargvstr = 1; 20 PS_STRINGS->ps_argvstr = "foo"; 21 ])], 22 [php_cv_var_PS_STRINGS=yes], 23 [php_cv_var_PS_STRINGS=no])]) 24 AS_VAR_IF([php_cv_var_PS_STRINGS], [yes], 25 [AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS exists.])]) 26 27 PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/cli/Makefile.frag]) 28 29 dnl Set filename. 30 SAPI_CLI_PATH=sapi/cli/php 31 32 dnl Select SAPI. 33 PHP_SELECT_SAPI([cli], 34 [program], 35 [php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c], 36 [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1]) 37 38 AS_CASE([$host_alias], 39 [*aix*], [ 40 AS_VAR_IF([php_sapi_module], [shared], [ 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/.libs\/\1.o/g'\` | \$(AWK) '{ if (((\$\$2 == \"T\") || (\$\$2 == \"D\") || (\$\$2 == \"B\")) && (substr(\$\$3,1,1) != \".\")) { print \$\$3 } }' | sort -u >> php.sym && \$(LIBTOOL) --tag=CC --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 ], [ 43 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) --tag=CC --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)" 44 ]) 45 ], 46 [*darwin*], [ 47 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)" 48 ], [ 49 BUILD_CLI="\$(LIBTOOL) --tag=CC --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_CLI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)" 50 ]) 51 52 dnl Set executable for tests. 53 PHP_EXECUTABLE="\$(top_builddir)/\$(SAPI_CLI_PATH)" 54 55 PHP_SUBST([PHP_EXECUTABLE]) 56 PHP_SUBST([SAPI_CLI_PATH]) 57 PHP_SUBST([BUILD_CLI]) 58 59 AC_CONFIG_FILES([sapi/cli/php.1]) 60 61 PHP_INSTALL_HEADERS([sapi/cli], [cli.h]) 62fi 63