From 675502693750e59619180baa027c76fcb15f3f7f Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Fri, 3 Apr 1998 20:21:51 +0000
Subject: [PATCH] A couple of weeks ago I submitted a patch to fix configure
 --with-tcl. However somebody else also applied a patch to the same part of
 configure to fix a different problem. So part of my patch was not applied or
 got reversed or ... whatever.

The attached patch will restore configure --with-tcl to working
order and should remove a lot of the messages complaining about
tcl not working.

Alvin
---
 src/configure    | 20 ++++++++++++++++----
 src/configure.in | 14 +++++++++++++-
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/configure b/src/configure
index 79aea1f64f1..31241ee5e81 100755
--- a/src/configure
+++ b/src/configure
@@ -5562,24 +5562,32 @@ fi
 
 if test "$USE_TCL" = "true"
 then
+ice_save_LIBS="$LIBS"
+ice_save_CFLAGS="$CFLAGS"
+ice_save_CPPFLAGS="$CPPFLAGS"
+ice_save_LDFLAGS="$LDFLAGS"
+LIBS="$LIBS $X_EXTRA_LIBS"
+CFLAGS="$CFLAGS $X_CFLAGS"
+CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+LDFLAGS="$LDFLAGS $X_LIBS"
 TK_LIB=
 echo $ac_n "checking for main in -ltk""... $ac_c" 1>&6
-echo "configure:5568: checking for main in -ltk" >&5
+echo "configure:5576: checking for main in -ltk" >&5
 ac_lib_var=`echo tk'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-ltk  $LIBS"
+LIBS="-ltk $X11_LIBS $TCL_LIB $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5576 "configure"
+#line 5584 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5606,6 +5614,10 @@ else
 TK_LIB=-l$TK_LIB
 fi
 
+LIBS="$ice_save_LIBS"
+CFLAGS="$ice_save_CFLAGS"
+CPPFLAGS="$ice_save_CPPFLAGS"
+LDFLAGS="$ice_save_LDFLAGS"
 fi
 
 trap '' 1 2 15
diff --git a/src/configure.in b/src/configure.in
index 9b717f1a372..2ed02dafbf5 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -620,8 +620,16 @@ fi
 dnl Check for Tk archive
 if test "$USE_TCL" = "true"
 then
+ice_save_LIBS="$LIBS"
+ice_save_CFLAGS="$CFLAGS"
+ice_save_CPPFLAGS="$CPPFLAGS"
+ice_save_LDFLAGS="$LDFLAGS"
+LIBS="$LIBS $X_EXTRA_LIBS"
+CFLAGS="$CFLAGS $X_CFLAGS"
+CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+LDFLAGS="$LDFLAGS $X_LIBS"
 TK_LIB=
-AC_CHECK_LIB(tk, main, TK_LIB=tk)
+AC_CHECK_LIB(tk, main, TK_LIB=tk,,$X11_LIBS $TCL_LIB)
 if test -z "$TK_LIB"; then
 AC_MSG_WARN(tcl support disabled; Tk library missing)
 USE_TCL=
@@ -629,6 +637,10 @@ else
 TK_LIB=-l$TK_LIB
 fi
 AC_SUBST(TK_LIB)
+LIBS="$ice_save_LIBS"
+CFLAGS="$ice_save_CFLAGS"
+CPPFLAGS="$ice_save_CPPFLAGS"
+LDFLAGS="$ice_save_LDFLAGS"
 fi
 
 AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile interfaces/ecpg/lib/Makefile ) 
-- 
GitLab