--- ext/gd/config.m4.orig	2013-07-10 12:43:08.000000000 -0500
+++ ext/gd/config.m4	2013-11-28 23:40:14.000000000 -0600
@@ -71,7 +71,7 @@
 AC_DEFUN([PHP_GD_JPEG],[
   if test "$PHP_JPEG_DIR" != "no"; then
 
-    for i in $PHP_JPEG_DIR /usr/local /usr; do
+    for i in $PHP_JPEG_DIR; do
       test -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && break
     done
 
@@ -96,7 +96,7 @@
 AC_DEFUN([PHP_GD_PNG],[
   if test "$PHP_PNG_DIR" != "no"; then
 
-    for i in $PHP_PNG_DIR /usr/local /usr; do
+    for i in $PHP_PNG_DIR; do
       test -f $i/include/png.h && GD_PNG_DIR=$i && break
     done
 
@@ -127,7 +127,7 @@
 AC_DEFUN([PHP_GD_XPM],[
   if test "$PHP_XPM_DIR" != "no"; then
 
-    for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
+    for i in $PHP_XPM_DIR; do
       test -f $i/$PHP_LIBDIR/libXpm.$SHLIB_SUFFIX_NAME || test -f $i/$PHP_LIBDIR/libXpm.a && GD_XPM_DIR=$i && break
     done
 
@@ -161,12 +161,10 @@
 AC_DEFUN([PHP_GD_FREETYPE2],[
   if test "$PHP_FREETYPE_DIR" != "no"; then
 
-    for i in $PHP_FREETYPE_DIR /usr/local /usr; do
-      if test -f "$i/include/freetype2/freetype/freetype.h"; then
+    for i in $PHP_FREETYPE_DIR; do
         FREETYPE2_DIR=$i
         FREETYPE2_INC_DIR=$i/include/freetype2
         break
-      fi
     done
 
     if test -z "$FREETYPE2_DIR"; then
@@ -194,7 +192,7 @@
 AC_DEFUN([PHP_GD_T1LIB],[
   if test "$PHP_T1LIB" != "no"; then
 
-    for i in $PHP_T1LIB /usr/local /usr; do
+    for i in $PHP_T1LIB; do
       test -f "$i/include/t1lib.h" && GD_T1_DIR=$i && break
     done
 
