Skip to content

Commit

Permalink
* expanded the following constants and made them available in PHP:
Browse files Browse the repository at this point in the history
  DEFAULT_INCLUDE_PATH
  PEAR_INSTALL_DIR
  PHP_EXTENSION_DIR
  PHP_BINDIR
  PHP_LIBDIR
  PHP_DATADIR
  PHP_SYSCONFDIR
  PHP_LOCALSTATEDIR
  PHP_CONFIG_FILE_PATH
* no longer generating pear/PEAR.php
* fixed some tests
* some more installer work
  • Loading branch information
stigsb committed Apr 22, 2001
1 parent 9dd0231 commit 2cf1b8d
Show file tree
Hide file tree
Showing 13 changed files with 357 additions and 110 deletions.
8 changes: 7 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ install-modules:
rm -f modules/*.la && \
cp modules/* $(INSTALL_ROOT)$(moduledir) >/dev/null 2>&1 || true

install-su: install-modules
install-tester:
-$(mkinstalldirs) $(datadir)
$(INSTALL) -m 755 $(srcdir)/run-tests.php $(INSTALL_ROOT)$(datadir)

install-pear: install-modules
(cd pear && $(MAKE) install)

install-su: install-pear install-tester

.NOEXPORT:
115 changes: 73 additions & 42 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -461,24 +461,10 @@ fi
divert(4)
PHP_ARG_WITH(config-file-path,whether to use a configuration file,
PHP_ARG_WITH(config-file-path,[path to configuration file],
[ --with-config-file-path=PATH
Sets the path in which to look for php.ini.
defaults to /usr/local/lib], yes)
if test "$PHP_CONFIG_FILE_PATH" = "yes"; then
PHP_CONFIG_FILE_PATH="/usr/local/lib"
fi
if test "$PHP_CONFIG_FILE_PATH" != "no"; then
AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "$PHP_CONFIG_FILE_PATH",[ ])
AC_DEFINE(USE_CONFIG_FILE, 1, [ ])
else
AC_DEFINE(CONFIGURATION_FILE_PATH, 0, [ ])
AC_DEFINE(USE_CONFIG_FILE, 0, [ ])
fi
defaults to --sysconfdir, "none" to disable], $sysconfdir)
PHP_ARG_ENABLE(debug, whether to include debugging symbols,
[ --enable-debug Compile with debugging symbols.], no)
Expand Down Expand Up @@ -525,6 +511,20 @@ AC_ARG_WITH(exec-dir,
AC_MSG_RESULT(/usr/local/php/bin)
])
# compatibility
if test "x$with_pear" = "x" -a "x$enable_pear" = "xno"; then
with_pear="no"
fi
PHP_ARG_WITH(pear, [whether to install PEAR, and where],
[ --with-pear=DIR Install PEAR in DIR (default \$datadir/php/pear)
--without-pear Do not install PEAR], $datadir/php/pear)
if test "$PHP_PEAR" != "no"; then
PEAR_DIR=pear
PEAR_INSTALLDIR="$PHP_PEAR"
fi
PHP_ARG_WITH(openssl,for OpenSSL support,
[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ])
if test "$PHP_OPENSSL" = "yes"; then
Expand Down Expand Up @@ -592,13 +592,6 @@ if test "$PHP_DMALLOC" = "yes"; then
CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
fi
PHP_ARG_ENABLE(pear,whether to install PEAR,
[ --disable-pear Do not install PEAR],yes)
if test "$PHP_PEAR" = "yes"; then
PEAR_DIR=pear
fi
# temporary until streams are better integrated
PHP_ARG_ENABLE(php-streams,whether to enable php streams,
[ --enable-php-streams Include experimental php streams.
Expand Down Expand Up @@ -703,31 +696,67 @@ $php_shtool mkdir -p $phplibdir
phptempdir="`pwd`/libs"
test "$prefix" = "NONE" && prefix="/usr/local"
test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
case $libdir in
*/php) ;;
*) libdir="$libdir/php";;
esac
case $datadir in
*/php) ;;
*) datadir="$datadir/php";;
esac
dnl Build extension directory path
if test "$PHP_DEBUG" = "1"; then
PART1=debug
else
PART1=no-debug
fi
if test "$enable_experimental_zts" = "yes"; then
PART2=zts
else
PART2=non-zts
fi
ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO //'`
if test -z "$PEAR_INSTALLDIR"; then
PEAR_INSTALLDIR="$prefix/lib/php"
fi
extbasedir="$ZEND_MODULE_API_NO"
EXTENSION_DIR="${PEAR_INSTALLDIR}/extensions/$PART1-$PART2-$ZEND_MODULE_API_NO"
if test "$enable_experimental_zts" = "yes"; then
extbasedir="${extbasedir}-zts"
fi
INCLUDE_PATH=".:${PEAR_INSTALLDIR}"
if test "$PHP_DEBUG" = "1"; then
extbasedir="${extbasedir}-debug"
fi
if test "x$PEAR_INSTALLDIR" = "x"; then
PEAR_INSTALLDIR="$datadir/pear"
fi
if test "x$EXTENSION_DIR" = "x"; then
EXTENSION_DIR="$libdir/$extbasedir"
fi
old_exec_prefix="$exec_prefix"
old_libdir="$libdir"
old_datadir="$datadir"
exec_prefix=`eval echo $exec_prefix`
libdir=`eval echo $libdir`
datadir=`eval echo $datadir`
EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
EXPANDED_BINDIR=`eval echo $bindir`
EXPANDED_LIBDIR="$libdir"
EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
EXPANDED_DATADIR="$datadir"
EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
INCLUDE_PATH=".:${EXPANDED_PEAR_INSTALLDIR}"
exec_prefix="$old_exec_prefix"
libdir="$old_libdir"
datadir="$old_datadir"
AC_SUBST(INCLUDE_PATH)
AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
AC_SUBST(EXPANDED_EXTENSION_DIR)
AC_SUBST(EXPANDED_BINDIR)
AC_SUBST(EXPANDED_LIBDIR)
AC_SUBST(EXPANDED_DATADIR)
AC_SUBST(EXPANDED_SYSCONFDIR)
AC_SUBST(EXPANDED_LOCALSTATEDIR)
AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
PHP_BUILD_RPATH
Expand All @@ -752,6 +781,8 @@ PHP_SUBST(phplibdir)
PHP_SUBST(phptempdir)
PHP_SUBST(prefix)
PHP_SUBST(localstatedir)
PHP_SUBST(datadir)
PHP_SUBST(sysconfdir)
PHP_SUBST(AWK)
PHP_SUBST(CC)
Expand Down Expand Up @@ -856,7 +887,7 @@ PHP_GEN_CONFIG_VARS
$php_shtool mkdir -p pear/scripts
ALL_OUTPUT_FILES="php4.spec Zend/Makefile main/build-defs.h \
pear/scripts/pear pear/scripts/phpize pear/scripts/php-config pear/PEAR.php \
pear/scripts/pear pear/scripts/phpize pear/scripts/php-config \
TSRM/Makefile $PHP_OUTPUT_FILES"
AC_OUTPUT($ALL_OUTPUT_FILES, [], [
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ PHPAPI void php_print_info(int flag)
php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
#endif

php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:CONFIGURATION_FILE_PATH);
php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:PHP_CONFIG_FILE_PATH);

#if ZEND_DEBUG
php_info_print_table_row(2, "ZEND_DEBUG", "enabled" );
Expand Down
1 change: 1 addition & 0 deletions footer
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/
13 changes: 8 additions & 5 deletions main/build-defs.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define PHP_FHTTPD_INCLUDE ""
#define PHP_FHTTPD_LIB ""
#define PHP_FHTTPD_TARGET ""
#define PHP_BINNAME "@BINNAME@"
#define PHP_CFLAGS "@CFLAGS@"
#define PHP_DBASE_LIB ""
#define PHP_BUILD_DEBUG "@DEBUG_CFLAGS@"
Expand All @@ -50,9 +49,6 @@
#define PHP_MYSQL_LFLAGS ""
#define PHP_MYSQL_LIBS ""
#define PHP_ODBC_TYPE "@ODBC_TYPE@"
#define PHP_ODBC_INCLUDE "@ODBC_INCLUDE@"
#define PHP_ODBC_LFLAGS "@ODBC_LFLAGS@"
#define PHP_ODBC_LIBS "@ODBC_LIBS@"
#define PHP_OCI8_SHARED_LIBADD "@OCI8_SHARED_LIBADD@"
#define PHP_OCI8_DIR "@OCI8_DIR@"
#define PHP_OCI8_VERSION "@OCI8_VERSION@"
Expand All @@ -78,5 +74,12 @@
#define PHP_LDAP_LIBS ""
#define PHP_VELOCIS_INCLUDE ""
#define PHP_VELOCIS_LIBS ""
#define PHP_EXTENSION_DIR "@EXTENSION_DIR@"
#define PEAR_INSTALLDIR "@EXPANDED_PEAR_INSTALLDIR@"
#define PHP_INCLUDE_PATH "@INCLUDE_PATH@"
#define PHP_EXTENSION_DIR "@EXPANDED_EXTENSION_DIR@"
#define PHP_BINDIR "@EXPANDED_BINDIR@"
#define PHP_LIBDIR "@EXPANDED_LIBDIR@"
#define PHP_DATADIR "@EXPANDED_DATADIR@"
#define PHP_SYSCONFDIR "@EXPANDED_SYSCONFDIR@"
#define PHP_LOCALSTATEDIR "@EXPANDED_LOCALSTATEDIR@"
#define PHP_CONFIG_FILE_PATH "@EXPANDED_PHP_CONFIG_FILE_PATH@"
9 changes: 9 additions & 0 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,15 @@ int php_module_startup(sapi_module_struct *sf)

REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH", PHP_INCLUDE_PATH, sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PEAR_INSTALL_DIR", PEAR_INSTALLDIR, sizeof(PEAR_INSTALLDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTENSION_DIR", PHP_EXTENSION_DIR, sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINDIR", PHP_BINDIR, sizeof(PHP_BINDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_LIBDIR", PHP_LIBDIR, sizeof(PHP_LIBDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_DATADIR", PHP_DATADIR, sizeof(PHP_DATADIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SYSCONFDIR", PHP_SYSCONFDIR, sizeof(PHP_SYSCONFDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_LOCALSTATEDIR", PHP_LOCALSTATEDIR, sizeof(PHP_LOCALSTATEDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | CONST_CS);
php_output_register_constants();

if (php_startup_ticks(PLS_C) == FAILURE) {
Expand Down
12 changes: 10 additions & 2 deletions main/php_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@


#include "php.h"
#include "build-defs.h"
#include "ext/standard/info.h"
#include "zend_ini.h"
#include "php_ini.h"
#include "ext/standard/dl.h"
#include "zend_extensions.h"


typedef struct _php_extension_lists {
zend_llist engine;
zend_llist functions;
Expand Down Expand Up @@ -210,7 +210,7 @@ int php_init_config(char *php_ini_path_override)
}
free_default_location=1;
#else
default_location = CONFIGURATION_FILE_PATH;
default_location = PHP_CONFIG_FILE_PATH;
free_default_location=0;
#endif
php_ini_search_path = (char *) emalloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
Expand Down Expand Up @@ -332,3 +332,11 @@ PHPAPI int cfg_get_string(char *varname, char **result)
*result = tmp->value.str.val;
return SUCCESS;
}

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/
12 changes: 5 additions & 7 deletions pear/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,18 @@ PEAR_FILES = \
Net/SMTP.php \
Net/Socket.php \
Numbers/Roman.php \
PEAR.php \
PEAR/Common.php \
PEAR/Installer.php \
PEAR/Packager.php \
PEAR/Updater.php \
Payment/Verisign.php \
Schedule/At.php \
XML/Parser.php \
XML/RPC.php \
XML/RPC/Server.php

install-data-local: PEAR.php
install-data-local:
@if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
for i in $(PEAR_SUBDIRS); do \
(set -x;$(mkinstalldirs) $(INSTALL_ROOT)$(peardir)/$$i); \
Expand All @@ -110,9 +114,6 @@ install-data-local: PEAR.php
dir=`echo $$i|sed 's%[^/][^/]*$$%%'`; \
(set -x;$(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(peardir)/$$dir); \
done; \
for i in PEAR.php; do \
(set -x;$(INSTALL_DATA) $$i $(INSTALL_ROOT)$(peardir)); \
done; \
else \
cat $(srcdir)/install-pear.txt; \
exit 5; \
Expand Down Expand Up @@ -183,6 +184,3 @@ scripts/phpize: scripts/phpize.in $(top_builddir)/config.status

scripts/php-config: scripts/php-config.in $(top_builddir)/config.status
(cd ..;CONFIG_FILES=pear/scripts/php-config CONFIG_HEADERS= $(top_builddir)/config.status)

PEAR.php: PEAR.php.in $(top_builddir)/config.status
(cd ..;CONFIG_FILES=pear/PEAR.php CONFIG_HEADERS= $(top_builddir)/config.status)
20 changes: 4 additions & 16 deletions pear/PEAR.php.in → pear/PEAR.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
define('PEAR_ERROR_DIE', 8);
define('PEAR_ERROR_CALLBACK', 16);

define('PHP_BINDIR', '@prefix@/bin');
define('PEAR_INSTALL_DIR', '@PEAR_INSTALLDIR@');
define('PEAR_EXTENSION_DIR', '@EXTENSION_DIR@');

if (substr(PHP_OS, 0, 3) == 'WIN') {
define('OS_WINDOWS', true);
define('OS_UNIX', false);
Expand All @@ -40,18 +36,10 @@
define('PEAR_OS', 'Unix'); // blatant assumption
}

if (!defined("DIRECTORY_SEPARATOR")) {
if (OS_WINDOWS) {
define("DIRECTORY_SEPARATOR", "\\");
} else {
define("DIRECTORY_SEPARATOR", "/");
}
}

$_PEAR_default_error_mode = PEAR_ERROR_RETURN;
$_PEAR_default_error_options = E_USER_NOTICE;
$_PEAR_default_error_callback = '';
$_PEAR_destructor_object_list = array();
$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
$GLOBALS['_PEAR_default_error_callback'] = '';
$GLOBALS['_PEAR_destructor_object_list'] = array();

//
// Tests needed: - PEAR inheritance
Expand Down
Loading

0 comments on commit 2cf1b8d

Please sign in to comment.