File ocaml-labltk.patch of Package ocaml-labltk

--- a/config/auto-aux/hasgot
+++ b/config/auto-aux/hasgot
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 #########################################################################
 #                                                                       #
@@ -31,7 +31,8 @@ while : ; do
 done
 
 (echo "main() {"
- for f in $*; do echo "  $f();"; done
+ fn=$1;shift;args="$@"
+ echo "  $fn(${args// /,});"
  echo "}") >> hasgot.c
 
 if test "$verbose" = yes; then
--- a/configure
+++ b/configure
@@ -19,7 +19,7 @@ installbindir=''
 installdir=''
 tk_defs=''
 tk_libs=''
-tk_x11=yes
+tk_x11=no
 use_findlib=no
 verbose=no
 optcomps=no
@@ -63,6 +63,8 @@ while : ; do
         tk_libs=$2; shift;;
     -tk-no-x11|--tk-no-x11)
         tk_x11=no;;
+    -tk-x11|--tk-x11)
+        tk_x11=yes;;
     -use-findlib|--use-findlib)
         use_findlib=yes;;
     -verbose|--verbose)
@@ -150,11 +152,17 @@ fi
 
 inf "Configuring LablTk..."
 
+if test "x$MAKE" = x; then
+  MAKE=make
+fi
+
 if test $tk_x11 = no; then
   has_tk=true
 else
-  tk_x11_include=`cat $where/Makefile.config | grep '^X11_INCLUDES=' | sed -e 's/^X11_INCLUDES=//'`
-  tk_x11_libs=`cat $where/Makefile.config | grep '^X11_LIBS=' | sed -e 's/^X11_LIBS=//'`
+#  tk_x11_include=`cat $where/Makefile.config | grep '^X11_INCLUDES=' | sed -e 's/^X11_INCLUDES=//'`
+#  tk_x11_libs=`cat $where/Makefile.config | grep '^X11_LIBS=' | sed -e 's/^X11_LIBS=//'`
+  tk_x11_include=`$MAKE where=$where includes -f readconf.mk`
+  tk_x11_libs=`$MAKE where=$where libs -f readconf.mk`
   has_tk=true
 fi
 
@@ -171,6 +179,7 @@ if test $has_tk = true; then
     "-I/sw/include" \
     "-I/usr/pkg/include" \
     "-I/usr/include" \
+    "-I/usr/X11/include" \
     "-I/usr/local/include/tcl8.6 -I/usr/local/include/tk8.6" \
     "-I/usr/include/tcl8.6 -I/usr/include/tk8.6" \
     "-I/usr/local/include/tcl8.5 -I/usr/local/include/tk8.5" \
@@ -213,12 +222,13 @@ if test $has_tk = true && test -z "$tk_l
     tkinclude="$tk_defs"
   else
     tkinclude="$tk_x11_include"
-  fi  
+  fi
   case "$tkinclude" in
   -I/opt/local/include*) tklibdir="/opt/local/lib" ;;
   -I/usr/local/include*) tklibdir="/usr/local/lib" ;;
   -I/sw/include*) tklibdir="/sw/lib" ;;
   -I/usr/pkg/include*) tklibdir="/usr/pkg/lib" ;;
+  -I/usr/X11/include*) tklibdir="/usr/X11/lib" ;;
   esac
   if test -n "$tklibdir"; then
     case "$system" in
@@ -226,26 +236,26 @@ if test $has_tk = true && test -z "$tk_l
     *) tk_libs="-L$tklibdir" ;;
     esac
   else
-    tk
+    tk_libs=""
   fi
 fi
 
 tkauxlibs="$cclibs"
 if test $has_tk = true; then
   if test -n "$tk_libs" && \
-     sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tcl_DoOneEvent
+     sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs -i tcl.h Tcl_DoOneEvent 0
   then tk_libs="$tk_libs $dllib"
-  elif sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs Tcl_DoOneEvent
+  elif sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs -i tcl.h Tcl_DoOneEvent 0
   then
     tk_libs="$tk_libs -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
-  elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs Tcl_DoOneEvent
+  elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs -i tcl.h Tcl_DoOneEvent 0
   then
     tk_libs="$tk_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin $dllib"
   elif test -z "$tk_libs" && tk_libs=-L/usr/local/lib && \
-    sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs Tcl_DoOneEvent
+    sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs -i tcl.h Tcl_DoOneEvent 0
   then
     tk_libs="$tk_libs -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
-  elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs Tcl_DoOneEvent
+  elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs -i tcl.h Tcl_DoOneEvent 0
   then
     tk_libs="$tk_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin $dllib"
   else
@@ -255,14 +265,15 @@ if test $has_tk = true; then
 fi
 
 if test $has_tk = true; then
-  if sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
+  if sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs -i tk.h Tk_SetGrid NULL 1 2 3 4; then
     inf "Tcl/Tk libraries found."
   else
     has_tk=false
-    for tklibdir in "/usr/local/lib" "/opt/local/lib" "/sw/lib" "/usr/pkg/lib";
+    for tklibdir in \
+      "/usr/local/lib" "/opt/local/lib" "/sw/lib" "/usr/pkg/lib"  "/usr/lib";
     do
-      if test $found = no &&
-         sh ./hasgot -L$tklibdir $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid
+      if test $has_tk = false &&
+         sh ./hasgot -L$tklibdir $tk_libs $tk_x11_libs $tkauxlibs -i tk.h Tk_SetGrid NULL 1 2 3 4
       then
         has_tk=true
         case "$system" in
openSUSE Build Service is sponsored by