1dnl config.m4 for sapi cli 2 3PHP_ARG_ENABLE(cli,, 4[ --disable-cli Disable building CLI version of PHP 5 (this forces --without-pear)], yes, no) 6 7AC_CHECK_FUNCS(setproctitle) 8 9AC_CHECK_HEADERS([sys/pstat.h]) 10 11AC_CACHE_CHECK([for PS_STRINGS], [cli_cv_var_PS_STRINGS], 12[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <machine/vmparam.h> 13#include <sys/exec.h> 14]], 15[[PS_STRINGS->ps_nargvstr = 1; 16PS_STRINGS->ps_argvstr = "foo";]])], 17[cli_cv_var_PS_STRINGS=yes], 18[cli_cv_var_PS_STRINGS=no])]) 19if test "$cli_cv_var_PS_STRINGS" = yes ; then 20 AC_DEFINE([HAVE_PS_STRINGS], [], [Define to 1 if the PS_STRINGS thing exists.]) 21fi 22 23AC_MSG_CHECKING(for CLI build) 24if test "$PHP_CLI" != "no"; then 25 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cli/Makefile.frag) 26 27 dnl Set filename 28 SAPI_CLI_PATH=sapi/cli/php 29 30 dnl Select SAPI 31 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)') 32 33 case $host_alias in 34 *aix*) 35 if test "$php_sapi_module" = "shared"; then 36 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)" 37 else 38 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)" 39 fi 40 ;; 41 *darwin*) 42 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)" 43 ;; 44 *) 45 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)" 46 ;; 47 esac 48 49 dnl Set executable for tests 50 PHP_EXECUTABLE="\$(top_builddir)/\$(SAPI_CLI_PATH)" 51 PHP_SUBST(PHP_EXECUTABLE) 52 53 dnl Expose to Makefile 54 PHP_SUBST(SAPI_CLI_PATH) 55 PHP_SUBST(BUILD_CLI) 56 57 PHP_OUTPUT(sapi/cli/php.1) 58 59 PHP_INSTALL_HEADERS([sapi/cli/cli.h]) 60fi 61AC_MSG_RESULT($PHP_CLI) 62