--- embedaddon/php/aclocal.m4	2012/05/29 12:34:34	1.1.1.2
+++ embedaddon/php/aclocal.m4	2013/07/22 01:31:35	1.1.1.3
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: aclocal.m4,v 1.1.1.2 2012/05/29 12:34:34 misho Exp $
+dnl $Id: aclocal.m4,v 1.1.1.3 2013/07/22 01:31:35 misho Exp $
 dnl
 dnl This file contains local autoconf functions.
 dnl
@@ -984,9 +984,15 @@ dnl ---------------------------------------------- Sha
   if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
 dnl ---------------------------------------------- CLI static module
     [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
+    case "$PHP_SAPI" in
+      cgi|embed[)]
+        PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
+        EXT_STATIC="$EXT_STATIC $1"
+        ;;
+      *[)]
         PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
-        PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cgi)
-        PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,fpm)
+        ;;
+    esac
     EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
   fi
   PHP_ADD_BUILD_DIR($ext_builddir)
@@ -1036,6 +1042,12 @@ You either need to build $1 shared or build $2 statica
 build to be successful.
 ])
   fi
+  if test "x$is_it_enabled" = "xno" && 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
 ])
 
@@ -1820,7 +1832,7 @@ AC_TRY_COMPILE([
 ])
 
 dnl -------------------------------------------------------------------------
-dnl Library/function existance and build sanity checks
+dnl Library/function existence and build sanity checks
 dnl -------------------------------------------------------------------------
 
 dnl
@@ -2308,9 +2320,9 @@ AC_DEFUN([PHP_SETUP_OPENSSL],[
   test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no
 
   dnl Fallbacks for different configure options
-  if test -n "$PHP_OPENSSL" && test "$PHP_OPENSSL" != "no"; then
+  if test "$PHP_OPENSSL" != "no"; then
     PHP_OPENSSL_DIR=$PHP_OPENSSL
-  elif test -n "$PHP_IMAP_SSL" && test "$PHP_IMAP_SSL" != "no"; then
+  elif test "$PHP_IMAP_SSL" != "no"; then
     PHP_OPENSSL_DIR=$PHP_IMAP_SSL
   fi
 
@@ -2330,8 +2342,10 @@ AC_DEFUN([PHP_SETUP_OPENSSL],[
       AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
     fi
 
-    if test -n "$OPENSSL_LIBS" && test -n "$OPENSSL_INCS"; then
+    if test -n "$OPENSSL_LIBS"; then
       PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
+    fi
+    if test -n "$OPENSSL_INCS"; then
       PHP_EVAL_INCLINE($OPENSSL_INCS)
     fi
   fi
@@ -2437,7 +2451,12 @@ AC_DEFUN([PHP_SETUP_ICONV], [
   dnl
   dnl Check libc first if no path is provided in --with-iconv
   dnl
+
   if test "$PHP_ICONV" = "yes"; then
+    dnl Reset LIBS temporarily as it may have already been included
+    dnl -liconv in.
+    LIBS_save="$LIBS"
+    LIBS=
     AC_CHECK_FUNC(iconv, [
       found_iconv=yes
     ],[
@@ -2447,6 +2466,7 @@ AC_DEFUN([PHP_SETUP_ICONV], [
         found_iconv=yes
       ])
     ])
+    LIBS="$LIBS_save"
   fi
 
   dnl
@@ -4485,7 +4505,7 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1.*)
+freebsd1*)
   dynamic_linker=no
   ;;
 
@@ -4496,7 +4516,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[[123]].*) objformat=aout ;;
+    freebsd[[123]]*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -6112,7 +6132,7 @@ case $host_os in
 	;;
     esac
     ;;
-  freebsd[[12]].*)
+  freebsd[[12]]*)
     # C++ shared libraries reported to be fairly broken before switch to ELF
     _LT_AC_TAGVAR(ld_shlibs, $1)=no
     ;;
@@ -8795,7 +8815,7 @@ _LT_EOF
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
-    freebsd1.*)
+    freebsd1*)
       _LT_AC_TAGVAR(ld_shlibs, $1)=no
       ;;