--- configure.orig	2003-05-28 15:34:23.000000000 +1000
+++ configure	2011-08-21 10:57:46.000000000 +1000
@@ -4940,9 +4940,9 @@
 _ACEOF
 
 else
-  echo "$as_me:$LINENO: checking for png_set_gray_1_2_4_to_8 in -lpng" >&5
-echo $ECHO_N "checking for png_set_gray_1_2_4_to_8 in -lpng... $ECHO_C" >&6
-if test "${ac_cv_lib_png_png_set_gray_1_2_4_to_8+set}" = set; then
+  echo "$as_me:$LINENO: checking for png_set_expand_gray_1_2_4_to_8 in -lpng" >&5
+echo $ECHO_N "checking for png_set_expand_gray_1_2_4_to_8 in -lpng... $ECHO_C" >&6
+if test "${ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -4957,7 +4957,7 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char png_set_gray_1_2_4_to_8 ();
+char png_set_expand_gray_1_2_4_to_8 ();
 #ifdef F77_DUMMY_MAIN
 #  ifdef __cplusplus
      extern "C"
@@ -4967,7 +4967,7 @@
 int
 main ()
 {
-png_set_gray_1_2_4_to_8 ();
+png_set_expand_gray_1_2_4_to_8 ();
   ;
   return 0;
 }
@@ -4984,18 +4984,18 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_png_png_set_gray_1_2_4_to_8=yes
+  ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_png_png_set_gray_1_2_4_to_8=no
+ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_set_gray_1_2_4_to_8" >&5
-echo "${ECHO_T}$ac_cv_lib_png_png_set_gray_1_2_4_to_8" >&6
-if test $ac_cv_lib_png_png_set_gray_1_2_4_to_8 = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" >&5
+echo "${ECHO_T}$ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" >&6
+if test $ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8 = yes; then
   LIBS="$LIBS -lpng -lz"
 			 cat >>confdefs.h <<\_ACEOF
 #define USE_PNG 1
@@ -5647,7 +5647,7 @@
 		echo 'FATAL: You need libungif to use gif images.  pass proper LIBS to configure.'
 		exit 1
 	fi
-	for i in /usr/pkg /usr/local /usr; do
+	for i in ${LOCALPREFIX} /usr/pkg /usr/local /usr; do
 		if test -f $i/include/gif_lib.h; then
 			gif_h_ok=yes
 			OPTFLAGS="$OPTFLAGS -I$i/include"
