Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
Date:                    2010-06-20
Initial Package Version: 5.44.1.15
Upstream Status:         Submitted
Origin:                  Gilles Espinasse
Description:             Allows the compilation of expectk to be disabled by
                         passing --with-tk=no to the configure script.

diff -Naur expect-5.44.1.15.orig/INSTALL expect-5.44.1.15/INSTALL
--- expect-5.44.1.15.orig/INSTALL	2010-03-11 19:06:30.000000000 +0000
+++ expect-5.44.1.15/INSTALL	2010-06-19 21:17:43.000000000 +0000
@@ -152,6 +152,7 @@
 
 	--with-tk=...		Specifies the directory containing Tk's
 				configure file (tkConfig.sh).
+                                --with-tk=no disable Tk usage in expect
 
 	--with-tkinclude=...	Specifies the directory containing Tk's
 				private include files (such as tkInt.h)
diff -Naur expect-5.44.1.15.orig/Makefile.in expect-5.44.1.15/Makefile.in
--- expect-5.44.1.15.orig/Makefile.in	2010-03-11 19:06:30.000000000 +0000
+++ expect-5.44.1.15/Makefile.in	2010-06-19 21:09:39.000000000 +0000
@@ -103,7 +103,10 @@
 PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
 
 lib_BINARIES	= $(PKG_LIB_FILE)
-bin_BINARIES	= expect expectk
+bin_BINARIES	= expect
+ifneq ($(TK_BIN_DIR),)
+  bin_BINARIES += expectk
+endif
 BINARIES	= $(lib_BINARIES) $(bin_BINARIES)
 
 SHELL		= @SHELL@
diff -Naur expect-5.44.1.15.orig/configure expect-5.44.1.15/configure
--- expect-5.44.1.15.orig/configure	2010-03-11 19:06:30.000000000 +0000
+++ expect-5.44.1.15/configure	2010-06-19 21:27:51.000000000 +0000
@@ -1754,6 +1754,12 @@
   withval="$with_tk"
   with_tkconfig=${withval}
 fi;
+
+        if test x"${with_tkconfig}" = x"no" ; then
+            echo "$as_me:$LINENO: result: Tk is disabled by --with-tk=no" >&5
+echo "${ECHO_T}Tk is disabled by --with-tk=no" >&6
+            unset TK_BIN_DIR
+        else
 	echo "$as_me:$LINENO: checking for Tk configuration" >&5
 echo $ECHO_N "checking for Tk configuration... $ECHO_C" >&6
 	if test "${ac_cv_c_tkconfig+set}" = set; then
@@ -1873,6 +1879,7 @@
 	    echo "$as_me:$LINENO: result: found ${TK_BIN_DIR}/tkConfig.sh" >&5
 echo "${ECHO_T}found ${TK_BIN_DIR}/tkConfig.sh" >&6
 	fi
+        fi
     fi
 
 
@@ -6458,6 +6465,11 @@
 echo "${ECHO_T}Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" >&6
 
 
+    if test x"${with_tkconfig}" = x"no" ; then
+      TK_INCLUDES=""
+
+    else
+
     echo "$as_me:$LINENO: checking for Tk public headers" >&5
 echo $ECHO_N "checking for Tk public headers... $ECHO_C" >&6
 
@@ -6556,6 +6568,7 @@
 	echo "$as_me:$LINENO: result: ${INCLUDE_DIR_NATIVE}" >&5
 echo "${ECHO_T}${INCLUDE_DIR_NATIVE}" >&6
     fi
+    fi
 
 
 #--------------------------------------------------------------------
diff -Naur expect-5.44.1.15.orig/tclconfig/tcl.m4 expect-5.44.1.15/tclconfig/tcl.m4
--- expect-5.44.1.15.orig/tclconfig/tcl.m4	2010-03-11 19:06:30.000000000 +0000
+++ expect-5.44.1.15/tclconfig/tcl.m4	2010-06-19 21:17:02.000000000 +0000
@@ -181,10 +181,12 @@
 #
 #	Adds the following arguments to configure:
 #		--with-tk=...
+#               --with-tk=no disable Tk is disabled
 #
 #	Defines the following vars:
 #		TK_BIN_DIR	Full path to the directory containing
 #				the tkConfig.sh file
+#                               Empty if Tk is disabled
 #------------------------------------------------------------------------
 
 AC_DEFUN(TEA_PATH_TKCONFIG, [
@@ -201,6 +203,11 @@
 	    AC_HELP_STRING([--with-tk],
 		[directory containing tk configuration (tkConfig.sh)]),
 	    with_tkconfig=${withval})
+
+        if test x"${with_tkconfig}" = x"no" ; then
+            AC_MSG_RESULT([Tk is disabled by --with-tk=no])
+            unset TK_BIN_DIR
+        else
 	AC_MSG_CHECKING([for Tk configuration])
 	AC_CACHE_VAL(ac_cv_c_tkconfig,[
 
@@ -309,6 +316,7 @@
 	    TK_BIN_DIR=${ac_cv_c_tkconfig}
 	    AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
 	fi
+        fi
     fi
 ])
 
@@ -3528,6 +3536,11 @@
 #------------------------------------------------------------------------
 
 AC_DEFUN(TEA_PUBLIC_TK_HEADERS, [
+    if test x"${with_tkconfig}" = x"no" ; then
+      TK_INCLUDES=""
+      AC_SUBST(TK_INCLUDES)
+    else
+
     AC_MSG_CHECKING([for Tk public headers])
 
     AC_ARG_WITH(tkinclude, [  --with-tkinclude      directory containing the public Tk header files.], with_tkinclude=${withval})
@@ -3608,6 +3621,7 @@
 	fi
 	AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
     fi
+    fi
 ])
 
 #------------------------------------------------------------------------
