$NetBSD: patch-configure,v 1.1 2011/09/16 05:18:58 minskim Exp $

Compatibility for b64_ntop.  SVN Revisions 2565 and 2568.

--- configure.orig	2011-07-09 16:12:35.000000000 +0000
+++ configure
@@ -637,6 +637,8 @@ NO_FORKPTY_TRUE
 NO_IMSG_FALSE
 NO_IMSG_TRUE
 XOPEN_DEFINES
+NO_B64_NTOP_FALSE
+NO_B64_NTOP_TRUE
 IS_GLIBC_FALSE
 IS_GLIBC_TRUE
 IS_SUNCC_FALSE
@@ -4605,119 +4607,83 @@ if test "x$found_curses" = xno; then
     as_fn_error "\"curses not found\"" "$LINENO" 5
 fi
 
-# Look for networking libraries.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing b64_ntop" >&5
-$as_echo_n "checking for library containing b64_ntop... " >&6; }
-if test "${ac_cv_search_b64_ntop+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
+# Check for b64_ntop.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for b64_ntop" >&5
+$as_echo_n "checking for b64_ntop... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char b64_ntop ();
+		#include <sys/types.h>
+		#include <netinet/in.h>
+		#include <resolv.h>
+
 int
 main ()
 {
-return b64_ntop ();
+b64_ntop(NULL, 0, NULL, 0);
   ;
   return 0;
 }
 _ACEOF
-for ac_lib in '' resolv; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_b64_ntop=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if test "${ac_cv_search_b64_ntop+set}" = set; then :
-  break
-fi
-done
-if test "${ac_cv_search_b64_ntop+set}" = set; then :
-
+if ac_fn_c_try_link "$LINENO"; then :
+  found_b64_ntop=yes
 else
-  ac_cv_search_b64_ntop=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_b64_ntop" >&5
-$as_echo "$ac_cv_search_b64_ntop" >&6; }
-ac_res=$ac_cv_search_b64_ntop
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  found_b64_ntop=no
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test "x$found_b64_ntop" = xno; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing __b64_ntop" >&5
-$as_echo_n "checking for library containing __b64_ntop... " >&6; }
-if test "${ac_cv_search___b64_ntop+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for b64_ntop with -lresolv" >&5
+$as_echo_n "checking for b64_ntop with -lresolv... " >&6; }
+	LIBS="$LIBS -lresolv"
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char __b64_ntop ();
+			#include <sys/types.h>
+			#include <netinet/in.h>
+			#include <resolv.h>
+
 int
 main ()
 {
-return __b64_ntop ();
+b64_ntop(NULL, 0, NULL, 0);
   ;
   return 0;
 }
 _ACEOF
-for ac_lib in '' resolv; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search___b64_ntop=$ac_res
+if ac_fn_c_try_link "$LINENO"; then :
+  found_b64_ntop=yes
+else
+  found_b64_ntop=no
+
 fi
 rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if test "${ac_cv_search___b64_ntop+set}" = set; then :
-  break
+    conftest$ac_exeext conftest.$ac_ext
+	if test "x$found_b64_ntop" = xno; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	fi
 fi
-done
-if test "${ac_cv_search___b64_ntop+set}" = set; then :
+if test "x$found_b64_ntop" = xyes; then
+	$as_echo "#define HAVE_B64_NTOP 1" >>confdefs.h
 
-else
-  ac_cv_search___b64_ntop=no
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
+ if test "x$found_b64_ntop" = xno; then
+  NO_B64_NTOP_TRUE=
+  NO_B64_NTOP_FALSE='#'
+else
+  NO_B64_NTOP_TRUE='#'
+  NO_B64_NTOP_FALSE=
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search___b64_ntop" >&5
-$as_echo "$ac_cv_search___b64_ntop" >&6; }
-ac_res=$ac_cv_search___b64_ntop
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-fi
 
+# Look for networking libraries.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntoa" >&5
 $as_echo_n "checking for library containing inet_ntoa... " >&6; }
 if test "${ac_cv_search_inet_ntoa+set}" = set; then :
