Skip to content

Commit

Permalink
MFH: - Made build system less major version dependant to ease MFB/MFH
Browse files Browse the repository at this point in the history
  • Loading branch information
Jani Taskinen committed Jul 26, 2007
1 parent 68b8235 commit 8684e74
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 50 deletions.
60 changes: 45 additions & 15 deletions Makefile.global
Expand Up @@ -13,22 +13,22 @@ all: $(all_targets)

build-modules: $(PHP_MODULES)

libphp5.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-@$(LIBTOOL) --silent --mode=install cp libphp5.la $(phptempdir)/libphp5.la >/dev/null 2>&1
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1

libs/libphp5.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp5.so
libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so

install: $(all_targets) $(install_targets)

install-sapi: $(OVERALL_TARGET)
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-@if test ! -r $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME); then \
-@if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
if test -r $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME); \
if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \
break; \
fi; \
done; \
Expand Down Expand Up @@ -66,11 +66,9 @@ install-headers:
fi \
done; \
fi

install-su: install-pear

PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1'
PHP_TEST_SHARED_EXTENSIONS = ` \
PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1'
PHP_TEST_SHARED_EXTENSIONS = ` \
if test "$(PHP_MODULES)"; then \
for i in $(PHP_MODULES); do \
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
Expand All @@ -82,7 +80,7 @@ test: all
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -d extension_dir=modules/ $(PHP_TEST_SHARED_EXTENSIONS) tests/; \
$(PHP_EXECUTABLE) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -U -d extension_dir=modules/ $(PHP_TEST_SHARED_EXTENSIONS) tests/; \
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
INI_FILE=`$(top_builddir)/$(SAPI_CLI_PATH) -r 'echo php_ini_loaded_file();'`; \
if test "$$INI_FILE"; then \
Expand All @@ -93,7 +91,39 @@ test: all
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
$(top_builddir)/$(SAPI_CLI_PATH) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -c $(top_builddir)/tmp-php.ini -U -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi

utest: all
-@if test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
INI_FILE=`$(top_builddir)/$(SAPI_CLI_PATH) -r 'echo php_ini_loaded_file();'`; \
if test "$$INI_FILE"; then \
$(EGREP) -v '^extension[\t\ ]*=' "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
else \
echo > $(top_builddir)/tmp-php.ini; \
fi; \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -c $(top_builddir)/tmp-php.ini -u -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi

ntest: all
-@if test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
INI_FILE=`$(top_builddir)/$(SAPI_CLI_PATH) -r 'echo php_ini_loaded_file();'`; \
if test "$$INI_FILE"; then \
$(EGREP) -v '^extension[\t\ ]*=' "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
else \
echo > $(top_builddir)/tmp-php.ini; \
fi; \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -c $(top_builddir)/tmp-php.ini -N -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
Expand All @@ -104,10 +134,10 @@ clean:
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp5.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*

distclean: clean
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php5.spec sapi/apache/libphp5.module buildmk.stamp
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php5.spec sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
find . -name Makefile | xargs rm -f

Expand Down
102 changes: 92 additions & 10 deletions acinclude.m4
Expand Up @@ -773,7 +773,7 @@ dnl PHP_BUILD_SHARED
dnl
AC_DEFUN([PHP_BUILD_SHARED],[
PHP_BUILD_PROGRAM
OVERALL_TARGET=libphp5.la
OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
php_build_target=shared
php_c_pre=$shared_c_pre
Expand All @@ -790,7 +790,7 @@ dnl PHP_BUILD_STATIC
dnl
AC_DEFUN([PHP_BUILD_STATIC],[
PHP_BUILD_PROGRAM
OVERALL_TARGET=libphp5.la
OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
php_build_target=static
])

Expand All @@ -799,7 +799,7 @@ dnl PHP_BUILD_BUNDLE
dnl
AC_DEFUN([PHP_BUILD_BUNDLE],[
PHP_BUILD_PROGRAM
OVERALL_TARGET=libs/libphp5.bundle
OVERALL_TARGET=libs/libphp[]$PHP_MAJOR_VERSION[.bundle]
php_build_target=static
])

Expand Down Expand Up @@ -1026,7 +1026,14 @@ dnl -------------------------------------------------------------------------
dnl Checks for structures, typedefs, broken functions, etc.
dnl -------------------------------------------------------------------------

dnl Internal helper macro
dnl Internal helper macros
dnl
dnl _PHP_DEF_HAVE_FILE(what, filename)
AC_DEFUN([_PHP_DEF_HAVE_FILE], [
php_def_have_what=HAVE_[]`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_' `
echo "#define $php_def_have_what 1" >> $2
])
dnl
dnl _PHP_CHECK_SIZEOF(type, cross-value, extra-headers [, found-action [, not-found-action]])
dnl
AC_DEFUN([_PHP_CHECK_SIZEOF], [
Expand Down Expand Up @@ -1084,6 +1091,21 @@ AC_DEFUN(PHP_CHECK_SIZEOF, [
AC_MSG_RESULT([[$][php_cv_sizeof_]translit($1, ,_)])
])

dnl
dnl PHP_CHECK_TYPES(type-list, include-file [, extra-headers])
dnl
AC_DEFUN([PHP_CHECK_TYPES], [
for php_typename in $1; do
AC_MSG_CHECKING([whether $php_typename exists])
_PHP_CHECK_SIZEOF($php_typename, 0, $3, [
_PHP_DEF_HAVE_FILE($php_typename, $2)
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
done
])

dnl
dnl PHP_CHECK_IN_ADDR_T
dnl
Expand Down Expand Up @@ -2062,11 +2084,14 @@ dnl
dnl Search for (f)lex and check it's version
dnl
AC_DEFUN([PHP_PROG_LEX], [
# we only support certain flex versions
dnl we only support certain flex versions
flex_version_list="2.5.4"
AC_PROG_LEX
if test "$LEX" = "flex"; then
dnl AC_DECL_YYTEXT is obsolete since autoconf 2.50 and merged into AC_PROG_LEX
dnl this is what causes that annoying "PHP_PROG_LEX is expanded from" warning with autoconf 2.50+
dnl it should be removed once we drop support of autoconf 2.13 (if ever)
AC_DECL_YYTEXT
:
fi
Expand Down Expand Up @@ -2120,17 +2145,17 @@ AC_DEFUN([PHP_PROG_RE2C],[
AC_CHECK_PROG(RE2C, re2c, re2c)
if test -n "$RE2C"; then
AC_CACHE_CHECK([for re2c version], php_cv_re2c_version, [
re2c_vernum=`echo "" | re2c --vernum 2>/dev/null`
if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "911"; then
re2c_vernum=`re2c --vernum 2>/dev/null`
if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "1200"; then
php_cv_re2c_version=invalid
else
php_cv_re2c_version="`echo "" | re2c --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
php_cv_re2c_version="`re2c --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
fi
])
fi
case $php_cv_re2c_version in
""|invalid[)]
AC_MSG_WARN([You will need re2c 0.9.11 or later if you want to regenerate PHP parsers.])
AC_MSG_WARN([You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.])
RE2C="exit 0;"
;;
esac
Expand All @@ -2141,6 +2166,57 @@ dnl -------------------------------------------------------------------------
dnl Common setup macros: PHP_SETUP_<what>
dnl -------------------------------------------------------------------------

dnl
dnl PHP_SETUP_ICU([shared-add])
dnl
dnl Common setup macro for ICU
dnl
AC_DEFUN([PHP_SETUP_ICU],[
PHP_ARG_WITH(icu-dir,,
[ --with-icu-dir=DIR Specify where ICU libraries and headers can be found], DEFAULT, no)
if test "$PHP_ICU_DIR" = "no"; then
PHP_ICU_DIR=DEFAULT
fi
if test "$PHP_ICU_DIR" = "DEFAULT"; then
dnl Try to find icu-config
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
else
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
fi
AC_MSG_CHECKING([for location of ICU headers and libraries])
dnl Trust icu-config to know better what the install prefix is..
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
if test "$?" != "0" || test -z "$icu_install_prefix"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
else
AC_MSG_RESULT([$icu_install_prefix])
dnl Check ICU version
AC_MSG_CHECKING([for ICU 3.4 or greater])
icu_version_full=`$ICU_CONFIG --version`
ac_IFS=$IFS
IFS="."
set $icu_version_full
IFS=$ac_IFS
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
if test "$icu_version" -lt "3004"; then
AC_MSG_ERROR([ICU version 3.4 or later is required])
fi
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
PHP_EVAL_INCLINE($ICU_INCS)
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
fi
])

dnl
dnl PHP_SETUP_KERBEROS(shared-add [, action-found [, action-not-found]])
dnl
Expand Down Expand Up @@ -2620,11 +2696,17 @@ AC_DEFUN([PHP_CHECK_CONFIGURE_OPTIONS],[
with-tsrm-pth | with-tsrm-st | with-tsrm-pthreads[)];;
# Allow certain Zend options
with-zend-vm | enable-maintainer-zts | enable-inline-optimization | enable-zend-multibyte[)];;
with-zend-vm | enable-maintainer-zts | enable-inline-optimization[)];;
# All the rest must be set using the PHP_ARG_* macros
# PHP_ARG_* macros set php_enable_<arg_name> or php_with_<arg_name>
*[)]
# Options that exist before PHP 6
if test "$PHP_MAJOR_VERSION" -lt "6"; then
case $arg_name in
enable-zend-multibyte[)] continue;;
esac
fi
is_arg_set=php_[]`echo [$]arg_name | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-' 'abcdefghijklmnopqrstuvwxyz_'`
if eval test -z "\$$is_arg_set"; then
PHP_UNKNOWN_CONFIGURE_OPTIONS="$PHP_UNKNOWN_CONFIGURE_OPTIONS
Expand Down
4 changes: 2 additions & 2 deletions buildconf
@@ -1,8 +1,8 @@
#!/bin/sh
# $Id$

eval `grep '^EXTRA_VERSION=' configure.in`
case "$EXTRA_VERSION" in
eval `grep '^PHP_EXTRA_VERSION=' configure.in`
case "$PHP_EXTRA_VERSION" in
*-dev)
dev=1
;;
Expand Down
34 changes: 20 additions & 14 deletions configure.in
Expand Up @@ -39,12 +39,18 @@ PHP_CANONICAL_HOST_TARGET

AC_CONFIG_HEADER(main/php_config.h)

MAJOR_VERSION=5
MINOR_VERSION=2
RELEASE_VERSION=4
EXTRA_VERSION="-dev"
PHP_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]MAJOR_VERSION \* 10000 + [$]MINOR_VERSION \* 100 + [$]RELEASE_VERSION`
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=2
PHP_RELEASE_VERSION=4
PHP_EXTRA_VERSION="-dev"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`

dnl Allow version values to be used in Makefile
PHP_SUBST(PHP_MAJOR_VERSION)
PHP_SUBST(PHP_MINOR_VERSION)
PHP_SUBST(PHP_RELEASE_VERSION)
PHP_SUBST(PHP_EXTRA_VERSION)

dnl Define where extension directories are located in the configure context
AC_DEFUN([PHP_EXT_BUILDDIR],[ext/$1])dnl
Expand All @@ -57,10 +63,10 @@ dnl -------------------------------------------------------------------------

echo "/* automatically generated by configure */" > php_version.h.new
echo "/* edit configure.in to change version number */" >> php_version.h.new
echo "#define PHP_MAJOR_VERSION $MAJOR_VERSION" >> php_version.h.new
echo "#define PHP_MINOR_VERSION $MINOR_VERSION" >> php_version.h.new
echo "#define PHP_RELEASE_VERSION $RELEASE_VERSION" >> php_version.h.new
echo "#define PHP_EXTRA_VERSION \"$EXTRA_VERSION\"" >> php_version.h.new
echo "#define PHP_MAJOR_VERSION $PHP_MAJOR_VERSION" >> php_version.h.new
echo "#define PHP_MINOR_VERSION $PHP_MINOR_VERSION" >> php_version.h.new
echo "#define PHP_RELEASE_VERSION $PHP_RELEASE_VERSION" >> php_version.h.new
echo "#define PHP_EXTRA_VERSION \"$PHP_EXTRA_VERSION\"" >> php_version.h.new
echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
echo "#define PHP_VERSION_ID $PHP_VERSION_ID" >> php_version.h.new
cmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1
Expand Down Expand Up @@ -188,7 +194,7 @@ case $host_alias in
PHP_ADD_SOURCES(/main, internal_functions.c,,PHP_GLOBAL_OBJS)
PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS, PHP_GLOBAL_OBJS)
PHP5LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\)
EXTENSION_DIR=sys:/php$MAJOR_VERSION/ext
EXTENSION_DIR=sys:/php$PHP_MAJOR_VERSION/ext
PHP_SUBST(PHP5LIB_SHARED_LIBADD)
PHP_SHARED_MODULE(php5lib, PHP_GLOBAL_OBJS, netware)
;;
Expand Down Expand Up @@ -240,9 +246,9 @@ dnl SAPI configuration.
dnl -------------------------------------------------------------------------

dnl paths to the targets are relative to the build directory
SAPI_SHARED=libs/libphp5.$SHLIB_DL_SUFFIX_NAME
SAPI_STATIC=libs/libphp5.a
SAPI_LIBTOOL=libphp5.la
SAPI_SHARED=libs/libphp[]$PHP_MAJOR_VERSION[.]$SHLIB_DL_SUFFIX_NAME
SAPI_STATIC=libs/libphp[]$PHP_MAJOR_VERSION[.a]
SAPI_LIBTOOL=libphp[]$PHP_MAJOR_VERSION[.la]

PHP_CONFIGURE_PART(Configuring SAPI modules)

Expand Down
10 changes: 6 additions & 4 deletions run-tests.php
Expand Up @@ -401,12 +401,14 @@ function write_information($show_html)
case '--version':
echo '$Revision$'."\n";
exit(1);

case 'u':
case 'U':
// Allow using u or U for forward compatibility
break;

default:
echo "Illegal switch '$switch' specified!\n";
if ($switch == 'u' || $switch == 'U') {
break;
}
// break
case 'h':
case '-help':
case '--help':
Expand Down

0 comments on commit 8684e74

Please sign in to comment.