Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.7-96) unstable; urgency=low
 .
   * better XDR detection; no __builtin_clear_cache on sh4
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.7.orig/configure
+++ gcl-2.6.7/configure
@@ -2547,9 +2547,9 @@ fi
 
 # Check whether --enable-xdr was given.
 if test "${enable_xdr+set}" = set; then :
-  enableval=$enable_xdr; try_xdr=$enableval
+  enableval=$enable_xdr; enable_xdr=$enableval
 else
-  try_xdr="no"
+  enable_xdr="yes"
 fi
 
 
@@ -5688,8 +5688,10 @@ if test "$enable_locbfd" = "yes" ; then
 fi
 
 
-ac_fn_c_check_func "$LINENO" "xdr_double" "ac_cv_func_xdr_double"
+if test "$enable_xdr" = "yes" ; then
+   ac_fn_c_check_func "$LINENO" "xdr_double" "ac_cv_func_xdr_double"
 if test "x$ac_cv_func_xdr_double" = xyes; then :
+  $as_echo "#define HAVE_XDR 1" >>confdefs.h
 
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -ltirpc" >&5
@@ -5729,24 +5731,111 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tirpc_xdr_double" >&5
 $as_echo "$ac_cv_lib_tirpc_xdr_double" >&6; }
 if test "x$ac_cv_lib_tirpc_xdr_double" = xyes; then :
-  TLIBS="$TLIBS -ltirpc"
+  $as_echo "#define HAVE_XDR 1" >>confdefs.h
+ TLIBS="$TLIBS -ltirpc"
 else
-  as_fn_error $? "Need xdr_double" "$LINENO" 5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -lrpc" >&5
+$as_echo_n "checking for xdr_double in -lrpc... " >&6; }
+if ${ac_cv_lib_rpc_xdr_double+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrpc  $LIBS"
+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 xdr_double ();
+int
+main ()
+{
+return xdr_double ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_rpc_xdr_double=yes
+else
+  ac_cv_lib_rpc_xdr_double=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rpc_xdr_double" >&5
+$as_echo "$ac_cv_lib_rpc_xdr_double" >&6; }
+if test "x$ac_cv_lib_rpc_xdr_double" = xyes; then :
+  $as_echo "#define HAVE_XDR 1" >>confdefs.h
+ TLIBS="$TLIBS -lrpc"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -loncrpc" >&5
+$as_echo_n "checking for xdr_double in -loncrpc... " >&6; }
+if ${ac_cv_lib_oncrpc_xdr_double+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-loncrpc  $LIBS"
+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 xdr_double ();
+int
+main ()
+{
+return xdr_double ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_oncrpc_xdr_double=yes
+else
+  ac_cv_lib_oncrpc_xdr_double=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_oncrpc_xdr_double" >&5
+$as_echo "$ac_cv_lib_oncrpc_xdr_double" >&6; }
+if test "x$ac_cv_lib_oncrpc_xdr_double" = xyes; then :
+  $as_echo "#define HAVE_XDR 1" >>confdefs.h
+ TLIBS="$TLIBS -loncrpc"
+fi
+
 fi
 
 fi
 
+fi
+
+fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __builtin___clear_cache" >&5
+case $use in
+     sh4*) ;; #FIXME
+     *)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking __builtin___clear_cache" >&5
 $as_echo_n "checking __builtin___clear_cache... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+     		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
 void *v,*ve;
- __builtin___clear_cache(v,ve);
+			        __builtin___clear_cache(v,ve);
 
   ;
   return 0;
@@ -5755,13 +5844,14 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   $as_echo "#define HAVE_BUILTIN_CLEAR_CACHE 1" >>confdefs.h
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+				 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext;;
+esac
 
 #AC_CONFIG_SUBDIRS($MY_SUBDIRS)
 
@@ -6520,41 +6610,6 @@ fi
 done
 
 fi
-if test "$use" = "mingw" ; then
- if test "$try_xdr" = "yes" ; then
-   for ac_header in rpc/rpc.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "rpc/rpc.h" "ac_cv_header_rpc_rpc_h" "$ac_includes_default"
-if test "x$ac_cv_header_rpc_rpc_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_RPC_RPC_H 1
-_ACEOF
- $as_echo "#define HAVE_XDR 1" >>confdefs.h
-
-			 	 LIBS="${LIBS} -loncrpc"
-fi
-
-done
-
- fi
-else
- if test "$try_xdr" = "yes" ; then
-   for ac_header in rpc/rpc.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "rpc/rpc.h" "ac_cv_header_rpc_rpc_h" "$ac_includes_default"
-if test "x$ac_cv_header_rpc_rpc_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_RPC_RPC_H 1
-_ACEOF
- $as_echo "#define HAVE_XDR 1" >>confdefs.h
-
-			 	 LIBS="${LIBS} -lrpc"
-fi
-
-done
-
- fi
-fi
 
 # Should really find a way to check for prototypes, but this
 # basically works for now.  CM
--- gcl-2.6.7.orig/configure.in
+++ gcl-2.6.7/configure.in
@@ -66,7 +66,7 @@ AC_ARG_ENABLE(japi,[ --enable-japi=yes w
 [try_japi=$enableval],[try_japi="no"])
 
 AC_ARG_ENABLE(xdr,[ --enable-xdr=yes will compile in support for XDR],
-[try_xdr=$enableval],[try_xdr="no"])
+[enable_xdr=$enableval],[enable_xdr="yes"])
 
 AC_ARG_ENABLE(xgcl,[ --enable-xgcl=yes will compile in support for XGCL],
 [enable_xgcl=$enableval],[enable_xgcl="yes"])
@@ -1046,17 +1046,25 @@ if test "$enable_locbfd" = "yes" ; then
 fi
 
 
-AC_CHECK_FUNC(xdr_double,,
-	   AC_CHECK_LIB(tirpc,xdr_double,TLIBS="$TLIBS -ltirpc",AC_MSG_ERROR([Need xdr_double])))
+if test "$enable_xdr" = "yes" ; then
+   AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR),
+   	   AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -ltirpc",
+	   AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -lrpc",
+	   AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -loncrpc"))))
+fi
 
-AC_MSG_CHECKING(__builtin___clear_cache)
-AC_TRY_COMPILE([],
-[void *v,*ve;
- __builtin___clear_cache(v,ve);
-],
-[AC_DEFINE(HAVE_BUILTIN_CLEAR_CACHE)
- AC_MSG_RESULT(yes)],
-AC_MSG_RESULT(no))
+case $use in
+     sh4*) ;; #FIXME
+     *) 
+     AC_MSG_CHECKING(__builtin___clear_cache)
+     		AC_TRY_COMPILE([],
+			       [void *v,*ve;
+			        __builtin___clear_cache(v,ve);
+				],
+				[AC_DEFINE(HAVE_BUILTIN_CLEAR_CACHE)
+				 AC_MSG_RESULT(yes)],
+				 AC_MSG_RESULT(no));;
+esac
 
 #AC_CONFIG_SUBDIRS($MY_SUBDIRS)
 
@@ -1373,17 +1381,17 @@ if test "$try_japi" = "yes" ; then
 				 EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o"
 			 	 LIBS="${LIBS} -ljapi -lwsock32"] )
 fi
-if test "$use" = "mingw" ; then
- if test "$try_xdr" = "yes" ; then
-   AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
-			 	 LIBS="${LIBS} -loncrpc"] )
- fi
-else
- if test "$try_xdr" = "yes" ; then
-   AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
-			 	 LIBS="${LIBS} -lrpc"] )
- fi
-fi
+dnl if test "$use" = "mingw" ; then
+dnl  if test "$try_xdr" = "yes" ; then
+dnl    AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
+dnl 			 	 LIBS="${LIBS} -loncrpc"] )
+dnl  fi
+dnl else
+dnl  if test "$try_xdr" = "yes" ; then
+dnl    AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
+dnl 			 	 LIBS="${LIBS} -lrpc"] )
+dnl  fi
+dnl fi
 
 # Should really find a way to check for prototypes, but this 
 # basically works for now.  CM
--- gcl-2.6.7.orig/h/mac2.h
+++ gcl-2.6.7/h/mac2.h
@@ -162,7 +162,7 @@ do {char *x=sbrk(0); \
    and get a stream connection with it */
 #define RUN_PROCESS
 
-#define HAVE_XDR
+/* #define HAVE_XDR */
 
   /* if there is no input there return false */
 #define LISTEN_FOR_INPUT(fp) \
--- gcl-2.6.7.orig/h/linux.h
+++ gcl-2.6.7/h/linux.h
@@ -97,7 +97,7 @@ do {static struct sigaction action; \
 
 #define	IEEEFLOAT
        
-#define HAVE_XDR
+/* #define HAVE_XDR */
 
 #define USE_ULONG_
 
--- gcl-2.6.7.orig/h/rios-aix3.h
+++ gcl-2.6.7/h/rios-aix3.h
@@ -219,7 +219,7 @@ for the kernel.   See aix3_mprotect dire
 #define HAVE_IOCTL
 #define HAVE_SIGACTION
   
-#define HAVE_XDR
+/* #define HAVE_XDR */
   
 #define SHARP_EQ_CONTEXT_SIZE 1024
 #undef VSSIZE
--- gcl-2.6.7.orig/h/rios.h
+++ gcl-2.6.7/h/rios.h
@@ -228,7 +228,7 @@ for the kernel.   See aix3_mprotect dire
 #define HAVE_IOCTL
 #define HAVE_SIGACTION
   
-#define HAVE_XDR
+/* #define HAVE_XDR */
   
 #define SHARP_EQ_CONTEXT_SIZE 1024
 #undef VSSIZE
--- gcl-2.6.7.orig/h/dos-go32.h
+++ gcl-2.6.7/h/dos-go32.h
@@ -63,7 +63,7 @@ struct rlimit { int i; } ;
 /* some regular bsd bells and whistles which aren't here */
 
 #undef HAVE_SIGVEC
-#undef HAVE_XDR
+/* #undef HAVE_XDR */
 #undef RUN_PROCESS
 
 
--- gcl-2.6.7.orig/h/bsd.h
+++ gcl-2.6.7/h/bsd.h
@@ -86,7 +86,7 @@ do {char *x=sbrk(0); \
    and get a stream connection with it */
 #define RUN_PROCESS
 
-#define HAVE_XDR
+/* #define HAVE_XDR */
 
 #define WANT_VALLOC  
 
--- gcl-2.6.7.orig/h/386-bsd.h
+++ gcl-2.6.7/h/386-bsd.h
@@ -26,7 +26,7 @@
 #define	I386			/* ?? this is apparently not used anywhere */
 #define	IEEEFLOAT
 
-#undef HAVE_XDR
+/* #undef HAVE_XDR */
 
 #define USE_ATT_TIME
 
--- gcl-2.6.7.orig/h/OpenBSD.h
+++ gcl-2.6.7/h/OpenBSD.h
@@ -22,7 +22,7 @@
 /* we don't need to worry about zeroing fp->_base, to prevent what??? */
 #define FCLOSE_SETBUF_OK 
 
-#undef HAVE_XDR
+/* #undef HAVE_XDR */
 
 #define USE_ATT_TIME
 
--- gcl-2.6.7.orig/h/u370_aix.h
+++ gcl-2.6.7/h/u370_aix.h
@@ -176,7 +176,7 @@ when they fix it
 #define SAFE_INC(u,amt) do{volatile unsigned int xTmp = u; xTmp += amt; u = (int) xTmp;}while(0)
 #define SAFE_DEC(u,amt) do{volatile unsigned int xTmp = u; xTmp -= amt; u = (int) xTmp;}while(0)
 
-#define HAVE_XDR
+/* #define HAVE_XDR */
 
 
 /* Begin for cmpinclude */
--- gcl-2.6.7.orig/h/NetBSD.h
+++ gcl-2.6.7/h/NetBSD.h
@@ -47,7 +47,7 @@
 #define deallocate_stream_buffer(x)
 
 
-#undef HAVE_XDR
+/* #undef HAVE_XDR */
 
 #define USE_ATT_TIME
 
