Cleanups of pltcl unknown thingy.

This commit is contained in:
Peter Eisentraut 2001-05-11 23:38:06 +00:00
parent 7a76e29b0e
commit 5e19e14ecd
9 changed files with 471 additions and 455 deletions

774
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -359,16 +359,6 @@ PGAC_ARG_BOOL(with, tcl, no, [ --with-tcl build Tcl and Tk interfa
AC_MSG_RESULT([$with_tcl])
AC_SUBST([with_tcl])
# If Tcl is enabled (above) then check for pltcl_unknown_support
AC_MSG_CHECKING([whether to build with pl/tcl unknown support])
if test "$with_tcl" = yes; then
PGAC_ARG_BOOL(with, pltcl_unknown, no, [ --enable-pltcl-unknown build pl/tcl unknown support if Tcl is enabled])
else
enable_pltcl_unknown=no
fi
AC_MSG_RESULT([$enable_pltcl_unknown])
AC_SUBST([enable_pltcl_unknown])
# If Tcl is enabled (above) then Tk is also, unless the user disables it using --without-tk
AC_MSG_CHECKING([whether to build with Tk])
if test "$with_tcl" = yes; then
@ -391,6 +381,21 @@ PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh and tkConf
PGAC_ARG_REQ(with, tkconfig, [ --with-tkconfig=DIR tkConfig.sh is in DIR])
#
# If Tcl is enabled (above) then check for pltcl_unknown_support
#
AC_MSG_CHECKING([whether to build with PL/Tcl unknown support])
if test "$with_tcl" = yes; then
PGAC_ARG_BOOL(enable, pltcl-unknown, no,
[ --enable-pltcl-unknown build PL/Tcl unknown support (if Tcl is enabled)],
[AC_DEFINE([ENABLE_PLTCL_UNKNOWN])])
else
enable_pltcl_unknown=no
fi
AC_MSG_RESULT([$enable_pltcl_unknown])
AC_SUBST([enable_pltcl_unknown])
#
# Optionally build Perl modules (Pg.pm and PL/Perl)
#

View File

@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure.
*
* $Id: config.h.in,v 1.163 2001/05/07 00:43:25 tgl Exp $
* $Id: config.h.in,v 1.164 2001/05/11 23:38:06 petere Exp $
*/
#ifndef CONFIG_H
@ -81,6 +81,9 @@
*/
#undef DEF_MAXBACKENDS
/* --enable-pltcl-unknown */
#undef ENABLE_PLTCL_UNKNOWN
/*
*------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
#
# Makefile for the pltcl shared object
#
# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.32 2001/05/09 21:42:29 momjian Exp $
# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.33 2001/05/11 23:38:06 petere Exp $
#
#-------------------------------------------------------------------------
@ -66,17 +66,6 @@ override CPPFLAGS += $(TCL_DEFS)
override CFLAGS = $(TCL_CFLAGS_OPTIMIZE) $(TCL_SHLIB_CFLAGS)
# Uncomment the following to enable the unknown command lookup on the
# first of all calls to the call handler. See the doc in the modules
# directory about details.
ifeq ($(enable_pltcl_unknown), yes)
override CPPFLAGS+= -DPLTCL_UNKNOWN_SUPPORT
TCL_UNKNOWN_MODS= modules/pltcl_loadmod \
modules/pltcl_delmod \
modules/pltcl_listmod
endif
#
# DLOBJS is the dynamically-loaded object file.
#
@ -96,57 +85,45 @@ endif
ifeq ($(TCL_SHARED_BUILD), 1)
all: $(INFILES) $(TCL_UNKNOWN_MODS)
modules/pltcl_loadmod: modules/pltcl_loadmod.in \
$(top_builddir)/src/Makefile.global
sed -e 's,@TCLSH@,$(TCLSH),g' \
$< >$@
chmod a+x $@
modules/pltcl_delmod: modules/pltcl_delmod.in \
$(top_builddir)/src/Makefile.global
sed -e 's,@TCLSH@,$(TCLSH),g' \
$< >$@
chmod a+x $@
modules/pltcl_listmod: modules/pltcl_listmod.in \
$(top_builddir)/src/Makefile.global
sed -e 's,@TCLSH@,$(TCLSH),g' \
$< >$@
chmod a+x $@
all: $(INFILES)
ifeq ($(enable_pltcl_unknown), yes)
$(MAKE) -C modules $@
endif
pltcl$(DLSUFFIX): pltcl.o
install: all installdirs
$(INSTALL_SHLIB) $(DLOBJS) $(DESTDIR)$(libdir)/$(DLOBJS)
ifeq ($(enable_pltcl_unknown), yes)
$(INSTALL_SCRIPT) modules/pltcl_loadmod \
$(DESTDIR)$(bindir)/pltcl_loadmod
$(INSTALL_SCRIPT) modules/pltcl_delmod \
$(DESTDIR)$(bindir)/pltcl_delmod
$(INSTALL_SCRIPT) modules/pltcl_listmod \
$(DESTDIR)$(bindir)/pltcl_listmod
$(INSTALL_DATA) modules/unknown.pltcl \
$(DESTDIR)$(datadir)/unknown.pltcl
$(MAKE) -C modules $@
endif
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir)
ifeq ($(enable_pltcl_unknown), yes)
$(MAKE) -C modules $@
endif
uninstall:
rm -f $(DESTDIR)$(libdir)/$(DLOBJS)
ifeq ($(enable_pltcl_unknown), yes)
$(MAKE) -C modules $@
endif
else
else # TCL_SHARED_BUILD = 0
all install:
@echo "*****"; \
echo "* Cannot build pltcl because Tcl is not a shared library; skipping it."; \
echo "*****"
endif
endif # TCL_SHARED_BUILD = 0
Makefile.tcldefs: mkMakefile.tcldefs.sh
$(SHELL) $< '$(TCL_CONFIG_SH)' '$@'
clean distclean maintainer-clean:
rm -f $(INFILES) pltcl.o Makefile.tcldefs modules/pltcl_listmod modules/pltcl_loadmod modules/pltcl_delmod
rm -f $(INFILES) pltcl.o Makefile.tcldefs
ifeq ($(enable_pltcl_unknown), yes)
$(MAKE) -C modules $@
endif

View File

@ -0,0 +1,28 @@
# $Header: /cvsroot/pgsql/src/pl/tcl/modules/Makefile,v 1.1 2001/05/11 23:38:06 petere Exp $
subdir = src/pl/tcl/modules
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
MODULES = pltcl_loadmod pltcl_delmod pltcl_listmod
all: $(MODULES)
$(MODULES): %: %.in $(top_builddir)/src/Makefile.global
sed 's,@TCLSH@,$(TCLSH),g' $< >$@
chmod a+x $@
install: all installdirs
$(INSTALL_SCRIPT) pltcl_loadmod $(DESTDIR)$(bindir)/pltcl_loadmod
$(INSTALL_SCRIPT) pltcl_delmod $(DESTDIR)$(bindir)/pltcl_delmod
$(INSTALL_SCRIPT) pltcl_listmod $(DESTDIR)$(bindir)/pltcl_listmod
$(INSTALL_DATA) unknown.pltcl $(DESTDIR)$(datadir)/unknown.pltcl
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)
uninstall:
rm -f $(DESTDIR)$(bindir)/pltcl_loadmod $(DESTDIR)$(bindir)/pltcl_delmod $(DESTDIR)$(bindir)/pltcl_listmod $(DESTDIR)$(datadir)/unknown.pltcl
clean distclean maintainer-clean:
rm -f $(MODULES)

View File

@ -1,6 +1,6 @@
#!/bin/sh
#! /bin/sh
# Start tclsh \
exec @TCLSH@ "$0" $@
exec @TCLSH@ "$0" "$@"
#
# Code still has to be documented
@ -113,4 +113,3 @@ while {$i < $argc} {
}
pg_disconnect $conn

View File

@ -1,6 +1,6 @@
#!/bin/sh
#! /bin/sh
# Start tclsh \
exec @TCLSH@ "$0" $@
exec @TCLSH@ "$0" "$@"
#
# Code still has to be documented
@ -119,4 +119,3 @@ if {$i == $argc} {
}
pg_disconnect $conn

View File

@ -1,6 +1,6 @@
#!/bin/sh
#! /bin/sh
# Start tclsh \
exec @TCLSH@ "$0" $@
exec @TCLSH@ "$0" "$@"
#
# Code still has to be documented
@ -499,5 +499,3 @@ __PLTcl_loadmod_load_modules $__PLTcl_loadmod_conn
pg_disconnect $__PLTcl_loadmod_conn
puts ""

View File

@ -31,10 +31,12 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.34 2001/03/22 04:01:42 momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.35 2001/05/11 23:38:06 petere Exp $
*
**********************************************************************/
#include "postgres.h"
#include <tcl.h>
#include <stdio.h>
@ -111,10 +113,9 @@ static FunctionCallInfo pltcl_current_fcinfo = NULL;
static void pltcl_init_all(void);
static void pltcl_init_interp(Tcl_Interp *interp);
#ifdef PLTCL_UNKNOWN_SUPPORT
#ifdef ENABLE_PLTCL_UNKNOWN
static void pltcl_init_load_unknown(Tcl_Interp *interp);
#endif /* PLTCL_UNKNOWN_SUPPORT */
#endif
Datum pltcl_call_handler(PG_FUNCTION_ARGS);
Datum pltclu_call_handler(PG_FUNCTION_ARGS);
@ -230,7 +231,7 @@ pltcl_init_interp(Tcl_Interp *interp)
Tcl_CreateCommand(interp, "spi_execp",
pltcl_SPI_execp, NULL, NULL);
#ifdef PLTCL_UNKNOWN_SUPPORT
#ifdef ENABLE_PLTCL_UNKNOWN
/************************************************************
* Try to load the unknown procedure from pltcl_modules
************************************************************/
@ -239,11 +240,11 @@ pltcl_init_interp(Tcl_Interp *interp)
pltcl_init_load_unknown(interp);
if (SPI_finish() != SPI_OK_FINISH)
elog(ERROR, "pltcl_init_interp(): SPI_finish failed");
#endif /* PLTCL_UNKNOWN_SUPPORT */
#endif /* ENABLE_PLTCL_UNKNOWN */
}
#ifdef PLTCL_UNKNOWN_SUPPORT
#ifdef ENABLE_PLTCL_UNKNOWN
/**********************************************************************
* pltcl_init_load_unknown() - Load the unknown procedure from
@ -315,7 +316,7 @@ pltcl_init_load_unknown(Tcl_Interp *interp)
Tcl_DStringFree(&unknown_src);
}
#endif /* PLTCL_UNKNOWN_SUPPORT */
#endif /* ENABLE_PLTCL_UNKNOWN */
/**********************************************************************