]> granicus.if.org Git - php/commitdiff
Fix bugs #35379 and #35432 by erroring out when the user configures PHP
authorWez Furlong <wez@php.net>
Wed, 30 Nov 2005 04:47:24 +0000 (04:47 +0000)
committerWez Furlong <wez@php.net>
Wed, 30 Nov 2005 04:47:24 +0000 (04:47 +0000)
extensions with conflicting options.

Jani, feel free to refine the way that extensions are detected as shared :)

For this to be foolproof, we either need to guarantee that the extensions have
their PHP_NEW_EXTENSION invoked in the right sequence.  Eg: PDO should be
handled in the configure script before any of the extensions that depend on it
are handled... tricky.

By happy coincidence, the alphabet ensures that pdo is configured before all
the pdo_ extensions, and also before sqlite, so this works for now.

acinclude.m4

index 0cc1ac347fe4d4c1e24c700665ab3160bca85043..47e94252955a519fa28c30f7c6c45be5b08917a2 100644 (file)
@@ -940,7 +940,7 @@ AC_DEFUN([PHP_NEW_EXTENSION],[
 
   if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
 dnl ---------------------------------------------- Static module
-
+    [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
     PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
     EXT_STATIC="$EXT_STATIC $1"
     if test "$3" != "nocli"; then
@@ -949,6 +949,7 @@ dnl ---------------------------------------------- Static module
   else
     if test "$3" = "shared" || test "$3" = "yes"; then
 dnl ---------------------------------------------- Shared module
+      [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=yes
       PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
       case $host_alias in
         *netware*[)]
@@ -964,6 +965,7 @@ dnl ---------------------------------------------- Shared module
 
   if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
 dnl ---------------------------------------------- CLI static module
+    [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
     if test "$PHP_SAPI" = "cgi"; then
       PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
       EXT_STATIC="$EXT_STATIC $1"
@@ -1004,9 +1006,29 @@ dnl list, so that modules can be init'd in the correct order
 dnl $1 = name of extension, $2 = extension upon which it depends
 dnl $3 = optional: if true, it's ok for $2 to have not been configured
 dnl default is false and should halt the build.
+dnl To be effective, this macro must be invoked *after* PHP_NEW_EXTENSION.
+dnl The extension on which it depends must also have been configured.
 dnl See ADD_EXTENSION_DEP in win32 build 
 dnl
-AC_DEFUN([PHP_ADD_EXTENSION_DEP], [])
+AC_DEFUN([PHP_ADD_EXTENSION_DEP], [
+  am_i_shared=$[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]
+  is_it_shared=$[PHP_]translit($2,a-z_-,A-Z__)[_SHARED]
+  if test "$am_i_shared" = "no" && test "$is_it_shared" = "yes" ; then
+    AC_MSG_ERROR([
+You've configured extension $1 to build statically, but it
+depends on extension $2, which you've configured to build shared.
+You either need to build $1 shared or build $2 statically for the
+build to be successful.
+])
+  fi
+  if test "x$is_it_shared" = "x" && test "x$3" != "xtrue"; then
+    AC_MSG_ERROR([
+You've configured extension $1, which depends on extension $2,
+but you've either not enabled $2, or have disabled it.
+])
+  fi
+  dnl Some systems require that we link $2 to $1 when building
+])
 
 dnl -------------------------------------------------------------------------
 dnl Checks for structures, typedefs, broken functions, etc.