summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdin Kadribasic <edink@php.net>2002-01-20 02:30:18 +0000
committerEdin Kadribasic <edink@php.net>2002-01-20 02:30:18 +0000
commitf5790b0a7c1af118db4009dbbf89660bf5a2f097 (patch)
treeaf7a89d064009001fbd39c90c4a06ecbeb397a05
parent7de51385c26f434727c6da30dbae3d0abe58496e (diff)
downloadphp-git-f5790b0a7c1af118db4009dbbf89660bf5a2f097.tar.gz
Modified the build system to make certain extensions (pcntl, ncurses,
pcntl) only with cgi/cli sapi's. This was done by adding 3rd optional parameter to PHP_EXTENSION macro which should be set to "cli" if the extension only makes sense for that class of api's.
-rw-r--r--acinclude.m427
-rw-r--r--configure.in6
-rw-r--r--ext/ncurses/config.m45
-rw-r--r--ext/pcntl/config.m45
-rw-r--r--ext/readline/config.m412
-rw-r--r--main/Makefile.in17
-rw-r--r--sapi/cli/Makefile.in3
7 files changed, 51 insertions, 24 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index c4f9c26e6b..b2367cbc8f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -906,13 +906,14 @@ AC_DEFUN(PHP_AC_BROKEN_SPRINTF,[
])
dnl
-dnl PHP_EXTENSION(extname [, shared])
+dnl PHP_EXTENSION(extname [, shared [,sapi_class]])
dnl
dnl Includes an extension in the build.
dnl
dnl "extname" is the name of the ext/ subdir where the extension resides
dnl "shared" can be set to "shared" or "yes" to build the extension as
-dnl a dynamically loadable library.
+dnl a dynamically loadable library. Optional parameter "sapi_class" can
+dnl be set to "cli" to mark extension build only with CLI or CGI sapi's.
dnl
AC_DEFUN(PHP_EXTENSION,[
EXT_SUBDIRS="$EXT_SUBDIRS $1"
@@ -927,15 +928,29 @@ dnl ---------------------------------------------- External Module
ext_srcdir=$abs_srcdir
fi
- if test "$2" != "shared" && test "$2" != "yes"; then
+ if test "$2" != "shared" && test "$2" != "yes" && test "$3" != "cli"; then
dnl ---------------------------------------------- Static module
LIB_BUILD($ext_builddir)
EXT_LTLIBS="$EXT_LTLIBS $abs_builddir/$ext_builddir/lib$1.la"
EXT_STATIC="$EXT_STATIC $1"
- else
+ else
+ if test "$2" = "shared" || test "$2" = "yes"; then
dnl ---------------------------------------------- Shared module
- LIB_BUILD($ext_builddir,yes)
- AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module)
+ LIB_BUILD($ext_builddir,yes)
+ AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module)
+ fi
+ fi
+
+ if test "$2" != "shared" && test "$2" != "yes" && test "$3" = "cli"; then
+dnl ---------------------------------------------- CLI static module
+ LIB_BUILD($ext_builddir)
+ if test "$PHP_SAPI" = "cgi"; then
+ EXT_LTLIBS="$EXT_LTLIBS $abs_builddir/$ext_builddir/lib$1.la"
+ EXT_STATIC="$EXT_STATIC $1"
+ else
+ EXT_CLI_LTLIBS="$EXT_CLI_LTLIBS $abs_builddir/$ext_builddir/lib$1.la"
+ EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
+ fi
fi
PHP_FAST_OUTPUT($ext_builddir/Makefile)
diff --git a/configure.in b/configure.in
index 3f085e6e34..88dfe5df0f 100644
--- a/configure.in
+++ b/configure.in
@@ -850,6 +850,7 @@ PHP_SUBST(EXT_STATIC)
PHP_SUBST(EXT_SHARED)
PHP_SUBST(EXT_LIBS)
PHP_SUBST(EXT_LTLIBS)
+PHP_SUBST(EXT_CLI_LTLIBS)
PHP_SUBST_OLD(abs_builddir)
PHP_SUBST_OLD(abs_srcdir)
@@ -995,6 +996,11 @@ if test -n "\$REDO_ALL"; then
extensions="$EXT_STATIC"
dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
+
+ echo "creating main/internal_functions_cli.c"
+ cli_extensions="$EXT_STATIC $EXT_CLI_STATIC"
+ sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$cli_extensions > main/internal_functions_cli.c
+
dnl if cmp main/internal_functions.c.old main/internal_functions.c > /dev/null 2>&1; then
dnl echo "main/internal_functions.c is unchanged"
dnl mv main/internal_functions.c.old main/internal_functions.c
diff --git a/ext/ncurses/config.m4 b/ext/ncurses/config.m4
index 1cdda4fd0b..120d3bb449 100644
--- a/ext/ncurses/config.m4
+++ b/ext/ncurses/config.m4
@@ -3,10 +3,9 @@ dnl $Id$
dnl
PHP_ARG_WITH(ncurses, for ncurses support,
-[ --with-ncurses[=DIR] Include ncurses support.])
+[ --with-ncurses[=DIR] Include ncurses support (CLI/CGI only).])
if test "$PHP_NCURSES" != "no"; then
- PHP_CHECK_INTERACTIVE(ncurses)
# --with-ncurses -> check with-path
SEARCH_PATH="/usr/local /usr"
@@ -50,7 +49,7 @@ if test "$PHP_NCURSES" != "no"; then
AC_CHECK_LIB(ncurses, asume_default_colors, [AC_DEFINE(HAVE_NCURSES_ASSUME_DEFAULT_COLORS, 1, [ ])])
AC_CHECK_LIB(ncurses, use_extended_names, [AC_DEFINE(HAVE_NCURSES_USE_EXTENDED_NAMES, 1, [ ])])
- PHP_EXTENSION(ncurses, $ext_shared)
+ PHP_EXTENSION(ncurses, $ext_shared, cli)
PHP_SUBST(NCURSES_SHARED_LIBADD)
fi
diff --git a/ext/pcntl/config.m4 b/ext/pcntl/config.m4
index 94b4782585..648c107263 100644
--- a/ext/pcntl/config.m4
+++ b/ext/pcntl/config.m4
@@ -6,14 +6,13 @@ dnl Process Control (pcntl) extentsion --EXPERIMENTAL--
dnl TODO - Add platform checks
PHP_ARG_ENABLE(pcntl, whether to enable pcntl support,
-[ --enable-pcntl Enable experimental pcntl support (CGI ONLY!)])
+[ --enable-pcntl Enable experimental pcntl support (CLI/CGI only)])
if test "$PHP_PCNTL" != "no"; then
- PHP_CHECK_STANDALONE(pcntl)
AC_CHECK_FUNCS(fork, [ AC_DEFINE(HAVE_FORK,1,[ ]) ], [ AC_MSG_ERROR(pcntl: fork() not supported by this platform) ])
AC_CHECK_FUNCS(waitpid, [ AC_DEFINE(HAVE_WAITPID,1,[ ]) ], [ AC_MSG_ERROR(pcntl: fork() not supported by this platform) ])
AC_CHECK_FUNCS(sigaction, [ AC_DEFINE(HAVE_SIGACTION,1,[ ]) ], [ AC_MSG_ERROR(pcntl: sigaction() not supported by this platform) ])
- PHP_EXTENSION(pcntl, $ext_shared)
+ PHP_EXTENSION(pcntl, $ext_shared, cli)
fi
diff --git a/ext/readline/config.m4 b/ext/readline/config.m4
index 3d7e2c70ea..d179f82ffd 100644
--- a/ext/readline/config.m4
+++ b/ext/readline/config.m4
@@ -3,14 +3,10 @@ dnl $Id$
dnl
PHP_ARG_WITH(libedit,for libedit readline replacement,
-[ --with-libedit[=DIR] Include libedit readline replacement.])
+[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only).])
PHP_ARG_WITH(readline,for readline support,
-[ --with-readline[=DIR] Include readline support.])
-
-if test "$PHP_READLINE" != "no" -o "$PHP_LIBEDIT" != "no"; then
- PHP_CHECK_INTERACTIVE(readline)
-fi
+[ --with-readline[=DIR] Include readline support (CLI/CGI only).])
if test "$PHP_READLINE" != "no"; then
for i in /usr/local /usr $PHP_READLINE; do
@@ -55,7 +51,7 @@ if test "$PHP_READLINE" != "no"; then
PHP_SUBST(READLINE_SHARED_LIBADD)
AC_DEFINE(HAVE_LIBREADLINE, 1, [ ])
- PHP_EXTENSION(readline, $ext_shared)
+ PHP_EXTENSION(readline, $ext_shared, cli)
fi
if test "$PHP_LIBEDIT" != "no"; then
@@ -92,5 +88,5 @@ if test "$PHP_LIBEDIT" != "no"; then
PHP_SUBST(READLINE_SHARED_LIBADD)
AC_DEFINE(HAVE_LIBEDIT, 1, [ ])
- PHP_EXTENSION(readline, $ext_shared)
+ PHP_EXTENSION(readline, $ext_shared, cli)
fi
diff --git a/main/Makefile.in b/main/Makefile.in
index 6729b31f13..b59aa1333b 100644
--- a/main/Makefile.in
+++ b/main/Makefile.in
@@ -1,15 +1,26 @@
LTLIBRARY_NAME = libmain.la
-LTLIBRARY_SOURCES = \
- main.c internal_functions.c snprintf.c php_sprintf.c \
+LTLIBRARY_SOURCES_COMMON = \
+ main.c snprintf.c php_sprintf.c \
safe_mode.c fopen_wrappers.c alloca.c \
php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
streams.c network.c php_open_temporary_file.c php_logos.c \
output.c
-include $(top_srcdir)/build/ltlib.mk
+LTLIBRARY_SOURCES = $(LTLIBRARY_SOURCES_COMMON) internal_functions.c
+LTLIBRARY_CLI_NAME = libmain_cli.la
+LTLIBRARY_CLI_SOURCES = $(LTLIBRARY_SOURCES_COMMON) internal_functions_cli.c
+LTLIBRARY_CLI_OBJECTS = $(LTLIBRARY_CLI_SOURCES:.c=.lo) $(LTLIBRARY_CLI_OBJECTS_X)
+
+targets = $(LTLIBRARY_NAME) $(LTLIBRARY_CLI_NAME)
+
+include $(top_srcdir)/build/rules.mk
+include $(top_srcdir)/build/library.mk
+
+$(LTLIBRARY_CLI_NAME): $(LTLIBRARY_CLI_OBJECTS) $(LTLIBRARY_CLI_DEPENDENCIES)
+ $(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_CLI_OBJECTS) $(LTLIBRARY_CLI_LIBADD)
internal_functions.c: $(srcdir)/internal_functions.c.in $(top_builddir)/config.status
cd $(top_builddir) && \
diff --git a/sapi/cli/Makefile.in b/sapi/cli/Makefile.in
index 0a10b98860..a58aab9000 100644
--- a/sapi/cli/Makefile.in
+++ b/sapi/cli/Makefile.in
@@ -3,9 +3,10 @@ LTLIBRARY_SOURCES = php_cli.c getopt.c
LTLIBRARY_DEPENDENCIES = \
$(top_builddir)/Zend/libZend.la \
- $(top_builddir)/main/libmain.la \
+ $(top_builddir)/main/libmain_cli.la \
$(top_builddir)/$(REGEX_LIB) \
$(EXT_LTLIBS) \
+ $(EXT_CLI_LTLIBS) \
$(top_builddir)/$(TSRM_LIB)
LTLIBRARY_LDFLAGS = -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)