
Repeat after me:

I WILL NOT TEST FOR PRESENCE OF LIBRARIES USING TEST -F.

--- php-4.3.11/ext/gd/config.m4.lib64
+++ php-4.3.11/ext/gd/config.m4
@@ -51,7 +51,7 @@
   if test "$PHP_JPEG_DIR" != "no"; then
 
     for i in $PHP_JPEG_DIR /usr/local /usr; do
-      test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a && GD_JPEG_DIR=$i && break
+      test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a -o -f $i/lib64/libjpeg.$SHLIB_SUFFIX_NAME && GD_JPEG_DIR=$i && break
     done
 
     if test -z "$GD_JPEG_DIR"; then
@@ -76,7 +76,7 @@
   if test "$PHP_PNG_DIR" != "no"; then
 
     for i in $PHP_PNG_DIR /usr/local /usr; do
-      test -f $i/lib/libpng.$SHLIB_SUFFIX_NAME -o -f $i/lib/libpng.a && GD_PNG_DIR=$i && break
+      test -f $i/lib/libpng.$SHLIB_SUFFIX_NAME -o -f $i/lib/libpng.a -o -f $i/lib64/libpng.$SHLIB_SUFFIX_NAME && GD_PNG_DIR=$i && break
     done
 
     if test -z "$GD_PNG_DIR"; then
@@ -95,11 +95,11 @@
     [
       PHP_ADD_INCLUDE($GD_PNG_DIR/include)
       PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, GD_SHARED_LIBADD)
-      PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR/lib, GD_SHARED_LIBADD)
+      PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR, GD_SHARED_LIBADD)
     ],[
       AC_MSG_ERROR([Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.]) 
     ],[
-      -L$PHP_ZLIB_DIR/lib -lz -L$GD_PNG_DIR/lib
+      -L$PHP_ZLIB_DIR/lib -lz -L$GD_PNG_DIR
     ])
 
   else 
@@ -111,7 +111,7 @@
   if test "$PHP_XPM_DIR" != "no"; then
 
     for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
-      test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.a && GD_XPM_DIR=$i && break
+      test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.a -o -f $i/lib64/libXpm.$SHLIB_SUFFIX_NAME && GD_XPM_DIR=$i && break
     done
 
     if test -z "$GD_XPM_DIR"; then
@@ -364,7 +364,7 @@
   done
 
 dnl Library path
-  for i in lib/gd1.3 lib/gd lib gd1.3 gd ""; do
+  for i in lib/gd1.3 lib/gd lib lib64 gd1.3 gd ""; do
     test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" -o -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i"
   done
 
--- php-4.3.11/ext/xml/config.m4.lib64
+++ php-4.3.11/ext/xml/config.m4
@@ -33,6 +33,8 @@
     for i in $PHP_XML $PHP_EXPAT_DIR; do
       if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME ; then
         EXPAT_DIR=$i
+      elif test -f $i/lib64/libexpat.a -o -f $i/lib64/libexpat.$SHLIB_SUFFIX_NAME ; then
+        EXPAT_DIR=$i
       fi
     done
 
--- php-4.3.11/ext/imap/config.m4.lib64
+++ php-4.3.11/ext/imap/config.m4
@@ -158,15 +158,10 @@
       AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
     fi
 
-    if test -r "$IMAP_DIR/c-client/c-client.a"; then
-      ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
-    elif test -r "$IMAP_DIR/lib/c-client.a"; then
-      ln -s "$IMAP_DIR/lib/c-client.a" "$IMAP_DIR/lib/libc-client.a" >/dev/null 2>&1
-    fi
-
     for lib in c-client4 c-client imap; do
       IMAP_LIB=$lib
       IMAP_LIB_CHK(lib)
+      IMAP_LIB_CHK(lib64)
       IMAP_LIB_CHK(c-client)
     done
 
--- php-4.3.11/ext/ldap/config.m4.lib64
+++ php-4.3.11/ext/ldap/config.m4
@@ -6,7 +6,8 @@
   if test -f $1/include/ldap.h; then
     LDAP_DIR=$1
     LDAP_INCDIR=$1/include
-    LDAP_LIBDIR=$1/lib
+    test -f $1/lib/libldap.so && LDAP_LIBDIR=$1/lib
+    test -f $1/lib64/libldap.so && LDAP_LIBDIR=$1/lib64
   elif test -f $1/include/umich-ldap/ldap.h; then
     LDAP_DIR=$1
     LDAP_INCDIR=$1/include/umich-ldap
--- php-4.3.11/ext/pcre/config0.m4.lib64
+++ php-4.3.11/ext/pcre/config0.m4
@@ -25,7 +25,7 @@
       AC_MSG_ERROR([Could not find pcre.h in $PHP_PCRE_REGEX])
     fi
 
-    for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/lib; do
+    for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/lib64 $PHP_PCRE_REGEX/lib; do
       test -f $j/libpcre.a -o -f $j/libpcre.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j
     done
     
--- php-4.3.11/ext/snmp/config.m4.lib64
+++ php-4.3.11/ext/snmp/config.m4
@@ -45,8 +45,8 @@
         test -f $i/snmp/snmp.h                  && SNMP_INCDIR=$i/snmp
         test -f $i/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/ucd-snmp
       done
-      for i in /usr /usr/snmp /usr/local /usr/local/snmp; do
-        test -f $i/lib/libsnmp.a -o -f $i/lib/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i/lib
+      for i in /usr/lib /usr/lib64 /usr/snmp/lib /usr/local/lib /usr/local/snmp/lib; do
+        test -f $i/libsnmp.a -o -f $i/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i
       done
     else
       SNMP_INCDIR=$PHP_SNMP/include
--- php-4.4.2.orig/ext/mysql/config.m4  2005-07-26 09:02:00.000000000 -0500
+++ php-4.4.2/ext/mysql/config.m4       2006-06-21 17:38:44.000000000 -0500
@@ -8,13 +8,18 @@
 sinclude(libmysql/mysql.m4)
 
 AC_DEFUN([MYSQL_LIB_CHK], [
-  str="$MYSQL_DIR/$1/lib$MY_LIBNAME.*"
-  for j in `echo $str`; do
-    if test -r $j; then
-      MYSQL_LIB_DIR=$MYSQL_DIR/$1
-      break 2
-    fi
-  done
+  MYSQL_LIB_DIR=$MYSQL_DIR/$1
+  my_LIBS=$LIBS
+  LIBS="$LIBS -L$MYSQL_LIB_DIR -lmysqlclient"
+  AC_MSG_CHECKING(for mysql in $MYSQL_LIB_DIR)
+  AC_TRY_LINK_FUNC(mysql_close,,[MYSQL_LIB_DIR=""])
+  LIBS=$my_LIBS
+  if test -z "$MYSQL_LIB_DIR"; then
+    AC_MSG_RESULT(no)
+  else
+    AC_MSG_RESULT(yes)
+    break
+  fi
 ])
 
 AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [
@@ -121,7 +126,7 @@
       ;;
   esac
 
-  for i in lib lib/mysql; do
+  for i in lib64 lib lib64/mysql lib/mysql; do
     MYSQL_LIB_CHK($i)
   done
  
--- php-4.4.2.orig/ext/pgsql/config.m4  2006-01-05 15:53:30.000000000 -0600
+++ php-4.4.2/ext/pgsql/config.m4       2006-06-21 17:41:05.000000000 -0500
@@ -46,7 +46,7 @@
         fi
       done
 
-      for j in lib lib/pgsql lib/postgres lib/postgresql ""; do
+      for j in lib lib64 lib/pgsql lib/postgres lib/postgresql ""; do
         if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then 
           PGSQL_LIBDIR=$i/$j
         fi
--- php-4.3.11/ext/domxml/config.m4.lib64
+++ php-4.3.11/ext/domxml/config.m4
@@ -50,11 +50,7 @@
 
   PHP_DOM_CHECK_VERSION
 
-  if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME ; then
-    DOM_LIBNAME=xml2
-  else
-    DOM_LIBNAME=xml
-  fi
+  DOM_LIBNAME=xml2
 
   XML2_CONFIG=$DOMXML_DIR/bin/xml2-config
  
@@ -145,11 +141,7 @@
     AC_MSG_ERROR(DOMXSLT requires DOMXML. Use --with-dom=<DIR>)
   fi
   
-  if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME ; then
-    DOM_LIBNAME=xml2
-  else
-    DOM_LIBNAME=xml
-  fi
+  DOM_LIBNAME=xml2
 
   PHP_ADD_LIBRARY_WITH_PATH($DOM_LIBNAME, $DOMXML_DIR/lib, DOMXML_SHARED_LIBADD)
   PHP_ADD_INCLUDE($DOMXML_DIR/include$DOMXML_DIR_ADD)
--- php-4.3.11/ext/gettext/config.m4.lib64
+++ php-4.3.11/ext/gettext/config.m4
@@ -18,7 +18,6 @@
   GETTEXT_INCDIR=$GETTEXT_DIR/include
   
   O_LDFLAGS=$LDFLAGS
-  LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR"
   AC_CHECK_LIB(intl, bindtextdomain, [
 	GETTEXT_LIBS=intl
 	GETTEXT_CHECK_IN_LIB=intl
--- php-4.3.11/ext/xmlrpc/config.m4.lib64
+++ php-4.3.11/ext/xmlrpc/config.m4
@@ -30,6 +30,13 @@
       testval=yes
       break
     fi
+    if test -f $i/lib64/libexpat.a -o -f $i/lib64/libexpat.$SHLIB_SUFFIX_NAME; then
+      AC_DEFINE(HAVE_LIBEXPAT2,1,[ ])
+      PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib64, XMLRPC_SHARED_LIBADD)
+      PHP_ADD_INCLUDE($i/include)
+      testval=yes
+      break
+    fi
   done
 
   if test "$testval" = "no"; then
--- php-4.4.2.orig/scripts/Makefile.frag        2005-10-13 05:04:53.000000000 -0500
+++ php-4.4.2/scripts/Makefile.frag     2006-06-21 17:43:18.000000000 -0500
@@ -4,7 +4,7 @@
 #
 
 phpincludedir = $(includedir)/php
-phpbuilddir = $(libdir)/build
+phpbuilddir = $(libdir)/php/build
 
 BUILD_FILES = \
        scripts/phpize.m4 \
--- php-4.4.2.orig/scripts/phpize.in    2005-09-03 23:41:00.000000000 -0500
+++ php-4.4.2/scripts/phpize.in 2006-06-21 17:45:03.000000000 -0500
@@ -3,7 +3,7 @@
 # Variable declaration
 prefix='@prefix@'
 exec_prefix="`eval echo @exec_prefix@`"
-phpdir="`eval echo @libdir@`/build"
+phpdir="@libdir@/php4/build"
 includedir="`eval echo @includedir@`/php"
 builddir="`pwd`"
 
--- php-4.3.11/acinclude.m4.lib64
+++ php-4.3.11/acinclude.m4
@@ -194,7 +194,7 @@
   unset ac_new_flags
   for i in [$]$1; do
     case [$]i in
-    -L/usr/lib|-L/usr/lib/[)] ;;
+    -L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/[)] ;;
     *[)] ac_new_flags="[$]ac_new_flags [$]i" ;;
     esac
   done
@@ -856,7 +856,9 @@
 dnl add a library to linkpath/runpath
 dnl
 AC_DEFUN([PHP_ADD_LIBPATH],[
-  if test "$1" != "/usr/lib"; then
+  case x$1 in
+  x/usr/lib|x/usr/lib64) ;;
+  *)
     PHP_EXPAND_PATH($1, ai_p)
     ifelse([$2],,[
       _PHP_ADD_LIBPATH_GLOBAL([$ai_p])
@@ -866,8 +868,8 @@
       else
         _PHP_ADD_LIBPATH_GLOBAL([$ai_p])
       fi
-    ])
-  fi
+    ]) ;;
+  esac
 ])
 
 dnl
@@ -1651,7 +1653,7 @@
     fi
 
     for i in $PHP_KERBEROS; do
-      if test -f $i/lib/libkrb5.a || test -f $i/lib/libkrb5.$SHLIB_SUFFIX_NAME; then
+      if test -f $i/lib/libkrb5.a || test -f $i/lib/libkrb5.$SHLIB_SUFFIX_NAME || test -f $i/lib64/libkrb5.a || test -f $i/lib64/libkrb5.$SHLIB_SUFFIX_NAME; then
         PHP_KERBEROS_DIR=$i
         break
       fi
@@ -1727,6 +1729,9 @@
       if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
         OPENSSL_LIBDIR=$i/lib
       fi
+      if test -r $i/lib64/libssl.a -o -r $i/lib64/libssl.$SHLIB_SUFFIX_NAME; then
+        OPENSSL_LIBDIR=$i/lib64
+      fi
       test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
     done
 
