OSDN Git Service

TCL/TK fixes from Billy G. Allie.
authorBruce Momjian <bruce@momjian.us>
Thu, 15 Oct 1998 15:58:16 +0000 (15:58 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 15 Oct 1998 15:58:16 +0000 (15:58 +0000)
src/Makefile.global.in
src/bin/pgtclsh/Makefile
src/bin/pgtclsh/mkMakefile.tcltkdefs.sh.in [deleted file]
src/configure.in

index 9df55d2..2492c93 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.50 1998/10/14 16:02:10 thomas Exp $
+#    $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.51 1998/10/15 15:58:12 momjian Exp $
 #
 # NOTES
 #    Essentially all Postgres make files include this file and use the 
@@ -136,7 +136,11 @@ KRBLIBS+= -lkrb5 -lcrypto -lcom_err -lisode
    endif
 endif
 
+#
+# Please do not edit USE_TCL and USE_TK by hand.
+#
 USE_TCL= @USE_TCL@
+USE_TK= @USE_TK@
 
 USE_PERL= @USE_PERL@
 
index c9a2427..c973137 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.21 1998/10/13 16:30:48 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.22 1998/10/15 15:58:15 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -17,7 +17,10 @@ include ../../Makefile.global
 #
 # Include definitions from the tclConfig.sh file
 #
-include Makefile.tcltkdefs
+include Makefile.tcldefs
+ifeq ($(USE_TK), true)
+       include Makefile.tkdefs
+endif
 
 CFLAGS+= $(X_CFLAGS) -I$(SRCDIR)/interfaces/libpgtcl 
 
@@ -30,10 +33,23 @@ endif
 LIBPGTCL= -L$(SRCDIR)/interfaces/libpgtcl -lpgtcl
 LIBPQ= -L$(LIBPQDIR) -lpq
 
-all: pgtclsh pgtksh
+# If we are here then TCL is available
+PGMS = pgtclsh
+INSTPGMS = install_tcl
+
+# Add TK targets if TK is available
+ifeq ($(USE_TK), true)
+       PGMS += pgtksh
+       INSTPGMS += install_tk
+endif
+
+all: $(PGMS)
 
-Makefile.tcltkdefs:
-       /bin/sh mkMakefile.tcltkdefs.sh
+Makefile.tcldefs:
+       /bin/sh mkMakefile.tcldefs.sh
+
+Makefile.tkdefs:
+       /bin/sh mkMakefile.tkdefs.sh
 
 pgtclsh: pgtclAppInit.o
        $(CC) $(CFLAGS) $(TCL_DEFS) -o $@ pgtclAppInit.o \
@@ -44,8 +60,12 @@ pgtksh: pgtkAppInit.o
          $(LIBPGTCL) $(LIBPQ) $(X_LIBS) $(TK_LIB_SPEC) $(TK_LIBS) \
          $(TCL_LIB_SPEC) $(X11_LIBS) $(LDFLAGS)
 
-install: pgtclsh pgtksh
+install: $(INSTPGMS)
+
+install_tcl: pgtclsh
        $(INSTALL) $(INSTL_EXE_OPTS) pgtclsh $(BINDIR)/pgtclsh
+
+install_tk: pgtksh
        $(INSTALL) $(INSTL_EXE_OPTS) pgtksh $(BINDIR)/pgtksh
 
 clean:
diff --git a/src/bin/pgtclsh/mkMakefile.tcltkdefs.sh.in b/src/bin/pgtclsh/mkMakefile.tcltkdefs.sh.in
deleted file mode 100644 (file)
index a7d7a6f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-
-if [ ! -f @TCL_CONFIG_SH@ ]; then
-    echo "@TCL_CONFIG_SH@ not found"
-    echo "I need this file! Please make a symbolic link to this file"
-    echo "and start make again."
-    exit 1
-fi
-
-if [ ! -f @TK_CONFIG_SH@ ]; then
-    echo "@TK_CONFIG_SH@ not found"
-    echo "I need this file! Please make a symbolic link to this file"
-    echo "and start make again."
-    exit 1
-fi
-
-. @TCL_CONFIG_SH@
-. @TK_CONFIG_SH@
-
-cat @TCL_CONFIG_SH@ @TK_CONFIG_SH@ |
-    egrep '^TCL_|^TK_' |
-    while read inp
-    do
-           eval eval echo $inp
-    done >Makefile.tcltkdefs
-
-exit 0
index c1729c3..3c380fb 100644 (file)
@@ -222,35 +222,15 @@ AC_ARG_WITH(
    [  --with-tcl              use tcl ],
    [
        case "$withval" in
-       y | ye | yes)           USE_TCL=true; AC_MSG_RESULT(enabled) ;;
-       *)                      USE_TCL=false; AC_MSG_RESULT(disabled) ;;
+       y | ye | yes)           USE_TCL=true; USE_TK=true; AC_MSG_RESULT(enabled) ;;
+       *)                      USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ;;
        esac
    ],
-   [ USE_TCL=false; AC_MSG_RESULT(disabled) ]
+   [ USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ]
 )
 
-dnl Add tcl/tk candidate directories to CPPFLAGS
-if test "$USE_TCL"; then
-       header_dirs="/usr/include $INCLUDE_DIRS"
-       tcl_dirs="tcl8.0 tcl80 tcl7.6 tcl76"
-       tk_dirs="tk8.0 tk4.2"
-       for dir in $header_dirs; do
-               for tcl_dir in $tcl_dirs; do
-                       if test -d "$dir/$tcl_dir"; then
-                               PGSQL_CPPFLAGS="$PGSQL_CPPFLAGS -I$dir/$tcl_dir"
-                       fi
-               done
-       done
-       for dir in $header_dirs; do
-               for tk_dir in $tk_dirs; do
-                       if test -d "$dir/$tk_dir"; then
-                       PGSQL_CPPFLAGS="$PGSQL_CPPFLAGS -I$dir/$tk_dir"
-                       fi
-               done
-       done
-fi
 export USE_TCL
-USE_X=$USE_TCL
+export USE_TK
 
 dnl We exclude perl support unless we override it with --with-perl
 AC_MSG_CHECKING(setting USE_PERL)
@@ -266,9 +246,9 @@ AC_ARG_WITH(
    [ USE_PERL=false; AC_MSG_RESULT(disabled) ]
 )
 
-#dnl Verify that postgres is already installed
-#dnl per instructions for perl interface installation
-if test "$USE_PERL" = "true"
+dnl Verify that postgres is already installed
+dnl per instructions for perl interface installation
+if test "$USE_PERL" = true
 then
        if test "$WHOAMI" != "root"
        then    AC_MSG_WARN(perl support disabled; must be root to install)
@@ -411,6 +391,7 @@ AC_SUBST(CFLAGS)
 AC_SUBST(DLSUFFIX)
 AC_SUBST(DL_LIB)
 AC_SUBST(USE_TCL)
+AC_SUBST(USE_TK)
 AC_SUBST(USE_PERL)
 AC_SUBST(USE_ODBC)
 AC_SUBST(MULTIBYTE)
@@ -782,6 +763,67 @@ fi
              AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $SPECIALMATHLIB)
 ])
 
+dnl Check for Tcl configuration script tclConfig.sh
+
+AC_PATH_PROG(TCLSH, tclsh)
+
+if test -z "$TCLSH"
+then
+       AC_MSG_WARN(TCL/TK support disabled; tclsh is not in your path)
+       USE_TCL=
+fi
+       
+if test "$USE_TCL" = true
+then
+       AC_MSG_CHECKING(for tclConfig.sh)
+       TCL_CONFIG_SH=
+       library_dirs=`echo 'puts $auto_path' | $TCLSH`
+       library_dirs="$LIBRARY_DIRS $library_dirs"
+       for dir in $library_dirs; do
+               if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
+                       TCL_CONFIG_SH=$dir/tclConfig.sh
+                       break
+               fi
+       done
+       if test -z "$TCL_CONFIG_SH"; then
+               AC_MSG_RESULT(no)
+               AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
+               USE_TCL=
+       else
+               AC_MSG_RESULT($TCL_CONFIG_SH)
+               AC_SUBST(TCL_CONFIG_SH)
+       fi
+fi
+
+USE_TK=$USE_TCL                # If TCL is disabled, disable TK
+
+dnl Check for Tk configuration script tkConfig.sh
+if test "$USE_TK" = true
+then
+       AC_MSG_CHECKING(for tkConfig.sh)
+       TK_CONFIG_SH=
+       # library_dirs are set in the check for TCL
+       for dir in $library_dirs
+       do
+               if test -d "$dir" -a -r "$dir/tkConfig.sh"
+               then
+                       TK_CONFIG_SH=$dir/tkConfig.sh
+                       break
+               fi
+       done
+       if test -z "$TK_CONFIG_SH"
+       then
+               AC_MSG_RESULT(no)
+               AC_MSG_WARN(TK support disabled; Tk configuration script missing)
+               USE_TK=
+       else
+               AC_MSG_RESULT($TK_CONFIG_SH)
+               AC_SUBST(TK_CONFIG_SH)
+       fi
+fi
+
+USE_X=$USE_TK
+
 dnl Check for X libraries
 
 if test "$USE_X" = true; then
@@ -819,64 +861,6 @@ if test "$USE_X" = true; then
        LDFLAGS="$ice_save_LDFLAGS"
 fi
 
-dnl Check for Tcl configuration script tclConfig.sh
-if test "$USE_TCL"; then
-       AC_MSG_CHECKING(for tclConfig.sh)
-       library_dirs="$LIBRARY_DIRS /usr/lib"
-       TCL_CONFIG_SH=
-       for dir in $library_dirs; do
-               for tcl_dir in $tcl_dirs; do
-                       if test -z "$TCL_CONFIG_SH"; then
-                               if test -d "$dir/$tcl_dir" -a -r "$dir/$tcl_dir/tclConfig.sh"; then
-                                       TCL_CONFIG_SH=$dir/$tcl_dir/tclConfig.sh
-                               fi
-                       fi
-               done
-               if test -z "$TCL_CONFIG_SH"; then
-                       if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
-                               TCL_CONFIG_SH=$dir/tclConfig.sh
-                       fi
-               fi
-       done
-       if test -z "$TCL_CONFIG_SH"; then
-               AC_MSG_RESULT(no)
-               AC_MSG_WARN(tcl support disabled; Tcl configuration script missing)
-               USE_TCL=
-       else
-               AC_MSG_RESULT($TCL_CONFIG_SH)
-               AC_SUBST(TCL_CONFIG_SH)
-       fi
-fi
-
-dnl Check for Tk configuration script tkConfig.sh
-if test "$USE_TCL"; then
-       AC_MSG_CHECKING(for tkConfig.sh)
-       library_dirs="$LIBRARY_DIRS /usr/lib"
-       TK_CONFIG_SH=
-       for dir in $library_dirs; do
-               for tk_dir in $tk_dirs; do
-                       if test -z "$TK_CONFIG_SH"; then
-                               if test -d "$dir/$tk_dir" -a -r "$dir/$tk_dir/tkConfig.sh"; then
-                                       TK_CONFIG_SH=$dir/$tk_dir/tkConfig.sh
-                               fi
-                       fi
-               done
-               if test -z "$TK_CONFIG_SH"; then
-                       if test -d "$dir" -a -r "$dir/tkConfig.sh"; then
-                               TK_CONFIG_SH=$dir/tkConfig.sh
-                       fi
-               fi
-       done
-       if test -z "$TK_CONFIG_SH"; then
-               AC_MSG_RESULT(no)
-               AC_MSG_WARN(tcl support disabled; Tk configuration script missing)
-               USE_TCL=
-       else
-               AC_MSG_RESULT($TK_CONFIG_SH)
-               AC_SUBST(TK_CONFIG_SH)
-       fi
-fi
-
 dnl cause configure to recurse into subdirectories with their own configure
 dnl Darn, setting AC_CONFIG_SUBDIRS sets a list $subdirs$ in the configure output
 dnl  file, but then configure doesn't bother using that list. Probably a bug in
@@ -909,7 +893,8 @@ AC_OUTPUT(
        bin/pg_dump/Makefile
        bin/pg_version/Makefile
        bin/psql/Makefile
-       bin/pgtclsh/mkMakefile.tcltkdefs.sh
+       bin/pgtclsh/mkMakefile.tcldefs.sh
+       bin/pgtclsh/mkMakefile.tkdefs.sh
        include/version.h
        interfaces/libpq/Makefile
        interfaces/ecpg/lib/Makefile