> > > If you try to compile --with-pcntl now, and you use
> > > --with-apxs, the ./configure process tries to be smart and
> > > bails out, saying that pcntl does not work with apache sapi.
> > >
> > > Seems we need some more smart changes to the build process.
> >
> > This is bit dirty, but if you apply this patch it would enable any
extension
> > that has PHP_EXTENSION(ext_name, $ext_shared, cli) in their config.m4 to
be
> > linked only with the cli executable. The patch also modifies
> > ext/pcntl/config.m4 to make use of this.
>
> Why dirty?
I had a problem with building two version of main/libmain.la. The attached
patch against the current CVS solves it in IMHO more elegant way.
I would appreciate any feedback/comments on the proposal before I go ahead
with it.
Edin
Index: acinclude.m4
===================================================================
RCS file: /repository/php4/acinclude.m4,v
retrieving revision 1.149
diff -u -3 -p -r1.149 acinclude.m4
--- acinclude.m4 13 Jan 2002 23:51:56 -0000 1.149
+++ acinclude.m4 14 Jan 2002 01:25:31 -0000
@@ -1,4 +1,4 @@
-dnl $Id: acinclude.m4,v 1.149 2002/01/13 23:51:56 edink Exp $
+dnl $Id: acinclude.m4,v 1.148 2002/01/12 14:51:54 edink Exp $
dnl
dnl This file contains local autoconf functions.
@@ -927,15 +927,29 @@ dnl ------------------------------------
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"; 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 "$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_LTLIBS $abs_builddir/$ext_builddir/lib$1.la"
+ EXT_CLI_STATIC="$EXT_STATIC $1"
+ fi
fi
PHP_FAST_OUTPUT($ext_builddir/Makefile)
Index: configure.in
===================================================================
RCS file: /repository/php4/configure.in,v
retrieving revision 1.289
diff -u -3 -p -r1.289 configure.in
--- configure.in 12 Jan 2002 14:51:54 -0000 1.289
+++ configure.in 14 Jan 2002 01:25:31 -0000
@@ -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"
+ extensions="$EXT_STATIC $EXT_CLI_STATIC"
+ sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir
+"$EXTRA_MODULE_PTRS" $AWK \$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
Index: ext/pcntl/config.m4
===================================================================
RCS file: /repository/php4/ext/pcntl/config.m4,v
retrieving revision 1.5
diff -u -3 -p -r1.5 config.m4
--- ext/pcntl/config.m4 4 Jan 2002 14:08:50 -0000 1.5
+++ ext/pcntl/config.m4 14 Jan 2002 01:25:34 -0000
@@ -9,11 +9,10 @@ PHP_ARG_ENABLE(pcntl, whether to enable
[ --enable-pcntl Enable experimental pcntl support (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
Index: main/Makefile.in
===================================================================
RCS file: /repository/php4/main/Makefile.in,v
retrieving revision 1.15
diff -u -3 -p -r1.15 Makefile.in
--- main/Makefile.in 20 Jul 2001 15:06:51 -0000 1.15
+++ main/Makefile.in 14 Jan 2002 01:25:43 -0000
@@ -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) && \
Index: sapi/cli/Makefile.in
===================================================================
RCS file: /repository/php4/sapi/cli/Makefile.in,v
retrieving revision 1.5
diff -u -3 -p -r1.5 Makefile.in
--- sapi/cli/Makefile.in 13 Jan 2002 23:51:56 -0000 1.5
+++ sapi/cli/Makefile.in 14 Jan 2002 01:25:49 -0000
@@ -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)
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]