diff --git a/kitsh/buildsrc/kitsh-0.0/aclocal.m4 b/kitsh/buildsrc/kitsh-0.0/aclocal.m4
index 4f86e6f..145064f 100644
--- a/kitsh/buildsrc/kitsh-0.0/aclocal.m4
+++ b/kitsh/buildsrc/kitsh-0.0/aclocal.m4
@@ -260,6 +260,16 @@ AC_DEFUN(DC_FIND_TCLKIT_LIBS, [
subprojs=""
fi
+ if test "${proj}" = "vqtcl"; then
+ if test -n "${projlibfiles}"; then
+ AC_DEFINE(KIT_INCLUDES_VQTCL, [1], [Specify this if you link against vqtcl])
+
+ kc_cv_feature_kit_includes_vqtcl='1'
+ fi
+
+ subprojs=""
+ fi
+
if test "${proj}" = "tk"; then
if test "${projlibfilesnostub}" != ""; then
DC_DO_TK
diff --git a/kitsh/buildsrc/kitsh-0.0/boot.tcl b/kitsh/buildsrc/kitsh-0.0/boot.tcl
index cdaa969..94aab40 100644
--- a/kitsh/buildsrc/kitsh-0.0/boot.tcl
+++ b/kitsh/buildsrc/kitsh-0.0/boot.tcl
@@ -87,6 +87,42 @@ proc tclInit {} {
uplevel #0 $s
}
}
+ "vlerq" {
+ # use raw Vlerq calls if Mk4tcl is not available
+ # $::vlerq::starkit_root is set in the init script in kitInit.c
+ set rootv [vlerq get $::vlerq::starkit_root 0 dirs]
+ set dname [vlerq get $rootv * name]
+ set prows [vlerq get $rootv * parent]
+ foreach r [lsearch -int -all $prows 0] {
+ if {[lindex $dname $r] eq "lib"} break
+ }
+
+ # glob for a subdir in "lib", then source the specified file inside it
+ foreach {d f} {
+ vfs* vfsUtils.tcl vfs* vfslib.tcl vqtcl4* mkclvfs.tcl
+ } {
+ foreach z [lsearch -int -all $prows $r] {
+ if {[string match $d [lindex $dname $z]]} break
+ }
+
+ set files [vlerq get $rootv $z files]
+ set names [vlerq get $files * name]
+
+ set n [lsearch $names $f]
+ if {$n < 0} { error "$d/$f: cannot find startup script"}
+
+ set s [vlerq get $files $n contents]
+ catch {set s [zlib decompress $s]}
+ uplevel #0 $s
+ }
+
+ # hack the mkcl info so it will know this mount point as "exe"
+ set vfs::mkcl::v::rootv(exe) $rootv
+ set vfs::mkcl::v::dname(exe) $dname
+ set vfs::mkcl::v::prows(exe) $prows
+
+ set vfsHandler [list ::vfs::mkcl::handler exe]
+ }
}
# mount the executable, i.e. make all runtime files available
diff --git a/kitsh/buildsrc/kitsh-0.0/configure.ac b/kitsh/buildsrc/kitsh-0.0/configure.ac
index 4b33332..c2cd25d 100644
--- a/kitsh/buildsrc/kitsh-0.0/configure.ac
+++ b/kitsh/buildsrc/kitsh-0.0/configure.ac
@@ -138,7 +138,7 @@ dnl Determine which storage mechanism to use
AC_MSG_CHECKING([which Tclkit Storage mechanism to use])
storage_mech="auto"
-AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4|cvfs}], [Specify storage mechanism to use for built-in VFS (default: auto)]), [
+AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4|cvfs|vlerq}], [Specify storage mechanism to use for built-in VFS (default: auto)]), [
AS_CASE(["$enableval"],
mk4, [
storage_mech="mk4"
@@ -149,6 +149,9 @@ AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4|cvfs}],
cvfs, [
storage_mech="cvfs"
],
+ vlerq, [
+ storage_mech="vlerq"
+ ],
yes, [
# If they just want to enable kit storage, but nothing specifically, do nothing
storage_mech="auto"
@@ -208,6 +211,9 @@ AS_CASE([$storage_mech],
dnl Set any flags as required
DC_SET_DIR2C_FLAGS
+ ],
+ vlerq, [
+ AC_DEFINE([KIT_STORAGE_VLERQ], [1], [Define if you are going to use vlerq for kit storage])
]
)
diff --git a/kitsh/buildsrc/kitsh-0.0/installvfs.tcl b/kitsh/buildsrc/kitsh-0.0/installvfs.tcl
index c3e83f8..0db6352 100644
--- a/kitsh/buildsrc/kitsh-0.0/installvfs.tcl
+++ b/kitsh/buildsrc/kitsh-0.0/installvfs.tcl
@@ -29,6 +29,9 @@ if {[string match "*KIT_STORAGE_MK4*" $data]} {
if {[string match "*KIT_STORAGE_CVFS*" $data]} {
set tclKitStorage cvfs
}
+if {[string match "*KIT_STORAGE_VLERQ*" $data]} {
+ set tclKitStorage vlerq
+}
# Define procedures
proc copy_file {srcfile destfile} {
@@ -125,4 +128,25 @@ switch -- $tclKitStorage {
"cvfs" {
file copy $kitfile $outfile
}
+ "vlerq" {
+ file copy $kitfile $outfile
+
+ if {[catch {
+ # Try as if a pre-existing Tclkit, or a tclsh
+ package require vfs::m2m
+ }]} {
+ load "" vlerq
+ load "" vfs
+
+ source [file join $vfsdir lib/vfs/vfsUtils.tcl]
+ source [file join $vfsdir lib/vfs/vfslib.tcl]
+ source [file join [glob [file join $vfsdir lib vqtcl*]] m2mvfs.tcl]
+ }
+
+ set handle [vfs::m2m::Mount $outfile /kit -nocommit]
+
+ recursive_copy $vfsdir /kit
+
+ vfs::unmount /kit
+ }
}
diff --git a/kitsh/buildsrc/kitsh-0.0/kitInit.c b/kitsh/buildsrc/kitsh-0.0/kitInit.c
index 17cccfe..669264b 100644
--- a/kitsh/buildsrc/kitsh-0.0/kitInit.c
+++ b/kitsh/buildsrc/kitsh-0.0/kitInit.c
@@ -76,6 +76,9 @@ Tcl_AppInitProc Zlib_Init;
#ifdef KIT_STORAGE_CVFS
Tcl_AppInitProc Cvfs_data_tcl_Init;
#endif
+#ifdef KIT_INCLUDES_VQTCL
+Tcl_AppInitProc Vlerq_Init, Vlerq_SafeInit;
+#endif
#ifdef TCL_THREADS
Tcl_AppInitProc Thread_Init;
#endif
@@ -148,6 +151,9 @@ static char *preInitCmd =
#endif
#ifdef KIT_INCLUDES_MK4TCL
"catch { load {} Mk4tcl }\n"
+#endif
+#ifdef KIT_INCLUDES_VQTCL
+ "catch { load {} vlerq }\n"
#endif
"load {} tclkit::init\n"
"::tclkit::init::initInterp\n"
@@ -200,6 +206,26 @@ static char *preInitCmd =
"}\n"
"}\n"
#endif /* KIT_STORAGE_CVFS */
+#ifdef KIT_STORAGE_VLERQ
+ "set ::tclKitStorage \"vlerq\"\n"
+ "if {![info exists s]} {\n"
+ "namespace eval ::vlerq {}\n"
+ "if {[catch {vlerq open " TCLKIT_VFSSOURCE "} ::vlerq::starkit_root]} {\n"
+ "set n -1\n"
+ "} else {\n"
+ "set files [vlerq get $::vlerq::starkit_root 0 dirs 0 files]\n"
+ "set n [lsearch [vlerq get $files * name] boot.tcl]\n"
+ "}\n"
+ "if {$n >= 0} {\n"
+ "set s [vlerq get $files $n contents]\n"
+ "if {![string length $s]} { error \"empty boot.tcl\" }\n"
+ "catch {load {} zlib}\n"
+ "if {[vlerq get $files $n size] != [string length $s]} {\n"
+ "set s [zlib decompress $s]\n"
+ "}\n"
+ "}\n"
+ "}\n"
+ #endif
"if {![info exists s]} {\n"
"set s \"\"\n"
"}\n"
@@ -353,6 +379,9 @@ static void _Tclkit_Generic_Init(void) {
#ifdef KIT_STORAGE_CVFS
Tcl_StaticPackage(0, "cvfs_data_tcl", Cvfs_data_tcl_Init, NULL);
#endif
+#ifdef KIT_INCLUDES_VQTCL
+ Tcl_StaticPackage(0, "vlerq", Vlerq_Init, Vlerq_SafeInit);
+#endif
#ifdef TCL_THREADS
Tcl_StaticPackage(0, "Thread", Thread_Init, NULL);
#endif
diff --git a/vqtcl/build.sh b/vqtcl/build.sh
new file mode 100755
index 0000000..9429bbd
--- /dev/null
+++ b/vqtcl/build.sh
@@ -0,0 +1,51 @@
+#! /usr/bin/env bash
+
+if [ ! -f 'build.sh' ]; then
+ echo 'ERROR: This script must be run from the directory it is in' >&2
+
+ exit 1
+fi
+if [ -z "${TCLVERS}" ]; then
+ echo 'ERROR: The TCLVERS environment variable is not set' >&2
+
+ exit 1
+fi
+
+BUILDDIR="$(pwd)/build/vqtcl"
+OUTDIR="$(pwd)/out"
+INSTDIR="$(pwd)/inst"
+OTHERPKGSDIR="$(pwd)/../"
+export BUILDDIR OUTDIR INSTDIR OTHERPKGSDIR
+
+# Set configure options for this sub-project
+LDFLAGS_ADD="${KC_VQTCL_LDFLAGS_ADD}"
+LDFLAGS="${LDFLAGS} ${KC_VQTCL_LDFLAGS}"
+CFLAGS="${CFLAGS} ${KC_VQTCL_CFLAGS}"
+CPPFLAGS="${CPPFLAGS} ${KC_VQTCL_CPPFLAGS}"
+LIBS="${LIBS} ${KC_VQTCL_LIBS}"
+export LDFLAGS_ADD LDFLAGS CFLAGS CPPFLAGS LIBS
+
+rm -rf 'build' 'out' 'inst'
+mkdir 'out' 'inst' || exit 1
+
+(
+ cp -rp 'buildsrc' 'build'
+ cd "${BUILDDIR}" || exit 1
+
+ if [ "${KITTARGET}" = "kitdll" ]; then
+ CFLAGS="${CFLAGS} -fPIC"
+ export CFLAGS
+ fi
+
+ echo "Running: ./configure --disable-shared --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
+ ./configure --disable-shared --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA} || continue
+
+ echo "Running: ${MAKE:-make} install"
+ ${MAKE:-make} install || continue
+
+ mkdir "${OUTDIR}/lib" || exit 1
+ cp -r "${INSTDIR}/lib"/* "${OUTDIR}/lib/"
+ find "${OUTDIR}" -name '*.a' | xargs rm -f >/dev/null 2>/dev/null
+) || exit 1
+
+exit 0
diff --git a/vqtcl/buildsrc/vqtcl/ChangeLog b/vqtcl/buildsrc/vqtcl/ChangeLog
new file mode 100644
index 0000000..00700f4
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/ChangeLog
@@ -0,0 +1,39 @@
+2009-02-20 patthoyts
+ * merge: Merged the following changes from the old repository.
+ - Fixed mkcl for recent change to all branches that propagates errors
+ from matchin directory functions which was breaking tclkit's based
+ on vlerq vfs.
+ - Updated for 8.6 changes. interp->errorLine is now replaced by
+ Tcl_GetErrorLine and the stubs variables are now const. Use
+ -ltclstubs for vqtcl.
+ - Updated the nmake build files for MSCV9 and added a target to run
+ the test suite. Fixed three tests that had unix expectations to
+ pass with windows as well.
+ - Applied patch from kostix to solve problems opening tclkit when
+ the directory has non-ascii characters in the path. Tcl provides a
+ utf-8 string and we need to convert it to the external encoding.
+ - Support release build with symbols under msvc
+ - For 8.6 - do not define USE_TCL_STUBS for static builds
+ - add code signing support for Win32, add stdint.h for newer mingw
+ - stdint.h required. Patched to permit operation on authenticode signed binaries
+2009-02-03 jcw
+ * all: this code was copied from http://www.equi4.com/pub/vq/vqtcl.tgz
+2007-01-26 jcw
+ * vlerq.c: updated to get rid of stdint.h header
+2007-01-25 jcw
+ * all: vlerq update
+2007-01-16 jcw
+ * all: vlerq update
+2007-01-02 jcw
+ * all: vlerq update
+2006-12-28 jcw
+ * all: vlerq and tclconfig updates
+2006-12-12 jcw
+ * all: vlerq update
+2006-12-06 jcw
+ * Added ratcl package and "view" operator, many tweaks, bump to 4.1
+ * m2mvfs.tcl: updated to 1.8 for sdx wrapping of starpacks
+2006-11-15 jcw
+ * all: Initial 4.0 release
+2006-11-05 jcw
+ * Sources brought under darcs revision control
diff --git a/vqtcl/buildsrc/vqtcl/Makefile.in b/vqtcl/buildsrc/vqtcl/Makefile.in
new file mode 100644
index 0000000..ef29880
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/Makefile.in
@@ -0,0 +1,434 @@
+# Makefile.in --
+#
+# This file is a Makefile for Vlerq TEA Extension. If it has the name
+# "Makefile.in" then it is a template for a Makefile; to generate the
+# actual Makefile, run "./configure", which is a configuration script
+# generated by the "autoconf" program (constructs like "@foo@" will get
+# replaced in the actual Makefile.
+#
+# Copyright (c) 1999 Scriptics Corporation.
+# Copyright (c) 2002-2005 ActiveState Corporation.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+#========================================================================
+# Add additional lines to handle any additional AC_SUBST cases that
+# have been added in a customized configure script.
+#========================================================================
+
+#VLERQ_NEW_VAR = @VLERQ_NEW_VAR@
+
+#========================================================================
+# Nothing of the variables below this line should need to be changed.
+# Please check the TARGETS section below to make sure the make targets
+# are correct.
+#========================================================================
+
+#========================================================================
+# The names of the source files is defined in the configure script.
+# The object files are used for linking into the final library.
+# This will be used when a dist target is added to the Makefile.
+# It is not important to specify the directory, as long as it is the
+# $(srcdir) or in the generic, win or unix subdirectory.
+#========================================================================
+
+PKG_SOURCES = @PKG_SOURCES@
+PKG_OBJECTS = @PKG_OBJECTS@
+
+PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
+PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
+
+#========================================================================
+# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
+# this package that need to be installed, if any.
+#========================================================================
+
+PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
+
+#========================================================================
+# This is a list of public header files to be installed, if any.
+#========================================================================
+
+PKG_HEADERS = @PKG_HEADERS@
+
+#========================================================================
+# "PKG_LIB_FILE" refers to the library (dynamic or static as per
+# configuration options) composed of the named objects.
+#========================================================================
+
+PKG_LIB_FILE = @PKG_LIB_FILE@
+PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
+
+lib_BINARIES = $(PKG_LIB_FILE)
+BINARIES = $(lib_BINARIES)
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+libdir = @libdir@
+datadir = @datadir@
+mandir = @mandir@
+includedir = @includedir@
+
+DESTDIR =
+
+PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION)
+pkgdatadir = $(datadir)/$(PKG_DIR)
+pkglibdir = $(libdir)/$(PKG_DIR)
+pkgincludedir = $(includedir)/$(PKG_DIR)
+
+top_builddir = .
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+CC = @CC@
+CFLAGS_DEFAULT = @CFLAGS_DEFAULT@
+CFLAGS_WARNING = @CFLAGS_WARNING@
+CLEANFILES = @CLEANFILES@
+EXEEXT = @EXEEXT@
+LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@
+MAKE_LIB = @MAKE_LIB@
+MAKE_SHARED_LIB = @MAKE_SHARED_LIB@
+MAKE_STATIC_LIB = @MAKE_STATIC_LIB@
+MAKE_STUB_LIB = @MAKE_STUB_LIB@
+OBJEXT = @OBJEXT@
+RANLIB = @RANLIB@
+RANLIB_STUB = @RANLIB_STUB@
+SHLIB_CFLAGS = @SHLIB_CFLAGS@
+SHLIB_LD = @SHLIB_LD@
+SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@
+SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
+STLIB_LD = @STLIB_LD@
+TCL_DEFS = @TCL_DEFS@
+TCL_BIN_DIR = @TCL_BIN_DIR@
+TCL_SRC_DIR = @TCL_SRC_DIR@
+# This is necessary for packages that use private Tcl headers
+#TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@
+# Not used, but retained for reference of what libs Tcl required
+TCL_LIBS = @TCL_LIBS@
+
+#========================================================================
+# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
+# package without installing. The other environment variables allow us
+# to test against an uninstalled Tcl. Add special env vars that you
+# require for testing here (like TCLX_LIBRARY).
+#========================================================================
+
+EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR)
+TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \
+ @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
+ PATH="$(EXTRA_PATH):$(PATH)" \
+ TCLLIBPATH="$(top_builddir)"
+
+TCLSH_PROG = @TCLSH_PROG@
+TCLSH = $(TCLSH_ENV) $(TCLSH_PROG)
+
+SHARED_BUILD = @SHARED_BUILD@
+
+INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@
+
+PKG_CFLAGS = @PKG_CFLAGS@
+
+# TCL_DEFS is not strictly need here, but if you remove it, then you
+# must make sure that configure.in checks for the necessary components
+# that your library may use. TCL_DEFS can actually be a problem if
+# you do not compile with a similar machine setup as the Tcl core was
+# compiled with.
+#DEFS = $(TCL_DEFS) @DEFS@ $(PKG_CFLAGS)
+DEFS = @DEFS@ $(PKG_CFLAGS)
+
+CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
+
+CPPFLAGS = @CPPFLAGS@
+LIBS = @PKG_LIBS@ @LIBS@
+AR = @AR@
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+
+#========================================================================
+# Start of user-definable TARGETS section
+#========================================================================
+
+#========================================================================
+# TEA TARGETS. Please note that the "libraries:" target refers to platform
+# independent files, and the "binaries:" target inclues executable programs and
+# platform-dependent libraries. Modify these targets so that they install
+# the various pieces of your package. The make and install rules
+# for the BINARIES that you specified above have already been done.
+#========================================================================
+
+all: binaries libraries doc
+
+#========================================================================
+# The binaries target builds executable programs, Windows .dll's, unix
+# shared/static libraries, and any other platform-dependent files.
+# The list of targets to build for "binaries:" is specified at the top
+# of the Makefile, in the "BINARIES" variable.
+#========================================================================
+
+binaries: $(BINARIES) pkgIndex.tcl
+
+libraries:
+
+doc: vlerq.html vlerq.n ratcl.html ratcl.n
+
+install: all install-binaries install-libraries install-doc
+
+install-binaries: binaries install-lib-binaries install-bin-binaries
+
+#========================================================================
+# This rule installs platform-independent files, such as header files.
+# The list=...; for p in $$list handles the empty list case x-platform.
+#========================================================================
+
+install-libraries: libraries
+ @mkdir -p $(DESTDIR)$(includedir)
+ @echo "Installing header files in $(DESTDIR)$(includedir)"
+ @list='$(PKG_HEADERS)'; for i in $$list; do \
+ echo "Installing $(srcdir)/$$i" ; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \
+ done;
+
+#========================================================================
+# Install documentation. Unix manpages should go in the $(mandir)
+# directory.
+#========================================================================
+
+install-doc: doc
+ @mkdir -p $(DESTDIR)$(mandir)/mann
+ @echo "Installing documentation in $(DESTDIR)$(mandir)"
+ @list='$(srcdir)/doc/*.n'; for i in $$list; do \
+ echo "Installing $$i"; \
+ rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
+ done
+
+test: binaries libraries
+ $(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
+
+shell: binaries libraries
+ @$(TCLSH) $(SCRIPT)
+
+gdb:
+ $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)
+
+depend:
+
+#========================================================================
+# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
+# mentioned above. That will ensure that this target is built when you
+# run "make binaries".
+#
+# The $(PKG_OBJECTS) objects are created and linked into the final
+# library. In most cases these object files will correspond to the
+# source files above.
+#========================================================================
+
+$(PKG_LIB_FILE): $(PKG_OBJECTS)
+ -rm -f $(PKG_LIB_FILE)
+ ${MAKE_LIB}
+ $(RANLIB) $(PKG_LIB_FILE)
+
+$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS)
+ -rm -f $(PKG_STUB_LIB_FILE)
+ ${MAKE_STUB_LIB}
+ $(RANLIB_STUB) $(PKG_STUB_LIB_FILE)
+
+#========================================================================
+# We need to enumerate the list of .c to .o lines here.
+#
+# In the following lines, $(srcdir) refers to the toplevel directory
+# containing your extension. If your sources are in a subdirectory,
+# you will have to modify the paths to reflect this:
+#
+# vlerq.$(OBJEXT): $(srcdir)/generic/vlerq.c
+# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/vlerq.c` -o $@
+#
+# Setting the VPATH variable to a list of paths will cause the makefile
+# to look into these paths when resolving .c to .obj dependencies.
+# As necessary, add $(srcdir):$(srcdir)/compat:....
+#========================================================================
+
+VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/doc
+
+.c.@OBJEXT@:
+ $(COMPILE) -c `@CYGPATH@ $<` -o $@
+
+#========================================================================
+# Create the pkgIndex.tcl file.
+# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but
+# you may find that you need to customize the package. If so, either
+# modify the -hand version, or create a pkgIndex.tcl.in file and have
+# the configure script output the pkgIndex.tcl by editing configure.in.
+#========================================================================
+
+pkgIndex.tcl-auto:
+ ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH)
+
+pkgIndex.tcl-hand:
+ (\
+ echo "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
+ [list load [file join \$$dir $(PKG_LIB_FILE)]]";\
+ ) > pkgIndex.tcl
+
+#========================================================================
+# Distribution creation
+# You may need to tweak this target to make it work correctly.
+#========================================================================
+
+#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
+COMPRESS = gnutar zcvf $(PKG_DIR).tar.gz $(PKG_DIR)
+DIST_ROOT = /tmp/dist
+DIST_DIR = $(DIST_ROOT)/$(PKG_DIR)
+
+dist-clean:
+ rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
+
+dist: dist-clean doc
+ mkdir -p $(DIST_DIR)
+ cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \
+ $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \
+ $(DIST_DIR)/
+ chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
+ chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in
+
+ mkdir $(DIST_DIR)/tclconfig
+ cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \
+ $(DIST_DIR)/tclconfig/
+ chmod 664 $(DIST_DIR)/tclconfig/tcl.m4
+ chmod +x $(DIST_DIR)/tclconfig/install-sh
+
+ list='data demos doc generic library mac tests unix win'; \
+ for p in $$list; do \
+ if test -d $(srcdir)/$$p ; then \
+ mkdir $(DIST_DIR)/$$p; \
+ cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \
+ fi; \
+ done
+
+ (cd $(DIST_ROOT); $(COMPRESS);)
+
+#========================================================================
+# End of user-definable section
+#========================================================================
+
+#========================================================================
+# Don't modify the file to clean here. Instead, set the "CLEANFILES"
+# variable in configure.in
+#========================================================================
+
+clean:
+ -test -z "$(BINARIES)" || rm -f $(BINARIES)
+ -rm -f *.$(OBJEXT) core *.core
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean: clean
+ -rm -f *.tab.c
+ -rm -f $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log config.status
+
+#========================================================================
+# Install binary object libraries. On Windows this includes both .dll and
+# .lib files. Because the .lib files are not explicitly listed anywhere,
+# we need to deduce their existence from the .dll file of the same name.
+# Library files go into the lib directory.
+# In addition, this will generate the pkgIndex.tcl
+# file in the install location (assuming it can find a usable tclsh shell)
+#
+# You should not have to modify this target.
+#========================================================================
+
+install-lib-binaries:
+ @mkdir -p $(DESTDIR)$(pkglibdir)
+ @list='$(lib_BINARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
+ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \
+ stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \
+ if test "x$$stub" = "xstub"; then \
+ echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \
+ $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \
+ else \
+ echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \
+ $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \
+ fi; \
+ ext=`echo $$p|sed -e "s/.*\.//"`; \
+ if test "x$$ext" = "xdll"; then \
+ lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
+ if test -f $$lib; then \
+ echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
+ $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \
+ fi; \
+ fi; \
+ fi; \
+ done
+ @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
+ if test -f $(srcdir)/$$p; then \
+ destp=`basename $$p`; \
+ echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
+ fi; \
+ done
+ echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \
+ $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir);
+
+#========================================================================
+# Install binary executables (e.g. .exe files and dependent .dll files)
+# This is for files that must go in the bin directory (located next to
+# wish and tclsh), like dependent .dll files on Windows.
+#
+# You should not have to modify this target, except to define bin_BINARIES
+# above if necessary.
+#========================================================================
+
+install-bin-binaries:
+ @mkdir -p $(DESTDIR)$(bindir)
+ @list='$(bin_BINARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
+ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \
+ fi; \
+ done
+
+.SUFFIXES: .c .$(OBJEXT)
+.SUFFIXES: .man .html .n
+
+.man.html:
+ dtplite -o "$@" html "`@CYGPATH@ $<`"
+ mv "$@" doc
+
+.man.n:
+ dtplite -o "$@" nroff "`@CYGPATH@ $<`"
+ mv "$@" doc
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+uninstall-binaries:
+ list='$(lib_BINARIES)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(pkglibdir)/$$p; \
+ done
+ list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
+ p=`basename $$p`; \
+ rm -f $(DESTDIR)$(pkglibdir)/$$p; \
+ done
+ list='$(bin_BINARIES)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/$$p; \
+ done
+
+.PHONY: all binaries clean depend distclean doc install libraries test
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vqtcl/buildsrc/vqtcl/README b/vqtcl/buildsrc/vqtcl/README
new file mode 100644
index 0000000..26c7cb8
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/README
@@ -0,0 +1,53 @@
+This is Vlerq, a Tcl extension for data manipulation and storage.
+
+This package is released as open source under the same license as Tcl,
+see ./license.terms and http://www.tcl.tk/software/tcltk/license.html
+
+UNIX BUILD
+==========
+
+Building under most UNIX systems is easy, just run the configure script
+and then run make. For more information about the build process, see the
+tcl/unix/README file in the Tcl src dist. The following will configure,
+test, build, and install the vlerq extension in the /opt/tcl directory.
+
+ $ ./configure --prefix=/opt/tcl --exec-prefix=/opt/tcl
+ $ make
+ $ make test
+ $ make install
+
+WINDOWS BUILD
+=============
+
+The recommended method to build extensions under windows is to use the Msys
++ Mingw build process. This provides a Unix-style build while generating
+native Windows binaries. Using the Msys + Mingw build tools means that you
+can use the same configure script as per the Unix build to create a
+Makefile. See the tcl/win/README file for the URL of the Msys + Mingw
+download.
+
+If you have VC++ then you may wish to use the files in the win subdirectory
+and build the extension using just VC++. These files have been designed to
+be as generic as possible but will require some additional maintenance by
+the project developer to synchronise with the TEA configure.in and
+Makefile.in files. Instructions for using the VC++ makefile are written in
+the first part of the Makefile.vc file.
+
+INSTALLATION
+============
+
+The installation of a TEA package is structured like so:
+
+ $exec_prefix
+ / \
+ lib bin
+ | |
+ PACKAGEx.y (dependent .dll files on Windows)
+ |
+ pkgIndex.tcl (.so|.dll|.dylib and .tcl files)
+
+The main .so|.dll library file gets installed in the versioned PACKAGE
+directory, which is OK on all platforms because it will be directly
+referenced with by 'load' in the pkgIndex.tcl file. Dependent DLL files on
+Windows must go in the bin directory (or other directory on the user's
+PATH) in order for them to be found.
diff --git a/vqtcl/buildsrc/vqtcl/aclocal.m4 b/vqtcl/buildsrc/vqtcl/aclocal.m4
new file mode 100644
index 0000000..0b05739
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/aclocal.m4
@@ -0,0 +1,9 @@
+#
+# Include the TEA standard macro set
+#
+
+builtin(include,tclconfig/tcl.m4)
+
+#
+# Add here whatever m4 macros you want to define for your package
+#
diff --git a/vqtcl/buildsrc/vqtcl/configure b/vqtcl/buildsrc/vqtcl/configure
new file mode 100755
index 0000000..c3a9e03
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/configure
@@ -0,0 +1,10858 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for vqtcl 4.1.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='vqtcl'
+PACKAGE_TARNAME='vqtcl'
+PACKAGE_VERSION='4.1'
+PACKAGE_STRING='vqtcl 4.1'
+PACKAGE_BUGREPORT=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include
+#if HAVE_SYS_TYPES_H
+# include
+#endif
+#if HAVE_SYS_STAT_H
+# include
+#endif
+#if STDC_HEADERS
+# include
+# include
+#else
+# if HAVE_STDLIB_H
+# include
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include
+# endif
+# include
+#endif
+#if HAVE_STRINGS_H
+# include
+#endif
+#if HAVE_INTTYPES_H
+# include
+#else
+# if HAVE_STDINT_H
+# include
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS PKG_SOURCES PKG_OBJECTS CLEANFILES TCL_INCLUDES TCL_THREADS SHARED_BUILD AR CELIB_DIR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB TCLSH_PROG LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures vqtcl 4.1 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of vqtcl 4.1:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-threads build with threads
+ --enable-shared build and link with shared libraries (default: on)
+ --enable-64bit enable 64bit support (default: off)
+ --enable-64bit-vis enable 64bit Sparc VIS support (default: off)
+ --enable-wince enable Win/CE support (where applicable)
+ --enable-load allow dynamic loading and "load" command (default:
+ on)
+ --enable-symbols build with debugging symbols (default: off)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-tcl directory containing tcl configuration
+ (tclConfig.sh)
+ --with-tclinclude directory containing the public Tcl header files
+ --with-celib=DIR use Windows/CE support library from DIR
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L if you have libraries in a
+ nonstandard directory
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have
+ headers in a nonstandard directory
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+vqtcl configure 4.1
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by vqtcl $as_me 4.1, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#--------------------------------------------------------------------
+# Call TEA_INIT as the first TEA_ macro to set up initial vars.
+# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
+# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
+#--------------------------------------------------------------------
+
+
+ # TEA extensions pass this us the version of TEA they think they
+ # are compatible with.
+ TEA_VERSION="3.5"
+
+ echo "$as_me:$LINENO: checking for correct TEA configuration" >&5
+echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6
+ if test x"${PACKAGE_NAME}" = x ; then
+ { { echo "$as_me:$LINENO: error:
+The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5
+echo "$as_me: error:
+The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ if test x"3.5" = x ; then
+ { { echo "$as_me:$LINENO: error:
+TEA version not specified." >&5
+echo "$as_me: error:
+TEA version not specified." >&2;}
+ { (exit 1); exit 1; }; }
+ elif test "3.5" != "${TEA_VERSION}" ; then
+ echo "$as_me:$LINENO: result: warning: requested TEA version \"3.5\", have \"${TEA_VERSION}\"" >&5
+echo "${ECHO_T}warning: requested TEA version \"3.5\", have \"${TEA_VERSION}\"" >&6
+ else
+ echo "$as_me:$LINENO: result: ok (TEA ${TEA_VERSION})" >&5
+echo "${ECHO_T}ok (TEA ${TEA_VERSION})" >&6
+ fi
+ case "`uname -s`" in
+ *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*)
+ # Extract the first word of "cygpath", so it can be a program name with args.
+set dummy cygpath; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CYGPATH+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CYGPATH"; then
+ ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CYGPATH="cygpath -w"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
+fi
+fi
+CYGPATH=$ac_cv_prog_CYGPATH
+if test -n "$CYGPATH"; then
+ echo "$as_me:$LINENO: result: $CYGPATH" >&5
+echo "${ECHO_T}$CYGPATH" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ EXEEXT=".exe"
+ TEA_PLATFORM="windows"
+ ;;
+ *)
+ CYGPATH=echo
+ EXEEXT=""
+ TEA_PLATFORM="unix"
+ ;;
+ esac
+
+ # Check if exec_prefix is set. If not use fall back to prefix.
+ # Note when adjusted, so that TEA_PREFIX can correct for this.
+ # This is needed for recursive configures, since autoconf propagates
+ # $prefix, but not $exec_prefix (doh!).
+ if test x$exec_prefix = xNONE ; then
+ exec_prefix_default=yes
+ exec_prefix=$prefix
+ fi
+
+
+
+
+ # This package name must be replaced statically for AC_SUBST to work
+
+ # Substitute STUB_LIB_FILE in case package creates a stub library too.
+
+
+ # We AC_SUBST these here to ensure they are subst'ed,
+ # in case the user doesn't call TEA_ADD_...
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in tclconfig $srcdir/tclconfig; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in tclconfig $srcdir/tclconfig" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in tclconfig $srcdir/tclconfig" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+#--------------------------------------------------------------------
+# Load the tclConfig.sh file
+#--------------------------------------------------------------------
+
+
+
+ #
+ # Ok, lets find the tcl configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tcl
+ #
+
+ if test x"${no_tcl}" = x ; then
+ # we reset no_tcl in case something fails here
+ no_tcl=true
+
+# Check whether --with-tcl or --without-tcl was given.
+if test "${with_tcl+set}" = set; then
+ withval="$with_tcl"
+ with_tclconfig=${withval}
+fi;
+ echo "$as_me:$LINENO: checking for Tcl configuration" >&5
+echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6
+ if test "${ac_cv_c_tclconfig+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+
+ # First check to see if --with-tcl was specified.
+ if test x"${with_tclconfig}" != x ; then
+ case ${with_tclconfig} in
+ */tclConfig.sh )
+ if test -f ${with_tclconfig}; then
+ { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
+echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
+ with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'`
+ fi ;;
+ esac
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
+ else
+ { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
+echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+
+ # then check for a private Tcl installation
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ../tcl \
+ `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
+ `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \
+ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \
+ ../../tcl \
+ `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
+ `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \
+ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \
+ ../../../tcl \
+ `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
+ `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \
+ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Darwin, check in Framework installation locations
+ if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
+ `ls -d /Library/Frameworks 2>/dev/null` \
+ `ls -d /Network/Library/Frameworks 2>/dev/null` \
+ `ls -d /System/Library/Frameworks 2>/dev/null` \
+ ; do
+ if test -f "$i/Tcl.framework/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Windows, check in common installation locations
+ if test "${TEA_PLATFORM}" = "windows" \
+ -a x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d C:/Tcl/lib 2>/dev/null` \
+ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ${libdir} 2>/dev/null` \
+ `ls -d ${exec_prefix}/lib 2>/dev/null` \
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few other private locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tcl \
+ `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \
+ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ done
+ fi
+
+fi
+
+
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ TCL_BIN_DIR="# no Tcl configs found"
+ { echo "$as_me:$LINENO: WARNING: Can't find Tcl configuration definitions" >&5
+echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;}
+ exit 0
+ else
+ no_tcl=
+ TCL_BIN_DIR=${ac_cv_c_tclconfig}
+ echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
+echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ fi
+ fi
+
+
+ echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
+echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6
+
+ if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
+ echo "$as_me:$LINENO: result: loading" >&5
+echo "${ECHO_T}loading" >&6
+ . ${TCL_BIN_DIR}/tclConfig.sh
+ else
+ echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
+echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ fi
+
+ # eval is required to do the TCL_DBGX substitution
+ eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
+ eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
+
+ # If the TCL_BIN_DIR is the build directory (not the install directory),
+ # then set the common variable name to the value of the build variables.
+ # For example, the variable TCL_LIB_SPEC will be set to the value
+ # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
+ # instead of TCL_BUILD_LIB_SPEC since it will work with both an
+ # installed and uninstalled version of Tcl.
+ if test -f ${TCL_BIN_DIR}/Makefile ; then
+ TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
+ TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
+ TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
+ elif test "`uname -s`" = "Darwin"; then
+ # If Tcl was built as a framework, attempt to use the libraries
+ # from the framework at the given location so that linking works
+ # against Tcl.framework installed in an arbitary location.
+ case ${TCL_DEFS} in
+ *TCL_FRAMEWORK*)
+ if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
+ for i in "`cd ${TCL_BIN_DIR}; pwd`" \
+ "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
+ if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
+ TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
+ break
+ fi
+ done
+ fi
+ if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
+ TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
+ TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
+ fi
+ ;;
+ esac
+ fi
+
+ # eval is required to do the TCL_DBGX substitution
+ eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
+ eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
+ eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
+ eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#--------------------------------------------------------------------
+# Load the tkConfig.sh file if necessary (Tk extension)
+#--------------------------------------------------------------------
+
+#TEA_PATH_TKCONFIG
+#TEA_LOAD_TKCONFIG
+
+#-----------------------------------------------------------------------
+# Handle the --prefix=... option by defaulting to what Tcl gave.
+# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
+#-----------------------------------------------------------------------
+
+
+ if test "${prefix}" = "NONE"; then
+ prefix_default=yes
+ if test x"${TCL_PREFIX}" != x; then
+ { echo "$as_me:$LINENO: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5
+echo "$as_me: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&6;}
+ prefix=${TCL_PREFIX}
+ else
+ { echo "$as_me:$LINENO: --prefix defaulting to /usr/local" >&5
+echo "$as_me: --prefix defaulting to /usr/local" >&6;}
+ prefix=/usr/local
+ fi
+ fi
+ if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
+ -o x"${exec_prefix_default}" = x"yes" ; then
+ if test x"${TCL_EXEC_PREFIX}" != x; then
+ { echo "$as_me:$LINENO: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5
+echo "$as_me: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&6;}
+ exec_prefix=${TCL_EXEC_PREFIX}
+ else
+ { echo "$as_me:$LINENO: --exec-prefix defaulting to ${prefix}" >&5
+echo "$as_me: --exec-prefix defaulting to ${prefix}" >&6;}
+ exec_prefix=$prefix
+ fi
+ fi
+
+
+#-----------------------------------------------------------------------
+# Standard compiler checks.
+# This sets up CC by using the CC env var, or looks for gcc otherwise.
+# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
+# the basic setup necessary to compile executables.
+#-----------------------------------------------------------------------
+
+
+ # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
+ # in this macro, they need to go into TEA_SETUP_COMPILER instead.
+
+ # If the user did not set CFLAGS, set it now to keep
+ # the AC_PROG_CC macro from adding "-g -O2".
+ if test "${CFLAGS+set}" != "set" ; then
+ CFLAGS=""
+ fi
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5
+ (eval $ac_compiler --version &5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5
+ (eval $ac_compiler -v &5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5
+ (eval $ac_compiler -V &5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#include
+#include
+#include
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer to if __STDC__ is defined, since
+ # exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer to if __STDC__ is defined, since
+ # exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ # Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+ #--------------------------------------------------------------------
+ # Checks to see if the make program sets the $MAKE variable.
+ #--------------------------------------------------------------------
+
+ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+all:
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ SET_MAKE=
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+ #--------------------------------------------------------------------
+ # Find ranlib
+ #--------------------------------------------------------------------
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+
+ #--------------------------------------------------------------------
+ # Determines the correct binary file extension (.o, .obj, .exe etc.)
+ #--------------------------------------------------------------------
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#include
+#include
+#include
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
+
+
+ #------------------------------------------------------------------------
+ # If we're using GCC, see if the compiler understands -pipe. If so, use it.
+ # It makes compiling go faster. (This is only a performance feature.)
+ #------------------------------------------------------------------------
+
+ if test -z "$no_pipe" -a -n "$GCC"; then
+ echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5
+echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6
+ OLDCC="$CC"
+ CC="$CC -pipe"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+CC="$OLDCC"
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+
+ #--------------------------------------------------------------------
+ # Common compiler flag setup
+ #--------------------------------------------------------------------
+
+ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
+if test "${ac_cv_c_bigendian+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#include
+
+int
+main ()
+{
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#include
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_bigendian=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+# It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+ # try to guess the endianness by grepping values into an object file
+ ac_cv_c_bigendian=unknown
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+ ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+int
+main ()
+{
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long l;
+ char c[sizeof (long)];
+ } u;
+ u.l = 1;
+ exit (u.c[sizeof (long) - 1] == 1);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=no
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+case $ac_cv_c_bigendian in
+ yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+ no)
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+
+ if test "${TEA_PLATFORM}" = "unix" ; then
+
+ #--------------------------------------------------------------------
+ # On a few very rare systems, all of the libm.a stuff is
+ # already in libc.a. Set compiler flags accordingly.
+ # Also, Linux requires the "ieee" library for math to work
+ # right (and it must appear before "-lm").
+ #--------------------------------------------------------------------
+
+ echo "$as_me:$LINENO: checking for sin" >&5
+echo $ECHO_N "checking for sin... $ECHO_C" >&6
+if test "${ac_cv_func_sin+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define sin to an innocuous variant, in case declares sin.
+ For example, HP-UX 11i declares gettimeofday. */
+#define sin innocuous_sin
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sin (); below.
+ Prefer to if __STDC__ is defined, since
+ exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+
+#undef sin
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char sin ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_sin) || defined (__stub___sin)
+choke me
+#else
+char (*f) () = sin;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != sin;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_sin=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_sin=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5
+echo "${ECHO_T}$ac_cv_func_sin" >&6
+if test $ac_cv_func_sin = yes; then
+ MATH_LIBS=""
+else
+ MATH_LIBS="-lm"
+fi
+
+ echo "$as_me:$LINENO: checking for main in -lieee" >&5
+echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6
+if test "${ac_cv_lib_ieee_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lieee $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_ieee_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ieee_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5
+echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6
+if test $ac_cv_lib_ieee_main = yes; then
+ MATH_LIBS="-lieee $MATH_LIBS"
+fi
+
+
+ #--------------------------------------------------------------------
+ # Interactive UNIX requires -linet instead of -lsocket, plus it
+ # needs net/errno.h to define the socket-related error codes.
+ #--------------------------------------------------------------------
+
+ echo "$as_me:$LINENO: checking for main in -linet" >&5
+echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6
+if test "${ac_cv_lib_inet_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-linet $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_inet_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_inet_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5
+echo "${ECHO_T}$ac_cv_lib_inet_main" >&6
+if test $ac_cv_lib_inet_main = yes; then
+ LIBS="$LIBS -linet"
+fi
+
+ if test "${ac_cv_header_net_errno_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for net/errno.h" >&5
+echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6
+if test "${ac_cv_header_net_errno_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5
+echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking net/errno.h usability" >&5
+echo $ECHO_N "checking net/errno.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking net/errno.h presence" >&5
+echo $ECHO_N "checking net/errno.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: net/errno.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: net/errno.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: net/errno.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: net/errno.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for net/errno.h" >&5
+echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6
+if test "${ac_cv_header_net_errno_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_net_errno_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5
+echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6
+
+fi
+if test $ac_cv_header_net_errno_h = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_NET_ERRNO_H 1
+_ACEOF
+
+fi
+
+
+
+ #--------------------------------------------------------------------
+ # Check for the existence of the -lsocket and -lnsl libraries.
+ # The order here is important, so that they end up in the right
+ # order in the command line generated by make. Here are some
+ # special considerations:
+ # 1. Use "connect" and "accept" to check for -lsocket, and
+ # "gethostbyname" to check for -lnsl.
+ # 2. Use each function name only once: can't redo a check because
+ # autoconf caches the results of the last check and won't redo it.
+ # 3. Use -lnsl and -lsocket only if they supply procedures that
+ # aren't already present in the normal libraries. This is because
+ # IRIX 5.2 has libraries, but they aren't needed and they're
+ # bogus: they goof up name resolution if used.
+ # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
+ # To get around this problem, check for both libraries together
+ # if -lsocket doesn't work by itself.
+ #--------------------------------------------------------------------
+
+ tcl_checkBoth=0
+ echo "$as_me:$LINENO: checking for connect" >&5
+echo $ECHO_N "checking for connect... $ECHO_C" >&6
+if test "${ac_cv_func_connect+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define connect to an innocuous variant, in case declares connect.
+ For example, HP-UX 11i declares gettimeofday. */
+#define connect innocuous_connect
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char connect (); below.
+ Prefer to if __STDC__ is defined, since
+ exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+
+#undef connect
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+char (*f) () = connect;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != connect;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_connect=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_connect=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
+echo "${ECHO_T}$ac_cv_func_connect" >&6
+if test $ac_cv_func_connect = yes; then
+ tcl_checkSocket=0
+else
+ tcl_checkSocket=1
+fi
+
+ if test "$tcl_checkSocket" = 1; then
+ echo "$as_me:$LINENO: checking for setsockopt" >&5
+echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6
+if test "${ac_cv_func_setsockopt+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define setsockopt to an innocuous variant, in case declares setsockopt.
+ For example, HP-UX 11i declares gettimeofday. */
+#define setsockopt innocuous_setsockopt
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char setsockopt (); below.
+ Prefer to if __STDC__ is defined, since
+ exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+
+#undef setsockopt
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char setsockopt ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_setsockopt) || defined (__stub___setsockopt)
+choke me
+#else
+char (*f) () = setsockopt;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != setsockopt;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_setsockopt=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_setsockopt=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5
+echo "${ECHO_T}$ac_cv_func_setsockopt" >&6
+if test $ac_cv_func_setsockopt = yes; then
+ :
+else
+ echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5
+echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6
+if test "${ac_cv_lib_socket_setsockopt+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char setsockopt ();
+int
+main ()
+{
+setsockopt ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_socket_setsockopt=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_socket_setsockopt=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6
+if test $ac_cv_lib_socket_setsockopt = yes; then
+ LIBS="$LIBS -lsocket"
+else
+ tcl_checkBoth=1
+fi
+
+fi
+
+ fi
+ if test "$tcl_checkBoth" = 1; then
+ tk_oldLibs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ echo "$as_me:$LINENO: checking for accept" >&5
+echo $ECHO_N "checking for accept... $ECHO_C" >&6
+if test "${ac_cv_func_accept+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define accept to an innocuous variant, in case declares accept.
+ For example, HP-UX 11i declares gettimeofday. */
+#define accept innocuous_accept
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char accept (); below.
+ Prefer to if __STDC__ is defined, since
+ exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+
+#undef accept
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char accept ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_accept) || defined (__stub___accept)
+choke me
+#else
+char (*f) () = accept;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != accept;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_accept=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_accept=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5
+echo "${ECHO_T}$ac_cv_func_accept" >&6
+if test $ac_cv_func_accept = yes; then
+ tcl_checkNsl=0
+else
+ LIBS=$tk_oldLibs
+fi
+
+ fi
+ echo "$as_me:$LINENO: checking for gethostbyname" >&5
+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
+if test "${ac_cv_func_gethostbyname+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define gethostbyname to an innocuous variant, in case declares gethostbyname.
+ For example, HP-UX 11i declares gettimeofday. */
+#define gethostbyname innocuous_gethostbyname
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gethostbyname (); below.
+ Prefer to if __STDC__ is defined, since
+ exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+
+#undef gethostbyname
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+char (*f) () = gethostbyname;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != gethostbyname;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_gethostbyname=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_gethostbyname=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
+if test $ac_cv_func_gethostbyname = yes; then
+ :
+else
+ echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname ();
+int
+main ()
+{
+gethostbyname ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_nsl_gethostbyname=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_nsl_gethostbyname=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
+if test $ac_cv_lib_nsl_gethostbyname = yes; then
+ LIBS="$LIBS -lnsl"
+fi
+
+fi
+
+
+ # Don't perform the eval of the libraries here because DL_LIBS
+ # won't be set until we call TEA_CONFIG_CFLAGS
+
+ TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
+
+
+
+
+ echo "$as_me:$LINENO: checking dirent.h" >&5
+echo $ECHO_N "checking dirent.h... $ECHO_C" >&6
+if test "${tcl_cv_dirent_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#include
+int
+main ()
+{
+
+#ifndef _POSIX_SOURCE
+# ifdef __Lynx__
+ /*
+ * Generate compilation error to make the test fail: Lynx headers
+ * are only valid if really in the POSIX environment.
+ */
+
+ missing_procedure();
+# endif
+#endif
+DIR *d;
+struct dirent *entryPtr;
+char *p;
+d = opendir("foobar");
+entryPtr = readdir(d);
+p = entryPtr->d_name;
+closedir(d);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_dirent_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_dirent_h=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_dirent_h" >&5
+echo "${ECHO_T}$tcl_cv_dirent_h" >&6
+
+ if test $tcl_cv_dirent_h = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_DIRENT_H 1
+_ACEOF
+
+ fi
+
+ if test "${ac_cv_header_errno_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for errno.h" >&5
+echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
+if test "${ac_cv_header_errno_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
+echo "${ECHO_T}$ac_cv_header_errno_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking errno.h usability" >&5
+echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking errno.h presence" >&5
+echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: errno.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: errno.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: errno.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: errno.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for errno.h" >&5
+echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
+if test "${ac_cv_header_errno_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_errno_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
+echo "${ECHO_T}$ac_cv_header_errno_h" >&6
+
+fi
+if test $ac_cv_header_errno_h = yes; then
+ :
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_ERRNO_H 1
+_ACEOF
+
+fi
+
+
+ if test "${ac_cv_header_float_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for float.h" >&5
+echo $ECHO_N "checking for float.h... $ECHO_C" >&6
+if test "${ac_cv_header_float_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5
+echo "${ECHO_T}$ac_cv_header_float_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking float.h usability" >&5
+echo $ECHO_N "checking float.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking float.h presence" >&5
+echo $ECHO_N "checking float.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: float.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: float.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: float.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: float.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: float.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for float.h" >&5
+echo $ECHO_N "checking for float.h... $ECHO_C" >&6
+if test "${ac_cv_header_float_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_float_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5
+echo "${ECHO_T}$ac_cv_header_float_h" >&6
+
+fi
+if test $ac_cv_header_float_h = yes; then
+ :
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_FLOAT_H 1
+_ACEOF
+
+fi
+
+
+ if test "${ac_cv_header_values_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for values.h" >&5
+echo $ECHO_N "checking for values.h... $ECHO_C" >&6
+if test "${ac_cv_header_values_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5
+echo "${ECHO_T}$ac_cv_header_values_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking values.h usability" >&5
+echo $ECHO_N "checking values.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking values.h presence" >&5
+echo $ECHO_N "checking values.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: values.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: values.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: values.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: values.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: values.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for values.h" >&5
+echo $ECHO_N "checking for values.h... $ECHO_C" >&6
+if test "${ac_cv_header_values_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_values_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5
+echo "${ECHO_T}$ac_cv_header_values_h" >&6
+
+fi
+if test $ac_cv_header_values_h = yes; then
+ :
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_VALUES_H 1
+_ACEOF
+
+fi
+
+
+ if test "${ac_cv_header_limits_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for limits.h" >&5
+echo $ECHO_N "checking for limits.h... $ECHO_C" >&6
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5
+echo "${ECHO_T}$ac_cv_header_limits_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking limits.h usability" >&5
+echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking limits.h presence" >&5
+echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: limits.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: limits.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: limits.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for limits.h" >&5
+echo $ECHO_N "checking for limits.h... $ECHO_C" >&6
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_limits_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5
+echo "${ECHO_T}$ac_cv_header_limits_h" >&6
+
+fi
+if test $ac_cv_header_limits_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIMITS_H 1
+_ACEOF
+
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_LIMITS_H 1
+_ACEOF
+
+fi
+
+
+ if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking stdlib.h usability" >&5
+echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking stdlib.h presence" >&5
+echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: stdlib.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_stdlib_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
+
+fi
+if test $ac_cv_header_stdlib_h = yes; then
+ tcl_ok=1
+else
+ tcl_ok=0
+fi
+
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "strtol" >/dev/null 2>&1; then
+ :
+else
+ tcl_ok=0
+fi
+rm -f conftest*
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "strtoul" >/dev/null 2>&1; then
+ :
+else
+ tcl_ok=0
+fi
+rm -f conftest*
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "strtod" >/dev/null 2>&1; then
+ :
+else
+ tcl_ok=0
+fi
+rm -f conftest*
+
+ if test $tcl_ok = 0; then
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_STDLIB_H 1
+_ACEOF
+
+ fi
+ if test "${ac_cv_header_string_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for string.h" >&5
+echo $ECHO_N "checking for string.h... $ECHO_C" >&6
+if test "${ac_cv_header_string_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5
+echo "${ECHO_T}$ac_cv_header_string_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking string.h usability" >&5
+echo $ECHO_N "checking string.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking string.h presence" >&5
+echo $ECHO_N "checking string.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: string.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: string.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: string.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: string.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: string.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for string.h" >&5
+echo $ECHO_N "checking for string.h... $ECHO_C" >&6
+if test "${ac_cv_header_string_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_string_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5
+echo "${ECHO_T}$ac_cv_header_string_h" >&6
+
+fi
+if test $ac_cv_header_string_h = yes; then
+ tcl_ok=1
+else
+ tcl_ok=0
+fi
+
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "strstr" >/dev/null 2>&1; then
+ :
+else
+ tcl_ok=0
+fi
+rm -f conftest*
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "strerror" >/dev/null 2>&1; then
+ :
+else
+ tcl_ok=0
+fi
+rm -f conftest*
+
+
+ # See also memmove check below for a place where NO_STRING_H can be
+ # set and why.
+
+ if test $tcl_ok = 0; then
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_STRING_H 1
+_ACEOF
+
+ fi
+
+ if test "${ac_cv_header_sys_wait_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for sys/wait.h" >&5
+echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/wait.h usability" >&5
+echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/wait.h presence" >&5
+echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/wait.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/wait.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for sys/wait.h" >&5
+echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_wait_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
+
+fi
+if test $ac_cv_header_sys_wait_h = yes; then
+ :
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_SYS_WAIT_H 1
+_ACEOF
+
+fi
+
+
+ if test "${ac_cv_header_dlfcn_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for dlfcn.h" >&5
+echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6
+if test "${ac_cv_header_dlfcn_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5
+echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking dlfcn.h usability" >&5
+echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking dlfcn.h presence" >&5
+echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for dlfcn.h" >&5
+echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6
+if test "${ac_cv_header_dlfcn_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_dlfcn_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5
+echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6
+
+fi
+if test $ac_cv_header_dlfcn_h = yes; then
+ :
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_DLFCN_H 1
+_ACEOF
+
+fi
+
+
+
+ # OS/390 lacks sys/param.h (and doesn't need it, by chance).
+
+for ac_header in sys/param.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to the vqtcl lists. ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ # Let the user call this, because if it triggers, they will
+ # need a compat/strtod.c that is correct. Users can also
+ # use Tcl_GetDouble(FromObj) instead.
+ #TEA_BUGGY_STRTOD
+ fi
+
+
+#-----------------------------------------------------------------------
+# Specify the C source files to compile in TEA_ADD_SOURCES,
+# public headers that need to be installed in TEA_ADD_HEADERS,
+# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
+# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
+# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
+# and PKG_TCL_SOURCES.
+#-----------------------------------------------------------------------
+
+
+ vars="vlerq.c"
+ for i in $vars; do
+ case $i in
+ \$*)
+ # allow $-var names
+ PKG_SOURCES="$PKG_SOURCES $i"
+ PKG_OBJECTS="$PKG_OBJECTS $i"
+ ;;
+ *)
+ # check for existence - allows for generic/win/unix VPATH
+ if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
+ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
+ ; then
+ { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5
+echo "$as_me: error: could not find source file '$i'" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ PKG_SOURCES="$PKG_SOURCES $i"
+ # this assumes it is in a VPATH dir
+ i=`basename $i`
+ # handle user calling this before or after TEA_SETUP_COMPILER
+ if test x"${OBJEXT}" != x ; then
+ j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}"
+ else
+ j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}"
+ fi
+ PKG_OBJECTS="$PKG_OBJECTS $j"
+ ;;
+ esac
+ done
+
+
+
+
+ vars=""
+ for i in $vars; do
+ # check for existence, be strict because it is installed
+ if test ! -f "${srcdir}/$i" ; then
+ { { echo "$as_me:$LINENO: error: could not find header file '${srcdir}/$i'" >&5
+echo "$as_me: error: could not find header file '${srcdir}/$i'" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ PKG_HEADERS="$PKG_HEADERS $i"
+ done
+
+
+
+ vars=""
+ for i in $vars; do
+ PKG_INCLUDES="$PKG_INCLUDES $i"
+ done
+
+
+
+ vars=""
+ for i in $vars; do
+ if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
+ # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
+ i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
+ fi
+ PKG_LIBS="$PKG_LIBS $i"
+ done
+
+
+
+ PKG_CFLAGS="$PKG_CFLAGS "
+
+
+
+ vars=""
+ for i in $vars; do
+ # check for existence - allows for generic/win/unix VPATH
+ if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
+ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
+ ; then
+ { { echo "$as_me:$LINENO: error: could not find stub source file '$i'" >&5
+echo "$as_me: error: could not find stub source file '$i'" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
+ # this assumes it is in a VPATH dir
+ i=`basename $i`
+ # handle user calling this before or after TEA_SETUP_COMPILER
+ if test x"${OBJEXT}" != x ; then
+ j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}"
+ else
+ j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}"
+ fi
+ PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
+ done
+
+
+
+
+ vars="library/m2mvfs.tcl
+ library/mkclvfs.tcl
+ library/mklite.tcl
+ library/ratcl.tcl"
+ for i in $vars; do
+ # check for existence, be strict because it is installed
+ if test ! -f "${srcdir}/$i" ; then
+ { { echo "$as_me:$LINENO: error: could not find tcl source file '${srcdir}/$i'" >&5
+echo "$as_me: error: could not find tcl source file '${srcdir}/$i'" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
+ done
+
+
+
+#--------------------------------------------------------------------
+# A few miscellaneous platform-specific items:
+#
+# Define a special symbol for Windows (BUILD_vlerq in this case) so
+# that we create the export library with the dll.
+#
+# Windows creates a few extra files that need to be cleaned up.
+# You can add more files to clean if your extension creates any extra
+# files.
+#
+# TEA_ADD_* any platform specific compiler/build info here.
+#--------------------------------------------------------------------
+
+if test "${TEA_PLATFORM}" = "windows" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_vlerq 1
+_ACEOF
+
+ CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc*.pch"
+ #TEA_ADD_SOURCES([win/winFile.c])
+ #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
+else
+ CLEANFILES=""
+ #TEA_ADD_SOURCES([unix/unixFile.c])
+ #TEA_ADD_LIBS([-lsuperfly])
+fi
+
+
+#--------------------------------------------------------------------
+# Choose which headers you need. Extension authors should try very
+# hard to only rely on the Tcl public header files. Internal headers
+# contain private data structures and are subject to change without
+# notice.
+# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
+#--------------------------------------------------------------------
+
+
+ echo "$as_me:$LINENO: checking for Tcl public headers" >&5
+echo $ECHO_N "checking for Tcl public headers... $ECHO_C" >&6
+
+
+# Check whether --with-tclinclude or --without-tclinclude was given.
+if test "${with_tclinclude+set}" = set; then
+ withval="$with_tclinclude"
+ with_tclinclude=${withval}
+fi;
+
+ if test "${ac_cv_c_tclh+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ # Use the value from --with-tclinclude, if it was given
+
+ if test x"${with_tclinclude}" != x ; then
+ if test -f "${with_tclinclude}/tcl.h" ; then
+ ac_cv_c_tclh=${with_tclinclude}
+ else
+ { { echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain tcl.h" >&5
+echo "$as_me: error: ${with_tclinclude} directory does not contain tcl.h" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ else
+ if test "`uname -s`" = "Darwin"; then
+ # If Tcl was built as a framework, attempt to use
+ # the framework's Headers directory
+ case ${TCL_DEFS} in
+ *TCL_FRAMEWORK*)
+ list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
+ ;;
+ esac
+ fi
+
+ # Look in the source dir only if Tcl is not installed,
+ # and in that situation, look there before installed locations.
+ if test -f "${TCL_BIN_DIR}/Makefile" ; then
+ list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
+ fi
+
+ # Check order: pkg --prefix location, Tcl's --prefix location,
+ # relative to directory of tclConfig.sh.
+
+ eval "temp_includedir=${includedir}"
+ list="$list \
+ `ls -d ${temp_includedir} 2>/dev/null` \
+ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
+ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
+ if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
+ list="$list /usr/local/include /usr/include"
+ if test x"${TCL_INCLUDE_SPEC}" != x ; then
+ d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
+ list="$list `ls -d ${d} 2>/dev/null`"
+ fi
+ fi
+ for i in $list ; do
+ if test -f "$i/tcl.h" ; then
+ ac_cv_c_tclh=$i
+ break
+ fi
+ done
+ fi
+
+fi
+
+
+ # Print a message based on how we determined the include path
+
+ if test x"${ac_cv_c_tclh}" = x ; then
+ { { echo "$as_me:$LINENO: error: tcl.h not found. Please specify its location with --with-tclinclude" >&5
+echo "$as_me: error: tcl.h not found. Please specify its location with --with-tclinclude" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ echo "$as_me:$LINENO: result: ${ac_cv_c_tclh}" >&5
+echo "${ECHO_T}${ac_cv_c_tclh}" >&6
+ fi
+
+ # Convert to a native path and substitute into the output files.
+
+ INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
+
+ TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
+
+
+
+#TEA_PRIVATE_TCL_HEADERS
+
+#TEA_PUBLIC_TK_HEADERS
+#TEA_PRIVATE_TK_HEADERS
+#TEA_PATH_X
+
+#--------------------------------------------------------------------
+# Check whether --enable-threads or --disable-threads was given.
+# This auto-enables if Tcl was compiled threaded.
+#--------------------------------------------------------------------
+
+
+ # Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ tcl_ok=$enableval
+else
+ tcl_ok=yes
+fi;
+
+ if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ tcl_ok=$enableval
+ else
+ tcl_ok=yes
+ fi
+
+ if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
+ TCL_THREADS=1
+
+ if test "${TEA_PLATFORM}" != "windows" ; then
+ # We are always OK on Windows, so check what this platform wants:
+
+ # USE_THREAD_ALLOC tells us to try the special thread-based
+ # allocator that significantly reduces lock contention
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_THREAD_ALLOC 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _REENTRANT 1
+_ACEOF
+
+ if test "`uname -s`" = "SunOS" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_PTHREAD_SEMANTICS 1
+_ACEOF
+
+ fi
+
+cat >>confdefs.h <<\_ACEOF
+#define _THREAD_SAFE 1
+_ACEOF
+
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pthread_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthread_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6
+if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "no"; then
+ # Check a little harder for __pthread_mutex_init in the same
+ # library, as some systems hide it there until pthread.h is
+ # defined. We could alternatively do an AC_TRY_COMPILE with
+ # pthread.h, but that will work with libpthread really doesn't
+ # exist, like AIX 4.2. [Bug: 4359]
+ echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5
+echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char __pthread_mutex_init ();
+int
+main ()
+{
+__pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pthread___pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthread___pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6
+if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthread"
+ else
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6
+if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthreads $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pthreads_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthreads_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6
+if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthreads"
+ else
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6
+if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_c_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6
+if test $ac_cv_lib_c_pthread_mutex_init = yes; then
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "no"; then
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6
+if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc_r $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_c_r_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_r_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6
+if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -pthread"
+ else
+ TCL_THREADS=0
+ { echo "$as_me:$LINENO: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&5
+echo "$as_me: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&2;}
+ fi
+ fi
+ fi
+ fi
+ fi
+ else
+ TCL_THREADS=0
+ fi
+ # Do checking message here to not mess up interleaved configure output
+ echo "$as_me:$LINENO: checking for building with threads" >&5
+echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
+ if test "${TCL_THREADS}" = 1; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_THREADS 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes (default)" >&5
+echo "${ECHO_T}yes (default)" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+ # TCL_THREADS sanity checking. See if our request for building with
+ # threads is the same as the way Tcl was built. If not, warn the user.
+ case ${TCL_DEFS} in
+ *THREADS=1*)
+ if test "${TCL_THREADS}" = "0"; then
+ { echo "$as_me:$LINENO: WARNING:
+ Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
+ that IS thread-enabled. It is recommended to use --enable-threads." >&5
+echo "$as_me: WARNING:
+ Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
+ that IS thread-enabled. It is recommended to use --enable-threads." >&2;}
+ fi
+ ;;
+ *)
+ if test "${TCL_THREADS}" = "1"; then
+ { echo "$as_me:$LINENO: WARNING:
+ --enable-threads requested, but building against a Tcl that is NOT
+ thread-enabled. This is an OK configuration that will also run in
+ a thread-enabled core." >&5
+echo "$as_me: WARNING:
+ --enable-threads requested, but building against a Tcl that is NOT
+ thread-enabled. This is an OK configuration that will also run in
+ a thread-enabled core." >&2;}
+ fi
+ ;;
+ esac
+
+
+
+#--------------------------------------------------------------------
+# The statement below defines a collection of symbols related to
+# building as a shared library instead of a static library.
+#--------------------------------------------------------------------
+
+
+ echo "$as_me:$LINENO: checking how to build libraries" >&5
+echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6
+ # Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ tcl_ok=$enableval
+else
+ tcl_ok=yes
+fi;
+
+ if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ tcl_ok=$enableval
+ else
+ tcl_ok=yes
+ fi
+
+ if test "$tcl_ok" = "yes" ; then
+ echo "$as_me:$LINENO: result: shared" >&5
+echo "${ECHO_T}shared" >&6
+ SHARED_BUILD=1
+ else
+ echo "$as_me:$LINENO: result: static" >&5
+echo "${ECHO_T}static" >&6
+ SHARED_BUILD=0
+
+cat >>confdefs.h <<\_ACEOF
+#define STATIC_BUILD 1
+_ACEOF
+
+ fi
+
+
+
+#--------------------------------------------------------------------
+# This macro figures out what flags to use with the compiler/linker
+# when building shared/static debug/optimized objects. This information
+# can be taken from the tclConfig.sh file, but this figures it all out.
+#--------------------------------------------------------------------
+
+
+
+
+ # Step 0.a: Enable 64 bit support?
+
+ echo "$as_me:$LINENO: checking if 64bit support is requested" >&5
+echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6
+ # Check whether --enable-64bit or --disable-64bit was given.
+if test "${enable_64bit+set}" = set; then
+ enableval="$enable_64bit"
+ do64bit=$enableval
+else
+ do64bit=no
+fi;
+ echo "$as_me:$LINENO: result: $do64bit" >&5
+echo "${ECHO_T}$do64bit" >&6
+
+ # Step 0.b: Enable Solaris 64 bit VIS support?
+
+ echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5
+echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6
+ # Check whether --enable-64bit-vis or --disable-64bit-vis was given.
+if test "${enable_64bit_vis+set}" = set; then
+ enableval="$enable_64bit_vis"
+ do64bitVIS=$enableval
+else
+ do64bitVIS=no
+fi;
+ echo "$as_me:$LINENO: result: $do64bitVIS" >&5
+echo "${ECHO_T}$do64bitVIS" >&6
+
+ if test "$do64bitVIS" = "yes"; then
+ # Force 64bit on with VIS
+ do64bit=yes
+ fi
+
+ # Step 0.c: Cross-compiling options for Windows/CE builds?
+
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5
+echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6
+ # Check whether --enable-wince or --disable-wince was given.
+if test "${enable_wince+set}" = set; then
+ enableval="$enable_wince"
+ doWince=$enableval
+else
+ doWince=no
+fi;
+ echo "$as_me:$LINENO: result: $doWince" >&5
+echo "${ECHO_T}$doWince" >&6
+ fi
+
+ # Step 1: set the variable "system" to hold the name and version number
+ # for the system.
+
+
+ echo "$as_me:$LINENO: checking system version" >&5
+echo $ECHO_N "checking system version... $ECHO_C" >&6
+if test "${tcl_cv_sys_version+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ tcl_cv_sys_version=windows
+ elif test -f /usr/lib/NextStep/software_version; then
+ tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+ tcl_cv_sys_version=`uname -s`-`uname -r`
+ if test "$?" -ne 0 ; then
+ { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5
+echo "$as_me: WARNING: can't find uname command" >&2;}
+ tcl_cv_sys_version=unknown
+ else
+ # Special check for weird MP-RAS system (uname returns weird
+ # results, and the version is kept in special file).
+
+ if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid`
+ fi
+ if test "`uname -s`" = "AIX" ; then
+ tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
+ fi
+ fi
+ fi
+
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5
+echo "${ECHO_T}$tcl_cv_sys_version" >&6
+ system=$tcl_cv_sys_version
+
+
+ # Step 2: check for existence of -ldl library. This is needed because
+ # Linux can use either -ldl or -ldld for dynamic loading.
+
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+ have_dl=yes
+else
+ have_dl=no
+fi
+
+
+ # Require ranlib early so we can override it in special cases below.
+
+
+
+ # Step 3: set configuration options based on system name and version.
+ # This is similar to Tcl's unix/tcl.m4 except that we've added a
+ # "windows" case.
+
+ do64bit_ok=no
+ LDFLAGS_ORIG="$LDFLAGS"
+ # When ld needs options to work in 64-bit mode, put them in
+ # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
+ # is disabled by the user. [Bug 1016796]
+ LDFLAGS_ARCH=""
+ TCL_EXPORT_FILE_SUFFIX=""
+ UNSHARED_LIB_SUFFIX=""
+ TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
+ ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
+ TCL_LIB_VERSIONS_OK=ok
+ CFLAGS_DEBUG=-g
+ CFLAGS_OPTIMIZE=-O
+ if test "$GCC" = "yes" ; then
+ CFLAGS_OPTIMIZE=-O2
+ CFLAGS_WARNING="-Wall -Wno-implicit-int"
+ else
+ CFLAGS_WARNING=""
+ fi
+ TCL_NEEDS_EXP_FILE=0
+ TCL_BUILD_EXP_FILE=""
+ TCL_EXP_FILE=""
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STLIB_LD='${AR} cr'
+ LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
+ case $system in
+ windows)
+ # This is a 2-stage check to make sure we have the 64-bit SDK
+ # We have to know where the SDK is installed.
+ # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
+ # MACHINE is IX86 for LINK, but this is used by the manifest,
+ # which requires x86|amd64|ia64.
+ MACHINE="X86"
+ if test "$do64bit" != "no" ; then
+ if test "x${MSSDK}x" = "xx" ; then
+ MSSDK="C:/Progra~1/Microsoft Platform SDK"
+ fi
+ MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
+ PATH64=""
+ case "$do64bit" in
+ amd64|x64|yes)
+ MACHINE="AMD64" ; # default to AMD64 64-bit build
+ PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
+ ;;
+ ia64)
+ MACHINE="IA64"
+ PATH64="${MSSDK}/Bin/Win64"
+ ;;
+ esac
+ if test ! -d "${PATH64}" ; then
+ { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5
+echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Ensure latest Platform SDK is installed" >&5
+echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;}
+ do64bit="no"
+ else
+ echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
+echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ do64bit_ok="yes"
+ fi
+ fi
+
+ if test "$doWince" != "no" ; then
+ if test "$do64bit" != "no" ; then
+ { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5
+echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ if test "$GCC" = "yes" ; then
+ { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5
+echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-celib
+
+ if test x"${no_celib}" = x ; then
+ # we reset no_celib in case something fails here
+ no_celib=true
+
+# Check whether --with-celib or --without-celib was given.
+if test "${with_celib+set}" = set; then
+ withval="$with_celib"
+ with_celibconfig=${withval}
+fi;
+ echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5
+echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6
+ if test "${ac_cv_c_celibconfig+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ # First check to see if --with-celibconfig was specified.
+ if test x"${with_celibconfig}" != x ; then
+ if test -d "${with_celibconfig}/inc" ; then
+ ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
+ else
+ { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5
+echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+
+ # then check for a celib library
+ if test x"${ac_cv_c_celibconfig}" = x ; then
+ for i in \
+ ../celib-palm-3.0 \
+ ../celib \
+ ../../celib-palm-3.0 \
+ ../../celib \
+ `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \
+ ${srcdir}/../celib-palm-3.0 \
+ ${srcdir}/../celib \
+ `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \
+ ; do
+ if test -d "$i/inc" ; then
+ ac_cv_c_celibconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+fi
+
+ if test x"${ac_cv_c_celibconfig}" = x ; then
+ { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5
+echo "$as_me: error: Cannot find celib support library directory" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ no_celib=
+ CELIB_DIR=${ac_cv_c_celibconfig}
+ CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
+ echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5
+echo "${ECHO_T}found $CELIB_DIR" >&6
+ fi
+ fi
+
+ # Set defaults for common evc4/PPC2003 setup
+ # Currently Tcl requires 300+, possibly 420+ for sockets
+ CEVERSION=420; # could be 211 300 301 400 420 ...
+ TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
+ ARCH=ARM; # could be ARM MIPS X86EM ...
+ PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
+ if test "$doWince" != "yes"; then
+ # If !yes then the user specified something
+ # Reset ARCH to allow user to skip specifying it
+ ARCH=
+ eval `echo $doWince | awk -F, '{ \
+ if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \
+ if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
+ if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \
+ if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \
+ if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \
+ }'`
+ if test "x${ARCH}" = "x" ; then
+ ARCH=$TARGETCPU;
+ fi
+ fi
+ OSVERSION=WCE$CEVERSION;
+ if test "x${WCEROOT}" = "x" ; then
+ WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
+ if test ! -d "${WCEROOT}" ; then
+ WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
+ fi
+ fi
+ if test "x${SDKROOT}" = "x" ; then
+ SDKROOT="C:/Program Files/Windows CE Tools"
+ if test ! -d "${SDKROOT}" ; then
+ SDKROOT="C:/Windows CE Tools"
+ fi
+ fi
+ WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
+ SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
+ if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
+ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
+ { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5
+echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;}
+ { (exit 1); exit 1; }; }
+ doWince="no"
+ else
+ # We could PATH_NOSPACE these, but that's not important,
+ # as long as we quote them when used.
+ CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
+ if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
+ CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
+ fi
+ CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
+ fi
+ fi
+
+ if test "$GCC" != "yes" ; then
+ if test "${SHARED_BUILD}" = "0" ; then
+ runtime=-MT
+ else
+ runtime=-MD
+ fi
+
+ if test "$do64bit" != "no" ; then
+ # All this magic is necessary for the Win64 SDK RC1 - hobbs
+ CC="\"${PATH64}/cl.exe\""
+ CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
+ RC="\"${MSSDK}/bin/rc.exe\""
+ lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
+ LINKBIN="\"${PATH64}/link.exe\""
+ CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
+ CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
+ # Avoid 'unresolved external symbol __security_cookie'
+ # errors, c.f. http://support.microsoft.com/?id=894573
+
+ vars="bufferoverflowU.lib"
+ for i in $vars; do
+ if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
+ # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
+ i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
+ fi
+ PKG_LIBS="$PKG_LIBS $i"
+ done
+
+
+ elif test "$doWince" != "no" ; then
+ CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
+ if test "${TARGETCPU}" = "X86"; then
+ CC="\"${CEBINROOT}/cl.exe\""
+ else
+ CC="\"${CEBINROOT}/cl${ARCH}.exe\""
+ fi
+ CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
+ RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
+ arch=`echo ${ARCH} | awk '{print tolower($0)}'`
+ defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
+ if test "${SHARED_BUILD}" = "1" ; then
+ # Static CE builds require static celib as well
+ defs="${defs} _DLL"
+ fi
+ for i in $defs ; do
+
+cat >>confdefs.h <<_ACEOF
+#define $i 1
+_ACEOF
+
+ done
+
+cat >>confdefs.h <<_ACEOF
+#define _WIN32_WCE $CEVERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define UNDER_CE $CEVERSION
+_ACEOF
+
+ CFLAGS_DEBUG="-nologo -Zi -Od"
+ CFLAGS_OPTIMIZE="-nologo -Ox"
+ lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
+ lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
+ LINKBIN="\"${CEBINROOT}/link.exe\""
+
+ else
+ RC="rc"
+ lflags="-nologo"
+ LINKBIN="link"
+ CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
+ CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
+ fi
+ fi
+
+ if test "$GCC" = "yes"; then
+ # mingw gcc mode
+ RC="windres"
+ CFLAGS_DEBUG="-g"
+ CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
+ SHLIB_LD="$CC -shared"
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
+ LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
+ else
+ SHLIB_LD="${LINKBIN} -dll ${lflags}"
+ # link -lib only works when -lib is the first arg
+ STLIB_LD="${LINKBIN} -lib ${lflags}"
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
+ PATHTYPE=-w
+ # For information on what debugtype is most useful, see:
+ # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
+ # This essentially turns it all on.
+ LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2"
+ LDFLAGS_OPTIMIZE="-release"
+ if test "$doWince" != "no" ; then
+ LDFLAGS_CONSOLE="-link ${lflags}"
+ LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
+ else
+ LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
+ LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
+ fi
+ fi
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".dll"
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
+
+ TCL_LIB_VERSIONS_OK=nodots
+ # Bogus to avoid getting this turned off
+ DL_OBJS="tclLoadNone.obj"
+ ;;
+ AIX-*)
+ if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
+ # AIX requires the _r compiler when gcc isn't being used
+ case "${CC}" in
+ *_r)
+ # ok ...
+ ;;
+ *)
+ CC=${CC}_r
+ ;;
+ esac
+ echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5
+echo "${ECHO_T}Using $CC for compiling with threads" >&6
+ fi
+ LIBS="$LIBS -lc"
+ SHLIB_CFLAGS=""
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ DL_OBJS="tclLoadDl.o"
+ LD_LIBRARY_PATH_VAR="LIBPATH"
+
+ # Check to enable 64-bit flags for compiler/linker on AIX 4+
+ if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
+ if test "$GCC" = "yes" ; then
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -q64"
+ LDFLAGS_ARCH="-q64"
+ RANLIB="${RANLIB} -X64"
+ AR="${AR} -X64"
+ SHLIB_LD_FLAGS="-b64"
+ fi
+ fi
+
+ if test "`uname -m`" = "ia64" ; then
+ # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ # AIX-5 has dl* in libc.so
+ DL_LIBS=""
+ if test "$GCC" = "yes" ; then
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ else
+ CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
+ fi
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ else
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="gcc -shared"
+ else
+ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ fi
+ SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ TCL_NEEDS_EXP_FILE=1
+ TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp'
+ fi
+
+ # AIX v<=4.1 has some different flags than 4.2+
+ if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
+ case $LIBOBJS in
+ "tclLoadAix.$ac_objext" | \
+ *" tclLoadAix.$ac_objext" | \
+ "tclLoadAix.$ac_objext "* | \
+ *" tclLoadAix.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" ;;
+esac
+
+ DL_LIBS="-lld"
+ fi
+
+ # On AIX <=v4 systems, libbsd.a has to be linked in to support
+ # non-blocking file IO. This library has to be linked in after
+ # the MATH_LIBS or it breaks the pow() function. The way to
+ # insure proper sequencing, is to add it to the tail of MATH_LIBS.
+ # This library also supplies gettimeofday.
+ #
+ # AIX does not have a timezone field in struct tm. When the AIX
+ # bsd library is used, the timezone global and the gettimeofday
+ # methods are to be avoided for timezone deduction instead, we
+ # deduce the timezone by comparing the localtime result on a
+ # known GMT value.
+
+ echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5
+echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6
+if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbsd $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gettimeofday ();
+int
+main ()
+{
+gettimeofday ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_bsd_gettimeofday=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_bsd_gettimeofday=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5
+echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6
+if test $ac_cv_lib_bsd_gettimeofday = yes; then
+ libbsd=yes
+else
+ libbsd=no
+fi
+
+ if test $libbsd = yes; then
+ MATH_LIBS="$MATH_LIBS -lbsd"
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_DELTA_FOR_TZ 1
+_ACEOF
+
+ fi
+ ;;
+ BeOS*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="${CC} -nostart"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+
+ #-----------------------------------------------------------
+ # Check for inet_ntoa in -lbind, for BeOS (which also needs
+ # -lsocket, even if the network functions are in -lnet which
+ # is always linked to, for compatibility.
+ #-----------------------------------------------------------
+ echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5
+echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6
+if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbind $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char inet_ntoa ();
+int
+main ()
+{
+inet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_bind_inet_ntoa=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_bind_inet_ntoa=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6
+if test $ac_cv_lib_bind_inet_ntoa = yes; then
+ LIBS="$LIBS -lbind -lsocket"
+fi
+
+ ;;
+ BSD/OS-2.1*|BSD/OS-3*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="shlicc -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ BSD/OS-4.*)
+ SHLIB_CFLAGS="-export-dynamic -fPIC"
+ SHLIB_LD="cc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ dgux*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ HP-UX-*.11.*)
+ # Use updated header definitions where possible
+
+cat >>confdefs.h <<\_ACEOF
+#define _XOPEN_SOURCE_EXTENDED 1
+_ACEOF
+
+ # Needed by Tcl, but not most extensions
+ #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
+ #LIBS="$LIBS -lxnet" # Use the XOPEN network library
+
+ SHLIB_SUFFIX=".sl"
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
+ LD_LIBRARY_PATH_VAR="SHLIB_PATH"
+ fi
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="gcc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ fi
+
+ # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
+ #CFLAGS="$CFLAGS +DAportable"
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = "yes" ; then
+ if test "$GCC" = "yes" ; then
+ hpux_arch=`${CC} -dumpmachine`
+ case $hpux_arch in
+ hppa64*)
+ # 64-bit gcc in use. Fix flags for GNU ld.
+ do64bit_ok=yes
+ SHLIB_LD="${CC} -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ ;;
+ *)
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
+ ;;
+ esac
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS +DD64"
+ LDFLAGS_ARCH="+DD64"
+ fi
+ fi
+ ;;
+ HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
+ SHLIB_SUFFIX=".sl"
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS=""
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
+ LD_LIBRARY_PATH_VAR="SHLIB_PATH"
+ fi
+ ;;
+ IRIX-5.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ ;;
+ IRIX-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -mabi=n32"
+ LDFLAGS="$LDFLAGS -mabi=n32"
+ else
+ case $system in
+ IRIX-6.3)
+ # Use to build 6.2 compatible binaries on 6.3.
+ CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
+ ;;
+ *)
+ CFLAGS="$CFLAGS -n32"
+ ;;
+ esac
+ LDFLAGS="$LDFLAGS -n32"
+ fi
+ ;;
+ IRIX64-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+
+ # Check to enable 64-bit flags for compiler/linker
+
+ if test "$do64bit" = "yes" ; then
+ if test "$GCC" = "yes" ; then
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5
+echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;}
+ else
+ do64bit_ok=yes
+ SHLIB_LD="ld -64 -shared -rdata_shared"
+ CFLAGS="$CFLAGS -64"
+ LDFLAGS_ARCH="-64"
+ fi
+ fi
+ ;;
+ Linux*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
+ # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
+ # when you inline the string and math operations. Turn this off to
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
+ # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS here:
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "`uname -m`" = "alpha" ; then
+ CFLAGS="$CFLAGS -mieee"
+ fi
+ if test $do64bit = yes; then
+ echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_m64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -m64"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_cc_m64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_m64=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5
+echo "${ECHO_T}$tcl_cv_cc_m64" >&6
+ if test $tcl_cv_cc_m64 = yes; then
+ CFLAGS="$CFLAGS -m64"
+ do64bit_ok=yes
+ fi
+ fi
+
+ # The combo of gcc + glibc has a bug related
+ # to inlining of functions like strtod(). The
+ # -fno-builtin flag should address this problem
+ # but it does not work. The -fno-inline flag
+ # is kind of overkill but it works.
+ # Disable inlining only when one of the
+ # files in compat/*.c is being linked in.
+ if test x"${USE_COMPAT}" != x ; then
+ CFLAGS="$CFLAGS -fno-inline"
+ fi
+
+ ;;
+ GNU*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ SHLIB_LD="${CC} -shared"
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ if test "`uname -m`" = "alpha" ; then
+ CFLAGS="$CFLAGS -mieee"
+ fi
+ ;;
+ Lynx*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ CFLAGS_OPTIMIZE=-02
+ SHLIB_LD="${CC} -shared "
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-mshared -ldl"
+ LD_FLAGS="-Wl,--export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ ;;
+ MP-RAS-02*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ MP-RAS-*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ NetBSD-*|FreeBSD-[1-2].*)
+ # NetBSD/SPARC needs -fPIC, -fpic will not do.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ echo "$as_me:$LINENO: checking for ELF" >&5
+echo $ECHO_N "checking for ELF... $ECHO_C" >&6
+if test "${tcl_cv_ld_elf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#ifdef __ELF__
+ yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes" >/dev/null 2>&1; then
+ tcl_cv_ld_elf=yes
+else
+ tcl_cv_ld_elf=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
+echo "${ECHO_T}$tcl_cv_ld_elf" >&6
+ if test $tcl_cv_ld_elf = yes; then
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
+ else
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
+ fi
+
+ # Ancient FreeBSD doesn't handle version numbers with dots.
+
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ OpenBSD-*)
+ # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
+ case `machine` in
+ sparc|sparc64)
+ SHLIB_CFLAGS="-fPIC";;
+ *)
+ SHLIB_CFLAGS="-fpic";;
+ esac
+ SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
+ echo "$as_me:$LINENO: checking for ELF" >&5
+echo $ECHO_N "checking for ELF... $ECHO_C" >&6
+if test "${tcl_cv_ld_elf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#ifdef __ELF__
+ yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes" >/dev/null 2>&1; then
+ tcl_cv_ld_elf=yes
+else
+ tcl_cv_ld_elf=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
+echo "${ECHO_T}$tcl_cv_ld_elf" >&6
+ if test $tcl_cv_ld_elf = yes; then
+ LDFLAGS=-Wl,-export-dynamic
+ else
+ LDFLAGS=""
+ fi
+
+ # OpenBSD doesn't do version numbers with dots.
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ FreeBSD-*)
+ # FreeBSD 3.* and greater have ELF.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "${TCL_THREADS}" = "1" ; then
+ # The -pthread needs to go in the CFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ fi
+ case $system in
+ FreeBSD-3.*)
+ # FreeBSD-3 doesn't handle version numbers with dots.
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ esac
+ ;;
+ Darwin-*)
+ CFLAGS_OPTIMIZE="-Os"
+ SHLIB_CFLAGS="-fno-common"
+ if test $do64bit = yes; then
+ case `arch` in
+ ppc)
+ echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_arch_ppc64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_cc_arch_ppc64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_arch_ppc64=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5
+echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6
+ if test $tcl_cv_cc_arch_ppc64 = yes; then
+ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
+ do64bit_ok=yes
+ fi;;
+ i386)
+ echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_arch_x86_64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -arch x86_64"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_cc_arch_x86_64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_arch_x86_64=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5
+echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6
+ if test $tcl_cv_cc_arch_x86_64 = yes; then
+ CFLAGS="$CFLAGS -arch x86_64"
+ do64bit_ok=yes
+ fi;;
+ *)
+ { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5
+echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};;
+ esac
+ else
+ # Check for combined 32-bit and 64-bit fat build
+ echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
+ echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
+ fat_32_64=yes
+ fi
+ # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS here:
+ SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
+ echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5
+echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_single_module+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+int i;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_ld_single_module=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_single_module=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$hold_ldflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5
+echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
+ if test $tcl_cv_ld_single_module = yes; then
+ SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
+ fi
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".dylib"
+ DL_OBJS="tclLoadDyld.o"
+ DL_LIBS=""
+ # Don't use -prebind when building for Mac OS X 10.4 or later only:
+ test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \
+ "`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \
+ LDFLAGS="$LDFLAGS -prebind"
+ LDFLAGS="$LDFLAGS -headerpad_max_install_names"
+ echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
+echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_search_paths_first+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+int i;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_ld_search_paths_first=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_search_paths_first=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$hold_ldflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5
+echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6
+ if test $tcl_cv_ld_search_paths_first = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
+ fi
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
+
+ # TEA specific: for Tk extensions, remove 64-bit arch flags from
+ # CFLAGS for combined 32-bit and 64-bit fat builds as neither TkAqua
+ # nor TkX11 can be built for 64-bit at present.
+ test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}" && \
+ CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`"
+ ;;
+ NEXTSTEP-*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="cc -nostdlib -r"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadNext.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OS/390-*)
+ CFLAGS_OPTIMIZE="" # Optimizer is buggy
+
+cat >>confdefs.h <<\_ACEOF
+#define _OE_SOCKETS 1
+_ACEOF
+
+ ;;
+ OSF1-1.0|OSF1-1.1|OSF1-1.2)
+ # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
+ SHLIB_CFLAGS=""
+ # Hack: make package name same as library name
+ SHLIB_LD='ld -R -export :'
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadOSF.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-1.*)
+ # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
+ SHLIB_CFLAGS="-fPIC"
+ if test "$SHARED_BUILD" = "1" ; then
+ SHLIB_LD="ld -shared"
+ else
+ SHLIB_LD="ld -non_shared"
+ fi
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-V*)
+ # Digital OSF/1
+ SHLIB_CFLAGS=""
+ if test "$SHARED_BUILD" = "1" ; then
+ SHLIB_LD='ld -shared -expect_unresolved "*"'
+ else
+ SHLIB_LD='ld -non_shared -expect_unresolved "*"'
+ fi
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -mieee"
+ else
+ CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
+ fi
+ # see pthread_intro(3) for pthread support on osf1, k.furukawa
+ if test "${TCL_THREADS}" = "1" ; then
+ CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
+ CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+ LIBS=`echo $LIBS | sed s/-lpthreads//`
+ if test "$GCC" = "yes" ; then
+ LIBS="$LIBS -lpthread -lmach -lexc"
+ else
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ fi
+ fi
+
+ ;;
+ QNX-6*)
+ # QNX RTP
+ # This may work for all QNX, but it was only reported for v6.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ # dlopen is in -lc on QNX
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SCO_SV-3.2*)
+ # Note, dlopen is available only on SCO 3.2.5 and greater. However,
+ # this test works, since "uname -s" was non-standard in 3.2.4 and
+ # below.
+ if test "$GCC" = "yes" ; then
+ SHLIB_CFLAGS="-fPIC -melf"
+ LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
+ else
+ SHLIB_CFLAGS="-Kpic -belf"
+ LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
+ fi
+ SHLIB_LD="ld -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SINIX*5.4*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SunOS-4*)
+ SHLIB_CFLAGS="-PIC"
+ SHLIB_LD="ld"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+
+ # SunOS can't handle version numbers with dots in them in library
+ # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
+ # requires an extra version number at the end of .so file names.
+ # So, the library has to have a name like libtcl75.so.1.0
+
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ SunOS-5.[0-6])
+ # Careful to not let 5.10+ fall into this case
+
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _REENTRANT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_PTHREAD_SEMANTICS 1
+_ACEOF
+
+
+ SHLIB_CFLAGS="-KPIC"
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="$CC -shared"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ else
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ fi
+ ;;
+ SunOS-5*)
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _REENTRANT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_PTHREAD_SEMANTICS 1
+_ACEOF
+
+
+ SHLIB_CFLAGS="-KPIC"
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = "yes" ; then
+ arch=`isainfo`
+ if test "$arch" = "sparcv9 sparc" ; then
+ if test "$GCC" = "yes" ; then
+ if test "`gcc -dumpversion | awk -F. '{print $1}'`" -lt "3" ; then
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;}
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -m64 -mcpu=v9"
+ LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+ SHLIB_CFLAGS="-fPIC"
+ fi
+ else
+ do64bit_ok=yes
+ if test "$do64bitVIS" = "yes" ; then
+ CFLAGS="$CFLAGS -xarch=v9a"
+ LDFLAGS_ARCH="-xarch=v9a"
+ else
+ CFLAGS="$CFLAGS -xarch=v9"
+ LDFLAGS_ARCH="-xarch=v9"
+ fi
+ # Solaris 64 uses this as well
+ #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
+ fi
+ elif test "$arch" = "amd64 i386" ; then
+ if test "$GCC" = "yes" ; then
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -xarch=amd64"
+ LDFLAGS="$LDFLAGS -xarch=amd64"
+ fi
+ else
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5
+echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;}
+ fi
+ fi
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="$CC -shared"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "$do64bit_ok" = "yes" ; then
+ # We need to specify -static-libgcc or we need to
+ # add the path to the sparv9 libgcc.
+ # JH: static-libgcc is necessary for core Tcl, but may
+ # not be necessary for extensions.
+ SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
+ # for finding sparcv9 libgcc, get the regular libgcc
+ # path, remove so name and append 'sparcv9'
+ #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
+ #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
+ fi
+ else
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ fi
+ ;;
+ UNIX_SV* | UnixWare-5*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
+ # that don't grok the -Bexport option. Test that it does.
+ echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5
+echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_Bexport+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+int i;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_ld_Bexport=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_Bexport=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$hold_ldflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5
+echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6
+ if test $tcl_cv_ld_Bexport = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ fi
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ esac
+
+ if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+ { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5
+echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;}
+ fi
+
+ # Step 4: disable dynamic loading if requested via a command-line switch.
+
+ # Check whether --enable-load or --disable-load was given.
+if test "${enable_load+set}" = set; then
+ enableval="$enable_load"
+ tcl_ok=$enableval
+else
+ tcl_ok=yes
+fi;
+ if test "$tcl_ok" = "no"; then
+ DL_OBJS=""
+ fi
+
+ if test "x$DL_OBJS" != "x" ; then
+ BUILD_DLTEST="\$(DLTEST_TARGETS)"
+ else
+ echo "Can't figure out how to do dynamic loading or shared libraries"
+ echo "on this system."
+ SHLIB_CFLAGS=""
+ SHLIB_LD=""
+ SHLIB_SUFFIX=""
+ DL_OBJS="tclLoadNone.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS_ORIG"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ BUILD_DLTEST=""
+ fi
+ LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
+
+ # If we're running gcc, then change the C flags for compiling shared
+ # libraries to the right flags for gcc, instead of those for the
+ # standard manufacturer compiler.
+
+ if test "$DL_OBJS" != "tclLoadNone.o" ; then
+ if test "$GCC" = "yes" ; then
+ case $system in
+ AIX-*)
+ ;;
+ BSD/OS*)
+ ;;
+ IRIX*)
+ ;;
+ NetBSD-*|FreeBSD-*)
+ ;;
+ Darwin-*)
+ ;;
+ SCO_SV-3.2*)
+ ;;
+ windows)
+ ;;
+ *)
+ SHLIB_CFLAGS="-fPIC"
+ ;;
+ esac
+ fi
+ fi
+
+ if test "$SHARED_LIB_SUFFIX" = "" ; then
+ SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
+ fi
+ if test "$UNSHARED_LIB_SUFFIX" = "" ; then
+ UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
+ fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # These must be called after we do the basic CFLAGS checks and
+ # verify any possible 64-bit or similar switches are necessary
+
+ echo "$as_me:$LINENO: checking for required early compiler flags" >&5
+echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6
+ tcl_flags=""
+
+ if test "${tcl_cv_flag__isoc99_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+int
+main ()
+{
+char *p = (char *)strtoll; char *q = (char *)strtoull;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_flag__isoc99_source=no
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _ISOC99_SOURCE 1
+#include
+int
+main ()
+{
+char *p = (char *)strtoll; char *q = (char *)strtoull;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_flag__isoc99_source=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__isoc99_source=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _ISOC99_SOURCE 1
+_ACEOF
+
+ tcl_flags="$tcl_flags _ISOC99_SOURCE"
+ fi
+
+
+ if test "${tcl_cv_flag__largefile64_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+int
+main ()
+{
+struct stat64 buf; int i = stat64("/", &buf);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_flag__largefile64_source=no
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _LARGEFILE64_SOURCE 1
+#include
+int
+main ()
+{
+struct stat64 buf; int i = stat64("/", &buf);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_flag__largefile64_source=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__largefile64_source=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _LARGEFILE64_SOURCE 1
+_ACEOF
+
+ tcl_flags="$tcl_flags _LARGEFILE64_SOURCE"
+ fi
+
+
+ if test "${tcl_cv_flag__largefile_source64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+int
+main ()
+{
+char *p = (char *)open64;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_flag__largefile_source64=no
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _LARGEFILE_SOURCE64 1
+#include
+int
+main ()
+{
+char *p = (char *)open64;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_flag__largefile_source64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__largefile_source64=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _LARGEFILE_SOURCE64 1
+_ACEOF
+
+ tcl_flags="$tcl_flags _LARGEFILE_SOURCE64"
+ fi
+
+ if test "x${tcl_flags}" = "x" ; then
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
+ else
+ echo "$as_me:$LINENO: result: ${tcl_flags}" >&5
+echo "${ECHO_T}${tcl_flags}" >&6
+ fi
+
+
+ echo "$as_me:$LINENO: checking for 64-bit integer type" >&5
+echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6
+ if test "${tcl_cv_type_64bit+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ tcl_cv_type_64bit=none
+ # See if the compiler knows natively about __int64
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+__int64 value = (__int64) 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_type_64bit=__int64
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_type_64bit="long long"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ # See if we should use long anyway Note that we substitute in the
+ # type that is our current guess for a 64-bit type inside this check
+ # program, so it should be modified only carefully...
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+switch (0) {
+ case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
+ }
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_type_64bit=${tcl_type_64bit}
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test "${tcl_cv_type_64bit}" = none ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_WIDE_INT_IS_LONG 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: using long" >&5
+echo "${ECHO_T}using long" >&6
+ elif test "${tcl_cv_type_64bit}" = "__int64" \
+ -a "${TEA_PLATFORM}" = "windows" ; then
+ # We actually want to use the default tcl.h checks in this
+ # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
+ echo "$as_me:$LINENO: result: using Tcl header defaults" >&5
+echo "${ECHO_T}using Tcl header defaults" >&6
+ else
+
+cat >>confdefs.h <<_ACEOF
+#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}
+_ACEOF
+
+ echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5
+echo "${ECHO_T}${tcl_cv_type_64bit}" >&6
+
+ # Now check for auxiliary declarations
+ echo "$as_me:$LINENO: checking for struct dirent64" >&5
+echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6
+if test "${tcl_cv_struct_dirent64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#include
+int
+main ()
+{
+struct dirent64 p;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_struct_dirent64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_struct_dirent64=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5
+echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6
+ if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_DIRENT64 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for struct stat64" >&5
+echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6
+if test "${tcl_cv_struct_stat64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+int
+main ()
+{
+struct stat64 p;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_struct_stat64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_struct_stat64=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5
+echo "${ECHO_T}$tcl_cv_struct_stat64" >&6
+ if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_STAT64 1
+_ACEOF
+
+ fi
+
+
+
+for ac_func in open64 lseek64
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case declares $ac_func.
+ For example, HP-UX 11i declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer to if __STDC__ is defined, since
+ exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ echo "$as_me:$LINENO: checking for off64_t" >&5
+echo $ECHO_N "checking for off64_t... $ECHO_C" >&6
+ if test "${tcl_cv_type_off64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+int
+main ()
+{
+off64_t offset;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_type_off64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_type_off64_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test "x${tcl_cv_type_off64_t}" = "xyes" && \
+ test "x${ac_cv_func_lseek64}" = "xyes" && \
+ test "x${ac_cv_func_open64}" = "xyes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TYPE_OFF64_T 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+ fi
+
+
+
+#--------------------------------------------------------------------
+# Set the default compiler switches based on the --enable-symbols option.
+#--------------------------------------------------------------------
+
+
+
+ echo "$as_me:$LINENO: checking for build with symbols" >&5
+echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6
+ # Check whether --enable-symbols or --disable-symbols was given.
+if test "${enable_symbols+set}" = set; then
+ enableval="$enable_symbols"
+ tcl_ok=$enableval
+else
+ tcl_ok=no
+fi;
+ DBGX=""
+ if test "$tcl_ok" = "no"; then
+ CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
+ LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ else
+ CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
+ LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
+ if test "$tcl_ok" = "yes"; then
+ echo "$as_me:$LINENO: result: yes (standard debugging)" >&5
+echo "${ECHO_T}yes (standard debugging)" >&6
+ fi
+ fi
+ if test "${TEA_PLATFORM}" != "windows" ; then
+ LDFLAGS_DEFAULT="${LDFLAGS}"
+ fi
+
+
+
+
+
+ if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_MEM_DEBUG 1
+_ACEOF
+
+ fi
+
+ if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
+ if test "$tcl_ok" = "all"; then
+ echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5
+echo "${ECHO_T}enabled symbols mem debugging" >&6
+ else
+ echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
+echo "${ECHO_T}enabled $tcl_ok debugging" >&6
+ fi
+ fi
+
+
+#--------------------------------------------------------------------
+# Everyone should be linking against the Tcl stub library. If you
+# can't for some reason, remove this definition. If you aren't using
+# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
+# link against the non-stubbed Tcl library. Add Tk too if necessary.
+#--------------------------------------------------------------------
+
+
+if test "${SHARED_BUILD}" = "1"; then
+cat >>confdefs.h <<\_ACEOF
+#define USE_TCL_STUBS 1
+_ACEOF
+
+#AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
+fi
+
+#--------------------------------------------------------------------
+# This macro generates a line to use when building a library. It
+# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
+# and TEA_LOAD_TCLCONFIG macros above.
+#--------------------------------------------------------------------
+
+
+ if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
+ MAKE_STATIC_LIB="\${STLIB_LD} -out:\$@ \$(PKG_OBJECTS)"
+ MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\$@ \$(PKG_OBJECTS)"
+ MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)"
+ else
+ MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)"
+ MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
+ MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)"
+ fi
+
+ if test "${SHARED_BUILD}" = "1" ; then
+ MAKE_LIB="${MAKE_SHARED_LIB} "
+ else
+ MAKE_LIB="${MAKE_STATIC_LIB} "
+ fi
+
+ #--------------------------------------------------------------------
+ # Shared libraries and static libraries have different names.
+ # Use the double eval to make sure any variables in the suffix is
+ # substituted. (@@@ Might not be necessary anymore)
+ #--------------------------------------------------------------------
+
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ if test "${SHARED_BUILD}" = "1" ; then
+ # We force the unresolved linking of symbols that are really in
+ # the private libraries of Tcl and Tk.
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
+ if test x"${TK_BIN_DIR}" != x ; then
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
+ fi
+ eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
+ else
+ eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
+ fi
+ # Some packages build their own stubs libraries
+ eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
+ if test "$GCC" = "yes"; then
+ PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
+ fi
+ # These aren't needed on Windows (either MSVC or gcc)
+ RANLIB=:
+ RANLIB_STUB=:
+ else
+ RANLIB_STUB="${RANLIB}"
+ if test "${SHARED_BUILD}" = "1" ; then
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
+ if test x"${TK_BIN_DIR}" != x ; then
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
+ fi
+ eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
+ RANLIB=:
+ else
+ eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
+ fi
+ # Some packages build their own stubs libraries
+ eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
+ fi
+
+ # These are escaped so that only CFLAGS is picked up at configure time.
+ # The other values will be substituted at make time.
+ CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
+ if test "${SHARED_BUILD}" = "1" ; then
+ CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
+ fi
+
+
+
+
+
+
+
+
+#--------------------------------------------------------------------
+# Determine the name of the tclsh and/or wish executables in the
+# Tcl and Tk build directories or the location they were installed
+# into. These paths are used to support running test cases only,
+# the Makefile should not be making use of these paths to generate
+# a pkgIndex.tcl file or anything else at extension build time.
+#--------------------------------------------------------------------
+
+
+ echo "$as_me:$LINENO: checking for tclsh" >&5
+echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
+ if test -f "${TCL_BIN_DIR}/Makefile" ; then
+ # tclConfig.sh is in Tcl build directory
+ if test "${TEA_PLATFORM}" = "windows"; then
+ TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
+ else
+ TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
+ fi
+ else
+ # tclConfig.sh is in install location
+ if test "${TEA_PLATFORM}" = "windows"; then
+ TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
+ else
+ TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
+ fi
+ list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
+ `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
+ `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
+ for i in $list ; do
+ if test -f "$i/${TCLSH_PROG}" ; then
+ REAL_TCL_BIN_DIR="`cd "$i"; pwd`"
+ break
+ fi
+ done
+ TCLSH_PROG="${REAL_TCL_BIN_DIR}/${TCLSH_PROG}"
+ fi
+ echo "$as_me:$LINENO: result: ${TCLSH_PROG}" >&5
+echo "${ECHO_T}${TCLSH_PROG}" >&6
+
+
+#TEA_PROG_WISH
+
+#--------------------------------------------------------------------
+# Finally, substitute all of the various values into the Makefile.
+# You may alternatively have a special pkgIndex.tcl.in or other files
+# which require substituting th AC variables in. Include these here.
+#--------------------------------------------------------------------
+
+ ac_config_files="$ac_config_files Makefile pkgIndex.tcl"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by vqtcl $as_me 4.1, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to ."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+vqtcl config.status 4.1
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "pkgIndex.tcl" ) CONFIG_FILES="$CONFIG_FILES pkgIndex.tcl" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CYGPATH@,$CYGPATH,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@PKG_LIB_FILE@,$PKG_LIB_FILE,;t t
+s,@PKG_STUB_LIB_FILE@,$PKG_STUB_LIB_FILE,;t t
+s,@PKG_STUB_SOURCES@,$PKG_STUB_SOURCES,;t t
+s,@PKG_STUB_OBJECTS@,$PKG_STUB_OBJECTS,;t t
+s,@PKG_TCL_SOURCES@,$PKG_TCL_SOURCES,;t t
+s,@PKG_HEADERS@,$PKG_HEADERS,;t t
+s,@PKG_INCLUDES@,$PKG_INCLUDES,;t t
+s,@PKG_LIBS@,$PKG_LIBS,;t t
+s,@PKG_CFLAGS@,$PKG_CFLAGS,;t t
+s,@TCL_VERSION@,$TCL_VERSION,;t t
+s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t
+s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t
+s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t
+s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t
+s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t
+s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t
+s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t
+s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t
+s,@TCL_LIBS@,$TCL_LIBS,;t t
+s,@TCL_DEFS@,$TCL_DEFS,;t t
+s,@TCL_EXTRA_CFLAGS@,$TCL_EXTRA_CFLAGS,;t t
+s,@TCL_LD_FLAGS@,$TCL_LD_FLAGS,;t t
+s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@EGREP@,$EGREP,;t t
+s,@MATH_LIBS@,$MATH_LIBS,;t t
+s,@PKG_SOURCES@,$PKG_SOURCES,;t t
+s,@PKG_OBJECTS@,$PKG_OBJECTS,;t t
+s,@CLEANFILES@,$CLEANFILES,;t t
+s,@TCL_INCLUDES@,$TCL_INCLUDES,;t t
+s,@TCL_THREADS@,$TCL_THREADS,;t t
+s,@SHARED_BUILD@,$SHARED_BUILD,;t t
+s,@AR@,$AR,;t t
+s,@CELIB_DIR@,$CELIB_DIR,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@DL_LIBS@,$DL_LIBS,;t t
+s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t
+s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t
+s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t
+s,@STLIB_LD@,$STLIB_LD,;t t
+s,@SHLIB_LD@,$SHLIB_LD,;t t
+s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t
+s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t
+s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t
+s,@TCL_DBGX@,$TCL_DBGX,;t t
+s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t
+s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t
+s,@MAKE_LIB@,$MAKE_LIB,;t t
+s,@MAKE_SHARED_LIB@,$MAKE_SHARED_LIB,;t t
+s,@MAKE_STATIC_LIB@,$MAKE_STATIC_LIB,;t t
+s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t
+s,@RANLIB_STUB@,$RANLIB_STUB,;t t
+s,@TCLSH_PROG@,$TCLSH_PROG,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+ esac
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/vqtcl/buildsrc/vqtcl/configure.in b/vqtcl/buildsrc/vqtcl/configure.in
new file mode 100644
index 0000000..6a08367
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/configure.in
@@ -0,0 +1,179 @@
+#!/bin/bash -norc
+dnl This file is an input file used by the GNU "autoconf" program to
+dnl generate the file "configure", which is run during Tcl installation
+dnl to configure the system for the local environment.
+
+#-----------------------------------------------------------------------
+# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
+# set as provided. These will also be added as -D defs in your Makefile
+# so you can encode the package version directly into the source files.
+#-----------------------------------------------------------------------
+
+AC_INIT([vqtcl], [4.1])
+
+#--------------------------------------------------------------------
+# Call TEA_INIT as the first TEA_ macro to set up initial vars.
+# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
+# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
+#--------------------------------------------------------------------
+
+TEA_INIT([3.5])
+
+AC_CONFIG_AUX_DIR(tclconfig)
+
+#--------------------------------------------------------------------
+# Load the tclConfig.sh file
+#--------------------------------------------------------------------
+
+TEA_PATH_TCLCONFIG
+TEA_LOAD_TCLCONFIG
+
+#--------------------------------------------------------------------
+# Load the tkConfig.sh file if necessary (Tk extension)
+#--------------------------------------------------------------------
+
+#TEA_PATH_TKCONFIG
+#TEA_LOAD_TKCONFIG
+
+#-----------------------------------------------------------------------
+# Handle the --prefix=... option by defaulting to what Tcl gave.
+# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
+#-----------------------------------------------------------------------
+
+TEA_PREFIX
+
+#-----------------------------------------------------------------------
+# Standard compiler checks.
+# This sets up CC by using the CC env var, or looks for gcc otherwise.
+# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
+# the basic setup necessary to compile executables.
+#-----------------------------------------------------------------------
+
+TEA_SETUP_COMPILER
+
+#-----------------------------------------------------------------------
+# Specify the C source files to compile in TEA_ADD_SOURCES,
+# public headers that need to be installed in TEA_ADD_HEADERS,
+# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
+# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
+# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
+# and PKG_TCL_SOURCES.
+#-----------------------------------------------------------------------
+
+TEA_ADD_SOURCES([vlerq.c])
+TEA_ADD_HEADERS([])
+TEA_ADD_INCLUDES([])
+TEA_ADD_LIBS([])
+TEA_ADD_CFLAGS([])
+TEA_ADD_STUB_SOURCES([])
+TEA_ADD_TCL_SOURCES([library/m2mvfs.tcl
+ library/mkclvfs.tcl
+ library/mklite.tcl
+ library/ratcl.tcl])
+
+#--------------------------------------------------------------------
+# A few miscellaneous platform-specific items:
+#
+# Define a special symbol for Windows (BUILD_vlerq in this case) so
+# that we create the export library with the dll.
+#
+# Windows creates a few extra files that need to be cleaned up.
+# You can add more files to clean if your extension creates any extra
+# files.
+#
+# TEA_ADD_* any platform specific compiler/build info here.
+#--------------------------------------------------------------------
+
+if test "${TEA_PLATFORM}" = "windows" ; then
+ AC_DEFINE(BUILD_vlerq, 1, [Build windows export dll])
+ CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc*.pch"
+ #TEA_ADD_SOURCES([win/winFile.c])
+ #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
+else
+ CLEANFILES=""
+ #TEA_ADD_SOURCES([unix/unixFile.c])
+ #TEA_ADD_LIBS([-lsuperfly])
+fi
+AC_SUBST(CLEANFILES)
+
+#--------------------------------------------------------------------
+# Choose which headers you need. Extension authors should try very
+# hard to only rely on the Tcl public header files. Internal headers
+# contain private data structures and are subject to change without
+# notice.
+# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
+#--------------------------------------------------------------------
+
+TEA_PUBLIC_TCL_HEADERS
+#TEA_PRIVATE_TCL_HEADERS
+
+#TEA_PUBLIC_TK_HEADERS
+#TEA_PRIVATE_TK_HEADERS
+#TEA_PATH_X
+
+#--------------------------------------------------------------------
+# Check whether --enable-threads or --disable-threads was given.
+# This auto-enables if Tcl was compiled threaded.
+#--------------------------------------------------------------------
+
+TEA_ENABLE_THREADS
+
+#--------------------------------------------------------------------
+# The statement below defines a collection of symbols related to
+# building as a shared library instead of a static library.
+#--------------------------------------------------------------------
+
+TEA_ENABLE_SHARED
+
+#--------------------------------------------------------------------
+# This macro figures out what flags to use with the compiler/linker
+# when building shared/static debug/optimized objects. This information
+# can be taken from the tclConfig.sh file, but this figures it all out.
+#--------------------------------------------------------------------
+
+TEA_CONFIG_CFLAGS
+
+#--------------------------------------------------------------------
+# Set the default compiler switches based on the --enable-symbols option.
+#--------------------------------------------------------------------
+
+TEA_ENABLE_SYMBOLS
+
+#--------------------------------------------------------------------
+# Everyone should be linking against the Tcl stub library. If you
+# can't for some reason, remove this definition. If you aren't using
+# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
+# link against the non-stubbed Tcl library. Add Tk too if necessary.
+#--------------------------------------------------------------------
+
+if test "${SHARED_BUILD}" = "1"; then
+AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
+#AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
+fi
+
+#--------------------------------------------------------------------
+# This macro generates a line to use when building a library. It
+# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
+# and TEA_LOAD_TCLCONFIG macros above.
+#--------------------------------------------------------------------
+
+TEA_MAKE_LIB
+
+#--------------------------------------------------------------------
+# Determine the name of the tclsh and/or wish executables in the
+# Tcl and Tk build directories or the location they were installed
+# into. These paths are used to support running test cases only,
+# the Makefile should not be making use of these paths to generate
+# a pkgIndex.tcl file or anything else at extension build time.
+#--------------------------------------------------------------------
+
+TEA_PROG_TCLSH
+#TEA_PROG_WISH
+
+#--------------------------------------------------------------------
+# Finally, substitute all of the various values into the Makefile.
+# You may alternatively have a special pkgIndex.tcl.in or other files
+# which require substituting th AC variables in. Include these here.
+#--------------------------------------------------------------------
+
+AC_OUTPUT([Makefile pkgIndex.tcl])
diff --git a/vqtcl/buildsrc/vqtcl/data/gtest.db b/vqtcl/buildsrc/vqtcl/data/gtest.db
new file mode 100644
index 0000000..d7ce5d4
Binary files /dev/null and b/vqtcl/buildsrc/vqtcl/data/gtest.db differ
diff --git a/vqtcl/buildsrc/vqtcl/data/lkit-be.db b/vqtcl/buildsrc/vqtcl/data/lkit-be.db
new file mode 100644
index 0000000..fec01ce
Binary files /dev/null and b/vqtcl/buildsrc/vqtcl/data/lkit-be.db differ
diff --git a/vqtcl/buildsrc/vqtcl/data/lkit-le.db b/vqtcl/buildsrc/vqtcl/data/lkit-le.db
new file mode 100644
index 0000000..759ec6c
Binary files /dev/null and b/vqtcl/buildsrc/vqtcl/data/lkit-le.db differ
diff --git a/vqtcl/buildsrc/vqtcl/data/mkblk.db b/vqtcl/buildsrc/vqtcl/data/mkblk.db
new file mode 100644
index 0000000..912be05
Binary files /dev/null and b/vqtcl/buildsrc/vqtcl/data/mkblk.db differ
diff --git a/vqtcl/buildsrc/vqtcl/doc/ratcl.html b/vqtcl/buildsrc/vqtcl/doc/ratcl.html
new file mode 100644
index 0000000..aee398b
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/doc/ratcl.html
@@ -0,0 +1,96 @@
+
+ratcl - Relational Algebra for Tcl
+
+
+
+
+
+ ratcl(n) 4 ratcl "Relational Algebra for Tcl"
+
+
+
ratcl - A Relational Algebra extension for Tcl
+
+
+
+
+ TABLE OF CONTENTS
+ SYNOPSIS
+ DESCRIPTION
+ COMMANDS
+ EXAMPLE
+ SEE ALSO
+ KEYWORDS
+
+
+package require ratcl ?4?
+
+
+
+
+
+The ratcl package implements a general-purpose relational algebra
+and persistence framework as a notation on top of the Vlerq extension.
+
+
+
+
+
+- view arg operator ... | ...
-
+
+
+The view command wraps all the different operators provided by
+the vlerq package and lets you create pipelines,
+whereby the output of one operator is fed as input to the next.
+
+
+ - ... view | names
-
+
+
+Return a list with all the column names of view.
+
+
+ - ... filename | open
-
+
+
+The open operator opens a Metakit-compatible datafile and returns
+its root view.
+
+
+ - ... view | to varname
-
+
+
+Store a view in the varname variable.
+That same view is also returned as result.
+
+
+
+
+THIS DOCUMENTATION NEEDS TO BE FINISHED
+
+
+
+
+
+
| |
+package require ratcl
+view myile.db open | to v
+puts [view $v names]
+ |
+
+This lists all the sub-views available in the myfile.db file.
+
+
+
+
+
+metakit, vlerq
+
+
+algebra, database, persistence, relational
+
diff --git a/vqtcl/buildsrc/vqtcl/doc/ratcl.man b/vqtcl/buildsrc/vqtcl/doc/ratcl.man
new file mode 100644
index 0000000..29d99ce
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/doc/ratcl.man
@@ -0,0 +1,52 @@
+[manpage_begin ratcl n 4]
+[moddesc {Relational Algebra for Tcl}]
+[titledesc {A Relational Algebra extension for Tcl}]
+[require ratcl [opt 4]]
+[description]
+[para]
+
+The [package ratcl] package implements a general-purpose relational algebra
+and persistence framework as a notation on top of the Vlerq extension.
+
+[section COMMANDS]
+[list_begin definitions]
+
+[call [cmd view] [arg arg] [cmd operator] [arg ...] | [arg ...]]
+
+The [cmd view] command wraps all the different operators provided by
+the [package vlerq] package and lets you create pipelines,
+whereby the output of one operator is fed as input to the next.
+
+[call ... [arg view] | [cmd names]]
+
+Return a list with all the column names of [arg view].
+
+[call ... [arg filename] | [cmd open]]
+
+The [cmd open] operator opens a Metakit-compatible datafile and returns
+its root view.
+
+[call ... [arg view] | [cmd to] [arg varname]]
+
+Store a view in the [arg varname] variable.
+That same view is also returned as result.
+
+[list_end]
+
+[para]
+THIS DOCUMENTATION NEEDS TO BE FINISHED
+
+[section EXAMPLE]
+
+[para]
+[example {
+package require ratcl
+view myile.db open | to v
+puts [view $v names]
+}]
+[para]
+This lists all the sub-views available in the myfile.db file.
+
+[see_also vlerq metakit]
+[keywords database persistence relational algebra]
+[manpage_end]
diff --git a/vqtcl/buildsrc/vqtcl/doc/ratcl.n b/vqtcl/buildsrc/vqtcl/doc/ratcl.n
new file mode 100644
index 0000000..5019c5f
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/doc/ratcl.n
@@ -0,0 +1,58 @@
+'\"
+'\" Generated from file './doc/ratcl.man' by tcllib/doctools with format 'nroff'
+'\"
+.so man.macros
+.TH "ratcl" n 4 ratcl "Relational Algebra for Tcl"
+.BS
+.SH NAME
+ratcl \- A Relational Algebra extension for Tcl
+.SH SYNOPSIS
+package require \fBratcl ?4?\fR
+.sp
+\fBview\fR \fIarg\fR \fBoperator\fR \fI...\fR | \fI...\fR
+.sp
+... \fIview\fR | \fBnames\fR
+.sp
+... \fIfilename\fR | \fBopen\fR
+.sp
+... \fIview\fR | \fBto\fR \fIvarname\fR
+.sp
+.BE
+.SH DESCRIPTION
+.PP
+The \fBratcl\fR package implements a general-purpose relational algebra
+and persistence framework as a notation on top of the Vlerq extension.
+.SH COMMANDS
+.TP
+\fBview\fR \fIarg\fR \fBoperator\fR \fI...\fR | \fI...\fR
+The \fBview\fR command wraps all the different operators provided by
+the \fBvlerq\fR package and lets you create pipelines,
+whereby the output of one operator is fed as input to the next.
+.TP
+... \fIview\fR | \fBnames\fR
+Return a list with all the column names of \fIview\fR.
+.TP
+... \fIfilename\fR | \fBopen\fR
+The \fBopen\fR operator opens a Metakit-compatible datafile and returns
+its root view.
+.TP
+... \fIview\fR | \fBto\fR \fIvarname\fR
+Store a view in the \fIvarname\fR variable.
+That same view is also returned as result.
+.PP
+THIS DOCUMENTATION NEEDS TO BE FINISHED
+.SH EXAMPLE
+.PP
+.nf
+
+package require ratcl
+view myile.db open | to v
+puts [view $v names]
+
+.fi
+.PP
+This lists all the sub-views available in the myfile.db file.
+.SH "SEE ALSO"
+metakit, vlerq
+.SH KEYWORDS
+algebra, database, persistence, relational
\ No newline at end of file
diff --git a/vqtcl/buildsrc/vqtcl/doc/vlerq.html b/vqtcl/buildsrc/vqtcl/doc/vlerq.html
new file mode 100644
index 0000000..dd8c632
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/doc/vlerq.html
@@ -0,0 +1,80 @@
+
+vlerq - Vlerq data manipulation core engine
+
+
+
+
+
+ vlerq(n) 4 vlerq "Vlerq data manipulation core engine"
+
+
+
vlerq - The engine used by the Ratcl extension
+
+
+
+
+ TABLE OF CONTENTS
+ SYNOPSIS
+ DESCRIPTION
+ COMMANDS
+ EXAMPLE
+ SEE ALSO
+ KEYWORDS
+
+
+package require vlerq ?4?
+
+
+
+
+
+The vlerq package provides commands used by the Ratcl extension
+to implement a general-purpose relational algebra and persistence framework.
+
+
+
+
+
+- vlerq command ...
-
+
+
+The vlerq command wraps all the different sub-commands provided by
+the vlerq package.
+
+
+ - vlerq open filename
-
+
+
+The open sub-command opens a Metakit-compatible datafile and returns
+its root view.
+
+
+
+
+THIS DOCUMENTATION NEEDS TO BE FINISHED
+
+
+
+
+
+
| |
+package require vlerq
+set v [vlerq open myfile.db]
+puts [vlerq names $v]
+ |
+
+This lists all the sub-views available in the myfile.db file.
+
+
+
+
+
+metakit, ratcl
+
+
+algebra, database, persistence, relational
+
diff --git a/vqtcl/buildsrc/vqtcl/doc/vlerq.man b/vqtcl/buildsrc/vqtcl/doc/vlerq.man
new file mode 100644
index 0000000..267799f
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/doc/vlerq.man
@@ -0,0 +1,42 @@
+[manpage_begin vlerq n 4]
+[moddesc {Vlerq data manipulation core engine}]
+[titledesc {The engine used by the Ratcl extension}]
+[require vlerq [opt 4]]
+[description]
+[para]
+
+The [package vlerq] package provides commands used by the Ratcl extension
+to implement a general-purpose relational algebra and persistence framework.
+
+[section COMMANDS]
+[list_begin definitions]
+
+[call [cmd vlerq] [arg command] [arg ...]]
+
+The [cmd vlerq] command wraps all the different sub-commands provided by
+the [package vlerq] package.
+
+[call [cmd vlerq] [cmd open] [arg filename]]
+
+The [cmd open] sub-command opens a Metakit-compatible datafile and returns
+its root view.
+
+[list_end]
+
+[para]
+THIS DOCUMENTATION NEEDS TO BE FINISHED
+
+[section EXAMPLE]
+
+[para]
+[example {
+package require vlerq
+set v [vlerq open myfile.db]
+puts [vlerq names $v]
+}]
+[para]
+This lists all the sub-views available in the myfile.db file.
+
+[see_also ratcl metakit]
+[keywords database persistence relational algebra]
+[manpage_end]
diff --git a/vqtcl/buildsrc/vqtcl/doc/vlerq.n b/vqtcl/buildsrc/vqtcl/doc/vlerq.n
new file mode 100644
index 0000000..b907249
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/doc/vlerq.n
@@ -0,0 +1,46 @@
+'\"
+'\" Generated from file './doc/vlerq.man' by tcllib/doctools with format 'nroff'
+'\"
+.so man.macros
+.TH "vlerq" n 4 vlerq "Vlerq data manipulation core engine"
+.BS
+.SH NAME
+vlerq \- The engine used by the Ratcl extension
+.SH SYNOPSIS
+package require \fBvlerq ?4?\fR
+.sp
+\fBvlerq\fR \fIcommand\fR \fI...\fR
+.sp
+\fBvlerq\fR \fBopen\fR \fIfilename\fR
+.sp
+.BE
+.SH DESCRIPTION
+.PP
+The \fBvlerq\fR package provides commands used by the Ratcl extension
+to implement a general-purpose relational algebra and persistence framework.
+.SH COMMANDS
+.TP
+\fBvlerq\fR \fIcommand\fR \fI...\fR
+The \fBvlerq\fR command wraps all the different sub-commands provided by
+the \fBvlerq\fR package.
+.TP
+\fBvlerq\fR \fBopen\fR \fIfilename\fR
+The \fBopen\fR sub-command opens a Metakit-compatible datafile and returns
+its root view.
+.PP
+THIS DOCUMENTATION NEEDS TO BE FINISHED
+.SH EXAMPLE
+.PP
+.nf
+
+package require vlerq
+set v [vlerq open myfile.db]
+puts [vlerq names $v]
+
+.fi
+.PP
+This lists all the sub-views available in the myfile.db file.
+.SH "SEE ALSO"
+metakit, ratcl
+.SH KEYWORDS
+algebra, database, persistence, relational
\ No newline at end of file
diff --git a/vqtcl/buildsrc/vqtcl/generic/vlerq.c b/vqtcl/buildsrc/vqtcl/generic/vlerq.c
new file mode 100644
index 0000000..00060de
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/generic/vlerq.c
@@ -0,0 +1,7610 @@
+/* vlerq.c - this is the single-source-file version of Vlerq for Tcl */
+
+/* %includeDir<../src>% */
+/* %includeDir<../src_tcl>% */
+
+/* %include% */
+/*
+ * bits.c - Implementation of bitwise operations.
+ */
+
+#include
+#include
+
+/*
+ * intern.h - Internal definitions.
+ */
+
+#include
+#ifdef HAVE_STDINT_H
+#include
+#endif
+#include
+
+typedef ptrdiff_t Int_t; /* large enough to hold a pointer */
+
+typedef unsigned char Byte_t;
+
+#ifdef OBJECT_TYPE
+typedef OBJECT_TYPE Object_p;
+#else
+/*
+ * defs.h - Binding-specific definitions needed by the general code.
+ */
+
+typedef struct Tcl_Obj *Object_p;
+#endif
+
+#if !defined(VALUES_MUST_BE_ALIGNED) && (defined(__hppa) || defined(__sparc__) || defined(__sgi__))
+#define VALUES_MUST_BE_ALIGNED 1
+#endif
+
+#if defined(WORDS_BIGENDIAN)
+#if !defined(_BIG_ENDIAN) || _BIG_ENDIAN == ""
+#define _BIG_ENDIAN 1
+#endif
+#endif
+
+#if DEBUG+0
+#define Assert(x) do if (!(x)) FailedAssert(#x, __FILE__, __LINE__); while (0)
+#define DbgIf(x) if (GetShared()->debug && (x))
+#else
+#define Assert(x)
+#define DbgIf(x) if (0)
+#endif
+
+#define DBG_trace (1<<0)
+#define DBG_deps (1<<1)
+
+#define PUSH_KEEP_REFS \
+ { Shared_p _shared = GetShared(); \
+ struct Buffer _keep, *_prev = _shared->keeps; \
+ InitBuffer(_shared->keeps = &_keep);
+
+#define POP_KEEP_REFS \
+ ReleaseSequences(&_keep); \
+ _shared->keeps = _prev; \
+ }
+
+/* keep in sync with CharAsItemType() in column.c */
+typedef enum ItemTypes {
+ IT_unknown,
+ IT_int,
+ IT_wide,
+ IT_float,
+ IT_double,
+ IT_string,
+ IT_bytes,
+ IT_object,
+ IT_column,
+ IT_view,
+ IT_error
+} ItemTypes;
+
+typedef enum ErrorCodes {
+ EC_cioor,
+ EC_rioor,
+ EC_cizwv,
+ EC_nmcw,
+ EC_rambe,
+ EC_nalor,
+ EC_wnoa
+} ErrorCodes;
+
+struct Shared {
+ struct SharedInfo *info; /* ext_tcl.c */
+ int refs; /* ext_tcl.c */
+ int debug; /* debug flags */
+ struct Buffer *keeps; /* column.c */
+ struct Sequence *empty; /* view.c */
+};
+
+typedef struct Shared *Shared_p;
+typedef struct SeqType *SeqType_p;
+typedef struct Sequence *Seq_p;
+typedef struct Column *Column_p;
+typedef union Item *Item_p;
+typedef Seq_p View_p;
+
+typedef ItemTypes (*Getter) (int row, Item_p item);
+typedef void (*Cleaner) (Seq_p seq);
+
+struct SeqType {
+ const char *name; /* for introspection only */
+ Getter getfun; /* item accessor, copied to Sequence during setup */
+ short cleanups; /* octal for data[0..3].p: 0=none, 1=decref, 2=free */
+ Cleaner cleaner; /* called before performing the above cleanups */
+};
+
+struct Sequence {
+ int count; /* number of entries */
+ int refs; /* reference count */
+ SeqType_p type; /* type dispatch table */
+ Getter getter; /* item accessor function */
+ union { int i; void *p; Seq_p q; Object_p o; } data[4]; /* getter-specific */
+};
+
+#define IncRefCount(seq) AdjustSeqRefs(seq, 1)
+#define DecRefCount(seq) AdjustSeqRefs(seq, -1)
+#define KeepRef(seq) IncRefCount(LoseRef(seq))
+
+typedef struct Column {
+ Seq_p seq; /* the sequence which will handle accesses */
+ int pos; /* position of this column in the view */
+} Column;
+
+typedef union Item {
+ char b [8]; /* used for raw access and byte-swapping */
+ int q [2]; /* used for hash calculation of wides and doubles */
+ int i; /* IT_int */
+ int64_t w; /* IT_wide */
+ float f; /* IT_float */
+ double d; /* IT_double */
+ const void *p; /* used to convert pointers */
+ const char *s; /* IT_string */
+ struct { const Byte_t *ptr; int len; } u; /* IT_bytes */
+ Object_p o; /* IT_object */
+ Column c; /* IT_column */
+ View_p v; /* IT_view */
+ ErrorCodes e; /* IT_error */
+} Item;
+
+/* column.c */
+
+void *(AdjustSeqRefs) (void *refs, int count);
+void (AppendToStrVec) (const void *s, int bytes, Seq_p seq);
+int (CastObjToItem) (char type, Item_p item);
+ItemTypes (CharAsItemType) (char type);
+Column (CoerceColumn) (ItemTypes type, Object_p obj);
+void (FailedAssert) (const char *msg, const char *file, int line);
+Column (ForceStringColumn) (Column column);
+Item (GetColItem) (int row, Column column, ItemTypes type);
+ItemTypes (GetItem) (int row, Item_p item);
+Item (GetSeqItem) (int row, Seq_p seq, ItemTypes type);
+Item (GetViewItem) (View_p view, int row, int col, ItemTypes type);
+Seq_p (LoseRef) (Seq_p seq);
+Seq_p (NewBitVec) (int count);
+Seq_p (NewIntVec) (int count, int **dataptr);
+Seq_p (NewPtrVec) (int count, Int_t **dataptr);
+Seq_p (NewSequence) (int count, SeqType_p type, int auxbytes);
+Seq_p (NewSequenceNoRef) (int count, SeqType_p type, int auxbytes);
+Seq_p (NewSeqVec) (ItemTypes type, const Seq_p *p, int n);
+Seq_p (NewStrVec) (int istext);
+Seq_p (FinishStrVec) (Seq_p seq);
+void (ReleaseSequences) (struct Buffer *keep);
+Seq_p (ResizeSeq) (Seq_p seq, int pos, int diff, int elemsize);
+Column (SeqAsCol) (Seq_p seq);
+
+/* buffer.c */
+
+typedef struct Buffer *Buffer_p;
+typedef struct Overflow *Overflow_p;
+
+struct Buffer {
+ union { char *c; int *i; const void **p; } fill;
+ char *limit;
+ Overflow_p head;
+ Int_t saved;
+ Int_t used;
+ char *ofill;
+ char *result;
+ char buf [128];
+ char slack [8];
+};
+
+#define ADD_ONEC_TO_BUF(b,x) (*(b).fill.c++ = (x))
+
+#define ADD_CHAR_TO_BUF(b,x) \
+ { char _c = (x); \
+ if ((b).fill.c < (b).limit) *(b).fill.c++ = _c; \
+ else AddToBuffer(&(b), &_c, sizeof _c); }
+
+#define ADD_INT_TO_BUF(b,x) \
+ { int _i = (x); \
+ if ((b).fill.c < (b).limit) *(b).fill.i++ = _i; \
+ else AddToBuffer(&(b), &_i, sizeof _i); }
+
+#define ADD_PTR_TO_BUF(b,x) \
+ { const void *_p = (x); \
+ if ((b).fill.c < (b).limit) *(b).fill.p++ = _p; \
+ else AddToBuffer(&(b), &_p, sizeof _p); }
+
+#define BufferFill(b) ((b)->saved + ((b)->fill.c - (b)->buf))
+
+void (InitBuffer) (Buffer_p bp);
+void (ReleaseBuffer) (Buffer_p bp, int keep);
+void (AddToBuffer) (Buffer_p bp, const void *data, Int_t len);
+void *(BufferAsPtr) (Buffer_p bp, int fast);
+Seq_p (BufferAsIntVec) (Buffer_p bp);
+int (NextBuffer) (Buffer_p bp, char **firstp, int *countp);
+
+/* view.c */
+
+typedef enum MetaCols {
+ MC_name, MC_type, MC_subv, MC_limit
+} MetaCols;
+
+#define V_Cols(view) ((Column_p) ((Seq_p) (view) + 1))
+#define V_Types(view) (*(char**) ((view)->data))
+#define V_Meta(view) (*(View_p*) ((view)->data+1))
+
+#define ViewAsCol(v) SeqAsCol(v)
+#define ViewWidth(view) ((view)->count)
+#define ViewCol(view,col) (V_Cols(view)[col])
+#define ViewColType(view,col) ((ItemTypes) V_Types(view)[col])
+#define ViewCompat(view1,view2) MetaIsCompatible(V_Meta(view1), V_Meta(view2))
+
+View_p (DescAsMeta) (const char** desc, const char* end);
+View_p (EmptyMetaView) (void);
+char (GetColType) (View_p meta, int col);
+View_p (IndirectView) (View_p meta, Seq_p seq);
+View_p (NewView) (View_p meta);
+View_p (MakeIntColMeta) (const char *name);
+int (MetaIsCompatible) (View_p meta1, View_p meta2);
+void (ReleaseUnusedViews) (void);
+void (SetViewCols) (View_p view, int first, int count, Column src);
+void (SetViewSeqs) (View_p view, int first, int count, Seq_p src);
+
+/* hash.c */
+
+int (HashMapAdd) (Seq_p hmap, int key, int value);
+int (HashMapLookup) (Seq_p hmap, int key, int defval);
+Seq_p (HashMapNew) (void);
+int (HashMapRemove) (Seq_p hmap, int key);
+
+/* file.c */
+
+typedef Seq_p MappedFile_p;
+
+MappedFile_p (InitMappedFile) (const char *data, Int_t length, Cleaner fun);
+View_p (MappedToView) (MappedFile_p map, View_p base);
+View_p (OpenDataFile) (const char *filename);
+
+/* emit.c */
+
+typedef void *(*SaveInitFun)(void*,Int_t);
+typedef void *(*SaveDataFun)(void*,const void*,Int_t);
+
+void (MetaAsDesc) (View_p meta, Buffer_p buffer);
+Int_t (ViewSave) (View_p view, void *aux, SaveInitFun, SaveDataFun, int);
+
+/* getters.c */
+
+SeqType_p (PickIntGetter) (int bits);
+SeqType_p (FixedGetter) (int bytes, int rows, int real, int flip);
+
+/* bits.c */
+
+char *(Bits2elias) (const char *bytes, int count, int *outsize);
+void (ClearBit) (Seq_p bitmap, int row);
+int (CountBits) (Seq_p seq);
+Seq_p (MinBitCount) (Seq_p *pbitmap, int count);
+int (NextBits) (Seq_p bits, int *fromp, int *countp);
+int (NextElias) (const char *bytes, int count, int *inbits);
+int (SetBit) (Seq_p *pbitmap, int row);
+void (SetBitRange) (Seq_p bits, int from, int count);
+int (TestBit) (Seq_p bitmap, int row);
+int (TopBit) (int v);
+
+/* mutable.c */
+
+enum MutPrepares {
+ MP_insdat, MP_adjdat, MP_usemap, MP_delmap, MP_adjmap,
+ MP_insmap, MP_revmap, MP_limit
+};
+
+int (IsMutable) (View_p view);
+View_p (MutableView) (View_p view);
+Seq_p (MutPrepare) (View_p view);
+View_p (ViewSet) (View_p view, int row, int col, Item_p item);
+
+/* the following must be supplied in the language binding */
+
+int (ColumnByName) (View_p meta, Object_p obj);
+struct Shared *(GetShared) (void);
+void (InvalidateView) (Object_p obj);
+Object_p (ItemAsObj) (ItemTypes type, Item_p item);
+Object_p (NeedMutable) (Object_p obj);
+Column (ObjAsColumn) (Object_p obj);
+View_p (ObjAsView) (Object_p obj);
+int (ObjToItem) (ItemTypes type, Item_p item);
+
+int TestBit (Seq_p bitmap, int row) {
+ if (bitmap != NULL && row < bitmap->count) {
+ const Byte_t *bits = bitmap->data[0].p;
+ return (bits[row>>3] >> (row&7)) & 1;
+ }
+ return 0;
+}
+
+int SetBit (Seq_p *pbitmap, int row) {
+ Byte_t *bits;
+ Seq_p bitmap = *pbitmap;
+
+ if (bitmap == NULL)
+ *pbitmap = bitmap = IncRefCount(NewBitVec(row+1));
+
+ if (TestBit(bitmap, row))
+ return 0;
+
+ if (row >= bitmap->count) {
+ int bytes = bitmap->data[1].i;
+ if (row >= 8 * bytes) {
+ Seq_p newbitmap = IncRefCount(NewBitVec(12 * bytes));
+ memcpy(newbitmap->data[0].p, LoseRef(bitmap)->data[0].p, bytes);
+ *pbitmap = bitmap = newbitmap;
+ }
+ bitmap->count = row + 1;
+ }
+
+ bits = bitmap->data[0].p;
+ bits[row>>3] |= 1 << (row&7);
+
+ return 8 * bitmap->data[1].i;
+}
+
+void ClearBit (Seq_p bitmap, int row) {
+ if (TestBit(bitmap, row)) {
+ Byte_t *bits = bitmap->data[0].p;
+ bits[row>>3] &= ~ (1 << (row&7));
+ }
+}
+
+void SetBitRange (Seq_p bits, int from, int count) {
+ while (--count >= 0)
+ SetBit(&bits, from++);
+}
+
+Seq_p MinBitCount (Seq_p *pbitmap, int count) {
+ if (*pbitmap == NULL || (*pbitmap)->count < count) {
+ SetBit(pbitmap, count);
+ ClearBit(*pbitmap, count);
+ --(*pbitmap)->count;
+ }
+ return *pbitmap;
+}
+
+int NextBits (Seq_p bits, int *fromp, int *countp) {
+ int curr = *fromp + *countp;
+
+ while (curr < bits->count && !TestBit(bits, curr))
+ ++curr;
+
+ *fromp = curr;
+
+ while (curr < bits->count && TestBit(bits, curr))
+ ++curr;
+
+ *countp = curr - *fromp;
+ return *countp;
+}
+
+int TopBit (int v) {
+#define Vn(x) (v < (1<> 3);
+ int bit = 8 - (*ppos & 7);
+ int top = TopBit(val), n = top + 1;
+
+ Assert(val > 0);
+
+ while (top >= bit) {
+ ++curr;
+ top -= bit;
+ bit = 8;
+ }
+
+ bit -= top;
+
+ while (n >= bit) {
+ *curr++ |= (char) (val >> (n-bit));
+ val &= (1 << (n-bit)) - 1;
+ n -= bit;
+ bit = 8;
+ }
+
+ *curr |= (char) (val << (bit - n));
+ *ppos = ((curr - bytes) << 3) + (8 - bit) + n;
+}
+
+char *Bits2elias (const char *bytes, int count, int *outbits) {
+ int i, last, bits = 0;
+ char *out;
+
+ if (count <= 0) {
+ *outbits = 0;
+ return NULL;
+ }
+
+ out = calloc(1, (count+count/2)/8+1);
+ last = *bytes & 1;
+ *out = last << 7;
+ *outbits = 1;
+ for (i = 0; i < count; ++i) {
+ if (((bytes[i>>3] >> (i&7)) & 1) == last)
+ ++bits;
+ else {
+ EmitBits(out, bits, outbits);
+ bits = 1;
+ last ^= 1;
+ }
+ }
+
+ if (bits)
+ EmitBits(out, bits, outbits);
+
+ return out;
+}
+
+int NextElias (const char *bytes, int count, int *inbits) {
+ int val = 0;
+ const char *in;
+
+ if (*inbits == 0)
+ *inbits = 1;
+
+ in = bytes + (*inbits >> 3);
+ if (in < bytes + count) {
+ int i = 0, bit = 8 - (*inbits & 7);
+
+ for (;;) {
+ ++i;
+ if (*in & (1 << (bit-1)))
+ break;
+ if (--bit <= 0) {
+ if (++in >= bytes + count)
+ return 0;
+ bit = 8;
+ }
+ }
+
+ while (i >= bit) {
+ val <<= bit;
+ val |= (*in++ & ((1 << bit) - 1));
+ i -= bit;
+ bit = 8;
+ }
+
+ val <<= i;
+ val |= (*in >> (bit - i)) & ((1 << i) - 1);
+ *inbits = ((in - bytes) << 3) + (8 - bit) + i;
+ }
+
+ return val;
+}
+
+int CountBits (Seq_p seq) {
+ int result = 0, from = 0, count = 0;
+
+ if (seq != NULL)
+ while (NextBits(seq, &from, &count))
+ result += count;
+
+ return result;
+}
+
+ItemTypes BitRunsCmd_i (Item_p a) {
+ int i, outsize, count = a->c.seq->count, pos = 0;
+ char *data;
+ struct Buffer buffer;
+ Seq_p temp;
+
+ temp = NewBitVec(count);
+
+ for (i = 0; i < count; ++i) {
+ if (GetColItem(i, a->c, IT_int).i)
+ SetBit(&temp, i);
+ }
+
+ data = Bits2elias(temp->data[0].p, count, &outsize);
+
+ count = (outsize + 7) / 8;
+ InitBuffer(&buffer);
+
+ if (count > 0) {
+ ADD_INT_TO_BUF(buffer, (*data & 0x80) != 0);
+ while ((i = NextElias(data, count, &pos)) != 0)
+ ADD_INT_TO_BUF(buffer, i);
+ }
+
+ free(data);
+
+ a->c = SeqAsCol(BufferAsIntVec(&buffer));
+ return IT_column;
+}
+/* %include% */
+/*
+ * buffer.c - Implementation of a simple temporary buffer.
+ */
+
+#include
+#include
+
+
+typedef struct Overflow {
+ char b[4096]; /* must be first member */
+ Overflow_p next;
+} Overflow;
+
+void InitBuffer (Buffer_p bp) {
+ bp->fill.c = bp->buf;
+ bp->limit = bp->buf + sizeof bp->buf;
+ bp->head = 0;
+ bp->ofill = 0;
+ bp->saved = 0;
+ bp->result = 0;
+}
+
+void ReleaseBuffer (Buffer_p bp, int keep) {
+ while (bp->head != 0) {
+ Overflow_p op = bp->head;
+ bp->head = op->next;
+ free(op);
+ }
+ if (!keep && bp->result != 0)
+ free(bp->result);
+}
+
+void AddToBuffer (Buffer_p bp, const void *data, Int_t len) {
+ Int_t n;
+ while (len > 0) {
+ if (bp->fill.c >= bp->limit) {
+ if (bp->head == 0 ||
+ bp->ofill >= bp->head->b + sizeof bp->head->b) {
+ Overflow_p op = (Overflow_p) malloc(sizeof(Overflow));
+ op->next = bp->head;
+ bp->head = op;
+ bp->ofill = op->b;
+ }
+ memcpy(bp->ofill, bp->buf, sizeof bp->buf);
+ bp->ofill += sizeof bp->buf;
+ bp->saved += sizeof bp->buf;
+ n = bp->fill.c - bp->slack;
+ memcpy(bp->buf, bp->slack, n);
+ bp->fill.c = bp->buf + n;
+ }
+ n = len;
+ if (n > bp->limit - bp->fill.c)
+ n = bp->limit - bp->fill.c; /* TODO: copy big chunks to overflow */
+ memcpy(bp->fill.c, data, n);
+ bp->fill.c += n;
+ data = (const char*) data + n;
+ len -= n;
+ }
+}
+
+int NextBuffer (Buffer_p bp, char **firstp, int *countp) {
+ int count;
+
+ if (*firstp == NULL) {
+ Overflow_p p = bp->head, q = NULL;
+ while (p != NULL) {
+ Overflow_p t = p->next;
+ p->next = q;
+ q = p;
+ p = t;
+ }
+
+ bp->head = q;
+ bp->used = 0;
+ } else if (*firstp == bp->head->b) {
+ bp->head = bp->head->next;
+ bp->used += *countp;
+ free(*firstp);
+ } else if (*firstp == bp->buf)
+ return *countp == 0;
+
+ if (bp->head != NULL) {
+ *firstp = bp->head->b;
+ count = bp->saved - bp->used;
+ if (count > sizeof bp->head->b)
+ count = sizeof bp->head->b;
+ } else {
+ count = bp->fill.c - bp->buf;
+ *firstp = bp->buf;
+ }
+
+ *countp = count;
+ return *countp;
+}
+
+void *BufferAsPtr (Buffer_p bp, int fast) {
+ Int_t len;
+ char *data, *ptr = NULL;
+ int cnt;
+
+ if (fast && bp->saved == 0)
+ return bp->buf;
+
+ len = BufferFill(bp);
+ if (bp->result == 0)
+ bp->result = malloc(len);
+
+ for (data = bp->result; NextBuffer(bp, &ptr, &cnt); data += cnt)
+ memcpy(data, ptr, cnt);
+
+ return bp->result;
+}
+
+Seq_p BufferAsIntVec (Buffer_p bp) {
+ int cnt;
+ char *data, *ptr = NULL;
+ Seq_p seq;
+
+ seq = NewIntVec(BufferFill(bp) / sizeof(int), (void*) &data);
+
+ for (; NextBuffer(bp, &ptr, &cnt); data += cnt)
+ memcpy(data, ptr, cnt);
+
+ return seq;
+}
+/* %include% */
+/*
+ * column.c - Implementation of sequences, columns, and items.
+ */
+
+#include
+#include
+#include
+
+/* wrap_gen.h - generated code, do not edit */
+
+View_p (BlockedView) (View_p);
+View_p (CloneView) (View_p);
+Column (CoerceCmd) (Object_p, const char*);
+View_p (ColMapView) (View_p, Column);
+View_p (ColOmitView) (View_p, Column);
+View_p (ConcatView) (View_p, View_p);
+View_p (DescToMeta) (const char*);
+View_p (FirstView) (View_p, int);
+Column (GetHashInfo) (View_p, View_p, int);
+View_p (GroupCol) (View_p, Column, const char*);
+View_p (GroupedView) (View_p, Column, Column, const char*);
+int (HashDoFind) (View_p, int, View_p, Column, Column, Column);
+Column (HashValues) (View_p);
+View_p (IjoinView) (View_p, View_p);
+Column (IntersectMap) (View_p, View_p);
+View_p (JoinView) (View_p, View_p, const char*);
+View_p (LastView) (View_p, int);
+Column (NewCountsColumn) (Column);
+Column (NewIotaColumn) (int);
+View_p (NoColumnView) (int);
+View_p (ObjAsMetaView) (Object_p);
+Column (OmitColumn) (Column, int);
+View_p (OneColView) (View_p, int);
+View_p (PairView) (View_p, View_p);
+View_p (RemapSubview) (View_p, Column, int, int);
+int (RowCompare) (View_p, int, View_p, int);
+int (RowEqual) (View_p, int, View_p, int);
+int (RowHash) (View_p, int);
+Column (SortMap) (View_p);
+View_p (StepView) (View_p, int, int, int, int);
+int (StringLookup) (const char*, Column);
+View_p (TagView) (View_p, const char*);
+View_p (TakeView) (View_p, int);
+View_p (UngroupView) (View_p, int);
+Column (UniqMap) (View_p);
+View_p (V_Meta) (View_p);
+Column (ViewAsCol) (View_p);
+Column (ViewCol) (View_p, int);
+int (ViewCompare) (View_p, View_p);
+int (ViewCompat) (View_p, View_p);
+View_p (ViewReplace) (View_p, int, int, View_p);
+int (ViewSize) (View_p);
+int (ViewWidth) (View_p);
+
+ItemTypes (AppendCmd_VV) (Item_p a);
+ItemTypes (AtCmd_VIO) (Item_p a);
+ItemTypes (AtRowCmd_OI) (Item_p a);
+ItemTypes (BitRunsCmd_i) (Item_p a);
+ItemTypes (BlockedCmd_V) (Item_p a);
+ItemTypes (CloneCmd_V) (Item_p a);
+ItemTypes (CoerceCmd_OS) (Item_p a);
+ItemTypes (ColConvCmd_C) (Item_p a);
+ItemTypes (ColMapCmd_Vn) (Item_p a);
+ItemTypes (ColOmitCmd_Vn) (Item_p a);
+ItemTypes (CompareCmd_VV) (Item_p a);
+ItemTypes (CompatCmd_VV) (Item_p a);
+ItemTypes (ConcatCmd_VV) (Item_p a);
+ItemTypes (CountsCmd_VN) (Item_p a);
+ItemTypes (CountsColCmd_C) (Item_p a);
+ItemTypes (CountViewCmd_I) (Item_p a);
+ItemTypes (DataCmd_VX) (Item_p a);
+ItemTypes (DebugCmd_I) (Item_p a);
+ItemTypes (DefCmd_OO) (Item_p a);
+ItemTypes (DeleteCmd_VII) (Item_p a);
+ItemTypes (DepsCmd_O) (Item_p a);
+ItemTypes (EmitCmd_V) (Item_p a);
+ItemTypes (EmitModsCmd_V) (Item_p a);
+ItemTypes (ExceptCmd_VV) (Item_p a);
+ItemTypes (ExceptMapCmd_VV) (Item_p a);
+ItemTypes (FirstCmd_VI) (Item_p a);
+ItemTypes (GetCmd_VX) (Item_p a);
+ItemTypes (GetColCmd_VN) (Item_p a);
+ItemTypes (GetInfoCmd_VVI) (Item_p a);
+ItemTypes (GroupCmd_VnS) (Item_p a);
+ItemTypes (GroupedCmd_ViiS) (Item_p a);
+ItemTypes (HashColCmd_SO) (Item_p a);
+ItemTypes (HashFindCmd_VIViii) (Item_p a);
+ItemTypes (HashViewCmd_V) (Item_p a);
+ItemTypes (IjoinCmd_VV) (Item_p a);
+ItemTypes (InsertCmd_VIV) (Item_p a);
+ItemTypes (IntersectCmd_VV) (Item_p a);
+ItemTypes (IotaCmd_I) (Item_p a);
+ItemTypes (IsectMapCmd_VV) (Item_p a);
+ItemTypes (JoinCmd_VVS) (Item_p a);
+ItemTypes (LastCmd_VI) (Item_p a);
+ItemTypes (LoadCmd_O) (Item_p a);
+ItemTypes (LoadModsCmd_OV) (Item_p a);
+ItemTypes (LoopCmd_X) (Item_p a);
+ItemTypes (MaxCmd_VN) (Item_p a);
+ItemTypes (MdefCmd_O) (Item_p a);
+ItemTypes (MdescCmd_S) (Item_p a);
+ItemTypes (MetaCmd_V) (Item_p a);
+ItemTypes (MinCmd_VN) (Item_p a);
+ItemTypes (MutInfoCmd_V) (Item_p a);
+ItemTypes (NameColCmd_V) (Item_p a);
+ItemTypes (NamesCmd_V) (Item_p a);
+ItemTypes (OmitMapCmd_iI) (Item_p a);
+ItemTypes (OneColCmd_VN) (Item_p a);
+ItemTypes (OpenCmd_S) (Item_p a);
+ItemTypes (PairCmd_VV) (Item_p a);
+ItemTypes (ProductCmd_VV) (Item_p a);
+ItemTypes (RefCmd_OX) (Item_p a);
+ItemTypes (RefsCmd_O) (Item_p a);
+ItemTypes (RemapCmd_Vi) (Item_p a);
+ItemTypes (RemapSubCmd_ViII) (Item_p a);
+ItemTypes (RenameCmd_VO) (Item_p a);
+ItemTypes (RepeatCmd_VI) (Item_p a);
+ItemTypes (ReplaceCmd_VIIV) (Item_p a);
+ItemTypes (ResizeColCmd_iII) (Item_p a);
+ItemTypes (ReverseCmd_V) (Item_p a);
+ItemTypes (RowCmpCmd_VIVI) (Item_p a);
+ItemTypes (RowEqCmd_VIVI) (Item_p a);
+ItemTypes (RowHashCmd_VI) (Item_p a);
+ItemTypes (SaveCmd_VS) (Item_p a);
+ItemTypes (SetCmd_MIX) (Item_p a);
+ItemTypes (SizeCmd_V) (Item_p a);
+ItemTypes (SliceCmd_VIII) (Item_p a);
+ItemTypes (SortCmd_V) (Item_p a);
+ItemTypes (SortMapCmd_V) (Item_p a);
+ItemTypes (SpreadCmd_VI) (Item_p a);
+ItemTypes (StepCmd_VIIII) (Item_p a);
+ItemTypes (StrLookupCmd_Ss) (Item_p a);
+ItemTypes (StructDescCmd_V) (Item_p a);
+ItemTypes (StructureCmd_V) (Item_p a);
+ItemTypes (SumCmd_VN) (Item_p a);
+ItemTypes (TagCmd_VS) (Item_p a);
+ItemTypes (TakeCmd_VI) (Item_p a);
+ItemTypes (ToCmd_OO) (Item_p a);
+ItemTypes (TypeCmd_O) (Item_p a);
+ItemTypes (TypesCmd_V) (Item_p a);
+ItemTypes (UngroupCmd_VN) (Item_p a);
+ItemTypes (UnionCmd_VV) (Item_p a);
+ItemTypes (UnionMapCmd_VV) (Item_p a);
+ItemTypes (UniqueCmd_V) (Item_p a);
+ItemTypes (UniqueMapCmd_V) (Item_p a);
+ItemTypes (ViewCmd_X) (Item_p a);
+ItemTypes (ViewAsColCmd_V) (Item_p a);
+ItemTypes (ViewConvCmd_V) (Item_p a);
+ItemTypes (WidthCmd_V) (Item_p a);
+ItemTypes (WriteCmd_VO) (Item_p a);
+
+/* end of generated code */
+
+ItemTypes DebugCmd_I (Item_p a) {
+ Shared_p sh = GetShared();
+ a->i = sh->debug ^= a[0].i;
+ return IT_int;
+}
+
+void *AdjustSeqRefs (void *refs, int count) {
+ /*if (count > 0)*/
+ if (refs != NULL) {
+ Seq_p ptr = refs;
+ ptr->refs += count;
+ if (ptr->refs <= 0) {
+ if (ptr->type != NULL) {
+ int i, f;
+
+ if (ptr->type->cleaner != NULL)
+ ptr->type->cleaner(ptr);
+
+ for (i = 0, f = ptr->type->cleanups; f > 0; ++i, f >>= 3)
+ if (f & 1)
+ DecRefCount(ptr->data[i].p);
+ else if (f & 2)
+ free(ptr->data[i].p);
+ }
+ free(refs);
+ refs = NULL;
+ }
+ }
+ return refs;
+}
+
+Seq_p LoseRef (Seq_p seq) {
+ ADD_PTR_TO_BUF(*GetShared()->keeps, seq);
+ return seq;
+}
+
+Column SeqAsCol (Seq_p seq) {
+ Column result;
+ result.seq = seq;
+ result.pos = -1;
+ return result;
+}
+
+Seq_p NewSequenceNoRef (int count, SeqType_p type, int bytes) {
+ Seq_p seq;
+
+ seq = calloc(1, sizeof(struct Sequence) + bytes);
+ seq->count = count;
+ seq->type = type;
+ seq->getter = type->getfun;
+
+ /* default for data[0].p is to point to the aux bytes after the sequence */
+ /* default for data[1].i is to contain number of extra bytes allocated */
+ seq->data[0].p = seq + 1;
+ seq->data[1].i = bytes;
+
+ /* make sure 64-bit values have a "natural" 8-byte alignment */
+ Assert(((Int_t) seq->data[0].p) % 8 == 0);
+
+ return seq;
+}
+
+Seq_p NewSequence (int count, SeqType_p type, int bytes) {
+ return KeepRef(NewSequenceNoRef(count, type, bytes));
+}
+
+void ReleaseSequences (Buffer_p keep) {
+ int cnt;
+ char *ptr = NULL;
+
+ while (NextBuffer(keep, &ptr, &cnt)) {
+ Seq_p *refs = (Seq_p*) ptr;
+ int count = cnt / sizeof(Seq_p);
+
+ while (--count >= 0)
+ DecRefCount(refs[count]);
+ }
+}
+
+/* TODO: not used yet, should review refcount scenarios, might be wrong now */
+Seq_p ResizeSeq (Seq_p seq, int pos, int diff, int elemsize) {
+ int newcnt, olimit, nlimit = 0, bytes;
+ Seq_p result = seq;
+
+ Assert(seq->refs == 1);
+
+ newcnt = seq->count + diff;
+ bytes = seq->data[1].i;
+ olimit = bytes / elemsize;
+
+ if (diff > 0) { /* grow when limit is reached */
+ if (newcnt > olimit) {
+ nlimit = (olimit / 2) * 3 + 4;
+ if (nlimit < newcnt)
+ nlimit = newcnt + 4;
+ }
+ } else { /* shrink when less than half full */
+ if (newcnt < olimit / 2) {
+ nlimit = newcnt + 2;
+ bytes = seq->count * elemsize;
+ }
+ }
+
+ if (nlimit > 0) {
+ result = IncRefCount(NewSequence(seq->count, seq->type,
+ nlimit * elemsize));
+ result->getter = seq->getter;
+ result->data[2] = seq->data[2];
+ result->data[3] = seq->data[3];
+ memcpy(result+1, seq+1, pos * elemsize);
+
+ seq->type = NULL; /* release and prevent from calling cleaner */
+ /*LoseRef(seq);*/
+ }
+
+ if (diff > 0) {
+ memmove((char*) (result+1) + (pos + diff) * elemsize,
+ (char*) (seq+1) + pos * elemsize,
+ (seq->count - pos) * elemsize);
+ memset((char*) (result+1) + pos * elemsize, 0, diff * elemsize);
+ } else
+ memmove((char*) (result+1) + pos * elemsize,
+ (char*) (seq+1) + (pos - diff) * elemsize,
+ (seq->count - (pos - diff)) * elemsize);
+
+ result->count += diff;
+ return result;
+}
+
+ItemTypes ResizeColCmd_iII (Item_p a) {
+ int r, *data;
+ Seq_p seq, result;
+
+ seq = a[0].c.seq;
+ result = NewIntVec(seq->count, &data);
+ for (r = 0; r < seq->count; ++r)
+ data[r] = GetSeqItem(r, seq, IT_int).i;
+
+ a->c.seq = ResizeSeq(result, a[1].i, a[2].i, sizeof(int));
+ return IT_column;
+}
+
+Seq_p NewBitVec (int count) {
+ return NewSequence(count, PickIntGetter(1), (count + 7) / 8);
+}
+
+Seq_p NewIntVec (int count, int **dataptr) {
+ const int w = sizeof(int);
+ Seq_p seq = NewSequence(count, PickIntGetter(8 * w), w * count);
+ if (dataptr != NULL)
+ *dataptr = seq->data[0].p;
+ return seq;
+}
+
+Seq_p NewPtrVec (int count, Int_t **dataptr) {
+ const int w = sizeof(Int_t);
+ Seq_p result = NewSequence(count, PickIntGetter(8 * w), w * count);
+ if (dataptr != NULL)
+ *dataptr = result->data[0].p;
+ return result;
+}
+
+ItemTypes GetItem (int row, Item_p item) {
+ Seq_p seq = item->c.seq;
+
+ if (row < 0 || row >= seq->count) {
+ item->e = EC_rioor;
+ return IT_error;
+ }
+
+ return seq->getter(row, item);
+}
+
+Item GetColItem (int row, Column column, ItemTypes type) {
+ Item item;
+ ItemTypes got;
+
+ item.c = column;
+ got = GetItem(row, &item);
+ Assert(got == type);
+ return item;
+}
+
+Item GetSeqItem (int row, Seq_p seq, ItemTypes type) {
+ Item item;
+ ItemTypes got;
+
+ item.c.seq = seq;
+ item.c.pos = -1;
+ got = GetItem(row, &item);
+ Assert(got == type);
+ return item;
+}
+
+Item GetViewItem (View_p view, int row, int col, ItemTypes type) {
+ Item item;
+ ItemTypes got;
+
+ item.c = ViewCol(view, col);
+ got = GetItem(row, &item);
+ Assert(got == type);
+ return item;
+}
+
+#if 0 /* unused */
+const char *ItemTypeAsString (ItemTypes type) {
+ static const char *typeTable[] = {
+ "", /* IT_unknown */
+ "I", /* IT_int */
+ "L", /* IT_wide */
+ "D", /* IT_double */
+ "S", /* IT_string */
+ "O", /* IT_object */
+ "C", /* IT_column */
+ "V", /* IT_view */
+ "E", /* IT_error */
+ };
+
+ return typeTable[type];
+}
+#endif
+
+ItemTypes CharAsItemType (char type) {
+ switch (type) {
+ case 0: return IT_unknown;
+ case 'I': return IT_int;
+ case 'L': return IT_wide;
+ case 'F': return IT_float;
+ case 'D': return IT_double;
+ case 'S': return IT_string;
+ case 'B': return IT_bytes;
+ case 'O': return IT_object;
+ case 'C': return IT_column;
+ case 'V': return IT_view;
+ }
+ return IT_error;
+}
+
+static ItemTypes StringGetter (int row, Item_p item) {
+ char **ptrs = (char**) item->c.seq->data[0].p;
+ item->s = ptrs[row];
+ return IT_string;
+}
+
+static struct SeqType ST_String = { "string", StringGetter, 0102 };
+
+static ItemTypes BytesGetter (int row, Item_p item) {
+ char **ptrs = (char**) item->c.seq->data[0].p;
+ item->u.ptr = (const Byte_t*) ptrs[row];
+ item->u.len = ptrs[row+1] - ptrs[row];
+ return IT_bytes;
+}
+
+static struct SeqType ST_Bytes = { "string", BytesGetter, 0102 };
+
+Seq_p NewStrVec (int istext) {
+ Seq_p seq;
+ Buffer_p bufs;
+
+ bufs = malloc(2 * sizeof(struct Buffer));
+ InitBuffer(bufs);
+ InitBuffer(bufs+1);
+
+ seq = NewSequence(0, istext ? &ST_String : &ST_Bytes, 0);
+ /* data[0] starts as two buffers, then becomes vector of string pointers */
+ /* data[1] is not used */
+ /* data[2] is an optional pointer to hash map sequence, see StringLookup */
+ seq->data[0].p = bufs;
+
+ return seq;
+}
+
+void AppendToStrVec (const void *string, int bytes, Seq_p seq) {
+ Buffer_p bufs = seq->data[0].p;
+
+ if (bytes < 0)
+ bytes = strlen((const char*) string) + 1;
+
+ /* TODO: consider tracking pointers i.s.o. making actual copies here */
+ AddToBuffer(bufs, string, bytes);
+ ADD_INT_TO_BUF(bufs[1], bytes);
+
+ ++seq->count;
+}
+
+Seq_p FinishStrVec (Seq_p seq) {
+ int r = 0, cnt = 0, *iptr = NULL;
+ char *fill, **ptrs, *cptr = NULL;
+ Buffer_p bufs = seq->data[0].p;
+
+ ptrs = malloc((seq->count+1) * sizeof(char*) + BufferFill(bufs));
+
+ fill = (char*) (ptrs + seq->count + 1);
+ while (NextBuffer(bufs+1, (void*) &iptr, &cnt)) {
+ int i, n = cnt / sizeof(int);
+ for (i = 0; i < n; ++i) {
+ ptrs[r++] = fill;
+ fill += iptr[i];
+ }
+ }
+ ptrs[r] = fill; /* past-end mark needed to provide length of last entry */
+
+ fill = (char*) (ptrs + seq->count + 1);
+ while (NextBuffer(bufs, &cptr, &cnt)) {
+ memcpy(fill, cptr, cnt);
+ fill += cnt;
+ }
+
+ ReleaseBuffer(bufs, 0);
+ ReleaseBuffer(bufs+1, 0);
+ free(seq->data[0].p);
+
+ seq->data[0].p = ptrs;
+ return seq;
+}
+
+Column ForceStringColumn (Column column) {
+ int r, rows;
+ Seq_p result;
+
+ /* this code needed to always make name column of meta views string cols */
+
+ if (column.seq == NULL || column.seq->getter == StringGetter)
+ return column;
+
+ rows = column.seq->count;
+ result = NewStrVec(1);
+
+ for (r = 0; r < rows; ++r)
+ AppendToStrVec(GetColItem(r, column, IT_string).s, -1, result);
+
+ return SeqAsCol(FinishStrVec(result));
+}
+
+static ItemTypes IotaGetter (int row, Item_p item) {
+ item->i = row;
+ return IT_int;
+}
+
+static struct SeqType ST_Iota = { "iota", IotaGetter };
+
+Column NewIotaColumn (int count) {
+ return SeqAsCol(NewSequence(count, &ST_Iota, 0));
+}
+
+static void SequenceCleaner (Seq_p seq) {
+ int i;
+ View_p *items = seq->data[0].p;
+
+ for (i = 0; i < seq->count; ++i)
+ DecRefCount(items[i]);
+}
+
+static ItemTypes SequenceGetter (int row, Item_p item) {
+ void **items = (void**) item->c.seq->data[0].p;
+ ItemTypes type = item->c.seq->data[1].i;
+
+ switch (type) {
+
+ case IT_view:
+ item->v = items[row];
+ return IT_view;
+
+ case IT_column:
+ item->c.seq = items[row];
+ item->c.pos = -1;
+ return IT_column;
+
+ default:
+ return IT_unknown;
+ }
+}
+
+static struct SeqType ST_Sequence = {
+ "sequence", SequenceGetter, 0, SequenceCleaner
+};
+
+Seq_p NewSeqVec (ItemTypes type, const Seq_p *items, int count) {
+ int i, bytes;
+ Seq_p seq;
+
+ bytes = count * sizeof(View_p);
+ seq = NewSequence(count, &ST_Sequence, bytes);
+ /* data[0] points to a list of pointers */
+ /* data[1] is the type of the returned items */
+ seq->data[1].i = type;
+
+ if (items != NULL) {
+ memcpy(seq->data[0].p, items, bytes);
+ for (i = 0; i < count; ++i)
+ IncRefCount(items[i]);
+ }
+
+ return seq;
+}
+
+static ItemTypes CountsGetter (int row, Item_p item) {
+ const View_p *items = (const View_p*) item->c.seq->data[0].p;
+
+ item->i = ViewSize(items[row]);
+ return IT_int;
+}
+
+Column NewCountsColumn (Column column) {
+ int r, rows;
+ View_p *items;
+ Seq_p seq;
+
+ rows = column.seq->count;
+ seq = NewSeqVec(IT_view, NULL, rows);
+ seq->getter = CountsGetter;
+
+ items = seq->data[0].p;
+ for (r = 0; r < rows; ++r)
+ items[r] = IncRefCount(GetColItem(r, column, IT_view).v);
+
+ return SeqAsCol(seq);
+}
+
+Column OmitColumn (Column omit, int size) {
+ int i, *data, j = 0, outsize;
+ Seq_p seq, map;
+
+ if (omit.seq == NULL)
+ return omit;
+
+ outsize = size - omit.seq->count;
+
+ /* FIXME: wasteful for large views, consider sorting input col instead */
+ map = NewBitVec(size);
+ for (i = 0; i < omit.seq->count; ++i)
+ SetBit(&map, GetColItem(i, omit, IT_int).i);
+
+ seq = NewIntVec(outsize, &data);
+
+ for (i = 0; i < size; ++i)
+ if (!TestBit(map, i)) {
+ Assert(j < outsize);
+ data[j++] = i;
+ }
+
+ return SeqAsCol(seq);
+}
+
+#if 0
+static ItemTypes UnknownGetter (int row, Item_p item) {
+ return IT_unknown;
+}
+
+static struct SeqType ST_Unknown = { "unknown", UnknownGetter };
+
+static Seq_p NewUnknownVec (int count) {
+ return NewSequence(count, &ST_Unknown, 0);
+}
+#endif
+
+Column CoerceColumn (ItemTypes type, Object_p obj) {
+ int i, n;
+ void *data;
+ Seq_p seq;
+ Item item;
+ Column out, column = ObjAsColumn(obj);
+
+ if (column.seq == NULL)
+ return column;
+
+ /* determine the input column type by fetching one item */
+ item.c = column;
+ n = column.seq->count;
+
+ if (GetItem(0, &item) == type)
+ return column;
+
+ switch (type) {
+ case IT_int: seq = NewIntVec(n, (void*) &data); break;
+ case IT_wide: seq = NewSequence(n, PickIntGetter(64), 8 * n); break;
+ case IT_float: seq = NewSequence(n, FixedGetter(4,1,1,0), 4 * n);
+ break;
+ case IT_double: seq = NewSequence(n, FixedGetter(8,1,1,0), 8 * n);
+ break;
+ case IT_string: seq = NewStrVec(1); break;
+ case IT_bytes: seq = NewStrVec(0); break;
+ case IT_view: seq = NewSeqVec(IT_view, NULL, n); break;
+ default: Assert(0);
+ }
+
+ out = SeqAsCol(seq);
+ data = out.seq->data[0].p;
+
+ for (i = 0; i < n; ++i) {
+ item.o = GetColItem(i, column, IT_object).o;
+ if (!ObjToItem(type, &item)) {
+ out.seq = NULL;
+ out.pos = i;
+ break;
+ }
+
+ switch (type) {
+ case IT_int: ((int*) data)[i] = item.i; break;
+ case IT_wide: ((int64_t*) data)[i] = item.w; break;
+ case IT_float: ((float*) data)[i] = item.f; break;
+ case IT_double: ((double*) data)[i] = item.d; break;
+ case IT_string: AppendToStrVec(item.s, -1, out.seq); break;
+ case IT_bytes: AppendToStrVec(item.u.ptr, item.u.len, out.seq);
+ break;
+ case IT_view: ((Seq_p*) data)[i] = IncRefCount(item.v); break;
+ default: Assert(0);
+ }
+ }
+
+ if (type == IT_string || type == IT_bytes)
+ FinishStrVec(seq);
+
+ return out;
+}
+
+Column CoerceCmd (Object_p obj, const char *str) {
+ return CoerceColumn(CharAsItemType(str[0]), obj);
+}
+
+int CastObjToItem (char type, Item_p item) {
+ switch (type) {
+
+ case 'M':
+ item->o = NeedMutable(item->o);
+ return (void*) item->o != NULL;
+
+ case 'N':
+ item->i = ColumnByName(V_Meta(item[-1].v), item->o);
+ return item->i >= 0;
+
+ case 'n': {
+ int *data, r, rows;
+ View_p meta;
+ Column column;
+ Seq_p seq;
+
+ column = ObjAsColumn(item->o);
+ if (column.seq == NULL)
+ return 0;
+
+ rows = column.seq->count;
+ seq = NewIntVec(rows, &data);
+ meta = V_Meta(item[-1].v);
+
+ for (r = 0; r < rows; ++r) {
+ /* FIXME: this only works if input is a list, not a column! */
+ data[r] = ColumnByName(meta, GetColItem(r, column,
+ IT_object).o);
+ if (data[r] < 0)
+ return 0;
+ }
+
+ item->c = SeqAsCol(seq);
+ break;
+ }
+
+ default:
+ if (type < 'a' || type > 'z')
+ return ObjToItem(CharAsItemType(type), item);
+
+ item->c = CoerceColumn(CharAsItemType(type + 'A'-'a'), item->o);
+ break;
+ }
+
+ return 1; /* cast succeeded */
+}
+/* %include% */
+/*
+ * emit.c - Implementation of file output commands.
+ */
+
+#include
+#include
+#include
+
+
+typedef enum EmitTypes {
+ ET_mem
+} EmitTypes;
+
+typedef struct EmitItem {
+ EmitTypes type;
+ Int_t size;
+ const void *data;
+} EmitItem, *EmitItem_p;
+
+typedef struct EmitInfo {
+ int64_t position; /* emit offset, track >2 Gb even on 32b arch */
+ struct Buffer *itembuf; /* item buffer */
+ struct Buffer *colbuf; /* column buffer */
+ int diff; /* true if emitting differences */
+} EmitInfo, *EmitInfo_p;
+
+static void EmitView (EmitInfo_p eip, View_p view, int describe); /* forward */
+
+static Int_t EmitBlock (EmitInfo_p eip, const void* data, int size) {
+ EmitItem item;
+ Int_t pos = eip->position;
+
+ if (size > 0) {
+ item.type = ET_mem;
+ item.size = size;
+ item.data = data;
+ AddToBuffer(eip->itembuf, &item, sizeof item);
+
+ eip->position += size;
+ } else
+ free((void*) data);
+
+ return pos;
+}
+
+static void *EmitCopy (EmitInfo_p eip, const void* data, int size) {
+ void *buf = NULL;
+ if (size > 0) {
+ buf = memcpy(malloc(size), data, size);
+ EmitBlock(eip, buf, size);
+ }
+ return buf;
+}
+
+static Int_t EmitBuffer (EmitInfo_p eip, Buffer_p buf) {
+ Int_t pos = EmitBlock(eip, BufferAsPtr(buf, 0), BufferFill(buf));
+ ReleaseBuffer(buf, 1);
+ return pos;
+}
+
+static void EmitAlign (EmitInfo_p eip) {
+ if (eip->position >= 1024 * 1024)
+ EmitCopy(eip, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 15 & - eip->position);
+}
+
+void MetaAsDesc (View_p meta, Buffer_p buffer) {
+ int r, rows = (int)ViewSize(meta);
+ Column names, types, subvs;
+ char type;
+ const char *name;
+ View_p subv;
+
+ names = ViewCol(meta, MC_name);
+ types = ViewCol(meta, MC_type);
+ subvs = ViewCol(meta, MC_subv);
+
+ for (r = 0; r < rows; ++r) {
+ if (r > 0)
+ AddToBuffer(buffer, ",", 1);
+
+ name = GetColItem(r, names, IT_string).s;
+ type = *GetColItem(r, types, IT_string).s;
+ subv = GetColItem(r, subvs, IT_view).v;
+
+ AddToBuffer(buffer, name, strlen(name));
+ if (type == 'V' && ViewSize(subv) > 0) {
+ AddToBuffer(buffer, "[", 1);
+ MetaAsDesc(subv, buffer);
+ AddToBuffer(buffer, "]", 1);
+ } else {
+ AddToBuffer(buffer, ":", 1);
+ AddToBuffer(buffer, &type, 1);
+ }
+ }
+}
+
+static void EmitVarInt (EmitInfo_p eip, Int_t value) {
+ int n;
+
+#if 0
+ if (value < 0) {
+ ADD_ONEC_TO_BUF(*eip->colbuf, 0);
+ value = ~value;
+ }
+#endif
+
+ Assert(value >= 0);
+ for (n = 7; (value >> n) > 0; n += 7)
+ ;
+ while ((n -= 7) > 0)
+ ADD_ONEC_TO_BUF(*eip->colbuf, (value >> n) & 0x7F);
+ ADD_CHAR_TO_BUF(*eip->colbuf, (value & 0x7F) | 0x80);
+}
+
+static void EmitPair (EmitInfo_p eip, Int_t offset) {
+ Int_t size;
+
+ size = eip->position - offset;
+ EmitVarInt(eip, size);
+ if (size > 0)
+ EmitVarInt(eip, offset);
+}
+
+static int MinWidth (int lo, int hi) {
+ lo = lo > 0 ? 0 : "444444445555555566666666666666666"[TopBit(~lo)+1] & 7;
+ hi = hi < 0 ? 0 : "012334445555555566666666666666666"[TopBit(hi)+1] & 7;
+ return lo > hi ? lo : hi;
+}
+
+static int *PackedIntVec (const int *data, int rows, Int_t *outsize) {
+ int r, width, lo = 0, hi = 0, bits, *result;
+ const int *limit;
+ Int_t bytes;
+
+ for (r = 0; r < rows; ++r) {
+ if (data[r] < lo) lo = data[r];
+ if (data[r] > hi) hi = data[r];
+ }
+
+ width = MinWidth(lo, hi);
+
+ if (width >= 6) {
+ bytes = rows * (1 << (width-4));
+ result = malloc(bytes);
+ memcpy(result, data, bytes);
+ } else if (rows > 0 && width > 0) {
+ if (rows < 5 && width < 4) {
+ static char fudges[3][4] = { /* n: 1: 2: 3: 4: */
+ {1,1,1,1}, /* 1-bit entries: 1b 2b 3b 4b */
+ {1,1,1,1}, /* 2-bit entries: 2b 4b 6b 8b */
+ {1,1,2,2}, /* 4-bit entries: 4b 8b 12b 16b */
+ };
+ static char widths[3][4] = { /* n: 1: 2: 3: 4: */
+ {3,3,2,2}, /* 1-bit entries: 4b 4b 2b 2b */
+ {3,3,2,2}, /* 2-bit entries: 4b 4b 2b 2b */
+ {3,3,3,3}, /* 4-bit entries: 4b 4b 4b 4b */
+ };
+ bytes = fudges[width-1][rows-1];
+ width = widths[width-1][rows-1];
+ } else
+ bytes = (((Int_t) rows << width) + 14) >> 4; /* round up */
+
+ result = malloc(bytes);
+ if (width < 4)
+ memset(result, 0, bytes);
+
+ limit = data + rows;
+ bits = 0;
+
+ switch (width) {
+
+ case 1: { /* 1 bit, 8 per byte */
+ char* q = (char*) result;
+ while (data < limit) {
+ *q |= (*data++ & 1) << bits; ++bits; q += bits >> 3;
+ bits &= 7;
+ }
+ break;
+ }
+
+ case 2: { /* 2 bits, 4 per byte */
+ char* q = (char*) result;
+ while (data < limit) {
+ *q |= (*data++ & 3) << bits; bits += 2; q += bits >> 3;
+ bits &= 7;
+ }
+ break;
+ }
+
+ case 3: { /* 4 bits, 2 per byte */
+ char* q = (char*) result;
+ while (data < limit) {
+ *q |= (*data++ & 15) << bits; bits += 4; q += bits >> 3;
+ bits &= 7;
+ }
+ break;
+ }
+
+ case 4: { /* 1-byte (char) */
+ char* q = (char*) result;
+ while (data < limit)
+ *q++ = (char) *data++;
+ break;
+ }
+
+ case 5: { /* 2-byte (short) */
+ short* q = (short*) result;
+ while (data < limit)
+ *q++ = (short) *data++;
+ break;
+ }
+ }
+ } else {
+ bytes = 0;
+ result = NULL;
+ }
+
+ *outsize = bytes;
+ return result;
+}
+
+static int EmitFixCol (EmitInfo_p eip, Column column, ItemTypes type) {
+ int r, rows, *tempvec;
+ void *buffer;
+ Int_t bufsize;
+
+ rows = column.seq->count;
+
+ switch (type) {
+
+ case IT_int:
+ bufsize = rows * sizeof(int);
+ tempvec = malloc(bufsize);
+ for (r = 0; r < rows; ++r)
+ tempvec[r] = GetColItem(r, column, type).i;
+ buffer = PackedIntVec(tempvec, rows, &bufsize);
+ free((char*) tempvec); /* TODO: avoid extra copy & malloc */
+
+ /* try to compress the bitmap, but only in diff save mode */
+ if (eip->diff && rows >= 128 && rows == bufsize * 8) {
+ int ebits;
+
+ tempvec = (void*) Bits2elias(buffer, rows, &ebits);
+
+ /* only keep compressed form if under 80% of plain bitmap */
+ if (ebits + ebits/4 < rows) {
+ free(buffer);
+ buffer = tempvec;
+ bufsize = (ebits + 7) / 8;
+ } else
+ free((char*) tempvec);
+ }
+
+ break;
+
+ case IT_wide:
+ bufsize = rows * sizeof(int64_t);
+ buffer = malloc(bufsize);
+ for (r = 0; r < rows; ++r)
+ ((int64_t*) buffer)[r] = GetColItem(r, column, type).w;
+ break;
+
+ case IT_float:
+ bufsize = rows * sizeof(float);
+ buffer = malloc(bufsize);
+ for (r = 0; r < rows; ++r)
+ ((float*) buffer)[r] = GetColItem(r, column, type).f;
+ break;
+
+ case IT_double:
+ bufsize = rows * sizeof(double);
+ buffer = malloc(bufsize);
+ for (r = 0; r < rows; ++r)
+ ((double*) buffer)[r] = GetColItem(r, column, type).d;
+ break;
+
+ default: Assert(0); return 0;
+ }
+
+ /* start using 16-byte alignment once the emitted data reaches 1 Mb */
+ /* only do this for vectors >= 128 bytes, worst-case waste is under 10% */
+
+ Assert(!(bufsize > 0 && rows == 0));
+ if (bufsize >= 128 && bufsize / rows >= 2)
+ EmitAlign(eip);
+
+ EmitPair(eip, EmitBlock(eip, buffer, bufsize));
+
+ return bufsize != 0;
+}
+
+static void EmitVarCol (EmitInfo_p eip, Column column, int istext) {
+ int r, rows, bytes, *sizevec;
+ Int_t buflen;
+ Item item;
+ struct Buffer buffer;
+ Seq_p sizes;
+
+ InitBuffer(&buffer);
+ rows = column.seq->count;
+ sizes = NewIntVec(rows, &sizevec);
+
+ if (istext)
+ for (r = 0; r < rows; ++r) {
+ item = GetColItem(r, column, IT_string);
+ bytes = strlen(item.s);
+ if (bytes > 0)
+ AddToBuffer(&buffer, item.s, ++bytes);
+ sizevec[r] = bytes;
+ }
+ else
+ for (r = 0; r < rows; ++r) {
+ item = GetColItem(r, column, IT_bytes);
+ AddToBuffer(&buffer, item.u.ptr, item.u.len);
+ sizevec[r] = item.u.len;
+ }
+
+ buflen = BufferFill(&buffer);
+ EmitPair(eip, EmitBuffer(eip, &buffer));
+ if (buflen > 0)
+ EmitFixCol(eip, SeqAsCol(sizes), 1);
+
+ EmitVarInt(eip, 0); /* no memos */
+}
+
+static void EmitSubCol (EmitInfo_p eip, Column column, int describe) {
+ int r, rows;
+ View_p view;
+ struct Buffer newcolbuf;
+ Buffer_p origcolbuf;
+
+ origcolbuf = eip->colbuf;
+ eip->colbuf = &newcolbuf;
+ InitBuffer(eip->colbuf);
+
+ rows = column.seq->count;
+
+ for (r = 0; r < rows; ++r) {
+ view = GetColItem(r, column, IT_view).v;
+ EmitView(eip, view, describe);
+ }
+
+ eip->colbuf = origcolbuf;
+
+ EmitPair(eip, EmitBuffer(eip, &newcolbuf));
+}
+
+static void EmitCols (EmitInfo_p eip, View_p view, View_p maps) {
+ int rows = ViewSize(view);
+
+ EmitVarInt(eip, rows);
+
+ if (rows > 0) {
+ int i, r, c, *rowptr = NULL;
+ ItemTypes type;
+ Column column;
+ Seq_p rowmap;
+ View_p v, subv, meta = V_Meta(view);
+
+ rowmap = NULL;
+
+ for (c = 0; c < ViewWidth(view); ++c) {
+ if (maps != NULL) {
+ Column mapcol = ViewCol(maps, c);
+ if (!EmitFixCol(eip, mapcol, IT_int))
+ continue;
+
+ if (rowmap == NULL)
+ rowmap = NewIntVec(rows, &rowptr);
+
+ i = 0;
+ for (r = 0; r < rows; ++r)
+ if (GetColItem(r, mapcol, IT_int).i)
+ rowptr[i++] = r;
+
+ rowmap->count = i;
+
+ v = RemapSubview(view, SeqAsCol(rowmap), 0, -1);
+ } else
+ v = view;
+
+ column = ViewCol(v,c);
+ type = ViewColType(view, c);
+ switch (type) {
+
+ case IT_int:
+ case IT_wide:
+ case IT_float:
+ case IT_double:
+ EmitFixCol(eip, column, type);
+ break;
+
+ case IT_string:
+ EmitVarCol(eip, column, 1);
+ break;
+
+ case IT_bytes:
+ EmitVarCol(eip, column, 0);
+ break;
+
+ case IT_view:
+ subv = GetViewItem(meta, c, MC_subv, IT_view).v;
+ EmitSubCol(eip, column, ViewSize(subv) == 0);
+ break;
+
+ default: Assert(0);
+ }
+ }
+ }
+}
+
+static void EmitView (EmitInfo_p eip, View_p view, int describe) {
+ EmitVarInt(eip, 0);
+
+ if (eip->diff) {
+ Seq_p mods = MutPrepare(view), *seqs = (void*) (mods + 1);
+
+ EmitVarInt(eip, 0);
+ EmitFixCol(eip, SeqAsCol(seqs[MP_delmap]), IT_int);
+
+ if (EmitFixCol(eip, SeqAsCol(seqs[MP_adjmap]), IT_int))
+ EmitCols(eip, seqs[MP_adjdat], seqs[MP_usemap]);
+
+ EmitCols(eip, seqs[MP_insdat], NULL);
+ if (ViewSize(seqs[MP_insdat]) > 0)
+ EmitFixCol(eip, SeqAsCol(seqs[MP_insmap]), IT_int);
+ } else {
+ if (describe) {
+ int cnt;
+ char *ptr = NULL;
+ struct Buffer desc;
+
+ InitBuffer(&desc);
+ MetaAsDesc(V_Meta(view), &desc);
+
+ EmitVarInt(eip, BufferFill(&desc));
+
+ while (NextBuffer(&desc, &ptr, &cnt))
+ AddToBuffer(eip->colbuf, ptr, cnt);
+ }
+
+ EmitCols(eip, view, NULL);
+ }
+}
+
+static void SetBigEndian32 (char* dest, Int_t value) {
+ dest[0] = (char) (value >> 24);
+ dest[1] = (char) (value >> 16);
+ dest[2] = (char) (value >> 8);
+ dest[3] = (char) value;
+}
+
+static Int_t EmitComplete (EmitInfo_p eip, View_p view) {
+ int overflow;
+ Int_t rootpos, tailpos, endpos;
+ char tail[16];
+ struct Head { short a; char b; char c; char d[4]; } head, *fixup;
+ struct Buffer newcolbuf;
+
+ if (eip->diff && !IsMutable(view))
+ return 0;
+
+ eip->position = 0;
+
+ head.a = 'J' + ('L' << 8);
+ head.b = 0x1A;
+ head.c = 0;
+ fixup = EmitCopy(eip, &head, sizeof head);
+
+ eip->colbuf = &newcolbuf;
+ InitBuffer(eip->colbuf);
+
+ EmitView(eip, view, 1);
+
+ EmitAlign(eip);
+ rootpos = EmitBuffer(eip, eip->colbuf);
+ eip->colbuf = NULL;
+
+ EmitAlign(eip);
+
+ if (eip->position != (Int_t) eip->position)
+ return -1; /* fail if >= 2 Gb on machines with a 32-bit address space */
+
+ /* large files will have bit 8 of head[3] and bit 8 of tail[12] set */
+ tailpos = eip->position;
+ endpos = tailpos + sizeof tail;
+ overflow = endpos >> 31;
+
+ /* for file sizes > 2 Gb, store bits 41..31 in tail[2..3] */
+ SetBigEndian32(tail, 0x80000000 + overflow);
+ SetBigEndian32(tail+4, tailpos);
+ SetBigEndian32(tail+8,
+ ((eip->diff ? 0x90 : 0x80) << 24) + tailpos - rootpos);
+ SetBigEndian32(tail+12, rootpos);
+ if (overflow)
+ tail[12] |= 0x80;
+
+ EmitCopy(eip, tail, sizeof tail);
+
+ if (overflow) {
+ /* store bits 41..36 in head[3], and bits 35..4 in head[4..7] */
+ Assert((endpos & 15) == 0);
+ fixup->c = 0x80 | ((endpos >> 16) >> 20);
+ SetBigEndian32(fixup->d, endpos >> 4);
+ } else
+ SetBigEndian32(fixup->d, endpos);
+
+ return endpos;
+}
+
+Int_t ViewSave (View_p view, void *aux, SaveInitFun initfun, SaveDataFun datafun, int diff) {
+ int i, numitems;
+ Int_t bytes;
+ struct Buffer buffer;
+ EmitItem_p items;
+ EmitInfo einfo;
+
+ InitBuffer(&buffer);
+
+ einfo.itembuf = &buffer;
+ einfo.diff = diff;
+
+ bytes = EmitComplete(&einfo, view);
+
+ numitems = BufferFill(&buffer) / sizeof(EmitItem);
+ items = BufferAsPtr(&buffer, 1);
+
+ if (initfun != NULL)
+ aux = initfun(aux, bytes);
+
+ for (i = 0; i < numitems; ++i) {
+ if (aux != NULL)
+ aux = datafun(aux, items[i].data, items[i].size);
+ free((void*) items[i].data);
+ }
+
+ if (aux == NULL)
+ bytes = 0;
+
+ ReleaseBuffer(&buffer, 0);
+ return bytes;
+}
+/* %include% */
+/*
+ * file.c - Implementation of memory-mapped file access.
+ */
+
+#include
+#include
+#include
+
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include
+#else
+#include
+#include
+#include
+#endif
+
+
+static View_p MapSubview (MappedFile_p, Int_t, View_p, View_p); /* forward */
+
+#define MF_Data(map) ((const char*) ((map)->data[0].p))
+#define MF_Length(map) ((Int_t) (map)->data[1].p)
+
+static void MappedCleaner (MappedFile_p map) {
+ Cleaner fun = *((Cleaner*) (map + 1));
+ if (fun != NULL)
+ fun(map);
+}
+
+static struct SeqType ST_Mapped = { "mapped", NULL, 0, MappedCleaner };
+
+MappedFile_p InitMappedFile (const char *data, Int_t length, Cleaner fun) {
+ MappedFile_p map;
+
+ map = NewSequence(0, &ST_Mapped, sizeof(Cleaner));
+ /* data[0] points to the current start of the mapped area */
+ /* data[1] is the current length of the mapped area */
+ /* data[2] points to the original mapped area */
+ /* data[3] is available for storing an Object_p, see ext_tcl.c */
+ map->data[0].p = (void*) data;
+ map->data[1].p = (void*) length;
+ map->data[2].p = (void*) data;
+
+ *((Cleaner*) (map + 1)) = fun; /* TODO: get rid of this ugly hack */
+
+ return map;
+}
+
+static void MappedFileCleaner (MappedFile_p map) {
+#if WIN32+0
+ UnmapViewOfFile(map->data[2].p);
+#else
+ int offset = MF_Data(map) - (const char*) map->data[2].p;
+ munmap(map->data[2].p, MF_Length(map) + offset);
+#endif
+}
+
+#if WIN32+0
+/*
+ * If we are opening a Windows PE executable with an attached metakit
+ * then we must check for the presence of an Authenticode certificate
+ * and reduce the length of our mapped region accordingly
+ */
+
+static DWORD
+AuthenticodeOffset(LPBYTE pData, DWORD cbData)
+{
+ if (pData[0] == 'M' && pData[1] == 'Z') /* IMAGE_DOS_SIGNATURE */
+ {
+ LPBYTE pNT = pData + *(LONG *)(pData + 0x3c); /* e_lfanew */
+ if (pNT[0] == 'P' && pNT[1] == 'E' && pNT[2] == 0 && pNT[3] == 0)
+ { /* IMAGE_NT_SIGNATURE */
+ DWORD dwCheckSum = 0, dwDirectories = 0;
+ LPBYTE pOpt = pNT + 0x18; /* OptionalHeader */
+ LPDWORD pCertDir = NULL;
+ if (pOpt[0] == 0x0b && pOpt[1] == 0x01) { /* IMAGE_NT_OPTIONAL_HDR_MAGIC */
+ dwCheckSum = *(DWORD *)(pOpt + 0x40); /* Checksum */
+ dwDirectories = *(DWORD *)(pOpt + 0x5c); /* NumberOfRvaAndSizes */
+ if (dwDirectories > 4) { /* DataDirectory[] */
+ pCertDir = (DWORD *)(pOpt + 0x60 + (4 * 8));
+ }
+ } else {
+ dwCheckSum = *(DWORD *)(pOpt + 0x40); /* Checksum */
+ dwDirectories = *(DWORD *)(pOpt + 0x6c); /* NumberOfRvaAndSizes */
+ if (dwDirectories > 4) { /* DataDirectory[] */
+ pCertDir = (DWORD *)(pOpt + 0x70 + (4 * 8));
+ }
+ }
+
+ if (pCertDir && pCertDir[1] > 0) {
+ int n = 0;
+ cbData = pCertDir[0];
+ /* need to eliminate any zero padding - up to 8 bytes */
+ while (pData[cbData - 16] != 0x80 && pData[cbData-1] == 0 && n < 16) {
+ --cbData, ++n;
+ }
+ }
+ }
+ }
+ return cbData;
+}
+#endif /* WIN32 */
+
+static MappedFile_p OpenMappedFile (const char *filename) {
+ const char *data = NULL;
+ Int_t length = -1;
+
+#if WIN32+0
+ {
+ DWORD n;
+ HANDLE h, f;
+ OSVERSIONINFO os;
+
+ memset(&os, 0, sizeof(os));
+ os.dwOSVersionInfoSize = sizeof(os);
+ os.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
+ GetVersionEx(&os);
+ if (os.dwPlatformId < VER_PLATFORM_WIN32_NT) {
+ f = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, 0,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ } else {
+ f = CreateFileW((LPCWSTR)filename, GENERIC_READ, FILE_SHARE_READ, 0,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ }
+ if (f != INVALID_HANDLE_VALUE) {
+ h = CreateFileMapping(f, 0, PAGE_READONLY, 0, 0, 0);
+ if (h != INVALID_HANDLE_VALUE) {
+ n = GetFileSize(f, 0);
+ data = MapViewOfFile(h, FILE_MAP_READ, 0, 0, n);
+ if (data != NULL) {
+ length = AuthenticodeOffset((LPBYTE)data, n);
+ }
+ CloseHandle(h);
+ }
+ CloseHandle(f);
+ }
+ }
+#else
+ {
+ struct stat sb;
+ int fd = open(filename, O_RDONLY);
+ if (fd != -1) {
+ if (fstat(fd, &sb) == 0) {
+ data = mmap(0, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
+
+ /* On HP-UX mmap does not work multiple times on the same
+ file, so try a private mmap before giving up on it */
+ if (data == MAP_FAILED)
+ data = mmap(0, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+
+ if (data != MAP_FAILED)
+ length = sb.st_size;
+ }
+ close(fd);
+ }
+ }
+#endif
+
+ if (length < 0)
+ return NULL;
+
+ return InitMappedFile(data, length, MappedFileCleaner);
+}
+
+static void AdjustMappedFile (MappedFile_p map, int offset) {
+ map->data[0].p = (void*) (MF_Data(map) + offset);
+ map->data[1].p = (void*) (MF_Length(map) - offset);
+}
+
+static int IsReversedEndian(MappedFile_p map) {
+#if _BIG_ENDIAN+0
+ return *MF_Data(map) == 'J';
+#else
+ return *MF_Data(map) == 'L';
+#endif
+}
+
+static Int_t GetVarInt (const char **cp) {
+ int8_t b;
+ Int_t v = 0;
+ do {
+ b = *(*cp)++;
+ v = (v << 7) + b;
+ } while (b >= 0);
+ return v + 128;
+}
+
+static Int_t GetVarPair(const char** cp) {
+ Int_t n = GetVarInt(cp);
+ if (n > 0 && GetVarInt(cp) == 0)
+ *cp += n;
+ return n;
+}
+
+#define MM_cache data[0].p
+#define MM_offvec data[1].q
+#define MM_mapf data[2].q
+#define MM_meta data[3].q
+
+#define MM_offsets MM_offvec->data[0].p
+#define MM_base MM_offvec->data[1].q
+
+
+static void MappedViewCleaner (Seq_p seq) {
+ int i, count;
+ const View_p *subviews = seq->MM_cache;
+
+ count = seq->MM_offvec->count;
+ for (i = 0; i < count; ++i)
+ DecRefCount(subviews[i]);
+
+ DecRefCount(seq->MM_base);
+}
+
+static ItemTypes MappedViewGetter (int row, Item_p item) {
+ Seq_p seq = item->c.seq;
+ View_p *subviews = seq->MM_cache;
+
+ if (subviews[row] == NULL) {
+ Seq_p base = seq->MM_base;
+ const Int_t *offsets = seq->MM_offsets;
+
+ if (base != NULL)
+ base = GetViewItem(base, row, item->c.pos, IT_view).v;
+
+ subviews[row] = IncRefCount(MapSubview(seq->MM_mapf, offsets[row],
+ seq->MM_meta, base));
+ }
+
+ item->v = subviews[row];
+ return IT_view;
+}
+
+static struct SeqType ST_MappedView = {
+ "mappedview", MappedViewGetter, 01110, MappedViewCleaner
+};
+
+static Seq_p MappedViewCol (MappedFile_p map, int rows, const char **nextp, View_p meta, View_p base) {
+ int r, c, cols, subcols;
+ Int_t colsize, colpos, *offsets;
+ const char *next;
+ Seq_p offseq, result;
+
+ offseq = NewPtrVec(rows, &offsets);
+
+ cols = ViewSize(meta);
+
+ colsize = GetVarInt(nextp);
+ colpos = colsize > 0 ? GetVarInt(nextp) : 0;
+ next = MF_Data(map) + colpos;
+
+ for (r = 0; r < rows; ++r) {
+ offsets[r] = next - MF_Data(map);
+ GetVarInt(&next);
+ if (cols == 0) {
+ Int_t desclen = GetVarInt(&next);
+ const char *desc = next;
+ next += desclen;
+ meta = DescAsMeta(&desc, next);
+ }
+ if (GetVarInt(&next) > 0) {
+ subcols = ViewSize(meta);
+ for (c = 0; c < subcols; ++c)
+ switch (GetColType(meta, c)) {
+ case 'B': case 'S': if (GetVarPair(&next))
+ GetVarPair(&next);
+ /* fall through */
+ default: GetVarPair(&next);
+ }
+ }
+ }
+
+ result = NewSequence(rows, &ST_MappedView, rows * sizeof(View_p));
+ /* data[0] points to a subview cache */
+ /* data[1] points to a sequence owning the offest vector */
+ /* data[2] points to the mapped file */
+ /* data[3] points to the meta view */
+ result->MM_offvec = IncRefCount(offseq);
+ result->MM_mapf = IncRefCount(map);
+ result->MM_meta = IncRefCount(cols > 0 ? meta : EmptyMetaView());
+ /* offseq->data[1] points to the base view if there is one */
+ result->MM_base = IncRefCount(base);
+
+ /* TODO: could combine subview cache and offsets vector */
+
+ return result;
+}
+
+static struct SeqType ST_MappedFix = { "mappedfix", NULL, 010 };
+
+static Seq_p MappedFixedCol (MappedFile_p map, int rows, const char **nextp, int isreal) {
+ Int_t colsize, colpos;
+ const char *data;
+ Seq_p result;
+
+ colsize = GetVarInt(nextp);
+ colpos = colsize > 0 ? GetVarInt(nextp) : 0;
+ data = MF_Data(map) + colpos;
+
+ /* if bit count is too low-for single-bit vectors then it's compressed */
+ if (rows >= 128 && 0 < colsize && colsize < rows/8) {
+ int from, pos = 0;
+
+ result = NewBitVec(rows);
+ from = *data & 0x80 ? 0 : NextElias(data, colsize, &pos);
+
+ for (;;) {
+ int count = NextElias(data, colsize, &pos);
+ if (count == 0)
+ break;
+ SetBitRange(result, from, count);
+ from += count + NextElias(data, colsize, &pos);
+ }
+ } else {
+ int rev = IsReversedEndian(map);
+
+ result = NewSequence(rows, &ST_MappedFix, 0);
+ result->getter = FixedGetter(colsize, rows, isreal, rev)->getfun;
+ /* data[0] points to the mapped data */
+ /* data[1] points to the mapped file */
+ result->data[0].p = (void*) data;
+ result->data[1].p = IncRefCount(map);
+ }
+
+ return result;
+}
+
+#define MS_offvec data[0].q
+#define MS_offptr data[1].p
+#define MS_mapf data[2].q
+#define MS_sizes data[3].q
+
+static ItemTypes MappedStringGetter (int row, Item_p item) {
+ const Int_t *offsets = item->c.seq->MS_offptr;
+ const char *data = MF_Data(item->c.seq->MS_mapf);
+
+ if (offsets[row] == 0)
+ item->s = "";
+ else if (offsets[row] > 0)
+ item->s = data + offsets[row];
+ else {
+ const char *next = data - offsets[row];
+ if (GetVarInt(&next) > 0)
+ item->s = data + GetVarInt(&next);
+ else
+ item->s = "";
+ }
+
+ return IT_string;
+}
+
+static struct SeqType ST_MappedString = {
+ "mappedstring", MappedStringGetter, 01101
+};
+
+static ItemTypes MappedBytesGetter (int row, Item_p item) {
+ Seq_p seq = item->c.seq;
+ const Int_t *offsets = seq->MS_offptr;
+ const char *data = MF_Data(seq->MS_mapf);
+
+ item->u.len = GetSeqItem(row, seq->MS_sizes, IT_int).i;
+
+ if (offsets[row] >= 0)
+ item->u.ptr = (const Byte_t*) data + offsets[row];
+ else {
+ const char *next = data - offsets[row];
+ item->u.len = GetVarInt(&next);
+ item->u.ptr = (const Byte_t*) data + GetVarInt(&next);
+ }
+
+ return IT_bytes;
+}
+
+static struct SeqType ST_MappedBytes = {
+ "mappedstring", MappedBytesGetter, 01101
+};
+
+static Seq_p MappedStringCol (MappedFile_p map, int rows, const char **nextp, int istext) {
+ int r, len, memopos;
+ Int_t colsize, colpos, *offsets;
+ const char *next, *limit;
+ Seq_p offseq, result, sizes;
+
+ offseq = NewPtrVec(rows, &offsets);
+
+ colsize = GetVarInt(nextp);
+ colpos = colsize > 0 ? GetVarInt(nextp) : 0;
+
+ if (colsize > 0) {
+ sizes = MappedFixedCol(map, rows, nextp, 0);
+ for (r = 0; r < rows; ++r) {
+ len = GetSeqItem(r, sizes, IT_int).i;
+ if (len > 0) {
+ offsets[r] = colpos;
+ colpos += len;
+ }
+ }
+ } else
+ sizes = NewSequence(rows, FixedGetter(0, rows, 0, 0), 0);
+
+ colsize = GetVarInt(nextp);
+ memopos = colsize > 0 ? GetVarInt(nextp) : 0;
+ next = MF_Data(map) + memopos;
+ limit = next + colsize;
+
+ /* negated offsets point to the size/pos pair in the map */
+ for (r = 0; next < limit; ++r) {
+ r += (int) GetVarInt(&next);
+ offsets[r] = MF_Data(map) - next; /* always < 0 */
+ GetVarPair(&next);
+ }
+
+ result = NewSequence(rows, istext ? &ST_MappedString : &ST_MappedBytes, 0);
+ /* data[0] points to a sequence owning the offset vector */
+ /* data[1] points to that vector of subview offsets */
+ /* data[2] points to the mapped file */
+ /* data[3] points to sizes seq if binary or is null if zero-terminated */
+ result->MS_offvec = IncRefCount(offseq);
+ result->MS_offptr = offsets;
+ result->MS_mapf = IncRefCount(map);
+ result->MS_sizes = istext ? NULL : IncRefCount(sizes);
+
+ return result;
+}
+
+static Seq_p MappedBits (MappedFile_p map, int rows, const char **nextp) {
+ Seq_p seq;
+
+ if ((**nextp & 0xFF) == 0x80) {
+ ++*nextp;
+ return NULL; /* zero-sized column */
+ }
+
+ seq = MappedFixedCol(map, rows, nextp, 0);
+
+ /* if this does not use 1-bit encoding, then we need to convert back */
+ if (rows < 8 && seq->getter != PickIntGetter(1)->getfun) {
+ int i;
+ Seq_p result = NULL;
+
+ for (i = 0; i < rows; ++i)
+ if (GetSeqItem(i, seq, IT_int).i)
+ SetBit(&result, i);
+
+ return result;
+ }
+
+ return seq;
+}
+
+static View_p MapCols (MappedFile_p map, const char **nextp, View_p meta, View_p base, Seq_p adjseq) {
+ int i, c, r, rows, *rowptr = NULL;
+ View_p result, subview;
+ Seq_p seq, usedmap = NULL, rowmap;
+ Item item;
+
+ rows = (int) GetVarInt(nextp);
+
+ if (ViewSize(meta) == 0)
+ return NoColumnView(rows);
+
+ if (base != NULL) {
+ int pos = 0, from = 0, count = 0;
+
+ rowmap = NewIntVec(rows, &rowptr);
+ while (NextBits(adjseq, &from, &count))
+ for (i = 0; i < count; ++i)
+ rowptr[pos++] = from + i;
+
+ result = base;
+ } else
+ result = NewView(meta);
+
+ if (rows > 0)
+ for (c = 0; c < ViewWidth(result); ++c) {
+ if (base != NULL) {
+ usedmap = MappedBits(map, rows, nextp);
+ r = CountBits(usedmap);
+ } else
+ r = rows;
+
+ switch (ViewColType(result, c)) {
+
+ case IT_int:
+ case IT_wide:
+ seq = MappedFixedCol(map, r, nextp, 0);
+ break;
+
+ case IT_float:
+ case IT_double:
+ seq = MappedFixedCol(map, r, nextp, 1);
+ break;
+
+ case IT_string:
+ seq = MappedStringCol(map, r, nextp, 1);
+ break;
+
+ case IT_bytes:
+ seq = MappedStringCol(map, r, nextp, 0);
+ break;
+
+ case IT_view:
+ subview = GetViewItem(meta, c, MC_subv, IT_view).v;
+ seq = MappedViewCol(map, r, nextp, subview, base);
+ break;
+
+ default:
+ Assert(0);
+ return result;
+ }
+
+ if (base != NULL) {
+ i = 0;
+ for (r = 0; r < usedmap->count; ++r)
+ if (TestBit(usedmap, r)) {
+ item.c.seq = seq;
+ item.c.pos = -1;
+ GetItem(i++, &item);
+ result = ViewSet(result, rowptr[r], c, &item);
+ }
+ Assert(i == seq->count);
+ } else
+ SetViewSeqs(result, c, 1, seq);
+ }
+
+ return result;
+}
+
+static View_p MapSubview (MappedFile_p map, Int_t offset, View_p meta, View_p base) {
+ const char *next;
+
+ next = MF_Data(map) + offset;
+ GetVarInt(&next);
+
+ if (base != NULL) {
+ int inscnt;
+ View_p insview;
+ Seq_p delseq, insseq, adjseq;
+
+ meta = V_Meta(base);
+
+ GetVarInt(&next); /* structure changes and defaults, NOTYET */
+
+ delseq = MappedBits(map, ViewSize(base), &next);
+ if (delseq != NULL) {
+ int delcnt = 0, from = 0, count = 0;
+ while (NextBits(delseq, &from, &count)) {
+ base = ViewReplace(base, from - delcnt, count, NULL);
+ delcnt += count;
+ }
+ }
+
+ adjseq = MappedBits(map, ViewSize(base), &next);
+ if (adjseq != NULL)
+ base = MapCols(map, &next, meta, base, adjseq);
+
+ insview = MapCols(map, &next, meta, NULL, NULL);
+ inscnt = ViewSize(insview);
+ if (inscnt > 0) {
+ int shift = 0, from = 0, count = 0;
+ insseq = MappedBits(map, ViewSize(base) + inscnt, &next);
+ while (NextBits(insseq, &from, &count)) {
+ View_p newdata = StepView(insview, count, shift, 1, 1);
+ base = ViewReplace(base, from, 0, newdata);
+ shift += count;
+ }
+ }
+
+ return base;
+ }
+
+ if (ViewSize(meta) == 0) {
+ Int_t desclen = GetVarInt(&next);
+ const char *desc = next;
+ next += desclen;
+ meta = DescAsMeta(&desc, next);
+ }
+
+ return MapCols(map, &next, meta, NULL, NULL);
+}
+
+static int BigEndianInt32 (const char *p) {
+ const Byte_t *up = (const Byte_t*) p;
+ return (p[0] << 24) | (up[1] << 16) | (up[2] << 8) | up[3];
+}
+
+View_p MappedToView (MappedFile_p map, View_p base) {
+ int i, t[4];
+ Int_t datalen, rootoff;
+
+ if (MF_Length(map) <= 24 || *(MF_Data(map) + MF_Length(map) - 16) != '\x80')
+ return NULL;
+
+ for (i = 0; i < 4; ++i)
+ t[i] = BigEndianInt32(MF_Data(map) + MF_Length(map) - 16 + i * 4);
+
+ datalen = t[1] + 16;
+ rootoff = t[3];
+
+ if (rootoff < 0) {
+ const Int_t mask = 0x7FFFFFFF;
+ datalen = (datalen & mask) + ((Int_t) ((t[0] & 0x7FF) << 16) << 15);
+ rootoff = (rootoff & mask) + (datalen & ~mask);
+ /* FIXME: rollover at 2 Gb, prob needs: if (rootoff > datalen) ... */
+ }
+
+ AdjustMappedFile(map, MF_Length(map) - datalen);
+ return MapSubview(map, rootoff, EmptyMetaView(), base);
+}
+
+View_p OpenDataFile (const char *filename) {
+ MappedFile_p map;
+
+ map = OpenMappedFile(filename);
+ if (map == NULL)
+ return NULL;
+
+ return MappedToView(map, NULL);
+}
+/* %include% */
+/*
+ * getters.c - Implementation of several simple getter functions.
+ */
+
+#include
+
+
+static ItemTypes Getter_i0 (int row, Item_p item) {
+ item->i = 0;
+ return IT_int;
+}
+
+static ItemTypes Getter_i1 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->i = (ptr[row>>3] >> (row&7)) & 1;
+ return IT_int;
+}
+
+static ItemTypes Getter_i2 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->i = (ptr[row>>2] >> 2*(row&3)) & 3;
+ return IT_int;
+}
+
+static ItemTypes Getter_i4 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->i = (ptr[row>>1] >> 4*(row&1)) & 15;
+ return IT_int;
+}
+
+static ItemTypes Getter_i8 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->i = (int8_t) ptr[row];
+ return IT_int;
+}
+
+#if VALUES_MUST_BE_ALIGNED+0
+
+static ItemTypes Getter_i16 (int row, Item_p item) {
+ const Byte_t *ptr = (const Byte_t*) item->c.seq->data[0].p + row * 2;
+#if _BIG_ENDIAN+0
+ item->i = (((int8_t) ptr[0]) << 8) | ptr[1];
+#else
+ item->i = (((int8_t) ptr[1]) << 8) | ptr[0];
+#endif
+ return IT_int;
+}
+
+static ItemTypes Getter_i32 (int row, Item_p item) {
+ const char *ptr = (const char*) item->c.seq->data[0].p + row * 4;
+ int i;
+ for (i = 0; i < 4; ++i)
+ item->b[i] = ptr[i];
+ return IT_int;
+}
+
+static ItemTypes Getter_i64 (int row, Item_p item) {
+ const char *ptr = (const char*) item->c.seq->data[0].p + row * 8;
+ int i;
+ for (i = 0; i < 8; ++i)
+ item->b[i] = ptr[i];
+ return IT_wide;
+}
+
+static ItemTypes Getter_f32 (int row, Item_p item) {
+ Getter_i32(row, item);
+ return IT_float;
+}
+
+static ItemTypes Getter_f64 (int row, Item_p item) {
+ Getter_i64(row, item);
+ return IT_double;
+}
+
+#else
+
+static ItemTypes Getter_i16 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->i = ((short*) ptr)[row];
+ return IT_int;
+}
+
+static ItemTypes Getter_i32 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->i = ((const int*) ptr)[row];
+ return IT_int;
+}
+
+static ItemTypes Getter_i64 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->w = ((const int64_t*) ptr)[row];
+ return IT_wide;
+}
+
+static ItemTypes Getter_f32 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->f = ((const float*) ptr)[row];
+ return IT_float;
+}
+
+static ItemTypes Getter_f64 (int row, Item_p item) {
+ const char *ptr = item->c.seq->data[0].p;
+ item->d = ((const double*) ptr)[row];
+ return IT_double;
+}
+
+#endif
+
+static ItemTypes Getter_i16r (int row, Item_p item) {
+ const Byte_t *ptr = (const Byte_t*) item->c.seq->data[0].p + row * 2;
+#if _BIG_ENDIAN+0
+ item->i = (((int8_t) ptr[1]) << 8) | ptr[0];
+#else
+ item->i = (((int8_t) ptr[0]) << 8) | ptr[1];
+#endif
+ return IT_int;
+}
+
+static ItemTypes Getter_i32r (int row, Item_p item) {
+ const char *ptr = (const char*) item->c.seq->data[0].p + row * 4;
+ int i;
+ for (i = 0; i < 4; ++i)
+ item->b[i] = ptr[3-i];
+ return IT_int;
+}
+
+static ItemTypes Getter_i64r (int row, Item_p item) {
+ const char *ptr = (const char*) item->c.seq->data[0].p + row * 8;
+ int i;
+ for (i = 0; i < 8; ++i)
+ item->b[i] = ptr[7-i];
+ return IT_wide;
+}
+
+static ItemTypes Getter_f32r (int row, Item_p item) {
+ Getter_i32r(row, item);
+ return IT_float;
+}
+
+static ItemTypes Getter_f64r (int row, Item_p item) {
+ Getter_i64r(row, item);
+ return IT_double;
+}
+
+static struct SeqType ST_Get_i0 = { "get_i0" , Getter_i0 };
+static struct SeqType ST_Get_i1 = { "get_i1" , Getter_i1 };
+static struct SeqType ST_Get_i2 = { "get_i2" , Getter_i2 };
+static struct SeqType ST_Get_i4 = { "get_i4" , Getter_i4 };
+static struct SeqType ST_Get_i8 = { "get_i8" , Getter_i8 };
+static struct SeqType ST_Get_i16 = { "get_i16" , Getter_i16 };
+static struct SeqType ST_Get_i32 = { "get_i32" , Getter_i32 };
+static struct SeqType ST_Get_i64 = { "get_i64" , Getter_i64 };
+static struct SeqType ST_Get_i16r = { "get_i16r", Getter_i16r };
+static struct SeqType ST_Get_i32r = { "get_i32r", Getter_i32r };
+static struct SeqType ST_Get_i64r = { "get_i64r", Getter_i64r };
+static struct SeqType ST_Get_f32 = { "get_f32" , Getter_f32 };
+static struct SeqType ST_Get_f64 = { "get_f64" , Getter_f64 };
+static struct SeqType ST_Get_f32r = { "get_f32r", Getter_f32r };
+static struct SeqType ST_Get_f64r = { "get_f64r", Getter_f64r };
+
+SeqType_p PickIntGetter (int bits) {
+ switch (bits) {
+ default: Assert(0); /* fall through */
+ case 0: return &ST_Get_i0;
+ case 1: return &ST_Get_i1;
+ case 2: return &ST_Get_i2;
+ case 4: return &ST_Get_i4;
+ case 8: return &ST_Get_i8;
+ case 16: return &ST_Get_i16;
+ case 32: return &ST_Get_i32;
+ case 64: return &ST_Get_i64;
+ }
+}
+
+SeqType_p FixedGetter (int bytes, int rows, int real, int flip) {
+ int bits;
+
+ static char widths[8][7] = {
+ {0,-1,-1,-1,-1,-1,-1},
+ {0, 8,16, 1,32, 2, 4},
+ {0, 4, 8, 1,16, 2,-1},
+ {0, 2, 4, 8, 1,-1,16},
+ {0, 2, 4,-1, 8, 1,-1},
+ {0, 1, 2, 4,-1, 8,-1},
+ {0, 1, 2, 4,-1,-1, 8},
+ {0, 1, 2,-1, 4,-1,-1},
+ };
+
+ bits = rows < 8 && bytes < 7 ? widths[rows][bytes] : (bytes << 3) / rows;
+
+ switch (bits) {
+ case 16: return flip ? &ST_Get_i16r : &ST_Get_i16;
+ case 32: return real ? flip ? &ST_Get_f32r : &ST_Get_f32
+ : flip ? &ST_Get_i32r : &ST_Get_i32;
+ case 64: return real ? flip ? &ST_Get_f64r : &ST_Get_f64
+ : flip ? &ST_Get_i64r : &ST_Get_i64;
+ }
+
+ return PickIntGetter(bits);
+}
+/* %include% */
+/*
+ * hash.c - Implementation of hashing functions.
+ */
+
+#include
+#include
+
+
+typedef struct HashInfo *HashInfo_p;
+
+typedef struct HashInfo {
+ View_p view; /* input view */
+ int prime; /* prime used for hashing */
+ int fill; /* used to fill map */
+ int *map; /* map of unique rows */
+ Column mapcol; /* owner of map */
+ int *hvec; /* hash probe vector */
+ Column veccol; /* owner of hvec */
+ int *hashes; /* hash values, one per view row */
+ Column hashcol; /* owner of hashes */
+} HashInfo;
+
+static int StringHash (const char *s, int n) {
+ /* similar to Python's stringobject.c */
+ int i, h = (*s * 0xFF) << 7;
+ if (n < 0)
+ n = strlen(s);
+ for (i = 0; i < n; ++i)
+ h = (1000003 * h) ^ s[i];
+ return h ^ i;
+}
+
+static Column HashCol (ItemTypes type, Column column) {
+ int i, count, *data;
+ Seq_p seq;
+ Item item;
+
+/* the following is not possible: the result may be xor-ed into!
+ if (type == IT_int && column.seq->getter == PickIntGetter(32))
+ return column;
+*/
+
+ count = column.seq->count;
+ seq = NewIntVec(count, &data);
+
+ switch (type) {
+
+ case IT_int:
+ for (i = 0; i < count; ++i)
+ data[i] = GetColItem(i, column, IT_int).i;
+ break;
+
+ case IT_wide:
+ for (i = 0; i < count; ++i) {
+ item = GetColItem(i, column, IT_wide);
+ data[i] = item.q[0] ^ item.q[1];
+ }
+ break;
+
+ case IT_float:
+ for (i = 0; i < count; ++i)
+ data[i] = GetColItem(i, column, IT_float).i;
+ break;
+
+ case IT_double:
+ for (i = 0; i < count; ++i) {
+ item = GetColItem(i, column, IT_double);
+ data[i] = item.q[0] ^ item.q[1];
+ }
+ break;
+
+ case IT_string:
+ for (i = 0; i < count; ++i) {
+ item = GetColItem(i, column, IT_string);
+ data[i] = StringHash(item.s, -1);
+ }
+ break;
+
+ case IT_bytes:
+ for (i = 0; i < count; ++i) {
+ item = GetColItem(i, column, IT_bytes);
+ data[i] = StringHash((const char*) item.u.ptr, item.u.len);
+ }
+ break;
+
+ case IT_view:
+ for (i = 0; i < count; ++i) {
+ int j, hcount, hval = 0;
+ const int *hvec;
+ Column hashes;
+
+ item = GetColItem(i, column, IT_view);
+ hashes = HashValues(item.v);
+ hvec = (const int*) hashes.seq->data[0].p;
+ hcount = hashes.seq->count;
+
+ for (j = 0; j < hcount; ++j)
+ hval ^= hvec[j];
+ /* TODO: release hashes right now */
+
+ data[i] = hval ^ hcount;
+ }
+ break;
+
+ default: Assert(0);
+ }
+
+ return SeqAsCol(seq);
+}
+
+ItemTypes HashColCmd_SO (Item args[]) {
+ ItemTypes type;
+ Column column;
+
+ type = CharAsItemType(args[0].s[0]);
+ column = CoerceColumn(type, args[1].o);
+ if (column.seq == NULL)
+ return IT_unknown;
+
+ args->c = HashCol(type, column);
+ return IT_column;
+}
+
+int RowHash (View_p view, int row) {
+ int c, hash = 0;
+ Item item;
+
+ for (c = 0; c < ViewWidth(view); ++c) {
+ item.c = ViewCol(view, c);
+ switch (GetItem(row, &item)) {
+
+ case IT_int:
+ hash ^= item.i;
+ break;
+
+ case IT_string:
+ hash ^= StringHash(item.s, -1);
+ break;
+
+ case IT_bytes:
+ hash ^= StringHash((const char*) item.u.ptr, item.u.len);
+ break;
+
+ default: {
+ View_p rview = StepView(view, 1, row, 1, 1);
+ Column rcol = HashValues(rview);
+ hash = *(const int*) rcol.seq->data[0].p;
+ break;
+ }
+ }
+ }
+
+ return hash;
+}
+
+static void XorWithIntCol (Column src, Column_p dest) {
+ const int *srcdata = (const int*) src.seq->data[0].p;
+ int i, count = src.seq->count, *destdata = (int*) dest->seq->data[0].p;
+
+ for (i = 0; i < count; ++i)
+ destdata[i] ^= srcdata[i];
+}
+
+Column HashValues (View_p view) {
+ int c;
+ Column result;
+
+ if (ViewWidth(view) == 0 || ViewSize(view) == 0)
+ return SeqAsCol(NewIntVec(ViewSize(view), NULL));
+
+ result = HashCol(ViewColType(view, 0), ViewCol(view, 0));
+ for (c = 1; c < ViewWidth(view); ++c) {
+ Column auxcol = HashCol(ViewColType(view, c), ViewCol(view, c));
+ /* TODO: get rid of the separate xor step by xoring in HashCol */
+ XorWithIntCol(auxcol, &result);
+ }
+ return result;
+}
+
+static int HashFind (View_p keyview, int keyrow, int keyhash, HashInfo_p data) {
+ int probe, datarow, mask, step;
+
+ mask = data->veccol.seq->count - 1;
+ probe = ~keyhash & mask;
+
+ step = (keyhash ^ (keyhash >> 3)) & mask;
+ if (step == 0)
+ step = mask;
+
+ for (;;) {
+ probe = (probe + step) & mask;
+ if (data->hvec[probe] == 0)
+ break;
+
+ datarow = data->map[data->hvec[probe]-1];
+ if (keyhash == data->hashes[datarow] &&
+ RowEqual(keyview, keyrow, data->view, datarow))
+ return data->hvec[probe] - 1;
+
+ step <<= 1;
+ if (step > mask)
+ step ^= data->prime;
+ }
+
+ if (keyview == data->view) {
+ data->hvec[probe] = data->fill + 1;
+ data->map[data->fill++] = keyrow;
+ }
+
+ return -1;
+}
+
+static int StringHashFind (const char *key, Seq_p hseq, Column values) {
+ int probe, datarow, mask, step, keyhash;
+ const int *hvec = (const int*) hseq->data[0].p;
+ int prime = hseq->data[2].i;
+
+ keyhash = StringHash(key, -1);
+ mask = hseq->count - 1;
+ probe = ~keyhash & mask;
+
+ step = (keyhash ^ (keyhash >> 3)) & mask;
+ if (step == 0)
+ step = mask;
+
+ for (;;) {
+ probe = (probe + step) & mask;
+ datarow = hvec[probe] - 1;
+ if (datarow < 0)
+ break;
+
+ /* These string hashes are much simpler than the standard HashFind:
+ no hashes vector, no indirect map, compute all hashes on-the-fly */
+
+ if (strcmp(key, GetColItem(datarow, values, IT_string).s) == 0)
+ return datarow;
+
+ step <<= 1;
+ if (step > mask)
+ step ^= prime;
+ }
+
+ return ~probe;
+}
+
+static int Log2bits (int n) {
+ int bits = 0;
+ while ((1 << bits) < n)
+ ++bits;
+ return bits;
+}
+
+static Column HashVector (int rows) {
+ int bits = Log2bits((4 * rows) / 3);
+ if (bits < 2)
+ bits = 2;
+ return SeqAsCol(NewIntVec(1 << bits, NULL));
+}
+
+static void InitHashInfo (HashInfo_p info, View_p view, Column hmap, Column hvec, Column hashes) {
+ int size = hvec.seq->count;
+
+ static char slack [] = {
+ 0, 0, 3, 3, 3, 5, 3, 3, 29, 17, 9, 5, 83, 27, 43, 3,
+ 45, 9, 39, 39, 9, 5, 3, 33, 27, 9, 71, 39, 9, 5, 83, 0
+ };
+
+ info->view = view;
+ info->prime = size + slack[Log2bits(size-1)];
+ info->fill = 0;
+
+ info->mapcol = hmap;
+ info->map = (int*) hmap.seq->data[0].p;
+
+ info->veccol = hvec;
+ info->hvec = (int*) hvec.seq->data[0].p;
+
+ info->hashcol = hashes;
+ info->hashes = (int*) hashes.seq->data[0].p;
+}
+
+int StringLookup (const char *key, Column values) {
+ int h, r, rows, *hptr;
+ const char *string;
+ Column hvec;
+ HashInfo info;
+
+ /* adjust data[2], this assumes values is a string column */
+
+ if (values.seq->data[2].p == NULL) {
+ rows = values.seq->count;
+ hvec = HashVector(rows);
+ hptr = (int*) hvec.seq->data[0].p;
+
+ /* use InitHashInfo to get at the prime number, bit of a hack */
+ InitHashInfo(&info, NULL, hvec, hvec, hvec);
+ hvec.seq->data[2].i = info.prime;
+
+ for (r = 0; r < rows; ++r) {
+ string = GetColItem(r, values, IT_string).s;
+ h = StringHashFind(string, hvec.seq, values);
+ if (h < 0) /* silently ignore duplicates */
+ hptr[~h] = r + 1;
+ }
+
+ values.seq->data[2].p = IncRefCount(hvec.seq);
+ }
+
+ h = StringHashFind(key, (Seq_p) values.seq->data[2].p, values);
+ return h >= 0 ? h : -1;
+}
+
+static void FillHashInfo (HashInfo_p info, View_p view) {
+ int r, rows;
+ Column mapcol;
+
+ rows = ViewSize(view);
+ mapcol = SeqAsCol(NewIntVec(rows, NULL)); /* worst-case, dunno #groups */
+
+ InitHashInfo(info, view, mapcol, HashVector(rows), HashValues(view));
+
+ for (r = 0; r < rows; ++r)
+ HashFind(view, r, info->hashes[r], info);
+
+ /* TODO: reclaim unused entries at end of map */
+ mapcol.seq->count = info->fill;
+}
+
+static void ChaseLinks (HashInfo_p info, int count, const int *hmap, const int *lmap) {
+ int groups = info->fill, *smap = info->hvec, *gmap = info->hashes;
+
+ while (--groups >= 0) {
+ int head = hmap[groups] - 1;
+ smap[groups] = count;
+ while (head >= 0) {
+ gmap[--count] = head;
+ head = lmap[head];
+ }
+ }
+ /* assert(count == 0); */
+}
+
+void FillGroupInfo (HashInfo_p info, View_p view) {
+ int g, r, rows, *hmap, *lmap;
+ Column mapcol, headmap, linkmap;
+
+ rows = ViewSize(view);
+ mapcol = SeqAsCol(NewIntVec(rows, NULL)); /* worst-case, dunno #groups */
+ headmap = SeqAsCol(NewIntVec(rows, &hmap)); /* same: don't know #groups */
+ linkmap = SeqAsCol(NewIntVec(rows, &lmap));
+
+ InitHashInfo(info, view, mapcol, HashVector(rows), HashValues(view));
+
+ for (r = 0; r < rows; ++r) {
+ g = HashFind(view, r, info->hashes[r], info);
+ if (g < 0)
+ g = info->fill - 1;
+ lmap[r] = hmap[g] - 1;
+ hmap[g] = r + 1;
+ }
+
+ /* TODO: reclaim unused entries at end of map and hvec */
+ info->mapcol.seq->count = info->veccol.seq->count = info->fill;
+
+ ChaseLinks(info, rows, hmap, lmap);
+
+ /* TODO: could release headmap and linkmap but that's a no-op here */
+
+ /* There's probably an opportunity to reduce space usage further,
+ since the grouping map points to the starting row of each group:
+ map[i] == gmap[smap[i]]
+ Perhaps "map" (which starts out with #rows entries) can be re-used
+ to append the gmap entries (if we can reduce it by #groups items).
+ Or just release map[x] for grouping views, and use gmap[smap[x]].
+ */
+}
+
+View_p GroupCol (View_p view, Column cols, const char *name) {
+ View_p vkey, vres, gview;
+ HashInfo info;
+
+ vkey = ColMapView(view, cols);
+ vres = ColMapView(view, OmitColumn(cols, ViewWidth(view)));
+
+ FillGroupInfo(&info, vkey);
+ gview = GroupedView(vres, info.veccol, info.hashcol, name);
+ return PairView(RemapSubview(vkey, info.mapcol, 0, -1), gview);
+}
+
+static void FillJoinInfo (HashInfo_p info, View_p left, View_p right) {
+ int g, r, gleft, nleft, nright, nused = 0, *hmap, *lmap, *jmap;
+ Column mapcol, headmap, linkmap, joincol;
+
+ nleft = ViewSize(left);
+ mapcol = SeqAsCol(NewIntVec(nleft, NULL)); /* worst-case dunno #groups */
+ joincol = SeqAsCol(NewIntVec(nleft, &jmap));
+
+ InitHashInfo(info, left, mapcol, HashVector(nleft), HashValues(left));
+
+ for (r = 0; r < nleft; ++r) {
+ g = HashFind(left, r, info->hashes[r], info);
+ if (g < 0)
+ g = info->fill - 1;
+ jmap[r] = g;
+ }
+
+ /* TODO: reclaim unused entries at end of map */
+ mapcol.seq->count = info->fill;
+
+ gleft = info->mapcol.seq->count;
+ nleft = info->hashcol.seq->count;
+ nright = ViewSize(right);
+
+ headmap = SeqAsCol(NewIntVec(gleft, &hmap)); /* don't know #groups */
+ linkmap = SeqAsCol(NewIntVec(nright, &lmap));
+
+ for (r = 0; r < nright; ++r) {
+ g = HashFind(right, r, RowHash(right, r), info);
+ if (g >= 0) {
+ lmap[r] = hmap[g] - 1;
+ hmap[g] = r + 1;
+ ++nused;
+ }
+ }
+
+ /* we're reusing veccol, but it might not be large enough to start with */
+ /* TODO: reclaim unused entries at end of hvec */
+ if (info->veccol.seq->count < nused)
+ info->veccol = SeqAsCol(NewIntVec(nused, &info->hvec));
+ else
+ info->veccol.seq->count = nused;
+
+ /* reorder output to match results from FillHashInfo and FillGroupInfo */
+ info->hashcol = info->veccol;
+ info->hashes = info->hvec;
+ info->veccol = info->mapcol;
+ info->hvec = info->map;
+ info->mapcol = joincol;
+ info->map = jmap;
+
+ ChaseLinks(info, nused, hmap, lmap);
+
+ /* As with FillGroupInfo, this is most likely not quite optimal yet.
+ All zero-length groups in smap (info->map, now info->hvec) could be
+ coalesced into one, and joinmap indices into it adjusted down a bit.
+ Would reduce the size of smap when there are lots of failed matches.
+ Also: FillJoinInfo needs quite a lot of temp vector space right now.
+ */
+}
+
+Column IntersectMap (View_p keys, View_p view) {
+ int r, rows;
+ HashInfo info;
+ struct Buffer buffer;
+
+ if (!ViewCompat(keys, view))
+ return SeqAsCol(NULL);
+
+ FillHashInfo(&info, view);
+ InitBuffer(&buffer);
+ rows = ViewSize(keys);
+
+ /* these ints are added in increasing order, could have used a bitmap */
+ for (r = 0; r < rows; ++r)
+ if (HashFind(keys, r, RowHash(keys, r), &info) >= 0)
+ ADD_INT_TO_BUF(buffer, r);
+
+ return SeqAsCol(BufferAsIntVec(&buffer));
+}
+
+/* ReverseIntersectMap returns RHS indices, instead of IntersectMap's LHS */
+static Column ReverseIntersectMap (View_p keys, View_p view) {
+ int r, rows;
+ HashInfo info;
+ struct Buffer buffer;
+
+ FillHashInfo(&info, view);
+ InitBuffer(&buffer);
+ rows = ViewSize(keys);
+
+ for (r = 0; r < rows; ++r) {
+ int f = HashFind(keys, r, RowHash(keys, r), &info);
+ if (f >= 0)
+ ADD_INT_TO_BUF(buffer, f);
+ }
+
+ return SeqAsCol(BufferAsIntVec(&buffer));
+}
+
+View_p JoinView (View_p left, View_p right, const char *name) {
+ View_p lmeta, rmeta, lkey, rkey, rres, gview;
+ Column lmap, rmap;
+ HashInfo info;
+
+ lmeta = V_Meta(left);
+ rmeta = V_Meta(right);
+
+ lmap = IntersectMap(lmeta, rmeta);
+ /* TODO: optimize, don't create the hash info twice */
+ rmap = ReverseIntersectMap(lmeta, rmeta);
+
+ lkey = ColMapView(left, lmap);
+ rkey = ColMapView(right, rmap);
+ rres = ColMapView(right, OmitColumn(rmap, ViewWidth(right)));
+
+ FillJoinInfo(&info, lkey, rkey);
+ gview = GroupedView(rres, info.veccol, info.hashcol, name);
+ return PairView(left, RemapSubview(gview, info.mapcol, 0, -1));
+}
+
+Column UniqMap (View_p view) {
+ HashInfo info;
+ FillHashInfo(&info, view);
+ return info.mapcol;
+}
+
+int HashDoFind (View_p view, int row, View_p w, Column a, Column b, Column c) {
+ HashInfo info;
+ /* TODO: avoid Log2bits call in InitHashInfo, since done on each find */
+ InitHashInfo(&info, w, a, b, c);
+ return HashFind(view, row, RowHash(view, row), &info);
+}
+
+Column GetHashInfo (View_p left, View_p right, int type) {
+ HashInfo info;
+ Seq_p seqvec[3];
+
+ switch (type) {
+ case 0: FillHashInfo(&info, left); break;
+ case 1: FillGroupInfo(&info, left); break;
+ default: FillJoinInfo(&info, left, right); break;
+ }
+
+ seqvec[0] = info.mapcol.seq;
+ seqvec[1] = info.veccol.seq;
+ seqvec[2] = info.hashcol.seq;
+
+ return SeqAsCol(NewSeqVec(IT_column, seqvec, 3));
+}
+
+View_p IjoinView (View_p left, View_p right) {
+ View_p view = JoinView(left, right, "?");
+ return UngroupView(view, ViewWidth(view)-1);
+}
+
+static struct SeqType ST_HashMap = { "hashmap", NULL, 02 };
+
+Seq_p HashMapNew (void) {
+ Seq_p result;
+
+ result = NewSequence(0, &ST_HashMap, 0);
+ /* data[0] is the key + value + hash vector */
+ /* data[1] is the allocated count */
+ result->data[0].p = NULL;
+ result->data[1].i = 0;
+
+ return result;
+}
+
+/* FIXME: dumb linear scan instead of hashing for now, for small tests only */
+
+static int HashMapLocate(Seq_p hmap, int key, int *pos) {
+ const int *data = hmap->data[0].p;
+
+ for (*pos = 0; *pos < hmap->count; ++*pos)
+ if (key == data[*pos])
+ return 1;
+
+ return 0;
+}
+
+int HashMapAdd (Seq_p hmap, int key, int value) {
+ int pos, *data = hmap->data[0].p;
+ int allocnt = hmap->data[1].i;
+
+ if (HashMapLocate(hmap, key, &pos)) {
+ data[pos+allocnt] = value;
+ return 0;
+ }
+
+ Assert(pos == hmap->count);
+ if (pos >= allocnt) {
+ int newlen = (allocnt / 2) * 3 + 10;
+ hmap->data[0].p = data = realloc(data, newlen * 2 * sizeof(int));
+ memmove(data+newlen, data+allocnt, allocnt * sizeof(int));
+ allocnt = hmap->data[1].i = newlen;
+ }
+
+ data[pos] = key;
+ data[pos+allocnt] = value;
+ ++hmap->count;
+ return allocnt;
+}
+
+int HashMapLookup (Seq_p hmap, int key, int defval) {
+ int pos;
+
+ if (HashMapLocate(hmap, key, &pos)) {
+ int allocnt = hmap->data[1].i;
+ const int *data = hmap->data[0].p;
+ return data[pos+allocnt];
+ }
+
+ return defval;
+}
+
+#if 0 /* not yet */
+int HashMapRemove (Seq_p hmap, int key) {
+ int pos;
+
+ if (HashMapLocate(hmap, key, &pos)) {
+ int last = --hmap->count;
+ if (pos < last) {
+ int allocnt = hmap->data[1].i, *data = hmap->data[0].p;
+ data[pos] = data[last];
+ data[pos+allocnt] = data[last+allocnt];
+ return pos;
+ }
+ }
+
+ return -1;
+}
+#endif
+/* %include% */
+/*
+ * indirect.c - Implementation of some virtual views.
+ */
+
+#include
+#include
+
+
+#define RV_parent data[0].q
+#define RV_map data[1].q
+#define RV_start data[2].i
+
+static ItemTypes RemapGetter (int row, Item_p item) {
+ const int* data;
+ Seq_p seq;
+
+ Assert(item->c.pos >= 0);
+ seq = item->c.seq;
+ data = seq->RV_map->data[0].p;
+
+ item->c = ViewCol(seq->RV_parent, item->c.pos);
+ row += seq->RV_start;
+ if (data[row] < 0)
+ row += data[row];
+ return GetItem(data[row], item);
+}
+
+static struct SeqType ST_Remap = { "remap", RemapGetter, 011 };
+
+View_p RemapSubview (View_p view, Column mapcol, int start, int count) {
+ Seq_p seq;
+
+ if (mapcol.seq == NULL)
+ return NULL;
+
+ if (count < 0)
+ count = mapcol.seq->count;
+
+ if (ViewWidth(view) == 0)
+ return NoColumnView(count);
+
+ seq = NewSequence(count, &ST_Remap, 0);
+ /* data[0] is the parent view to which the map applies */
+ /* data[1] is the map, as a sequence */
+ /* data[2] is the index offset */
+ seq->RV_parent = IncRefCount(view);
+ seq->RV_map = IncRefCount(mapcol.seq);
+ seq->RV_start = start;
+
+ return IndirectView(V_Meta(view), seq);
+}
+
+static View_p MakeMetaSubview (const char *name, View_p view) {
+ View_p meta, result;
+ Seq_p names, types, subvs;
+
+ names = NewStrVec(1);
+ AppendToStrVec(name, -1, names);
+
+ types = NewStrVec(1);
+ AppendToStrVec("V", -1, types);
+
+ meta = V_Meta(view);
+ subvs = NewSeqVec(IT_view, &meta, 1);
+
+ result = NewView(V_Meta(meta));
+ SetViewSeqs(result, MC_name, 1, FinishStrVec(names));
+ SetViewSeqs(result, MC_type, 1, FinishStrVec(types));
+ SetViewSeqs(result, MC_subv, 1, subvs);
+ return result;
+}
+
+#define GV_parent data[0].q
+#define GV_start data[1].q
+#define GV_group data[2].q
+#define GV_cache data[3].q
+
+static ItemTypes GroupedGetter (int row, Item_p item) {
+ Seq_p seq = item->c.seq;
+ View_p *subviews = seq->GV_cache->data[0].p;
+
+ if (subviews[row] == NULL) {
+ const int *sptr = seq->GV_start->data[0].p;
+ Seq_p gmap = seq->GV_group;
+ int start = row > 0 ? sptr[row-1] : 0;
+
+ item->c.seq = gmap;
+ subviews[row] = IncRefCount(RemapSubview(seq->GV_parent, item->c,
+ start, sptr[row] - start));
+ }
+
+ item->v = subviews[row];
+ return IT_view;
+}
+
+static struct SeqType ST_Grouped = { "grouped", GroupedGetter, 01111 };
+
+View_p GroupedView (View_p view, Column startcol, Column groupcol, const char *name) {
+ int groups;
+ Seq_p seq, subviews;
+
+ groups = startcol.seq->count;
+ subviews = NewSeqVec(IT_view, NULL, groups);
+
+ seq = NewSequence(groups, &ST_Grouped, 0);
+ /* data[0] is the parent view to which the grouping applies */
+ /* data[1] is the start map, as a sequence */
+ /* data[2] is the group map, as a sequence */
+ /* data[3] is a cache of subviews, as a pointer vector in a sequence */
+ seq->GV_parent = IncRefCount(view);
+ seq->GV_start = IncRefCount(startcol.seq);
+ seq->GV_group = IncRefCount(groupcol.seq);
+ seq->GV_cache = IncRefCount(subviews);
+
+ return IndirectView(MakeMetaSubview(name, view), seq);
+}
+
+#define PV_parent data[0].q
+#define PV_start data[1].i
+#define PV_rate data[2].i
+#define PV_step data[3].i
+
+static ItemTypes StepGetter (int row, Item_p item) {
+ Seq_p seq = item->c.seq;
+ int rows = ViewSize(seq->PV_parent);
+
+ item->c = ViewCol(seq->PV_parent, item->c.pos);
+ row = (seq->PV_start + (row / seq->PV_rate) * seq->PV_step) % rows;
+ if (row < 0)
+ row += rows;
+ return GetItem(row, item);
+}
+
+static struct SeqType ST_Step = { "step", StepGetter, 01 };
+
+View_p StepView (View_p view, int count, int offset, int rate, int step) {
+ Seq_p seq;
+
+ /* prevent division by zero if input view is empty */
+ if (ViewSize(view) == 0)
+ return view;
+
+ seq = NewSequence(count * rate, &ST_Step, 0);
+ /* data[0] is the parent view to which the changes apply */
+ /* data[1] is the starting offset */
+ /* data[2] is the rate to repeat an item */
+ /* data[3] is the step to the next item */
+ seq->PV_parent = IncRefCount(view);
+ seq->PV_start = offset;
+ seq->PV_rate = rate;
+ seq->PV_step = step;
+
+ return IndirectView(V_Meta(view), seq);
+}
+
+#define CV_left data[0].q
+#define CV_right data[1].q
+
+static ItemTypes ConcatGetter (int row, Item_p item) {
+ View_p view = item->c.seq->CV_left;
+ int rows = ViewSize(view);
+
+ if (row >= rows) {
+ row -= rows;
+ view = item->c.seq->CV_right;
+ }
+
+ item->c = ViewCol(view, item->c.pos);
+ return GetItem(row, item);
+}
+
+static struct SeqType ST_Concat = { "concat", ConcatGetter, 011 };
+
+View_p ConcatView (View_p view1, View_p view2) {
+ int rows1, rows2;
+ Seq_p seq;
+
+ if (view1 == NULL || view2 == NULL || !ViewCompat(view1, view2))
+ return NULL;
+
+ rows1 = ViewSize(view1);
+ if (rows1 == 0)
+ return view2;
+
+ rows2 = ViewSize(view2);
+ if (rows2 == 0)
+ return view1;
+
+ seq = NewSequence(rows1 + rows2, &ST_Concat, 0);
+ /* data[0] is the left-hand view */
+ /* data[1] is the right-hand view */
+ seq->CV_left = IncRefCount(view1);
+ seq->CV_right = IncRefCount(view2);
+
+ return IndirectView(V_Meta(view1), seq);
+}
+
+#define UV_parent data[0].q
+#define UV_unmap data[1].q
+#define UV_subcol data[2].i
+#define UV_swidth data[3].i
+
+static ItemTypes UngroupGetter (int row, Item_p item) {
+ int col, subcol, parentrow;
+ const int *data;
+ View_p view;
+ Seq_p seq;
+
+ col = item->c.pos;
+ seq = item->c.seq;
+
+ view = seq->UV_parent;
+ data = seq->UV_unmap->data[0].p;
+ subcol = seq->UV_subcol;
+
+ parentrow = data[row];
+ if (parentrow < 0) {
+ parentrow = data[row+parentrow];
+ row = -data[row];
+ } else
+ row = 0;
+
+ if (subcol <= col && col < subcol + seq->UV_swidth) {
+ view = GetViewItem(view, parentrow, subcol, IT_view).v;
+ col -= subcol;
+ } else {
+ if (col >= subcol)
+ col -= seq->UV_swidth - 1;
+ row = parentrow;
+ }
+
+ item->c = ViewCol(view, col);
+ return GetItem(row, item);
+}
+
+static struct SeqType ST_Ungroup = { "ungroup", UngroupGetter, 011 };
+
+View_p UngroupView (View_p view, int col) {
+ int i, n, r, rows;
+ struct Buffer buffer;
+ View_p subview, meta, submeta, newmeta;
+ Seq_p seq, map;
+ Column column;
+
+ InitBuffer(&buffer);
+
+ column = ViewCol(view, col);
+ rows = column.seq->count;
+
+ for (r = 0; r < rows; ++r) {
+ subview = GetColItem(r, column, IT_view).v;
+ n = ViewSize(subview);
+ if (n > 0) {
+ ADD_INT_TO_BUF(buffer, r);
+ for (i = 1; i < n; ++i)
+ ADD_INT_TO_BUF(buffer, -i);
+ }
+ }
+
+ map = BufferAsIntVec(&buffer);
+
+ /* result meta view replaces subview column with its actual meta view */
+ meta = V_Meta(view);
+ submeta = GetViewItem(meta, col, MC_subv, IT_view).v;
+ newmeta = ConcatView(FirstView(meta, col), submeta);
+ newmeta = ConcatView(newmeta, LastView(meta, ViewSize(meta) - (col + 1)));
+
+ seq = NewSequence(map->count, &ST_Ungroup, 0);
+ /* data[0] is the parent view */
+ /* data[1] is ungroup map as a sequence */
+ /* data[2] is the subview column */
+ /* data[3] is the subview width */
+ seq->UV_parent = IncRefCount(view);
+ seq->UV_unmap = IncRefCount(map);
+ seq->UV_subcol = col;
+ seq->UV_swidth = ViewSize(submeta);
+
+ return IndirectView(newmeta, seq);
+}
+
+#define BV_parent data[0].q
+#define BV_cumcnt data[1].q
+
+static ItemTypes BlockedGetter (int row, Item_p item) {
+ int block;
+ const int* data;
+ View_p subv;
+ Seq_p seq;
+
+ seq = item->c.seq;
+ data = seq->BV_cumcnt->data[0].p;
+
+ for (block = 0; block + data[block] < row; ++block)
+ ;
+
+ if (row == block + data[block]) {
+ row = block;
+ block = ViewSize(seq->BV_parent) - 1;
+ } else if (block > 0)
+ row -= block + data[block-1];
+
+ subv = GetViewItem(seq->BV_parent, block, 0, IT_view).v;
+ item->c = ViewCol(subv, item->c.pos);
+ return GetItem(row, item);
+}
+
+static struct SeqType ST_Blocked = { "blocked", BlockedGetter, 011 };
+
+View_p BlockedView (View_p view) {
+ int r, rows, *limits, tally = 0;
+ View_p submeta;
+ Seq_p seq, offsets;
+ Column blocks;
+
+ /* view must have exactly one subview column */
+ if (ViewWidth(view) != 1)
+ return NULL;
+
+ blocks = ViewCol(view, 0);
+ rows = ViewSize(view);
+
+ offsets = NewIntVec(rows, &limits);
+ for (r = 0; r < rows; ++r) {
+ tally += ViewSize(GetColItem(r, blocks, IT_view).v);
+ limits[r] = tally;
+ }
+
+ seq = NewSequence(tally, &ST_Blocked, 0);
+ /* data[0] is the parent view */
+ /* data[1] is a cumulative row count, as a sequence */
+ seq->BV_parent = IncRefCount(view);
+ seq->BV_cumcnt = IncRefCount(offsets);
+
+ submeta = GetViewItem(V_Meta(view), 0, MC_subv, IT_view).v;
+ return IndirectView(submeta, seq);
+}
+/* %include% */
+/*
+ * mutable.c - Implementation of mutable views.
+ */
+
+#include
+#include
+
+
+#define MUT_DEBUG 0
+
+#define S_aux(seq,typ) ((typ) ((Seq_p) (seq) + 1))
+
+#define SV_data(seq) S_aux(seq, Seq_p*)
+#define SV_bits data[0].q
+#define SV_hash data[1].q
+#define SV_view data[2].q
+
+static void SettableCleaner (Seq_p seq) {
+ int c, r;
+ View_p view = seq->SV_view;
+
+ for (c = 0; c < ViewWidth(view); ++c) {
+ Seq_p dseq = SV_data(seq)[c];
+
+ if (dseq != NULL)
+ switch (ViewColType(view, c)) {
+
+ case IT_string: {
+ char **p = S_aux(dseq, char**);
+ for (r = 0; r < dseq->count; ++r)
+ if (p[r] != NULL)
+ free(p[r]);
+ break;
+ }
+
+ case IT_bytes: {
+ const Item *p = S_aux(dseq, const Item*);
+ for (r = 0; r < dseq->count; ++r)
+ if (p[r].u.ptr != NULL)
+ free((char*) p[r].u.ptr);
+ break;
+ }
+
+ case IT_view: {
+ const View_p *p = S_aux(dseq, const View_p*);
+ for (r = 0; r < dseq->count; ++r)
+ if (p[r] != NULL)
+ DecRefCount(p[r]);
+ break;
+ }
+
+ default: break;
+ }
+
+ DecRefCount(dseq);
+ DecRefCount(SV_data(seq)[ViewWidth(view)+c]);
+ }
+}
+
+static ItemTypes SettableGetter (int row, Item_p item) {
+ int col = item->c.pos;
+ Seq_p seq = item->c.seq;
+ View_p view = seq->SV_view;
+
+ item->c = ViewCol(view, col);
+
+ if (TestBit(seq->SV_bits, row)) {
+ int index = HashMapLookup(seq->SV_hash, row, -1);
+ Assert(index >= 0);
+
+ if (TestBit(SV_data(seq)[ViewWidth(view)+col], index)) {
+ row = index;
+ item->c.seq = SV_data(seq)[col];
+ }
+ }
+
+ return GetItem(row, item);
+}
+
+static int SettableWidth (ItemTypes type) {
+ switch (type) {
+ case IT_int: case IT_float: return 4;
+ case IT_wide: case IT_double: return 8;
+ case IT_view: case IT_string: return sizeof(void*);
+ case IT_bytes: return sizeof(Item);
+ default: Assert(0); return 0;
+ }
+}
+
+static ItemTypes StringSetGetter (int row, Item_p item) {
+ item->s = S_aux(item->c.seq, const char**)[row];
+ return IT_string;
+}
+
+static ItemTypes BytesSetGetter (int row, Item_p item) {
+ item->u = S_aux(item->c.seq, const Item*)[row].u;
+ return IT_bytes;
+}
+
+static ItemTypes ViewSetGetter (int row, Item_p item) {
+ item->v = S_aux(item->c.seq, const View_p*)[row];
+ return IT_view;
+}
+
+static struct SeqType ST_StringSet = { "stringset", StringSetGetter };
+static struct SeqType ST_BytesSet = { "bytesset", BytesSetGetter };
+static struct SeqType ST_ViewSet = { "viewset", ViewSetGetter };
+
+static SeqType_p PickSetGetter (ItemTypes type) {
+ int w = 8;
+ switch (type) {
+ case IT_int: w = 4; /* fall through */
+ case IT_wide: return FixedGetter(w, 1, 0, 0);
+ case IT_float: w = 4; /* fall through */
+ case IT_double: return FixedGetter(w, 1, 1, 0);
+ case IT_string: return &ST_StringSet;
+ case IT_bytes: return &ST_BytesSet;
+ case IT_view: return &ST_ViewSet;
+ default: Assert(0); return NULL;
+ }
+}
+
+static struct SeqType ST_Settable = {
+ "settable", SettableGetter, 0111, SettableCleaner
+};
+
+static int IsSettable(View_p view) {
+ Seq_p seq = ViewCol(view, 0).seq;
+ return seq != NULL && seq->type == &ST_Settable;
+}
+
+static void SettableSetter (View_p view, int row, int col, Item_p item) {
+ int index, count, limit;
+ ItemTypes type;
+ Seq_p seq, dseq, hash;
+
+ Assert(IsSettable(view));
+
+ seq = ViewCol(view, col).seq;
+ type = ViewColType(view, col);
+ dseq = SV_data(seq)[col];
+ hash = seq->SV_hash;
+
+ if (SetBit(&seq->SV_bits, row)) {
+ index = hash->count;
+ HashMapAdd(hash, row, index);
+ } else {
+ index = HashMapLookup(hash, row, -1);
+ Assert(index >= 0);
+ }
+
+ limit = SetBit(&SV_data(seq)[ViewWidth(view)+col], index);
+ count = dseq != NULL ? dseq->count : 0;
+
+ /* clumsy: resize a settable column so it can store more items if needed */
+ if (limit > count) {
+ int w = SettableWidth(type);
+ Seq_p nseq;
+ nseq = IncRefCount(NewSequence(limit, PickSetGetter(type), limit * w));
+ memcpy(nseq + 1, LoseRef(dseq) + 1, count * w);
+ SV_data(seq)[col] = dseq = nseq;
+ }
+
+ switch (type) {
+
+ case IT_int: S_aux(dseq, int* )[index] = item->i; break;
+ case IT_wide: S_aux(dseq, int64_t*)[index] = item->w; break;
+ case IT_float: S_aux(dseq, float* )[index] = item->f; break;
+ case IT_double: S_aux(dseq, double* )[index] = item->d; break;
+
+ case IT_string: {
+ char **p = S_aux(dseq, char**) + index;
+ free(*p);
+ *p = strdup(item->s);
+ break;
+ }
+
+ case IT_bytes: {
+ Item *p = S_aux(dseq, Item*) + index;
+ free((char*) p->u.ptr);
+ p->u.len = item->u.len;
+ p->u.ptr = memcpy(malloc(p->u.len), item->u.ptr, p->u.len);
+ break;
+ }
+
+ case IT_view: {
+ View_p *p = S_aux(dseq, View_p*) + index;
+ LoseRef(*p);
+ *p = IncRefCount(item->v);
+ break;
+ }
+
+ default: Assert(0); break;
+ }
+}
+
+static View_p SettableView (View_p view) {
+ Int_t bytes = 2 * ViewWidth(view) * sizeof(Seq_p*);
+ Seq_p seq;
+
+ /* room for a set of new data columns, then a set of "used" bitmaps */
+ seq = NewSequence(ViewSize(view), &ST_Settable, bytes);
+ /* data[0] is the adjusted bitmap */
+ /* data[1] points to hash row map */
+ /* data[2] points to the original view */
+ seq->SV_bits = NULL;
+ seq->SV_hash = IncRefCount(HashMapNew());
+ seq->SV_view = IncRefCount(view);
+
+ return IndirectView(V_Meta(view), seq);
+}
+
+#define MV_parent data[0].q
+#define MV_mutmap data[1].q
+
+ typedef struct MutRange {
+ int start;
+ int shift;
+ View_p added;
+ } *MutRange_p;
+
+static void MutableCleaner (Seq_p seq) {
+ int i;
+ Seq_p map;
+ MutRange_p range;
+
+ map = seq->MV_mutmap;
+ range = S_aux(map, MutRange_p);
+
+ for (i = 0; i < map->count; ++i)
+ DecRefCount(range[i].added);
+}
+
+#if MUT_DEBUG
+#include
+static void DumpRanges (const char *msg, View_p view) {
+ int i;
+ Seq_p seq, map;
+ MutRange_p range;
+
+ seq = ViewCol(view, 0).seq;
+ map = seq->MV_mutmap;
+ range = S_aux(map, MutRange_p);
+
+ printf("%s: view %p rc %d, has %d rows %d ranges\n",
+ msg, (void*) view, view->refs, ViewSize(view), map->count);
+ for (i = 0; i < map->count; ++i) {
+ View_p v = range[i].added;
+ printf(" %2d: st %3d sh %3d", i, range[i].start, range[i].shift);
+ if (v != NULL)
+ printf(" - %p: sz %3d rc %3d\n", (void*) v, ViewSize(v), v->refs);
+ printf("\n");
+ }
+}
+#else
+#define DumpRanges(a,b)
+#endif
+
+static int MutSlot (MutRange_p range, int pos) {
+ int i = -1;
+ /* TODO: use binary i.s.o. linear search */
+ while (pos > range[++i].start)
+ ;
+ return pos < range[i].start ? i-1 : i;
+}
+
+static int ChooseMutView (Seq_p seq, int *prow) {
+ int slot, row = *prow;
+ MutRange_p range;
+
+ range = S_aux(seq->MV_mutmap, MutRange_p);
+
+ slot = MutSlot(range, row);
+ row -= range[slot].start;
+ Assert(row >= 0);
+
+ *prow = range[slot].added != NULL ? slot : -1;
+ return row + range[slot].shift;
+}
+
+static ItemTypes MutableGetter (int row, Item_p item) {
+ Seq_p seq = item->c.seq;
+ View_p view = seq->MV_parent;
+ int index = ChooseMutView(seq, &row);
+
+ if (row >= 0) {
+ MutRange_p range = S_aux(seq->MV_mutmap, MutRange_p);
+ view = range[row].added;
+ }
+
+ item->c = ViewCol(view, item->c.pos);
+ return GetItem(index, item);
+}
+
+static MutRange_p MutResize (Seq_p *seqp, int pos, int diff) {
+ int i, limit = 0, count = 0;
+ MutRange_p range = NULL;
+ Seq_p map;
+
+ map = *seqp;
+ if (map != NULL) {
+ count = map->count;
+ limit = map->data[1].i / sizeof(struct MutRange);
+ range = S_aux(map, MutRange_p);
+ }
+
+ /* TODO: this only grows the ranges, should also shrink when possible */
+ if (diff > 0 && count + diff > limit) {
+ int newlimit;
+ MutRange_p newrange;
+
+ newlimit = (count / 2) * 3 + 5;
+ Assert(pos + diff <= newlimit);
+
+ *seqp = NewSequence(count, PickIntGetter(0),
+ newlimit * sizeof(struct MutRange));
+
+ newrange = S_aux(*seqp, MutRange_p);
+ memcpy(newrange, range, count * sizeof(struct MutRange));
+ range = newrange;
+
+ LoseRef(map);
+ map = IncRefCount(*seqp);
+ }
+
+ map->count += diff;
+
+ if (diff > 0) {
+ for (i = count; --i >= pos; )
+ range[i+diff] = range[i];
+ } else if (diff < 0) {
+ for (i = pos; i < pos - diff; ++i)
+ LoseRef(range[i].added);
+ for (i = pos - diff; i < count; ++i)
+ range[i+diff] = range[i];
+ }
+
+ return range;
+}
+
+static struct SeqType ST_Mutable = {
+ "mutable", MutableGetter, 011, MutableCleaner
+};
+
+View_p MutableView (View_p view) {
+ int rows;
+ Seq_p seq;
+
+ rows = ViewSize(view);
+ seq = NewSequence(rows, &ST_Mutable, 0);
+ /* data[0] is the parent view (may be changed to a settable one later) */
+ /* data[1] holds the mutable range map, as a sequence */
+ seq->MV_parent = IncRefCount(view);
+ seq->MV_mutmap = NULL;
+
+ if (rows == 0)
+ MutResize(&seq->MV_mutmap, 0, 1);
+ else {
+ MutRange_p range = MutResize(&seq->MV_mutmap, 0, 2);
+ range[1].start = rows;
+ }
+
+ return IndirectView(V_Meta(view), seq);
+}
+
+int IsMutable (View_p view) {
+ Seq_p seq = ViewCol(view, 0).seq;
+ return seq != NULL && seq->type == &ST_Mutable;
+}
+
+View_p ViewSet (View_p view, int row, int col, Item_p item) {
+ int index;
+ View_p *modview;
+ Seq_p mutseq;
+
+ if (!IsMutable(view))
+ view = MutableView(view);
+
+ mutseq = ViewCol(view, 0).seq;
+ index = ChooseMutView(mutseq, &row);
+
+ if (row >= 0) {
+ MutRange_p range = S_aux(mutseq->MV_mutmap, MutRange_p);
+ modview = &range[row].added;
+ } else
+ modview = (View_p*) &mutseq->data[0].p;
+
+ if (!IsSettable(*modview))
+ *modview = IncRefCount(SettableView(LoseRef(*modview)));
+
+ SettableSetter(*modview, index, col, item);
+
+ return view;
+}
+
+View_p ViewReplace (View_p view, int offset, int count, View_p data) {
+ int drows, fend, fpos, fslot, tend, tpos, tslot, grow, diff;
+ Seq_p seq, map;
+ MutRange_p range;
+ View_p tailv;
+
+ drows = data != NULL ? ViewSize(data) : 0;
+ fend = offset + count;
+ tend = offset + drows;
+
+ if (drows > 0 && !ViewCompat(view, data))
+ return NULL;
+
+ if (drows == 0 && count == 0)
+ return view;
+
+ if (!IsMutable(view))
+ view = MutableView(view);
+
+ DumpRanges("before", view);
+
+ seq = ViewCol(view, 0).seq;
+ map = seq->MV_mutmap;
+ range = S_aux(map, MutRange_p);
+
+ fslot = MutSlot(range, offset);
+ fpos = offset - range[fslot].start;
+
+ tslot = MutSlot(range, fend);
+ tpos = fend - range[tslot].start;
+
+ tailv = range[tslot].added;
+
+#if MUT_DEBUG
+printf("fslot %d fpos %d tslot %d tpos %d drows %d offset %d count %d fend %d tend %d\n", fslot,fpos,tslot,tpos,drows,offset,count,fend,tend);
+#endif
+
+ /* keep head of first range, if rows remain before offset */
+ if (fpos > 0)
+ ++fslot;
+
+ grow = fslot - tslot;
+ if (drows > 0)
+ ++grow;
+
+ range = MutResize(&seq->MV_mutmap, fslot, grow);
+ tslot += grow;
+
+ if (fpos > 0 && grow > 0)
+ range[tslot].shift = range[fslot-1].shift;
+
+ if (drows > 0) {
+ range[fslot].start = offset;
+ range[fslot].shift = 0;
+ range[fslot].added = IncRefCount(data);
+ }
+
+ /* keep tail of last range, if rows remain after offset */
+ if (tpos > 0) {
+ range[tslot].start = tend;
+ range[tslot].shift += tpos;
+ LoseRef(range[tslot].added);
+ range[tslot].added = IncRefCount(tailv);
+ ++tslot;
+ }
+
+ diff = drows - count;
+ seq->count += diff;
+
+ map = seq->MV_mutmap;
+ while (tslot < map->count)
+ range[tslot++].start += diff;
+
+ DumpRanges("after", view);
+ return view;
+}
+
+ItemTypes SetCmd_MIX (Item args[]) {
+ int i, col, row, objc;
+ const Object_p *objv;
+ View_p view;
+ Item item;
+
+ view = ObjAsView(args[0].o);
+ row = args[1].i;
+ if (row < 0)
+ row += ViewSize(view);
+
+ objv = (const Object_p *) args[2].u.ptr;
+ objc = args[2].u.len;
+
+ if (objc % 2 != 0) {
+ args->e = EC_wnoa;
+ return IT_error;
+ }
+
+ for (i = 0; i < objc; i += 2) {
+ col = ColumnByName(V_Meta(view), objv[i]);
+ if (col < 0)
+ return IT_unknown;
+
+ item.o = objv[i+1];
+ if (!ObjToItem(ViewColType(view, col), &item))
+ return IT_unknown;
+
+ view = ViewSet(view, row, col, &item);
+ }
+
+ args->v = view;
+ return IT_view;
+}
+
+Seq_p MutPrepare (View_p view) {
+ int i, j, k, cols, ranges, parows, delcnt, delpos, count, adjpos;
+ Seq_p result, *seqs, mutseq, mutmap;
+ MutRange_p range, rp;
+ View_p parent, insview;
+ Column column;
+
+ Assert(IsMutable(view));
+
+ mutseq = ViewCol(view, 0).seq;
+ parent = mutseq->MV_parent;
+ parows = ViewSize(parent);
+ mutmap = mutseq->MV_mutmap;
+ range = S_aux(mutmap, MutRange_p);
+ ranges = mutmap->count - 1;
+
+ cols = ViewWidth(view);
+ result = NewSeqVec(IT_unknown, NULL, MP_limit);
+
+ seqs = S_aux(result, Seq_p*);
+
+ seqs[MP_delmap] = NewBitVec(parows);
+ seqs[MP_insmap] = NewBitVec(ViewSize(view));
+
+ delcnt = delpos = 0;
+ insview = CloneView(view);
+
+ for (i = 0; i < ranges; ++i) {
+ rp = range + i;
+ count = (rp+1)->start - rp->start;
+ if (rp->added == NULL) {
+ delcnt += rp->shift - delpos;
+ SetBitRange(seqs[MP_delmap], delpos, rp->shift - delpos);
+ delpos = rp->shift + count;
+ } else {
+ View_p newdata = StepView(rp->added, count, rp->shift, 1, 1);
+ insview = ViewReplace(insview, ViewSize(insview), 0, newdata);
+ SetBitRange(seqs[MP_insmap], rp->start, count);
+ }
+ }
+
+ delcnt += parows - delpos;
+ SetBitRange(seqs[MP_delmap], delpos, parows - delpos);
+ seqs[MP_insdat] = insview;
+
+ seqs[MP_adjmap] = NewBitVec(parows - delcnt);
+
+ if (IsSettable(parent)) {
+ Seq_p setseq, adjseq;
+
+ setseq = ViewCol(parent, 0).seq;
+ adjseq = setseq->SV_bits;
+
+ if (adjseq != NULL && adjseq->count > 0) {
+ int *revptr, *rowptr;
+ Seq_p revmap, rowmap, hash = setseq->SV_hash;
+ View_p bitmeta, bitview;
+
+ revmap = NewIntVec(hash->count, &revptr);
+ rowmap = NewIntVec(hash->count, &rowptr);
+
+ k = adjpos = 0;
+
+ for (i = 0; i < ranges; ++i) {
+ rp = range + i;
+ if (rp->added == NULL) {
+ count = (rp+1)->start - rp->start;
+ for (j = 0; j < count; ++j)
+ if (TestBit(adjseq, rp->start + j)) {
+ int index = HashMapLookup(hash, rp->start + j, -1);
+ Assert(index >= 0);
+ revptr[k] = index;
+ rowptr[k++] = rp->start + j;
+ SetBit(seqs+MP_adjmap, adjpos + j);
+ }
+ adjpos += count;
+ }
+ }
+
+ Assert(adjpos == parows - delcnt);
+
+ seqs[MP_adjdat] = RemapSubview(parent, SeqAsCol(rowmap), 0, -1);
+
+ bitmeta = StepView(MakeIntColMeta("_"), 1, 0, ViewWidth(parent), 1);
+ bitview = NewView(bitmeta); /* will become an N-intcol view */
+
+ for (i = 0; i < cols; ++i) {
+ column.seq = SV_data(setseq)[cols+i];
+ column.pos = -1;
+ MinBitCount(&column.seq, hash->count);
+ SetViewCols(bitview, i, 1, column);
+ }
+
+ seqs[MP_revmap] = revmap;
+ seqs[MP_usemap] = RemapSubview(bitview, SeqAsCol(revmap), 0, -1);
+ }
+ } else {
+ seqs[MP_adjdat] = seqs[MP_usemap] = NoColumnView(0);
+ seqs[MP_revmap] = ViewCol(seqs[MP_usemap], 0).seq;
+ }
+
+ for (i = 0; i < MP_limit; ++i)
+ IncRefCount(seqs[i]);
+
+ return result;
+}
+/* %include% */
+/*
+ * sorted.c - Implementation of sorting functions.
+ */
+
+#include
+#include
+
+
+static int ItemsEqual (ItemTypes type, Item a, Item b) {
+ switch (type) {
+
+ case IT_int:
+ return a.i == b.i;
+
+ case IT_wide:
+ return a.w == b.w;
+
+ case IT_float:
+ return a.f == b.f;
+
+ case IT_double:
+ return a.d == b.d;
+
+ case IT_string:
+ return strcmp(a.s, b.s) == 0;
+
+ case IT_bytes:
+ return a.u.len == b.u.len && memcmp(a.u.ptr, b.u.ptr, a.u.len) == 0;
+
+ case IT_view:
+ return ViewCompare(a.v, b.v) == 0;
+
+ default: Assert(0); return -1;
+ }
+}
+
+int RowEqual (View_p v1, int r1, View_p v2, int r2) {
+ int c;
+ ItemTypes type;
+ Item item1, item2;
+
+ for (c = 0; c < ViewWidth(v1); ++c) {
+ type = ViewColType(v1, c);
+ item1 = GetViewItem(v1, r1, c, type);
+ item2 = GetViewItem(v2, r2, c, type);
+
+ if (!ItemsEqual(type, item1, item2))
+ return 0;
+ }
+
+ return 1;
+}
+
+/* TODO: UTF-8 comparisons, also case-sensitive & insensitive */
+
+static int ItemsCompare (ItemTypes type, Item a, Item b, int lower) {
+ switch (type) {
+
+ case IT_int:
+ return (a.i > b.i) - (a.i < b.i);
+
+ case IT_wide:
+ return (a.w > b.w) - (a.w < b.w);
+
+ case IT_float:
+ return (a.f > b.f) - (a.f < b.f);
+
+ case IT_double:
+ return (a.d > b.d) - (a.d < b.d);
+
+ case IT_string:
+ return (lower ? strcasecmp : strcmp)(a.s, b.s);
+
+ case IT_bytes: {
+ int f;
+
+ if (a.u.len == b.u.len)
+ return memcmp(a.u.ptr, b.u.ptr, a.u.len);
+
+ f = memcmp(a.u.ptr, b.u.ptr, a.u.len < b.u.len ? a.u.len : b.u.len);
+ return f != 0 ? f : a.u.len - b.u.len;
+ }
+
+ case IT_view:
+ return ViewCompare(a.v, b.v);
+
+ default: Assert(0); return -1;
+ }
+}
+
+int RowCompare (View_p v1, int r1, View_p v2, int r2) {
+ int c, f;
+ ItemTypes type;
+ Item item1, item2;
+
+ for (c = 0; c < ViewWidth(v1); ++c) {
+ type = ViewColType(v1, c);
+ item1 = GetViewItem(v1, r1, c, type);
+ item2 = GetViewItem(v2, r2, c, type);
+
+ f = ItemsCompare(type, item1, item2, 0);
+ if (f != 0)
+ return f < 0 ? -1 : 1;
+ }
+
+ return 0;
+}
+
+static int RowIsLess (View_p v, int a, int b) {
+ int c, f;
+ ItemTypes type;
+ Item va, vb;
+
+ if (a != b)
+ for (c = 0; c < ViewWidth(v); ++c) {
+ type = ViewColType(v, c);
+ va = GetViewItem(v, a, c, type);
+ vb = GetViewItem(v, b, c, type);
+
+ f = ItemsCompare(type, va, vb, 0);
+ if (f != 0)
+ return f < 0;
+ }
+
+ return a < b;
+}
+
+static int TestAndSwap (View_p v, int *a, int *b) {
+ if (RowIsLess(v, *b, *a)) {
+ int t = *a;
+ *a = *b;
+ *b = t;
+ return 1;
+ }
+ return 0;
+}
+
+static void MergeSort (View_p v, int *ar, int nr, int *scr) {
+ switch (nr) {
+ case 2:
+ TestAndSwap(v, ar, ar+1);
+ break;
+ case 3:
+ TestAndSwap(v, ar, ar+1);
+ if (TestAndSwap(v, ar+1, ar+2))
+ TestAndSwap(v, ar, ar+1);
+ break;
+ case 4: /* TODO: optimize with if's */
+ TestAndSwap(v, ar, ar+1);
+ TestAndSwap(v, ar+2, ar+3);
+ TestAndSwap(v, ar, ar+2);
+ TestAndSwap(v, ar+1, ar+3);
+ TestAndSwap(v, ar+1, ar+2);
+ break;
+ /* TODO: also special-case 5-item sort? */
+ default: {
+ int s1 = nr / 2, s2 = nr - s1;
+ int *f1 = scr, *f2 = scr + s1, *t1 = f1 + s1, *t2 = f2 + s2;
+ MergeSort(v, f1, s1, ar);
+ MergeSort(v, f2, s2, ar+s1);
+ for (;;)
+ if (RowIsLess(v, *f1, *f2)) {
+ *ar++ = *f1++;
+ if (f1 >= t1) {
+ while (f2 < t2)
+ *ar++ = *f2++;
+ break;
+ }
+ } else {
+ *ar++ = *f2++;
+ if (f2 >= t2) {
+ while (f1 < t1)
+ *ar++ = *f1++;
+ break;
+ }
+ }
+ }
+ }
+}
+
+Column SortMap (View_p view) {
+ int r, rows, *imap, *itmp;
+ Seq_p seq;
+
+ rows = ViewSize(view);
+
+ if (rows <= 1 || ViewWidth(view) == 0)
+ return NewIotaColumn(rows);
+
+ seq = NewIntVec(rows, &imap);
+ NewIntVec(rows, &itmp);
+
+ for (r = 0; r < rows; ++r)
+ imap[r] = itmp[r] = r;
+
+ MergeSort(view, imap, rows, itmp);
+
+ return SeqAsCol(seq);
+}
+
+static ItemTypes AggregateMax (ItemTypes type, Column column, Item_p item) {
+ int r, rows;
+ Item temp;
+
+ rows = column.seq->count;
+ if (rows == 0) {
+ item->e = EC_nalor;
+ return IT_error;
+ }
+
+ *item = GetColItem(0, column, type);
+ for (r = 1; r < rows; ++r) {
+ temp = GetColItem(r, column, type);
+ if (ItemsCompare (type, temp, *item, 0) > 0)
+ *item = temp;
+ }
+
+ return type;
+}
+
+ItemTypes MaxCmd_VN (Item args[]) {
+ Column column = ViewCol(args[0].v, args[1].i);
+ return AggregateMax(ViewColType(args[0].v, args[1].i), column, args);
+}
+
+static ItemTypes AggregateMin (ItemTypes type, Column column, Item_p item) {
+ int r, rows;
+ Item temp;
+
+ rows = column.seq->count;
+ if (rows == 0) {
+ item->e = EC_nalor;
+ return IT_error;
+ }
+
+ *item = GetColItem(0, column, type);
+ for (r = 1; r < rows; ++r) {
+ temp = GetColItem(r, column, type);
+ if (ItemsCompare (type, temp, *item, 0) < 0)
+ *item = temp;
+ }
+
+ return type;
+}
+
+ItemTypes MinCmd_VN (Item args[]) {
+ Column column = ViewCol(args[0].v, args[1].i);
+ return AggregateMin(ViewColType(args[0].v, args[1].i), column, args);
+}
+
+static ItemTypes AggregateSum (ItemTypes type, Column column, Item_p item) {
+ int r, rows = column.seq->count;
+
+ switch (type) {
+
+ case IT_int:
+ item->w = 0;
+ for (r = 0; r < rows; ++r)
+ item->w += GetColItem(r, column, IT_int).i;
+ return IT_wide;
+
+ case IT_wide:
+ item->w = 0;
+ for (r = 0; r < rows; ++r)
+ item->w += GetColItem(r, column, IT_wide).w;
+ return IT_wide;
+
+ case IT_float:
+ item->d = 0;
+ for (r = 0; r < rows; ++r)
+ item->d += GetColItem(r, column, IT_float).f;
+ return IT_double;
+
+ case IT_double:
+ item->d = 0;
+ for (r = 0; r < rows; ++r)
+ item->d += GetColItem(r, column, IT_double).d;
+ return IT_double;
+
+ default:
+ return IT_unknown;
+ }
+}
+
+ItemTypes SumCmd_VN (Item args[]) {
+ Column column = ViewCol(args[0].v, args[1].i);
+ return AggregateSum(ViewColType(args[0].v, args[1].i), column, &args[0]);
+}
+/* %include% */
+/*
+ * view.c - Implementation of views.
+ */
+
+#include
+#include
+
+
+int ViewSize (View_p view) {
+ Seq_p seq = ViewCol(view, 0).seq;
+ return seq != NULL ? seq->count : 0;
+}
+
+char GetColType (View_p meta, int col) {
+ /* TODO: could be a #define */
+ return *GetViewItem(meta, col, MC_type, IT_string).s;
+}
+
+static void ViewCleaner (View_p view) {
+ int c;
+ for (c = 0; c <= ViewWidth(view); ++c)
+ DecRefCount(ViewCol(view, c).seq);
+}
+
+static ItemTypes ViewGetter (int row, Item_p item) {
+ item->c = ViewCol(item->c.seq, row);
+ return IT_column;
+}
+
+static struct SeqType ST_View = { "view", ViewGetter, 010, ViewCleaner };
+
+static View_p ForceMetaView(View_p meta) {
+ View_p newmeta;
+ Column orignames, names;
+
+ /* this code is needed so we can always do a hash lookup on name column */
+
+ orignames = ViewCol(meta, MC_name);
+ names = ForceStringColumn(orignames);
+
+ if (names.seq == orignames.seq)
+ return meta;
+
+ /* need to construct a new meta view with the adjusted names column */
+ newmeta = NewView(V_Meta(meta));
+
+ SetViewCols(newmeta, MC_name, 1, names);
+ SetViewCols(newmeta, MC_type, 1, ViewCol(meta, MC_type));
+ SetViewCols(newmeta, MC_subv, 1, ViewCol(meta, MC_subv));
+
+ return newmeta;
+}
+
+View_p NewView (View_p meta) {
+ int c, cols, bytes;
+ View_p view;
+
+ /* a view must always be able to store at least one column */
+ cols = ViewSize(meta);
+ bytes = (cols + 1) * (sizeof(Column) + 1);
+
+ view = NewSequence(cols, &ST_View, bytes);
+ /* data[0] points to types string (allocated inline after the columns) */
+ /* data[1] is the meta view */
+ V_Types(view) = (char*) (V_Cols(view) + cols + 1);
+ V_Meta(view) = IncRefCount(ForceMetaView(meta));
+
+ /* TODO: could optimize by storing the types with the meta view instead */
+ for (c = 0; c < cols; ++c)
+ V_Types(view)[c] = CharAsItemType(GetColType(meta, c));
+
+ return view;
+}
+
+void SetViewCols (View_p view, int first, int count, Column src) {
+ int c;
+
+ AdjustSeqRefs(src.seq, count);
+ for (c = first; c < first + count; ++c) {
+ DecRefCount(ViewCol(view, c).seq);
+ ViewCol(view, c) = src;
+ }
+}
+
+void SetViewSeqs (View_p view, int first, int count, Seq_p src) {
+ SetViewCols(view, first, count, SeqAsCol(src));
+}
+
+View_p IndirectView (View_p meta, Seq_p seq) {
+ int c, cols;
+ View_p result;
+
+ cols = ViewSize(meta);
+ if (cols == 0)
+ ++cols;
+
+ result = NewView(meta);
+ SetViewSeqs(result, 0, cols, seq);
+
+ for (c = 0; c < cols; ++c)
+ ViewCol(result, c).pos = c;
+
+ return result;
+}
+
+View_p EmptyMetaView (void) {
+ Shared_p sh = GetShared();
+
+ if (sh->empty == NULL) {
+ int bytes;
+ View_p meta, subs [MC_limit];
+ Seq_p tempseq;
+
+ /* meta is recursively defined, so we can't use NewView here */
+ bytes = (MC_limit + 1) * (sizeof(Column) + 1);
+ meta = NewSequence(MC_limit, &ST_View, bytes);
+ V_Meta(meta) = IncRefCount(meta); /* circular */
+
+ V_Types(meta) = (char*) (V_Cols(meta) + MC_limit + 1);
+ V_Types(meta)[0] = V_Types(meta)[1] = IT_string;
+ V_Types(meta)[2] = IT_view;
+
+ /* initialize all but last columns of meta with static ptr contents */
+ tempseq = NewStrVec(1);
+ AppendToStrVec("name", -1, tempseq);
+ AppendToStrVec("type", -1, tempseq);
+ AppendToStrVec("subv", -1, tempseq);
+ SetViewSeqs(meta, MC_name, 1, FinishStrVec(tempseq));
+
+ tempseq = NewStrVec(1);
+ AppendToStrVec("S", -1, tempseq);
+ AppendToStrVec("S", -1, tempseq);
+ AppendToStrVec("V", -1, tempseq);
+ SetViewSeqs(meta, MC_type, 1, FinishStrVec(tempseq));
+
+ /* same structure as meta but no rows */
+ sh->empty = NewView(meta);
+
+ /* initialize last column of meta, now that empty exists */
+ subs[MC_name] = subs[MC_type] = subs[MC_subv] = sh->empty;
+ SetViewSeqs(meta, MC_subv, 1, NewSeqVec(IT_view, subs, MC_limit));
+ }
+
+ return sh->empty;
+}
+
+View_p NoColumnView (int rows) {
+ View_p result = NewView(EmptyMetaView());
+ SetViewSeqs(result, 0, 1, NewSequence(rows, PickIntGetter(0), 0));
+ return result;
+}
+
+View_p ColMapView (View_p view, Column mapcol) {
+ int c, cols;
+ const int *map;
+ View_p result;
+
+ map = (const int*) mapcol.seq->data[0].p;
+ cols = mapcol.seq->count;
+
+ if (cols == 0)
+ return NoColumnView(ViewSize(view));
+
+ result = NewView(RemapSubview(V_Meta(view), mapcol, 0, cols));
+
+ for (c = 0; c < cols; ++c)
+ SetViewCols(result, c, 1, ViewCol(view, map[c]));
+
+ return result;
+}
+
+View_p ColOmitView (View_p view, Column omitcol) {
+ int c, d, *map;
+ Seq_p mapcol;
+
+ mapcol = NewIntVec(ViewWidth(view), &map);
+
+ /* TODO: make this robust, may have to add bounds check */
+ for (c = 0; c < omitcol.seq->count; ++c)
+ map[GetColItem(c, omitcol, IT_int).i] = 1;
+
+ for (c = d = 0; c < mapcol->count; ++c)
+ if (!map[c])
+ map[d++] = c;
+
+ mapcol->count = d; /* TODO: truncate unused area */
+ return ColMapView(view, SeqAsCol(mapcol));
+}
+
+View_p OneColView (View_p view, int col) {
+ View_p result;
+
+ result = NewView(StepView(V_Meta(view), 1, col, 1, 1));
+ SetViewCols(result, 0, 1, ViewCol(view, col));
+
+ return result;
+}
+
+View_p FirstView (View_p view, int count) {
+ if (count >= ViewSize(view))
+ return view;
+ return StepView(view, count, 0, 1, 1);
+}
+
+View_p LastView (View_p view, int count) {
+ int rows = ViewSize(view);
+ if (count >= rows)
+ return view;
+ return StepView(view, count, rows - count, 1, 1);
+}
+
+View_p TakeView (View_p view, int count) {
+ if (count >= 0)
+ return StepView(view, count, 0, 1, 1);
+ else
+ return StepView(view, -count, -1, 1, -1);
+}
+
+View_p CloneView (View_p view) {
+ return NewView(V_Meta(view));
+}
+
+View_p PairView (View_p view1, View_p view2) {
+ int c, rows1 = ViewSize(view1), rows2 = ViewSize(view2);
+ View_p meta, result;
+
+ if (rows2 < rows1)
+ view1 = FirstView(view1, rows2);
+ else if (rows1 < rows2)
+ view2 = FirstView(view2, rows1);
+ else if (ViewWidth(view2) == 0)
+ return view1;
+ else if (ViewWidth(view1) == 0)
+ return view2;
+
+ meta = ConcatView(V_Meta(view1), V_Meta(view2));
+ result = NewView(meta);
+
+ for (c = 0; c < ViewWidth(view1); ++c)
+ SetViewCols(result, c, 1, ViewCol(view1, c));
+ for (c = 0; c < ViewWidth(view2); ++c)
+ SetViewCols(result, ViewWidth(view1) + c, 1, ViewCol(view2, c));
+
+ return result;
+}
+
+static void ViewStructure (View_p meta, Buffer_p buffer) {
+ int c, cols = ViewSize(meta);
+
+ for (c = 0; c < cols; ++c) {
+ char type = GetColType(meta, c);
+
+ if (type == 'V') {
+ View_p submeta = GetViewItem(meta, c, MC_subv, IT_view).v;
+
+ if (ViewSize(submeta) > 0) {
+ AddToBuffer(buffer, "(", 1);
+ ViewStructure(submeta, buffer);
+ AddToBuffer(buffer, ")", 1);
+ continue;
+ }
+ }
+ AddToBuffer(buffer, &type, 1);
+ }
+}
+
+int MetaIsCompatible (View_p meta1, View_p meta2) {
+ if (meta1 != meta2) {
+ int c, cols = ViewSize(meta1);
+
+ if (cols != ViewSize(meta2))
+ return 0;
+
+ for (c = 0; c < cols; ++c) {
+ char type = GetColType(meta1, c);
+
+ if (type != GetColType(meta2, c))
+ return 0;
+
+ if (type == 'V') {
+ View_p v1 = GetViewItem(meta1, c, MC_subv, IT_view).v;
+ View_p v2 = GetViewItem(meta2, c, MC_subv, IT_view).v;
+
+ if (!MetaIsCompatible(v1, v2))
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+int ViewCompare (View_p view1, View_p view2) {
+ int f, r, rows1, rows2;
+
+ if (view1 == view2)
+ return 0;
+
+ f = ViewCompare(V_Meta(view1), V_Meta(view2));
+ if (f != 0)
+ return f;
+
+ rows1 = ViewSize(view1);
+ rows2 = ViewSize(view2);
+
+ for (r = 0; r < rows1; ++r) {
+ if (r >= rows2)
+ return 1;
+
+ f = RowCompare(view1, r, view2, r);
+ if (f != 0)
+ return f < 0 ? -1 : 1;
+ }
+
+ return rows1 < rows2 ? -1 : 0;
+}
+
+View_p MakeIntColMeta (const char *name) {
+ View_p result, subv;
+ Seq_p names, types, subvs;
+
+ names = NewStrVec(1);
+ AppendToStrVec(name, -1, names);
+
+ types = NewStrVec(1);
+ AppendToStrVec("I", -1, types);
+
+ subv = EmptyMetaView();
+ subvs = NewSeqVec(IT_view, &subv, 1);
+
+ result = NewView(V_Meta(EmptyMetaView()));
+ SetViewSeqs(result, MC_name, 1, FinishStrVec(names));
+ SetViewSeqs(result, MC_type, 1, FinishStrVec(types));
+ SetViewSeqs(result, MC_subv, 1, subvs);
+ return result;
+}
+
+View_p TagView (View_p view, const char* name) {
+ View_p tagview;
+
+ tagview = NewView(MakeIntColMeta(name));
+ SetViewCols(tagview, 0, 1, NewIotaColumn(ViewSize(view)));
+
+ return PairView(view, tagview);
+}
+
+View_p DescAsMeta (const char** desc, const char* end) {
+ int c, len, cols = 0, namebytes = 0;
+ char sep, *buf, *ptr, **strings;
+ Seq_p *views, tempseq;
+ struct Buffer names, types, subvs;
+ View_p result, empty;
+
+ InitBuffer(&names);
+ InitBuffer(&types);
+ InitBuffer(&subvs);
+
+ len = end - *desc;
+ buf = memcpy(malloc(len+1), *desc, len);
+ buf[len] = ',';
+
+ empty = EmptyMetaView();
+ result = NewView(V_Meta(empty));
+
+ for (ptr = buf; ptr < buf + len; ++ptr) {
+ const char *s = ptr;
+ while (strchr(":,[]", *ptr) == 0)
+ ++ptr;
+ sep = *ptr;
+ *ptr = 0;
+
+ ADD_PTR_TO_BUF(names, s);
+ namebytes += ptr - s + 1;
+
+ switch (sep) {
+
+ case '[':
+ ADD_PTR_TO_BUF(types, "V");
+ ++ptr;
+ ADD_PTR_TO_BUF(subvs, DescAsMeta((const char**) &ptr, buf + len));
+ sep = *++ptr;
+ break;
+
+ case ':':
+ ptr += 2;
+ sep = *ptr;
+ *ptr = 0;
+ ADD_PTR_TO_BUF(types, ptr - 1);
+ ADD_PTR_TO_BUF(subvs, empty);
+ break;
+
+ default:
+ ADD_PTR_TO_BUF(types, "S");
+ ADD_PTR_TO_BUF(subvs, empty);
+ break;
+ }
+
+ ++cols;
+ if (sep != ',')
+ break;
+ }
+
+ strings = BufferAsPtr(&names, 1);
+ tempseq = NewStrVec(1);
+ for (c = 0; c < cols; ++c)
+ AppendToStrVec(strings[c], -1, tempseq);
+ SetViewSeqs(result, MC_name, 1, FinishStrVec(tempseq));
+ ReleaseBuffer(&names, 0);
+
+ strings = BufferAsPtr(&types, 1);
+ tempseq = NewStrVec(1);
+ for (c = 0; c < cols; ++c)
+ AppendToStrVec(strings[c], -1, tempseq);
+ SetViewSeqs(result, MC_type, 1, FinishStrVec(tempseq));
+ ReleaseBuffer(&types, 0);
+
+ views = BufferAsPtr(&subvs, 1);
+ tempseq = NewSeqVec(IT_view, views, cols);
+ SetViewSeqs(result, MC_subv, 1, tempseq);
+ ReleaseBuffer(&subvs, 0);
+
+ free(buf);
+ *desc += ptr - buf;
+ return result;
+}
+
+View_p DescToMeta (const char *desc) {
+ int len;
+ const char *end;
+ View_p meta;
+
+ len = strlen(desc);
+ end = desc + len;
+
+ meta = DescAsMeta(&desc, end);
+ if (desc < end)
+ return NULL;
+
+ return meta;
+}
+
+ItemTypes DataCmd_VX (Item args[]) {
+ View_p meta, view;
+ int c, cols, objc;
+ const Object_p *objv;
+ Column column;
+
+ meta = args[0].v;
+ cols = ViewSize(meta);
+
+ objv = (const Object_p *) args[1].u.ptr;
+ objc = args[1].u.len;
+
+ if (objc != cols) {
+ args->e = EC_wnoa;
+ return IT_error;
+ }
+
+ view = NewView(meta);
+ for (c = 0; c < cols; ++c) {
+ column = CoerceColumn(ViewColType(view, c), objv[c]);
+ if (column.seq == NULL)
+ return IT_unknown;
+
+ SetViewCols(view, c, 1, column);
+ }
+
+ args->v = view;
+ return IT_view;
+}
+
+ItemTypes StructDescCmd_V (Item args[]) {
+ struct Buffer buffer;
+ Item item;
+
+ InitBuffer(&buffer);
+ MetaAsDesc(V_Meta(args[0].v), &buffer);
+ AddToBuffer(&buffer, "", 1);
+ item.s = BufferAsPtr(&buffer, 1);
+ args->o = ItemAsObj(IT_string, &item);
+ ReleaseBuffer(&buffer, 0);
+ return IT_object;
+}
+
+ItemTypes StructureCmd_V (Item args[]) {
+ struct Buffer buffer;
+ Item item;
+
+ InitBuffer(&buffer);
+ ViewStructure(V_Meta(args[0].v), &buffer);
+ AddToBuffer(&buffer, "", 1);
+ item.s = BufferAsPtr(&buffer, 1);
+ args->o = ItemAsObj(IT_string, &item);
+ ReleaseBuffer(&buffer, 0);
+ return IT_object;
+}
+/* %include% */
+/* wrap_gen.c - generated code, do not edit */
+
+#include
+
+
+ItemTypes BlockedCmd_V (Item_p a) {
+ a[0].v = BlockedView(a[0].v);
+ return IT_view;
+}
+
+ItemTypes CloneCmd_V (Item_p a) {
+ a[0].v = CloneView(a[0].v);
+ return IT_view;
+}
+
+ItemTypes CoerceCmd_OS (Item_p a) {
+ a[0].c = CoerceCmd(a[0].o, a[1].s);
+ return IT_column;
+}
+
+ItemTypes ColMapCmd_Vn (Item_p a) {
+ a[0].v = ColMapView(a[0].v, a[1].c);
+ return IT_view;
+}
+
+ItemTypes ColOmitCmd_Vn (Item_p a) {
+ a[0].v = ColOmitView(a[0].v, a[1].c);
+ return IT_view;
+}
+
+ItemTypes CompareCmd_VV (Item_p a) {
+ a[0].i = ViewCompare(a[0].v, a[1].v);
+ return IT_int;
+}
+
+ItemTypes CompatCmd_VV (Item_p a) {
+ a[0].i = ViewCompat(a[0].v, a[1].v);
+ return IT_int;
+}
+
+ItemTypes ConcatCmd_VV (Item_p a) {
+ a[0].v = ConcatView(a[0].v, a[1].v);
+ return IT_view;
+}
+
+ItemTypes CountsColCmd_C (Item_p a) {
+ a[0].c = NewCountsColumn(a[0].c);
+ return IT_column;
+}
+
+ItemTypes CountViewCmd_I (Item_p a) {
+ a[0].v = NoColumnView(a[0].i);
+ return IT_view;
+}
+
+ItemTypes FirstCmd_VI (Item_p a) {
+ a[0].v = FirstView(a[0].v, a[1].i);
+ return IT_view;
+}
+
+ItemTypes GetColCmd_VN (Item_p a) {
+ a[0].c = ViewCol(a[0].v, a[1].i);
+ return IT_column;
+}
+
+ItemTypes GetInfoCmd_VVI (Item_p a) {
+ a[0].c = GetHashInfo(a[0].v, a[1].v, a[2].i);
+ return IT_column;
+}
+
+ItemTypes GroupCmd_VnS (Item_p a) {
+ a[0].v = GroupCol(a[0].v, a[1].c, a[2].s);
+ return IT_view;
+}
+
+ItemTypes GroupedCmd_ViiS (Item_p a) {
+ a[0].v = GroupedView(a[0].v, a[1].c, a[2].c, a[3].s);
+ return IT_view;
+}
+
+ItemTypes HashFindCmd_VIViii (Item_p a) {
+ a[0].i = HashDoFind(a[0].v, a[1].i, a[2].v, a[3].c, a[4].c, a[5].c);
+ return IT_int;
+}
+
+ItemTypes HashViewCmd_V (Item_p a) {
+ a[0].c = HashValues(a[0].v);
+ return IT_column;
+}
+
+ItemTypes IjoinCmd_VV (Item_p a) {
+ a[0].v = IjoinView(a[0].v, a[1].v);
+ return IT_view;
+}
+
+ItemTypes IotaCmd_I (Item_p a) {
+ a[0].c = NewIotaColumn(a[0].i);
+ return IT_column;
+}
+
+ItemTypes IsectMapCmd_VV (Item_p a) {
+ a[0].c = IntersectMap(a[0].v, a[1].v);
+ return IT_column;
+}
+
+ItemTypes JoinCmd_VVS (Item_p a) {
+ a[0].v = JoinView(a[0].v, a[1].v, a[2].s);
+ return IT_view;
+}
+
+ItemTypes LastCmd_VI (Item_p a) {
+ a[0].v = LastView(a[0].v, a[1].i);
+ return IT_view;
+}
+
+ItemTypes MdefCmd_O (Item_p a) {
+ a[0].v = ObjAsMetaView(a[0].o);
+ return IT_view;
+}
+
+ItemTypes MdescCmd_S (Item_p a) {
+ a[0].v = DescToMeta(a[0].s);
+ return IT_view;
+}
+
+ItemTypes MetaCmd_V (Item_p a) {
+ a[0].v = V_Meta(a[0].v);
+ return IT_view;
+}
+
+ItemTypes OmitMapCmd_iI (Item_p a) {
+ a[0].c = OmitColumn(a[0].c, a[1].i);
+ return IT_column;
+}
+
+ItemTypes OneColCmd_VN (Item_p a) {
+ a[0].v = OneColView(a[0].v, a[1].i);
+ return IT_view;
+}
+
+ItemTypes PairCmd_VV (Item_p a) {
+ a[0].v = PairView(a[0].v, a[1].v);
+ return IT_view;
+}
+
+ItemTypes RemapSubCmd_ViII (Item_p a) {
+ a[0].v = RemapSubview(a[0].v, a[1].c, a[2].i, a[3].i);
+ return IT_view;
+}
+
+ItemTypes ReplaceCmd_VIIV (Item_p a) {
+ a[0].v = ViewReplace(a[0].v, a[1].i, a[2].i, a[3].v);
+ return IT_view;
+}
+
+ItemTypes RowCmpCmd_VIVI (Item_p a) {
+ a[0].i = RowCompare(a[0].v, a[1].i, a[2].v, a[3].i);
+ return IT_int;
+}
+
+ItemTypes RowEqCmd_VIVI (Item_p a) {
+ a[0].i = RowEqual(a[0].v, a[1].i, a[2].v, a[3].i);
+ return IT_int;
+}
+
+ItemTypes RowHashCmd_VI (Item_p a) {
+ a[0].i = RowHash(a[0].v, a[1].i);
+ return IT_int;
+}
+
+ItemTypes SizeCmd_V (Item_p a) {
+ a[0].i = ViewSize(a[0].v);
+ return IT_int;
+}
+
+ItemTypes SortMapCmd_V (Item_p a) {
+ a[0].c = SortMap(a[0].v);
+ return IT_column;
+}
+
+ItemTypes StepCmd_VIIII (Item_p a) {
+ a[0].v = StepView(a[0].v, a[1].i, a[2].i, a[3].i, a[4].i);
+ return IT_view;
+}
+
+ItemTypes StrLookupCmd_Ss (Item_p a) {
+ a[0].i = StringLookup(a[0].s, a[1].c);
+ return IT_int;
+}
+
+ItemTypes TagCmd_VS (Item_p a) {
+ a[0].v = TagView(a[0].v, a[1].s);
+ return IT_view;
+}
+
+ItemTypes TakeCmd_VI (Item_p a) {
+ a[0].v = TakeView(a[0].v, a[1].i);
+ return IT_view;
+}
+
+ItemTypes UngroupCmd_VN (Item_p a) {
+ a[0].v = UngroupView(a[0].v, a[1].i);
+ return IT_view;
+}
+
+ItemTypes UniqueMapCmd_V (Item_p a) {
+ a[0].c = UniqMap(a[0].v);
+ return IT_column;
+}
+
+ItemTypes ViewAsColCmd_V (Item_p a) {
+ a[0].c = ViewAsCol(a[0].v);
+ return IT_column;
+}
+
+ItemTypes WidthCmd_V (Item_p a) {
+ a[0].i = ViewWidth(a[0].v);
+ return IT_int;
+}
+
+/* : append ( VV-V ) over size swap insert ; */
+ItemTypes AppendCmd_VV (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ t = SizeCmd_V(a+2);
+ /* swap 1 */ a[3] = a[1]; a[1] = a[2]; a[2] = a[3];
+ t = InsertCmd_VIV(a);
+ return IT_view;
+}
+
+/* : colconv ( C-C ) ; */
+ItemTypes ColConvCmd_C (Item_p a) {
+ return IT_column;
+}
+
+/* : counts ( VN-C ) getcol countscol ; */
+ItemTypes CountsCmd_VN (Item_p a) {
+ ItemTypes t;
+ t = GetColCmd_VN(a);
+ t = CountsColCmd_C(a);
+ return IT_column;
+}
+
+/* : delete ( VII-V ) 0 countview replace ; */
+ItemTypes DeleteCmd_VII (Item_p a) {
+ ItemTypes t;
+ a[3].i = 0;
+ t = CountViewCmd_I(a+3);
+ t = ReplaceCmd_VIIV(a);
+ return IT_view;
+}
+
+/* : except ( VV-V ) over swap exceptmap remap ; */
+ItemTypes ExceptCmd_VV (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ /* swap 1 */ a[3] = a[1]; a[1] = a[2]; a[2] = a[3];
+ t = ExceptMapCmd_VV(a+1);
+ t = RemapCmd_Vi(a);
+ return IT_view;
+}
+
+/* : exceptmap ( VV-C ) over swap isectmap swap size omitmap ; */
+ItemTypes ExceptMapCmd_VV (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ /* swap 1 */ a[3] = a[1]; a[1] = a[2]; a[2] = a[3];
+ t = IsectMapCmd_VV(a+1);
+ /* swap 0 */ a[2] = a[0]; a[0] = a[1]; a[1] = a[2];
+ t = SizeCmd_V(a+1);
+ t = OmitMapCmd_iI(a);
+ return IT_column;
+}
+
+/* : insert ( VIV-V ) 0 swap replace ; */
+ItemTypes InsertCmd_VIV (Item_p a) {
+ ItemTypes t;
+ a[3].i = 0;
+ /* swap 2 */ a[4] = a[2]; a[2] = a[3]; a[3] = a[4];
+ t = ReplaceCmd_VIIV(a);
+ return IT_view;
+}
+
+/* : intersect ( VV-V ) over swap isectmap remap ; */
+ItemTypes IntersectCmd_VV (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ /* swap 1 */ a[3] = a[1]; a[1] = a[2]; a[2] = a[3];
+ t = IsectMapCmd_VV(a+1);
+ t = RemapCmd_Vi(a);
+ return IT_view;
+}
+
+/* : namecol ( V-V ) meta 0 onecol ; */
+ItemTypes NameColCmd_V (Item_p a) {
+ ItemTypes t;
+ t = MetaCmd_V(a);
+ a[1].i = 0;
+ t = OneColCmd_VN(a);
+ return IT_view;
+}
+
+/* : names ( V-C ) meta 0 getcol ; */
+ItemTypes NamesCmd_V (Item_p a) {
+ ItemTypes t;
+ t = MetaCmd_V(a);
+ a[1].i = 0;
+ t = GetColCmd_VN(a);
+ return IT_column;
+}
+
+/* : product ( VV-V ) over over size spread rrot swap size repeat pair ; */
+ItemTypes ProductCmd_VV (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ /* over 1 */ a[3] = a[1];
+ t = SizeCmd_V(a+3);
+ t = SpreadCmd_VI(a+2);
+ /* rrot 0 */ a[3] = a[2]; a[2] = a[1]; a[1] = a[0]; a[0] = a[3];
+ /* swap 1 */ a[3] = a[1]; a[1] = a[2]; a[2] = a[3];
+ t = SizeCmd_V(a+2);
+ t = RepeatCmd_VI(a+1);
+ t = PairCmd_VV(a);
+ return IT_view;
+}
+
+/* : remap ( Vi-V ) 0 -1 remapsub ; */
+ItemTypes RemapCmd_Vi (Item_p a) {
+ ItemTypes t;
+ a[2].i = 0;
+ a[3].i = -1;
+ t = RemapSubCmd_ViII(a);
+ return IT_view;
+}
+
+/* : repeat ( VI-V ) over size imul 0 1 1 step ; */
+ItemTypes RepeatCmd_VI (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ t = SizeCmd_V(a+2);
+ /* imul 1 */ a[1].i *= a[2].i;
+ a[2].i = 0;
+ a[3].i = 1;
+ a[4].i = 1;
+ t = StepCmd_VIIII(a);
+ return IT_view;
+}
+
+/* : reverse ( V-V ) dup size -1 1 -1 step ; */
+ItemTypes ReverseCmd_V (Item_p a) {
+ ItemTypes t;
+ /* dup 0 */ a[1] = a[0];
+ t = SizeCmd_V(a+1);
+ a[2].i = -1;
+ a[3].i = 1;
+ a[4].i = -1;
+ t = StepCmd_VIIII(a);
+ return IT_view;
+}
+
+/* : slice ( VIII-V ) rrot 1 swap step ; */
+ItemTypes SliceCmd_VIII (Item_p a) {
+ ItemTypes t;
+ /* rrot 1 */ a[4] = a[3]; a[3] = a[2]; a[2] = a[1]; a[1] = a[4];
+ a[4].i = 1;
+ /* swap 3 */ a[5] = a[3]; a[3] = a[4]; a[4] = a[5];
+ t = StepCmd_VIIII(a);
+ return IT_view;
+}
+
+/* : sort ( V-V ) dup sortmap remap ; */
+ItemTypes SortCmd_V (Item_p a) {
+ ItemTypes t;
+ /* dup 0 */ a[1] = a[0];
+ t = SortMapCmd_V(a+1);
+ t = RemapCmd_Vi(a);
+ return IT_view;
+}
+
+/* : spread ( VI-V ) over size 0 rot 1 step ; */
+ItemTypes SpreadCmd_VI (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ t = SizeCmd_V(a+2);
+ a[3].i = 0;
+ /* rot 1 */ a[4] = a[1]; a[1] = a[2]; a[2] = a[3]; a[3] = a[4];
+ a[4].i = 1;
+ t = StepCmd_VIIII(a);
+ return IT_view;
+}
+
+/* : types ( V-C ) meta 1 getcol ; */
+ItemTypes TypesCmd_V (Item_p a) {
+ ItemTypes t;
+ t = MetaCmd_V(a);
+ a[1].i = 1;
+ t = GetColCmd_VN(a);
+ return IT_column;
+}
+
+/* : union ( VV-V ) over except concat ; */
+ItemTypes UnionCmd_VV (Item_p a) {
+ ItemTypes t;
+ /* over 0 */ a[2] = a[0];
+ t = ExceptCmd_VV(a+1);
+ t = ConcatCmd_VV(a);
+ return IT_view;
+}
+
+/* : unionmap ( VV-C ) swap exceptmap ; */
+ItemTypes UnionMapCmd_VV (Item_p a) {
+ ItemTypes t;
+ /* swap 0 */ a[2] = a[0]; a[0] = a[1]; a[1] = a[2];
+ t = ExceptMapCmd_VV(a);
+ return IT_column;
+}
+
+/* : unique ( V-V ) dup uniquemap remap ; */
+ItemTypes UniqueCmd_V (Item_p a) {
+ ItemTypes t;
+ /* dup 0 */ a[1] = a[0];
+ t = UniqueMapCmd_V(a+1);
+ t = RemapCmd_Vi(a);
+ return IT_view;
+}
+
+/* : viewconv ( V-V ) ; */
+ItemTypes ViewConvCmd_V (Item_p a) {
+ return IT_view;
+}
+
+/* end of generated code */
+
+/* %include% */
+/*
+ * cmds.c - Implementation of Tcl-specific operators.
+ */
+
+/*
+ * ext_tcl.h - Definitions needed across the Tcl-specific code.
+ */
+
+#include
+#include
+
+
+#include
+
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
+#define Tcl_GetErrorLine(interp) (interp)->errorLine
+#define CONST86
+#endif
+
+/* colobj.c */
+
+extern Tcl_ObjType f_colObjType;
+
+Object_p (ColumnAsObj) (Column column);
+
+/* ext_tcl.c */
+
+typedef struct SharedInfo {
+ Tcl_Interp *interp;
+ const struct CmdDispatch *cmds;
+} SharedInfo;
+
+#define Interp() (GetShared()->info->interp)
+#define DecObjRef Tcl_DecrRefCount
+
+Object_p (BufferAsTclList) (Buffer_p bp);
+Object_p (IncObjRef) (Object_p objPtr);
+
+/* viewobj.c */
+
+extern Tcl_ObjType f_viewObjType;
+
+int (AdjustCmdDef) (Object_p cmd);
+Object_p (ViewAsObj) (View_p view);
+
+ItemTypes DefCmd_OO (Item args[]) {
+ int argc, c, r, cols, rows;
+ View_p meta, result;
+ Object_p obj, *argv;
+ Column column;
+ struct Buffer buffer;
+
+ if (MdefCmd_O(args) != IT_view)
+ return IT_error;
+ if (args[0].v == NULL)
+ return IT_view;
+ meta = args[0].v;
+
+ if (Tcl_ListObjGetElements(Interp(), args[1].o, &argc, &argv) != TCL_OK)
+ return IT_unknown;
+
+ cols = ViewSize(meta);
+ if (cols == 0) {
+ if (argc != 0) {
+ args->e = EC_cizwv;
+ return IT_error;
+ }
+
+ args->v = NoColumnView(0);
+ return IT_view;
+ }
+
+ if (argc % cols != 0) {
+ args->e = EC_nmcw;
+ return IT_error;
+ }
+
+ result = NewView(meta);
+ rows = argc / cols;
+
+ for (c = 0; c < cols; ++c) {
+ InitBuffer(&buffer);
+
+ for (r = 0; r < rows; ++r)
+ ADD_PTR_TO_BUF(buffer, argv[c + cols * r]);
+
+ obj = BufferAsTclList(&buffer);
+ column = CoerceColumn(ViewColType(result, c), obj);
+ DecObjRef(obj);
+
+ if (column.seq == NULL)
+ return IT_unknown;
+
+ SetViewCols(result, c, 1, column);
+ }
+
+ args->v = result;
+ return IT_view;
+}
+
+static Object_p GetViewRows (View_p view, int row, int rows, int tags) {
+ int r, c, cols;
+ View_p meta;
+ Item item;
+ struct Buffer buf;
+
+ meta = V_Meta(view);
+ cols = ViewSize(meta);
+ InitBuffer(&buf);
+
+ for (r = 0; r < rows; ++r)
+ for (c = 0; c < cols; ++c) {
+ if (tags) {
+ item.c = ViewCol(meta, 0);
+ ADD_PTR_TO_BUF(buf, ItemAsObj(GetItem(c, &item), &item));
+ }
+ item.c = ViewCol(view, c);
+ ADD_PTR_TO_BUF(buf, ItemAsObj(GetItem(r + row, &item), &item));
+ }
+
+ return BufferAsTclList(&buf);
+}
+
+static int ColumnNumber(Object_p obj, View_p meta) {
+ int col;
+ const char *name = Tcl_GetString(obj);
+
+ switch (*name) {
+
+ case '#': return -2;
+ case '*': return -1;
+ case '-': case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ if (Tcl_GetIntFromObj(Interp(), obj, &col) != TCL_OK)
+ return -3;
+
+ if (col < 0)
+ col += ViewSize(meta);
+
+ if (col < 0 || col >= ViewSize(meta))
+ return -4;
+ break;
+
+ default:
+ col = StringLookup(name, ViewCol(meta, MC_name));
+ if (col < 0)
+ return -3;
+ }
+
+ return col;
+}
+
+ItemTypes GetCmd_VX (Item args[]) {
+ View_p view;
+ int i, objc, r, row, col, rows;
+ const Object_p *objv;
+ ItemTypes currtype;
+
+ view = args[0].v;
+ currtype = IT_view;
+
+ objv = (const Object_p *) args[1].u.ptr;
+ objc = args[1].u.len;
+
+ if (objc == 0) {
+ args->o = GetViewRows(view, 0, ViewSize(view), 0);
+ return IT_object;
+ }
+
+ for (i = 0; i < objc; ++i) {
+ if (currtype == IT_view)
+ view = args[0].v;
+ else /* TODO: make sure the object does not leak if newly created */
+ view = ObjAsView(ItemAsObj(currtype, args));
+
+ if (view == NULL)
+ return IT_unknown;
+
+ rows = ViewSize(view);
+
+ if (Tcl_GetIntFromObj(0, objv[i], &row) != TCL_OK)
+ switch (*Tcl_GetString(objv[i])) {
+ case '@': args->v = V_Meta(view);
+ currtype = IT_view;
+ continue;
+ case '#': args->i = rows;
+ currtype = IT_int;
+ continue;
+ case '*': row = -1;
+ break;
+ default: Tcl_GetIntFromObj(Interp(), objv[i], &row);
+ return IT_unknown;
+ }
+ else if (row < 0) {
+ row += rows;
+ if (row < 0) {
+ args->e = EC_rioor;
+ return IT_error;
+ }
+ }
+
+ if (++i >= objc) {
+ if (row >= 0)
+ args->o = GetViewRows(view, row, 1, 1); /* one tagged row */
+ else {
+ struct Buffer buf;
+ InitBuffer(&buf);
+ for (r = 0; r < rows; ++r)
+ ADD_PTR_TO_BUF(buf, GetViewRows(view, r, 1, 0));
+ args->o = BufferAsTclList(&buf);
+ }
+ return IT_object;
+ }
+
+ col = ColumnNumber(objv[i], V_Meta(view));
+
+ if (row >= 0)
+ switch (col) {
+ default: args->c = ViewCol(view, col);
+ currtype = GetItem(row, args);
+ break;
+ case -1: args->o = GetViewRows(view, row, 1, 0);
+ currtype = IT_object;
+ break;
+ case -2: args->i = row;
+ currtype = IT_int;
+ break;
+ case -3: return IT_unknown;
+ case -4: args->e = EC_cioor;
+ return IT_error;
+ }
+ else
+ switch (col) {
+ default: args->c = ViewCol(view, col);
+ currtype = IT_column;
+ break;
+ case -1: args->o = GetViewRows(view, 0, rows, 0);
+ currtype = IT_object;
+ break;
+ case -2: args->c = NewIotaColumn(rows);
+ currtype = IT_column;
+ break;
+ case -3: return IT_unknown;
+ case -4: args->e = EC_cioor;
+ return IT_error;
+ }
+ }
+
+ return currtype;
+}
+
+ItemTypes MutInfoCmd_V (Item_p a) {
+ int i;
+ Seq_p mods, *seqs;
+ Object_p result;
+
+ if (!IsMutable(a[0].v))
+ return IT_unknown;
+
+ mods = MutPrepare(a[0].v);
+ seqs = (void*) (mods + 1);
+
+ result = Tcl_NewListObj(0, NULL);
+
+ for (i = 0; i < MP_delmap; ++i)
+ Tcl_ListObjAppendElement(NULL, result, ViewAsObj(seqs[i]));
+ for (i = MP_delmap; i < MP_limit; ++i)
+ Tcl_ListObjAppendElement(NULL, result, ColumnAsObj(SeqAsCol(seqs[i])));
+
+ a->o = result;
+ return IT_object;
+}
+
+ItemTypes RefsCmd_O (Item args[]) {
+ args->i = args[0].o->refCount;
+ return IT_int;
+}
+
+ItemTypes RenameCmd_VO (Item args[]) {
+ int i, c, objc;
+ View_p meta, view, newmeta, newview;
+ Object_p *objv;
+ Item item;
+
+ if (Tcl_ListObjGetElements(Interp(), args[1].o, &objc, &objv) != TCL_OK)
+ return IT_unknown;
+
+ if (objc % 2) {
+ args->e = EC_rambe;
+ return IT_error;
+ }
+
+ view = args[0].v;
+ meta = V_Meta(view);
+ newmeta = meta;
+
+ for (i = 0; i < objc; i += 2) {
+ c = ColumnByName(meta, objv[i]);
+ if (c < 0)
+ return IT_unknown;
+ item.s = Tcl_GetString(objv[i+1]);
+ newmeta = ViewSet(newmeta, c, MC_name, &item);
+ }
+
+ newview = NewView(newmeta);
+
+ for (c = 0; c < ViewWidth(view); ++c)
+ SetViewCols(newview, c, 1, ViewCol(view, c));
+
+ args->v = newview;
+ return IT_view;
+}
+
+ItemTypes ToCmd_OO (Item args[]) {
+ Object_p result;
+
+ result = Tcl_ObjSetVar2(Interp(), args[1].o, 0, args[0].o,
+ TCL_LEAVE_ERR_MSG);
+ if (result == NULL)
+ return IT_unknown;
+
+ args->o = result;
+ return IT_object;
+}
+
+ItemTypes TypeCmd_O (Item args[]) {
+ args->s = args[0].o->typePtr != NULL ? args[0].o->typePtr->name : "";
+ return IT_string;
+}
+/* %include% */
+/*
+ * colobj.c - Implementation of column objects in Tcl.
+ */
+
+
+static const char *ErrorMessage(ErrorCodes code) {
+ switch (code) {
+ case EC_cioor: return "column index out of range";
+ case EC_rioor: return "row index out of range";
+ case EC_cizwv: return "cannot insert in zero-width view";
+ case EC_nmcw: return "item count not a multiple of column width";
+ case EC_rambe: return "rename arg count must be even";
+ case EC_nalor: return "nead at least one row";
+ case EC_wnoa: return "wrong number of arguments";
+ }
+ return "?";
+}
+
+Object_p ItemAsObj (ItemTypes type, Item_p item) {
+ switch (type) {
+
+ case IT_int:
+ return Tcl_NewIntObj(item->i);
+
+ case IT_wide:
+ return Tcl_NewWideIntObj(item->w);
+
+ case IT_float:
+ return Tcl_NewDoubleObj(item->f);
+
+ case IT_double:
+ return Tcl_NewDoubleObj(item->d);
+
+ case IT_string:
+ return Tcl_NewStringObj(item->s, -1);
+
+ case IT_bytes:
+ return Tcl_NewByteArrayObj(item->u.ptr, item->u.len);
+
+ case IT_object:
+ return item->o;
+
+ case IT_column:
+ return ColumnAsObj(item->c);
+
+ case IT_view:
+ if (item->v == NULL) {
+ Tcl_SetResult(Interp(), "invalid view", TCL_STATIC);
+ return NULL;
+ }
+ return ViewAsObj(item->v);
+
+ case IT_error:
+ Tcl_SetResult(Interp(), (char*) ErrorMessage(item->e), TCL_STATIC);
+ return NULL;
+
+ default:
+ Assert(0);
+ return NULL;
+ }
+}
+
+int ColumnByName (View_p meta, Object_p obj) {
+ int colnum;
+ const char *str = Tcl_GetString(obj);
+
+ switch (*str) {
+
+ case '#':
+ return -2;
+
+ case '*':
+ return -3;
+
+ case '-': case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ if (Tcl_GetIntFromObj(NULL, obj, &colnum) != TCL_OK)
+ return -4;
+ if (colnum < 0)
+ colnum += ViewSize(meta);
+ if (colnum < 0 || colnum >= ViewSize(meta))
+ return -5;
+ return colnum;
+
+ default:
+ return StringLookup(str, ViewCol(meta, MC_name));
+ }
+}
+
+int ObjToItem (ItemTypes type, Item_p item) {
+ switch (type) {
+
+ case IT_int:
+ return Tcl_GetIntFromObj(Interp(), item->o, &item->i) == TCL_OK;
+
+ case IT_wide:
+ return Tcl_GetWideIntFromObj(Interp(), item->o,
+ (Tcl_WideInt*) &item->w) == TCL_OK;
+
+ case IT_float:
+ if (Tcl_GetDoubleFromObj(Interp(), item->o, &item->d) != TCL_OK)
+ return 0;
+ item->f = (float) item->d;
+ break;
+
+ case IT_double:
+ return Tcl_GetDoubleFromObj(Interp(), item->o, &item->d) == TCL_OK;
+
+ case IT_string:
+ item->s = Tcl_GetString(item->o);
+ break;
+
+ case IT_bytes:
+ item->u.ptr = Tcl_GetByteArrayFromObj(item->o, &item->u.len);
+ break;
+
+ case IT_object:
+ break;
+
+ case IT_column:
+ item->c = ObjAsColumn(item->o);
+ return item->c.seq != NULL && item->c.seq->count >= 0;
+
+ case IT_view:
+ item->v = ObjAsView(item->o);
+ return item->v != NULL;
+
+ default:
+ Assert(0);
+ return 0;
+ }
+
+ return 1;
+}
+
+#define OBJ_TO_COLUMN_P(o) ((Column*) &(o)->internalRep.twoPtrValue)
+
+static void FreeColIntRep (Tcl_Obj *obj) {
+ PUSH_KEEP_REFS
+ DecRefCount(OBJ_TO_COLUMN_P(obj)->seq);
+ POP_KEEP_REFS
+}
+
+static void DupColIntRep (Tcl_Obj *src, Tcl_Obj *dup) {
+ Column_p column = OBJ_TO_COLUMN_P(src);
+ IncRefCount(column->seq);
+ *OBJ_TO_COLUMN_P(dup) = *column;
+ dup->typePtr = &f_colObjType;
+}
+
+static void UpdateColStrRep (Tcl_Obj *obj) {
+ int r;
+ Object_p list;
+ Item item;
+ struct Buffer buf;
+ Column column;
+ PUSH_KEEP_REFS
+
+ InitBuffer(&buf);
+ column = *OBJ_TO_COLUMN_P(obj);
+
+ if (column.seq != NULL)
+ for (r = 0; r < column.seq->count; ++r) {
+ item.c = column;
+ ADD_PTR_TO_BUF(buf, ItemAsObj(GetItem(r, &item), &item));
+ }
+
+ list = BufferAsTclList(&buf);
+
+ /* this hack avoids creating a second copy of the string rep */
+ obj->bytes = Tcl_GetStringFromObj(list, &obj->length);
+ list->bytes = NULL;
+ list->length = 0;
+
+ DecObjRef(list);
+
+ POP_KEEP_REFS
+}
+
+#define LO_list data[0].o
+#define LO_objv data[1].p
+
+static void ListObjCleaner (Seq_p seq) {
+ DecObjRef(seq->LO_list);
+}
+
+static ItemTypes ListObjGetter (int row, Item_p item) {
+ const Object_p *objv = item->c.seq->LO_objv;
+ item->o = objv[row];
+ return IT_object;
+}
+
+static struct SeqType ST_ListObj = {
+ "listobj", ListObjGetter, 0, ListObjCleaner
+};
+
+static int SetColFromAnyRep (Tcl_Interp *interp, Tcl_Obj *obj) {
+ int objc;
+ Object_p dup, *objv;
+ Seq_p seq;
+
+ /* must duplicate the list because it'll be kept by ObjAsColumn */
+ dup = Tcl_DuplicateObj(obj);
+
+ if (Tcl_ListObjGetElements(interp, dup, &objc, &objv) != TCL_OK) {
+ DecObjRef(dup);
+ return TCL_ERROR;
+ }
+
+ PUSH_KEEP_REFS
+
+ seq = IncRefCount(NewSequence(objc, &ST_ListObj, 0));
+ seq->LO_list = IncObjRef(dup);
+ seq->LO_objv = objv;
+
+ if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL)
+ obj->typePtr->freeIntRepProc(obj);
+
+ *OBJ_TO_COLUMN_P(obj) = SeqAsCol(seq);
+ obj->typePtr = &f_colObjType;
+
+ POP_KEEP_REFS
+ return TCL_OK;
+}
+
+Tcl_ObjType f_colObjType = {
+ "column", FreeColIntRep, DupColIntRep, UpdateColStrRep, SetColFromAnyRep
+};
+
+Column ObjAsColumn (Object_p obj) {
+ if (Tcl_ConvertToType(Interp(), obj, &f_colObjType) != TCL_OK) {
+ Column column;
+ column.seq = NULL;
+ column.pos = -1;
+ return column;
+ }
+
+ return *OBJ_TO_COLUMN_P(obj);
+}
+
+Object_p ColumnAsObj (Column column) {
+ Object_p result;
+
+ result = Tcl_NewObj();
+ Tcl_InvalidateStringRep(result);
+
+ IncRefCount(column.seq);
+ *OBJ_TO_COLUMN_P(result) = column;
+ result->typePtr = &f_colObjType;
+ return result;
+}
+/* %include% */
+/*
+ * loop.c - Implementation of the Tcl-specific "loop" operator.
+ */
+
+/* TODO: code was copied from v3, needs a lot of cleanup */
+
+
+ typedef struct LoopInfo {
+ int row;
+ Object_p view;
+ View_p v;
+ Object_p cursor;
+ } LoopInfo;
+
+ typedef struct ColTrace {
+ LoopInfo* lip;
+ int col;
+ Object_p name;
+ int lastRow;
+ } ColTrace;
+
+static char* cursor_tracer(ClientData cd, Tcl_Interp* ip, const char *name1, const char *name2, int flags) {
+ ColTrace* ct = (ColTrace*) cd;
+ int row = ct->lip->row;
+ if (row != ct->lastRow) {
+ Object_p o;
+ if (ct->col < 0)
+ o = Tcl_NewIntObj(row);
+ else {
+ Item item;
+ item.c = ViewCol(ct->lip->v, ct->col);
+ o = ItemAsObj(GetItem(row, &item), &item);
+ }
+ if (Tcl_ObjSetVar2(ip, ct->lip->cursor, ct->name, o, 0) == 0)
+ return "cursor_tracer?";
+ ct->lastRow = row;
+ }
+ return 0;
+}
+
+static int loop_vop(int oc, Tcl_Obj* const* ov) {
+ LoopInfo li;
+ const char *cur;
+ struct Buffer result;
+ int type, e = TCL_OK;
+ static const char *options[] = { "-where", "-index", "-collect", 0 };
+ enum { eLOOP = -1, eWHERE, eINDEX, eCOLLECT };
+
+ if (oc < 2 || oc > 4) {
+ Tcl_WrongNumArgs(Interp(), 1, ov, "view ?arrayName? ?-type? body");
+ return TCL_ERROR;
+ }
+
+ li.v = ObjAsView(ov[0]);
+ if (li.v == NULL)
+ return TCL_ERROR;
+
+ --oc; ++ov;
+ if (oc > 1 && *Tcl_GetString(*ov) != '-') {
+ li.cursor = *ov++; --oc;
+ } else
+ li.cursor = Tcl_NewObj();
+ cur = Tcl_GetString(IncObjRef(li.cursor));
+
+ if (Tcl_GetIndexFromObj(0, *ov, options, "", 0, &type) == TCL_OK) {
+ --oc; ++ov;
+ } else
+ type = eLOOP;
+
+ {
+ int i, nr = ViewSize(li.v), nc = ViewWidth(li.v);
+ ColTrace* ctab = (ColTrace*) ckalloc((nc + 1) * sizeof(ColTrace));
+ InitBuffer(&result);
+ for (i = 0; i <= nc; ++i) {
+ ColTrace* ctp = ctab + i;
+ ctp->lip = &li;
+ ctp->lastRow = -1;
+ if (i < nc) {
+ ctp->col = i;
+ ctp->name = Tcl_NewStringObj(GetColItem(i,
+ ViewCol(V_Meta(li.v), MC_name), IT_string).s, -1);
+ } else {
+ ctp->col = -1;
+ ctp->name = Tcl_NewStringObj("#", -1);
+ }
+ e = Tcl_TraceVar2(Interp(), cur, Tcl_GetString(ctp->name),
+ TCL_TRACE_READS, cursor_tracer, (ClientData) ctp);
+ }
+ if (e == TCL_OK)
+ switch (type) {
+ case eLOOP:
+ for (li.row = 0; li.row < nr; ++li.row) {
+ e = Tcl_EvalObj(Interp(), *ov);
+ if (e == TCL_CONTINUE)
+ e = TCL_OK;
+ else if (e != TCL_OK) {
+ if (e == TCL_BREAK)
+ e = TCL_OK;
+ else if (e == TCL_ERROR) {
+ char msg[50];
+ sprintf(msg, "\n (\"loop\" body line %d)",
+ Tcl_GetErrorLine(Interp()));
+ Tcl_AddObjErrorInfo(Interp(), msg, -1);
+ }
+ break;
+ }
+ }
+ break;
+ case eWHERE:
+ case eINDEX:
+ for (li.row = 0; li.row < nr; ++li.row) {
+ int f;
+ e = Tcl_ExprBooleanObj(Interp(), *ov, &f);
+ if (e != TCL_OK)
+ break;
+ if (f)
+ ADD_INT_TO_BUF(result, li.row);
+ }
+ break;
+ case eCOLLECT:
+ for (li.row = 0; li.row < nr; ++li.row) {
+ Object_p o;
+ e = Tcl_ExprObj(Interp(), *ov, &o);
+ if (e != TCL_OK)
+ break;
+ ADD_PTR_TO_BUF(result, o);
+ }
+ break;
+ default: Assert(0); return TCL_ERROR;
+ }
+ for (i = 0; i <= nc; ++i) {
+ ColTrace* ctp = ctab + i;
+ Tcl_UntraceVar2(Interp(), cur, Tcl_GetString(ctp->name),
+ TCL_TRACE_READS, cursor_tracer, (ClientData) ctp);
+ DecObjRef(ctp->name);
+ }
+ ckfree((char*) ctab);
+ if (e == TCL_OK)
+ switch (type) {
+ case eWHERE: case eINDEX: {
+ Column map = SeqAsCol(BufferAsIntVec(&result));
+ if (type == eWHERE)
+ Tcl_SetObjResult(Interp(),
+ ViewAsObj(RemapSubview(li.v, map, 0, -1)));
+ else
+ Tcl_SetObjResult(Interp(), ColumnAsObj(map));
+ break;
+ }
+ case eCOLLECT: {
+ Tcl_SetObjResult(Interp(), BufferAsTclList(&result));
+ break;
+ }
+ default:
+ ReleaseBuffer(&result, 0);
+ }
+ }
+
+ DecObjRef(li.cursor);
+ return e;
+}
+
+ItemTypes LoopCmd_X (Item args[]) {
+ int objc;
+ const Object_p *objv;
+
+ objv = (const Object_p *) args[0].u.ptr;
+ objc = args[0].u.len;
+
+ if (loop_vop(objc, objv) != TCL_OK)
+ return IT_unknown;
+
+ args->o = Tcl_GetObjResult(Interp());
+ return IT_object;
+}
+/* %include% */
+/*
+ * viewobj.c - Implementation of view objects in Tcl.
+ */
+
+
+#define DEP_DEBUG 0
+
+#define OBJ_TO_VIEW_P(o) ((o)->internalRep.twoPtrValue.ptr1)
+#define OBJ_TO_ORIG_P(o) ((o)->internalRep.twoPtrValue.ptr2)
+
+#define OBJ_TO_ORIG_CNT(o) (((Seq_p) OBJ_TO_ORIG_P(o))->OR_objc)
+#define OBJ_TO_ORIG_VEC(o) ((Object_p*) ((Seq_p) OBJ_TO_ORIG_P(o) + 1))
+
+#define OR_depx data[0].o
+#define OR_objc data[1].i
+#define OR_depc data[2].i
+#define OR_depv data[3].p
+
+/* forward */
+static void SetupViewObj (Object_p, View_p, int objc, Object_p *objv, Object_p);
+static void ClearViewObj (Object_p obj);
+
+static void FreeViewIntRep (Tcl_Obj *obj) {
+ PUSH_KEEP_REFS
+
+ Assert(((Seq_p) OBJ_TO_ORIG_P(obj))->refs == 1);
+ ClearViewObj(obj);
+
+ DecRefCount(OBJ_TO_VIEW_P(obj));
+ DecRefCount(OBJ_TO_ORIG_P(obj));
+
+ POP_KEEP_REFS
+}
+
+static void DupViewIntRep (Tcl_Obj *src, Tcl_Obj *dup) {
+ Assert(0);
+}
+
+static void UpdateViewStrRep (Tcl_Obj *obj) {
+ int length;
+ const char *string;
+ Object_p origobj;
+ PUSH_KEEP_REFS
+
+ /* TODO: avoid creating a Tcl list and copying the string, use a buffer */
+ origobj = Tcl_NewListObj(OBJ_TO_ORIG_CNT(obj), OBJ_TO_ORIG_VEC(obj));
+ string = Tcl_GetStringFromObj(origobj, &length);
+
+ obj->bytes = strcpy(ckalloc(length+1), string);
+ obj->length = length;
+
+ DecObjRef(origobj);
+
+ POP_KEEP_REFS
+}
+
+static char *RefTracer (ClientData cd, Tcl_Interp *interp, const char *name1, const char *name2, int flags) {
+ Object_p obj = (Object_p) cd;
+
+#if DEBUG+0
+ DbgIf(DBG_trace) printf(" rt %p var: %s\n", (void*) obj, name1);
+#endif
+
+ if (flags && TCL_TRACE_WRITES) {
+ Tcl_UntraceVar2(Interp(), name1, name2,
+ TCL_TRACE_WRITES | TCL_TRACE_UNSETS | TCL_GLOBAL_ONLY,
+ RefTracer, obj);
+ }
+
+ InvalidateView(obj);
+ DecObjRef(obj);
+ return NULL;
+}
+
+static int SetViewFromAnyRep (Tcl_Interp *interp, Tcl_Obj *obj) {
+ int e = TCL_ERROR, objc, rows;
+ Object_p *objv;
+ View_p view;
+
+ if (Tcl_ListObjGetElements(interp, obj, &objc, &objv) != TCL_OK)
+ return TCL_ERROR;
+
+ PUSH_KEEP_REFS
+
+ switch (objc) {
+
+ case 0:
+ view = EmptyMetaView();
+ SetupViewObj(obj, view, objc, objv, NULL);
+ break;
+
+ case 1:
+ if (Tcl_GetIntFromObj(interp, objv[0], &rows) == TCL_OK &&
+ rows >= 0) {
+ view = NoColumnView(rows);
+ SetupViewObj(obj, view, objc, objv, NULL);
+ } else {
+ Object_p o;
+ const char *var = Tcl_GetString(objv[0]) + 1;
+
+ if (var[-1] != '@')
+ goto FAIL;
+
+#if DEBUG+0
+ DbgIf(DBG_trace) printf("svfar %p var: %s\n", (void*) obj, var);
+#endif
+ o = (Object_p) Tcl_VarTraceInfo(Interp(), var, TCL_GLOBAL_ONLY,
+ RefTracer, NULL);
+ if (o == NULL) {
+ o = Tcl_GetVar2Ex(interp, var, NULL,
+ TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
+ if (o == NULL)
+ goto FAIL;
+
+ o = NeedMutable(o);
+ Assert(o != NULL);
+
+ if (Tcl_TraceVar2(interp, var, 0,
+ TCL_TRACE_WRITES|TCL_TRACE_UNSETS|TCL_GLOBAL_ONLY,
+ RefTracer, IncObjRef(o)) != TCL_OK)
+ goto FAIL;
+ }
+
+ view = ObjAsView(o);
+ Assert(view != NULL);
+
+ SetupViewObj(obj, view, objc, objv, /*o*/ NULL);
+ }
+
+ break;
+
+ default: {
+ Object_p cmd;
+ Tcl_SavedResult state;
+
+ Assert(interp != NULL);
+ Tcl_SaveResult(interp, &state);
+
+ cmd = IncObjRef(Tcl_DuplicateObj(obj));
+ view = NULL;
+
+ /* def -> cmd namespace name conv can prob be avoided in Tcl 8.5 */
+ if (AdjustCmdDef(cmd) == TCL_OK) {
+ int ac;
+ Object_p *av;
+ Tcl_ListObjGetElements(NULL, cmd, &ac, &av);
+ /* don't use Tcl_EvalObjEx, it forces a string conversion */
+ if (Tcl_EvalObjv(interp, ac, av, TCL_EVAL_GLOBAL) == TCL_OK) {
+ /* result to view, may call EvalIndirectView recursively */
+ view = ObjAsView(Tcl_GetObjResult(interp));
+ }
+ }
+
+ DecObjRef(cmd);
+
+ if (view == NULL) {
+ Tcl_DiscardResult(&state);
+ goto FAIL;
+ }
+
+ SetupViewObj(obj, view, objc, objv, NULL);
+ Tcl_RestoreResult(interp, &state);
+ }
+ }
+
+ e = TCL_OK;
+
+FAIL:
+ POP_KEEP_REFS
+ return e;
+}
+
+Tcl_ObjType f_viewObjType = {
+ "view", FreeViewIntRep, DupViewIntRep, UpdateViewStrRep, SetViewFromAnyRep
+};
+
+View_p ObjAsView (Object_p obj) {
+ if (Tcl_ConvertToType(Interp(), obj, &f_viewObjType) != TCL_OK)
+ return NULL;
+ return OBJ_TO_VIEW_P(obj);
+}
+
+static void AddDependency (Object_p obj, Object_p child) {
+ Object_p *deps;
+ Seq_p origin = OBJ_TO_ORIG_P(obj);
+
+#if DEBUG+0
+ DbgIf(DBG_deps) printf(" +dep %p %p\n", (void*) obj, (void*) child);
+#endif
+
+ if (origin->OR_depv == NULL)
+ origin->OR_depv = calloc(10, sizeof(Object_p));
+
+ Assert(origin->OR_depc < 10);
+ deps = origin->OR_depv;
+ deps[origin->OR_depc++] = child;
+}
+
+static void RemoveDependency (Object_p obj, Object_p child) {
+ Object_p *deps;
+ Seq_p origin = OBJ_TO_ORIG_P(obj);
+
+#if DEBUG+0
+ DbgIf(DBG_deps) printf(" -dep %p %p\n", (void*) obj, (void*) child);
+#endif
+
+ deps = origin->OR_depv;
+ Assert(deps != NULL);
+
+ if (deps != NULL) {
+ int i;
+
+ /* removed from end in case we're called from the invalidation loop */
+ for (i = origin->OR_depc; --i >= 0; )
+ if (deps[i] == child)
+ break;
+ /*printf(" -> i %d n %d\n", i, origin->OR_depc);*/
+
+ Assert(i < origin->OR_depc);
+ deps[i] = deps[--origin->OR_depc];
+
+ if (origin->OR_depc == 0) {
+ free(deps);
+ origin->OR_depv = NULL;
+ }
+ }
+}
+
+void InvalidateView (Object_p obj) {
+ Object_p *deps;
+ Seq_p origin = OBJ_TO_ORIG_P(obj);
+
+#if DEP_DEBUG+0
+ printf("inval %p deps %d refs %d\n",
+ (void*) obj, origin->OR_depc, obj->refCount);
+#endif
+
+ if (obj->typePtr != &f_viewObjType)
+ return;
+
+ deps = origin->OR_depv;
+ if (deps != NULL) {
+ /* careful, RemoveDependency will remove the item during iteration */
+ while (origin->OR_depc > 0) {
+ int last = origin->OR_depc - 1;
+ InvalidateView(deps[last]);
+ Assert(origin->OR_depc <= last); /* make sure count went down */
+ }
+ Assert(origin->OR_depv == NULL);
+ }
+
+#if 1
+ Assert(obj->typePtr == &f_viewObjType);
+ Tcl_GetString(obj);
+ FreeViewIntRep(obj);
+ obj->typePtr = NULL;
+#else
+ /* FIXME: hack to allow changes to list, even when the object is shared! */
+ { Object_p nobj = Tcl_NewListObj(OBJ_TO_ORIG_CNT(obj),
+ OBJ_TO_ORIG_VEC(obj));
+ DecRefCount(OBJ_TO_VIEW_P(obj));
+ DecRefCount(origin);
+ obj->typePtr = nobj->typePtr;
+ obj->internalRep = nobj->internalRep;
+ nobj->typePtr = NULL;
+ DecObjRef(nobj);
+ /*Tcl_InvalidateStringRep(obj);*/
+ }
+#endif
+}
+
+#if 0
+static void OriginCleaner (Seq_p seq) {
+ int i, items = seq->OR_objc;
+ const Object_p *objv = (const void*) (seq + 1);
+
+ for (i = 0; i < items; ++i)
+ DecObjRef(objv[i]);
+
+ Assert(seq->OR_depc == 0);
+ Assert(seq->OR_depv == NULL);
+}
+
+static ItemTypes OriginGetter (int row, Item_p item) {
+ const Object_p *objv = (const void*) (item->c.seq + 1);
+ item->o = objv[row];
+ return IT_object;
+}
+#endif
+
+static struct SeqType ST_Origin = { "origin", NULL, 0, NULL };
+
+static void SetupViewObj (Object_p obj, View_p view, int objc, Object_p *objv, Object_p extradep) {
+ int i;
+ Object_p *vals;
+ Seq_p origin;
+
+ origin = NewSequenceNoRef(objc, &ST_Origin, objc * sizeof(Object_p));
+ /* data[0] is a pointer to the reference for "@..." references */
+ /* data[1] has the number of extra bytes, i.e. objc * sizeof (Seq_p) */
+ /* data[2] is the dependency count */
+ /* data[3] is the dependency vector if data[2].i > 0 */
+ origin->OR_depx = extradep;
+ origin->OR_objc = objc;
+ vals = (void*) (origin + 1);
+
+ for (i = 0; i < objc; ++i)
+ vals[i] = IncObjRef(objv[i]);
+
+ if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL)
+ obj->typePtr->freeIntRepProc(obj);
+
+ OBJ_TO_VIEW_P(obj) = IncRefCount(view);
+ OBJ_TO_ORIG_P(obj) = IncRefCount(origin);
+ obj->typePtr = &f_viewObjType;
+
+ for (i = 0; i < objc; ++i)
+ if (vals[i]->typePtr == &f_viewObjType)
+ AddDependency(vals[i], obj);
+
+ if (extradep != NULL)
+ AddDependency(extradep, obj);
+}
+
+static void ClearViewObj (Object_p obj) {
+ int i, objc;
+ Object_p *objv;
+ Seq_p origin = OBJ_TO_ORIG_P(obj);
+
+ /* can't have any child dependencies at this stage */
+ Assert(origin->OR_depc == 0);
+ Assert(origin->OR_depv == NULL);
+
+ objc = OBJ_TO_ORIG_CNT(obj);
+ objv = OBJ_TO_ORIG_VEC(obj);
+
+ for (i = 0; i < objc; ++i) {
+ if (objv[i]->typePtr == &f_viewObjType)
+ RemoveDependency(objv[i], obj);
+ DecObjRef(objv[i]);
+ }
+
+ if (origin->OR_depx != NULL)
+ RemoveDependency(origin->OR_depx, obj);
+}
+
+static Object_p MetaViewAsObj (View_p meta) {
+ char typeCh;
+ int width, rowNum;
+ Object_p result, fieldobj;
+ View_p subv;
+ Column names, types, subvs;
+
+ names = ViewCol(meta, MC_name);
+ types = ViewCol(meta, MC_type);
+ subvs = ViewCol(meta, MC_subv);
+
+ result = Tcl_NewListObj(0, NULL);
+
+ width = ViewSize(meta);
+ for (rowNum = 0; rowNum < width; ++rowNum) {
+ fieldobj = Tcl_NewStringObj(GetColItem(rowNum, names, IT_string).s, -1);
+
+ /* this ignores all but the first character of the type */
+ typeCh = *GetColItem(rowNum, types, IT_string).s;
+
+ switch (typeCh) {
+
+ case 'S':
+ break;
+
+ case 'V':
+ subv = GetColItem(rowNum, subvs, IT_view).v;
+ fieldobj = Tcl_NewListObj(1, &fieldobj);
+ Tcl_ListObjAppendElement(NULL, fieldobj, MetaViewAsObj(subv));
+ break;
+
+ default:
+ Tcl_AppendToObj(fieldobj, ":", 1);
+ Tcl_AppendToObj(fieldobj, &typeCh, 1);
+ break;
+ }
+
+ Tcl_ListObjAppendElement(NULL, result, fieldobj);
+ }
+
+ return result;
+}
+
+Object_p ViewAsObj (View_p view) {
+ View_p meta = V_Meta(view);
+ int c, rows = ViewSize(view), cols = ViewSize(meta);
+ Object_p result;
+ struct Buffer buffer;
+
+ InitBuffer(&buffer);
+
+ if (meta == V_Meta(meta)) {
+ if (rows > 0) {
+ ADD_PTR_TO_BUF(buffer, Tcl_NewStringObj("mdef", 4));
+ ADD_PTR_TO_BUF(buffer, MetaViewAsObj(view));
+ }
+ } else {
+ if (cols == 0) {
+ ADD_PTR_TO_BUF(buffer, Tcl_NewIntObj(rows));
+ } else {
+ ADD_PTR_TO_BUF(buffer, Tcl_NewStringObj("data", 4));
+ ADD_PTR_TO_BUF(buffer, ViewAsObj(meta));
+ for (c = 0; c < cols; ++c)
+ ADD_PTR_TO_BUF(buffer, ColumnAsObj(ViewCol(view, c)));
+ }
+ }
+
+ result = Tcl_NewObj();
+ Tcl_InvalidateStringRep(result);
+
+ SetupViewObj(result, view, BufferFill(&buffer) / sizeof(Object_p),
+ BufferAsPtr(&buffer, 1), NULL);
+
+ ReleaseBuffer(&buffer, 0);
+ return result;
+}
+
+View_p ObjAsMetaView (Object_p obj) {
+ int r, rows, objc;
+ Object_p names, types, subvs, *objv, entry, nameobj, subvobj;
+ const char *name, *sep, *type;
+ View_p view = NULL;
+
+ if (Tcl_ListObjLength(Interp(), obj, &rows) != TCL_OK)
+ return NULL;
+
+ names = Tcl_NewListObj(0, 0);
+ types = Tcl_NewListObj(0, 0);
+ subvs = Tcl_NewListObj(0, 0);
+
+ for (r = 0; r < rows; ++r) {
+ Tcl_ListObjIndex(NULL, obj, r, &entry);
+ if (Tcl_ListObjGetElements(Interp(), entry, &objc, &objv) != TCL_OK ||
+ objc < 1 || objc > 2)
+ goto DONE;
+
+ name = Tcl_GetString(objv[0]);
+ sep = strchr(name, ':');
+ type = objc > 1 ? "V" : "S";
+
+ if (sep != NULL) {
+ if (sep[1] != 0) {
+ if (strchr("BDFLISV", sep[1]) == NULL)
+ goto DONE;
+ type = sep+1;
+ }
+ nameobj= Tcl_NewStringObj(name, sep - name);
+ } else
+ nameobj = objv[0];
+
+ if (objc > 1) {
+ view = ObjAsMetaView(objv[1]);
+ if (view == NULL)
+ goto DONE;
+ subvobj = ViewAsObj(view);
+ } else
+ subvobj = Tcl_NewObj();
+
+ Tcl_ListObjAppendElement(NULL, names, nameobj);
+ Tcl_ListObjAppendElement(NULL, types, Tcl_NewStringObj(type, -1));
+ Tcl_ListObjAppendElement(NULL, subvs, subvobj);
+ }
+
+ view = NewView(V_Meta(EmptyMetaView()));
+ SetViewCols(view, MC_name, 1, CoerceColumn(IT_string, names));
+ SetViewCols(view, MC_type, 1, CoerceColumn(IT_string, types));
+ SetViewCols(view, MC_subv, 1, CoerceColumn(IT_view, subvs));
+
+DONE:
+ DecObjRef(names);
+ DecObjRef(types);
+ DecObjRef(subvs);
+ return view;
+}
+
+Object_p NeedMutable (Object_p obj) {
+ int objc;
+ Object_p *objv;
+ View_p view;
+
+ view = ObjAsView(obj);
+ if (view == NULL)
+ return NULL;
+
+ if (IsMutable(view))
+ return obj;
+
+ objc = OBJ_TO_ORIG_CNT(obj);
+ objv = OBJ_TO_ORIG_VEC(obj);
+
+ if (objc == 1 && *Tcl_GetString(objv[0]) == '@') {
+ const char *var = Tcl_GetString(objv[0]) + 1;
+ Object_p o = (Object_p) Tcl_VarTraceInfo(Interp(), var,
+ TCL_GLOBAL_ONLY, RefTracer, NULL);
+ Assert(o != NULL);
+ return o;
+ }
+
+ if (objc > 1 && strcmp(Tcl_GetString(objv[0]), "get") == 0) {
+ Object_p origdef, tmp = NeedMutable(objv[1]); /* recursive */
+ Assert(tmp != NULL);
+
+ origdef = Tcl_NewListObj(objc, objv);
+ Tcl_ListObjReplace(NULL, origdef, 1, 1, 1, &tmp);
+ return origdef;
+ }
+
+ return obj;
+}
+
+static void ListOneDep (Buffer_p buf, Object_p obj) {
+ Object_p o, vec[3];
+
+ if (obj->typePtr == &f_viewObjType) {
+ View_p view = OBJ_TO_VIEW_P(obj);
+ Seq_p seq = ViewCol(view, 0).seq;
+ vec[0] = Tcl_NewStringObj(seq != NULL ? seq->type->name : "", -1);
+ vec[1] = MetaViewAsObj(V_Meta(view));
+ vec[2] = Tcl_NewIntObj(ViewSize(view));
+ o = Tcl_NewListObj(3, vec);
+ } else if (Tcl_ListObjIndex(NULL, obj, 0, &o) != TCL_OK)
+ o = Tcl_NewStringObj("?", 1);
+
+ ADD_PTR_TO_BUF(*buf, o);
+}
+
+ItemTypes DepsCmd_O (Item_p a) {
+ int i;
+ Object_p obj, *objv;
+ Seq_p origin;
+ struct Buffer buffer;
+
+ obj = a[0].o;
+ ObjAsView(obj);
+
+ if (obj->typePtr != &f_viewObjType)
+ return IT_unknown;
+
+ InitBuffer(&buffer);
+
+ origin = OBJ_TO_ORIG_P(obj);
+ objv = OBJ_TO_ORIG_VEC(obj);
+
+ if (origin->OR_depx != NULL)
+ ListOneDep(&buffer, origin->OR_depx);
+ else
+ ADD_PTR_TO_BUF(buffer, Tcl_NewStringObj("-", 1));
+
+ for (i = 0; i < origin->OR_depc; ++i)
+ ListOneDep(&buffer, objv[i]);
+
+ a->o = BufferAsTclList(&buffer);
+ return IT_object;
+}
+/* %include% */
+/*
+ * ext_tcl.c - Interface to the Tcl scripting language.
+ */
+
+
+#ifndef PACKAGE_VERSION
+#define PACKAGE_VERSION "4"
+#endif
+
+/* stub interface code, removes the need to link with libtclstub*.a */
+#if STATIC_BUILD+0
+#define MyInitStubs(x) 1
+#else
+#ifdef FAKE_TCL_STUBS
+/*
+ * stubs.h - Internal stub code, adapted from CritLib
+ */
+
+CONST86 TclStubs *tclStubsPtr = NULL;
+CONST86 TclPlatStubs *tclPlatStubsPtr = NULL;
+struct TclIntStubs *tclIntStubsPtr = NULL;
+struct TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
+
+static int MyInitStubs (Tcl_Interp *ip) {
+
+ typedef struct HeadOfInterp {
+ char *result;
+ Tcl_FreeProc *freeProc;
+ int errorLine;
+ TclStubs *stubTable;
+ } HeadOfInterp;
+
+ HeadOfInterp *hoi = (HeadOfInterp*) ip;
+
+ if (hoi->stubTable == NULL || hoi->stubTable->magic != TCL_STUB_MAGIC) {
+ ip->result = "This extension requires stubs-support.";
+ ip->freeProc = TCL_STATIC;
+ return 0;
+ }
+
+ tclStubsPtr = hoi->stubTable;
+
+ if (Tcl_PkgRequire(ip, "Tcl", "8.1", 0) == NULL) {
+ tclStubsPtr = NULL;
+ return 0;
+ }
+
+ if (tclStubsPtr->hooks != NULL) {
+ tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
+ tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
+ tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
+ }
+
+ return 1;
+}
+#else /* !FAKE_TCL_STUBS */
+#define MyInitStubs(ip) Tcl_InitStubs((ip), "8.4", 0)
+#endif /* FAKE_TCL_STUBS */
+#endif /* !STATIC_BUILD */
+
+#if NO_THREAD_CALLS+0
+Shared_p GetShared (void) {
+ static struct Shared data;
+ return &data;
+}
+#define UngetShared Tcl_CreateExitHandler
+#else
+static Tcl_ThreadDataKey tls_data;
+Shared_p GetShared (void) {
+ return (Shared_p) Tcl_GetThreadData(&tls_data, sizeof(struct Shared));
+}
+#define UngetShared Tcl_CreateThreadExitHandler
+#endif
+
+typedef struct CmdDispatch {
+ const char *name, *args;
+ ItemTypes (*proc) (Item_p);
+} CmdDispatch;
+
+static CmdDispatch f_commands[] = {
+/* opdefs_gen.h - generated code, do not edit */
+
+/* 94 definitions generated for Tcl:
+
+ # name in out inline-code
+ : drop U {} {}
+ : dup U UU {$1 = $0;}
+ : imul II I {$0.i *= $1.i;}
+ : nip UU U {$0 = $1;}
+ : over UU UUU {$2 = $0;}
+ : rot UUU UUU {$3 = $0; $0 = $1; $1 = $2; $2 = $3;}
+ : rrot UUU UUU {$3 = $2; $2 = $1; $1 = $0; $0 = $3;}
+ : swap UU UU {$2 = $0; $0 = $1; $1 = $2;}
+ : tuck UU UUU {$1 = $2; $0 = $1; $2 = $0;}
+
+ tcl {
+ # name in out
+ : Def OO V
+ : Deps O O
+ : Emit V O
+ : EmitMods V O
+ : Get VX U
+ : Load O V
+ : LoadMods OV V
+ : Loop X O
+ : MutInfo V O
+ : Ref OX O
+ : Refs O I
+ : Rename VO V
+ : Save VS I
+ : To OO O
+ : Type O O
+ : View X O
+ }
+
+ python {
+ # name in out
+ }
+
+ ruby {
+ # name in out
+ : AtRow OI O
+ }
+
+ lua {
+ # name in out
+ }
+
+ objc {
+ # name in out
+ : At VIO O
+ }
+
+ # name in out
+ : BitRuns i C
+ : Data VX V
+ : Debug I I
+ : HashCol SO C
+ : Max VN O
+ : Min VN O
+ : Open S V
+ : ResizeCol iII C
+ : Set MIX V
+ : StructDesc V S
+ : Structure V S
+ : Sum VN O
+ : Write VO I
+
+ # name in out internal-name
+ : Blocked V V BlockedView
+ : Clone V V CloneView
+ : ColMap Vn V ColMapView
+ : ColOmit Vn V ColOmitView
+ : Coerce OS C CoerceCmd
+ : Compare VV I ViewCompare
+ : Compat VV I ViewCompat
+ : Concat VV V ConcatView
+ : CountsCol C C NewCountsColumn
+ : CountView I V NoColumnView
+ : First VI V FirstView
+ : GetCol VN C ViewCol
+ : Group VnS V GroupCol
+ : HashFind VIViii I HashDoFind
+ : Ijoin VV V IjoinView
+ : GetInfo VVI C GetHashInfo
+ : Grouped ViiS V GroupedView
+ : HashView V C HashValues
+ : IsectMap VV C IntersectMap
+ : Iota I C NewIotaColumn
+ : Join VVS V JoinView
+ : Last VI V LastView
+ : Mdef O V ObjAsMetaView
+ : Mdesc S V DescToMeta
+ : Meta V V V_Meta
+ : OmitMap iI C OmitColumn
+ : OneCol VN V OneColView
+ : Pair VV V PairView
+ : RemapSub ViII V RemapSubview
+ : Replace VIIV V ViewReplace
+ : RowCmp VIVI I RowCompare
+ : RowEq VIVI I RowEqual
+ : RowHash VI I RowHash
+ : Size V I ViewSize
+ : SortMap V C SortMap
+ : Step VIIII V StepView
+ : StrLookup Ss I StringLookup
+ : Tag VS V TagView
+ : Take VI V TakeView
+ : Ungroup VN V UngroupView
+ : UniqueMap V C UniqMap
+ : ViewAsCol V C ViewAsCol
+ : Width V I ViewWidth
+
+ # name in out compound-definition
+ : Append VV V {over size swap insert}
+ : ColConv C C { }
+ : Counts VN C {getcol countscol}
+ : Delete VII V {0 countview replace}
+ : Except VV V {over swap exceptmap remap}
+ : ExceptMap VV C {over swap isectmap swap size omitmap}
+ : Insert VIV V {0 swap replace}
+ : Intersect VV V {over swap isectmap remap}
+ : NameCol V V {meta 0 onecol}
+ : Names V C {meta 0 getcol}
+ : Product VV V {over over size spread rrot swap size repeat pair}
+ : Repeat VI V {over size imul 0 1 1 step}
+ : Remap Vi V {0 -1 remapsub}
+ : Reverse V V {dup size -1 1 -1 step}
+ : Slice VIII V {rrot 1 swap step}
+ : Sort V V {dup sortmap remap}
+ : Spread VI V {over size 0 rot 1 step}
+ : Types V C {meta 1 getcol}
+ : Unique V V {dup uniquemap remap}
+ : Union VV V {over except concat}
+ : UnionMap VV C {swap exceptmap}
+ : ViewConv V V { }
+
+ # some operators are omitted from restricted execution environments
+ unsafe Open Save
+*/
+
+ { "open", "V:S", OpenCmd_S },
+ { "save", "I:VS", SaveCmd_VS },
+#define UNSAFE 2
+ { "append", "V:VV", AppendCmd_VV },
+ { "bitruns", "C:i", BitRunsCmd_i },
+ { "blocked", "V:V", BlockedCmd_V },
+ { "clone", "V:V", CloneCmd_V },
+ { "coerce", "C:OS", CoerceCmd_OS },
+ { "colconv", "C:C", ColConvCmd_C },
+ { "colmap", "V:Vn", ColMapCmd_Vn },
+ { "colomit", "V:Vn", ColOmitCmd_Vn },
+ { "compare", "I:VV", CompareCmd_VV },
+ { "compat", "I:VV", CompatCmd_VV },
+ { "concat", "V:VV", ConcatCmd_VV },
+ { "counts", "C:VN", CountsCmd_VN },
+ { "countscol", "C:C", CountsColCmd_C },
+ { "countview", "V:I", CountViewCmd_I },
+ { "data", "V:VX", DataCmd_VX },
+ { "debug", "I:I", DebugCmd_I },
+ { "def", "V:OO", DefCmd_OO },
+ { "delete", "V:VII", DeleteCmd_VII },
+ { "deps", "O:O", DepsCmd_O },
+ { "emit", "O:V", EmitCmd_V },
+ { "emitmods", "O:V", EmitModsCmd_V },
+ { "except", "V:VV", ExceptCmd_VV },
+ { "exceptmap", "C:VV", ExceptMapCmd_VV },
+ { "first", "V:VI", FirstCmd_VI },
+ { "get", "U:VX", GetCmd_VX },
+ { "getcol", "C:VN", GetColCmd_VN },
+ { "getinfo", "C:VVI", GetInfoCmd_VVI },
+ { "group", "V:VnS", GroupCmd_VnS },
+ { "grouped", "V:ViiS", GroupedCmd_ViiS },
+ { "hashcol", "C:SO", HashColCmd_SO },
+ { "hashfind", "I:VIViii", HashFindCmd_VIViii },
+ { "hashview", "C:V", HashViewCmd_V },
+ { "ijoin", "V:VV", IjoinCmd_VV },
+ { "insert", "V:VIV", InsertCmd_VIV },
+ { "intersect", "V:VV", IntersectCmd_VV },
+ { "iota", "C:I", IotaCmd_I },
+ { "isectmap", "C:VV", IsectMapCmd_VV },
+ { "join", "V:VVS", JoinCmd_VVS },
+ { "last", "V:VI", LastCmd_VI },
+ { "load", "V:O", LoadCmd_O },
+ { "loadmods", "V:OV", LoadModsCmd_OV },
+ { "loop", "O:X", LoopCmd_X },
+ { "max", "O:VN", MaxCmd_VN },
+ { "mdef", "V:O", MdefCmd_O },
+ { "mdesc", "V:S", MdescCmd_S },
+ { "meta", "V:V", MetaCmd_V },
+ { "min", "O:VN", MinCmd_VN },
+ { "mutinfo", "O:V", MutInfoCmd_V },
+ { "namecol", "V:V", NameColCmd_V },
+ { "names", "C:V", NamesCmd_V },
+ { "omitmap", "C:iI", OmitMapCmd_iI },
+ { "onecol", "V:VN", OneColCmd_VN },
+ { "pair", "V:VV", PairCmd_VV },
+ { "product", "V:VV", ProductCmd_VV },
+ { "ref", "O:OX", RefCmd_OX },
+ { "refs", "I:O", RefsCmd_O },
+ { "remap", "V:Vi", RemapCmd_Vi },
+ { "remapsub", "V:ViII", RemapSubCmd_ViII },
+ { "rename", "V:VO", RenameCmd_VO },
+ { "repeat", "V:VI", RepeatCmd_VI },
+ { "replace", "V:VIIV", ReplaceCmd_VIIV },
+ { "resizecol", "C:iII", ResizeColCmd_iII },
+ { "reverse", "V:V", ReverseCmd_V },
+ { "rowcmp", "I:VIVI", RowCmpCmd_VIVI },
+ { "roweq", "I:VIVI", RowEqCmd_VIVI },
+ { "rowhash", "I:VI", RowHashCmd_VI },
+ { "set", "V:MIX", SetCmd_MIX },
+ { "size", "I:V", SizeCmd_V },
+ { "slice", "V:VIII", SliceCmd_VIII },
+ { "sort", "V:V", SortCmd_V },
+ { "sortmap", "C:V", SortMapCmd_V },
+ { "spread", "V:VI", SpreadCmd_VI },
+ { "step", "V:VIIII", StepCmd_VIIII },
+ { "strlookup", "I:Ss", StrLookupCmd_Ss },
+ { "structdesc", "S:V", StructDescCmd_V },
+ { "structure", "S:V", StructureCmd_V },
+ { "sum", "O:VN", SumCmd_VN },
+ { "tag", "V:VS", TagCmd_VS },
+ { "take", "V:VI", TakeCmd_VI },
+ { "to", "O:OO", ToCmd_OO },
+ { "type", "O:O", TypeCmd_O },
+ { "types", "C:V", TypesCmd_V },
+ { "ungroup", "V:VN", UngroupCmd_VN },
+ { "union", "V:VV", UnionCmd_VV },
+ { "unionmap", "C:VV", UnionMapCmd_VV },
+ { "unique", "V:V", UniqueCmd_V },
+ { "uniquemap", "C:V", UniqueMapCmd_V },
+ { "view", "O:X", ViewCmd_X },
+ { "viewascol", "C:V", ViewAsColCmd_V },
+ { "viewconv", "V:V", ViewConvCmd_V },
+ { "width", "I:V", WidthCmd_V },
+ { "write", "I:VO", WriteCmd_VO },
+
+/* end of generated code */
+ { NULL, NULL, NULL }
+};
+
+Object_p IncObjRef (Object_p objPtr) {
+ Tcl_IncrRefCount(objPtr);
+ return objPtr;
+}
+
+Object_p BufferAsTclList (Buffer_p bp) {
+ int argc;
+ Object_p result;
+
+ argc = BufferFill(bp) / sizeof(Object_p);
+ result = Tcl_NewListObj(argc, BufferAsPtr(bp, 1));
+ ReleaseBuffer(bp, 0);
+ return result;
+}
+
+void FailedAssert (const char *msg, const char *file, int line) {
+ Tcl_Panic("Failed assertion at %s, line %d: %s\n", file, line, msg);
+}
+
+ItemTypes RefCmd_OX (Item args[]) {
+ int objc;
+ const Object_p *objv;
+
+ objv = (const Object_p *) args[1].u.ptr;
+ objc = args[1].u.len;
+
+ args->o = Tcl_ObjGetVar2(Interp(), args[0].o, 0,
+ TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG);
+ return IT_object;
+}
+
+ItemTypes OpenCmd_S (Item args[]) {
+ View_p result;
+ Tcl_DString ds;
+ char *native;
+
+ /*
+ * When providing a database for a tclkit, we have here a "chicken
+ * and egg" problem with encodings: a call to this code will
+ * result from invoking the "open" script-level Vlerq command, and
+ * thus it will be passed an UTF-8 encoded filename. In the case
+ * of tclkits this filename is obtained via a call to [info
+ * nameofexecutable], and at the time of that call [encoding
+ * system] is "identity" because the encodings subsystem can be
+ * initialized only after the tclkit VFS is mounted, and its
+ * mounting is what this very function is called for.
+ *
+ * On Windows, when converting between "system native" characters
+ * and UTF-8 (and vice-versa) two encodings may be used:
+ * - [encoding system] on Win9x/ME
+ * - "unicode" encoding on Windows NT.
+ * The "unicode" encoding is built-in, and [encoding system] will
+ * only have correct value on Latin-1 and UTF-8 systems,
+ * on others it will be "identity".
+ *
+ * This means when the tclkit is started from a folder whose name
+ * contains non-latin-1 characters, on Windows NT this function
+ * will receive correct UTF-8 string and the call to
+ * Tcl_WinUtfToTChar() below will return proper array of WCHARs.
+ * On Win95/ME and Unices the behaviour depends on whether the
+ * system encoding happens to be UTF-8 or any variant of Latin-1;
+ * if it is, this function will receive a proper UTF-8 string and
+ * the call to Tcl_WinUtfToTChar()/Tcl_UtfToExternalDString()
+ * below will produce a proper "native" string back. Otherwise,
+ * [encoding system] will be "identity" and due to the way it
+ * works this function will receive a string containing exactly
+ * the bytes returned by some relevant system call, which [info
+ * nameofexecutable] performed and the call to
+ * Tcl_WinUtfToTChar()/Tcl_UtfToExternalDString() will produce an
+ * array of char with the same bytes. It this case startup from a
+ * folder containing non-latin-1 characters will fail.
+ */
+
+#if WIN32+0
+ native = Tcl_WinUtfToTChar(args[0].s, strlen(args[0].s), &ds);
+#else
+ native = Tcl_UtfToExternalDString(NULL,
+ args[0].s, strlen(args[0].s), &ds);
+#endif
+ result = OpenDataFile(native);
+ Tcl_DStringFree(&ds);
+ if (result == NULL) {
+ Tcl_AppendResult(Interp(), "cannot open file: ", args[0].s, NULL);
+ return IT_unknown;
+ }
+
+ args->v = result;
+ return IT_view;
+}
+
+static void LoadedStringCleaner (MappedFile_p map) {
+ DecObjRef((Object_p) map->data[3].p);
+}
+
+ItemTypes LoadCmd_O (Item args[]) {
+ int len;
+ const char *ptr;
+ View_p view;
+ MappedFile_p map;
+
+ ptr = (const char*) Tcl_GetByteArrayFromObj(args[0].o, &len);
+
+ map = InitMappedFile(ptr, len, LoadedStringCleaner);
+ map->data[3].p = IncObjRef(args[0].o);
+
+ view = MappedToView(map, NULL);
+ if (view == NULL)
+ return IT_unknown;
+
+ args->v = view;
+ return IT_view;
+}
+
+ItemTypes LoadModsCmd_OV (Item args[]) {
+ int len;
+ const char *ptr;
+ View_p view;
+ MappedFile_p map;
+
+ ptr = (const char*) Tcl_GetByteArrayFromObj(args[0].o, &len);
+
+ map = InitMappedFile(ptr, len, LoadedStringCleaner);
+ map->data[3].p = IncObjRef(args[0].o);
+
+ view = MappedToView(map, args[1].v);
+ if (view == NULL)
+ return IT_unknown;
+
+ args->v = view;
+ return IT_view;
+}
+
+ static void *WriteDataFun(void *chan, const void *ptr, Int_t len) {
+ Tcl_Write(chan, ptr, len);
+ return chan;
+ }
+
+ItemTypes SaveCmd_VS (Item args[]) {
+ Int_t bytes;
+ Tcl_Channel chan;
+
+ chan = Tcl_OpenFileChannel(Interp(), args[1].s, "w", 0666);
+ if (chan == NULL || Tcl_SetChannelOption(Interp(), chan,
+ "-translation", "binary") != TCL_OK)
+ return IT_unknown;
+
+ bytes = ViewSave(args[0].v, chan, NULL, WriteDataFun, 0);
+
+ Tcl_Close(Interp(), chan);
+
+ if (bytes < 0)
+ return IT_unknown;
+
+ args->w = bytes;
+ return IT_wide;
+}
+
+ItemTypes WriteCmd_VO (Item args[]) {
+ Int_t bytes;
+ Tcl_Channel chan;
+
+ chan = Tcl_GetChannel(Interp(), Tcl_GetString(args[1].o), NULL);
+ if (chan == NULL || Tcl_SetChannelOption(Interp(), chan,
+ "-translation", "binary") != TCL_OK)
+ return IT_unknown;
+
+ bytes = ViewSave(args[0].v, chan, NULL, WriteDataFun, 0);
+
+ if (bytes < 0)
+ return IT_unknown;
+
+ args->w = bytes;
+ return IT_wide;
+}
+
+#define EmitInitFun ((SaveInitFun) Tcl_SetByteArrayLength)
+
+ static void *EmitDataFun(void *data, const void *ptr, Int_t len) {
+ memcpy(data, ptr, len);
+ return (char*) data + len;
+ }
+
+ItemTypes EmitCmd_V (Item args[]) {
+ Object_p result = Tcl_NewByteArrayObj(NULL, 0);
+
+ if (ViewSave(args[0].v, result, EmitInitFun, EmitDataFun, 0) < 0) {
+ DecObjRef(result);
+ return IT_unknown;
+ }
+
+ args->o = result;
+ return IT_object;
+}
+
+ItemTypes EmitModsCmd_V (Item args[]) {
+ Object_p result = Tcl_NewByteArrayObj(NULL, 0);
+
+ if (ViewSave(args[0].v, result, EmitInitFun, EmitDataFun, 1) < 0) {
+ DecObjRef(result);
+ return IT_unknown;
+ }
+
+ args->o = result;
+ return IT_object;
+}
+
+int AdjustCmdDef (Object_p cmd) {
+ Object_p origname, newname;
+ Tcl_CmdInfo cmdinfo;
+
+ /* Use "::vlerq::blah ..." if it exists, else use "vlerq blah ...". */
+ /* Could perhaps be simplified (optimized?) by using 8.5 ensembles. */
+
+ if (Tcl_ListObjIndex(Interp(), cmd, 0, &origname) != TCL_OK)
+ return TCL_ERROR;
+
+ /* insert "::vlerq::" before the first list element */
+ newname = Tcl_NewStringObj("::vlerq::", -1);
+ Tcl_AppendObjToObj(newname, origname);
+
+ if (Tcl_GetCommandInfo(Interp(), Tcl_GetString(newname), &cmdinfo))
+ Tcl_ListObjReplace(NULL, cmd, 0, 1, 1, &newname);
+ else {
+ Object_p buf[2];
+ DecObjRef(newname);
+ buf[0] = Tcl_NewStringObj("vlerq", -1);
+ buf[1] = origname;
+ Tcl_ListObjReplace(NULL, cmd, 0, 1, 2, buf);
+ }
+ return TCL_OK;
+}
+
+ItemTypes ViewCmd_X (Item args[]) {
+ int e = TCL_OK, i, n, index, objc;
+ const Object_p *objv;
+ Object_p result, buf[10], *cvec;
+ Tcl_Interp *interp = Interp();
+ const CmdDispatch *cmds = GetShared()->info->cmds;
+
+ objv = (const Object_p *) args[0].u.ptr;
+ objc = args[0].u.len;
+
+ if (objc < 1) {
+ Tcl_WrongNumArgs(interp, 0, objv, "view arg ?op ...? ?| ...?");
+ return IT_unknown;
+ }
+
+ Tcl_SetObjResult(interp, objv[0]); --objc; ++objv;
+
+ while (e == TCL_OK && objc > 0) {
+ for (n = 0; n < objc; ++n)
+ if (objv[n]->bytes != 0 && *objv[n]->bytes == '|' &&
+ objv[n]->length == 1)
+ break;
+
+ if (n > 0) {
+ cvec = n > 8 ? malloc((n+2) * sizeof(Object_p)) : buf;
+
+ if (Tcl_GetIndexFromObjStruct(NULL, *objv, cmds, sizeof *cmds,
+ "", TCL_EXACT, &index) != TCL_OK)
+ index = -1;
+
+ cvec[0] = Tcl_NewStringObj("vlerq", -1);
+ cvec[1] = objv[0];
+ cvec[2] = IncObjRef(Tcl_GetObjResult(interp));
+ for (i = 1; i < n; ++i)
+ cvec[i+2] = objv[i];
+
+ result = Tcl_NewListObj(n+1, cvec+1);
+
+ if (index < 0 || *cmds[index].args != 'V') {
+ e = AdjustCmdDef(result);
+ if (e == TCL_OK) {
+ int ac;
+ Object_p *av;
+ Tcl_ListObjGetElements(NULL, result, &ac, &av);
+ /* don't use Tcl_EvalObjEx, it forces a string conversion */
+ e = Tcl_EvalObjv(interp, ac, av, 0);
+ }
+ DecObjRef(result);
+ } else
+ Tcl_SetObjResult(interp, result);
+
+ DecObjRef(cvec[2]);
+ if (n > 8)
+ free(cvec);
+ }
+
+ objc -= n+1; objv += n+1; /*++k;*/
+ }
+
+ if (e != TCL_OK) {
+#if 0
+ char msg[50];
+ sprintf(msg, "\n (\"view\" step %d)", k);
+ Tcl_AddObjErrorInfo(interp, msg, -1);
+#endif
+ return IT_unknown;
+ }
+
+ args->o = Tcl_GetObjResult(interp);
+ return IT_object;
+}
+
+#define MAX_STACK 20
+
+static int VlerqObjCmd (ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
+ int i, index, ok = TCL_ERROR;
+ ItemTypes type;
+ Object_p result;
+ Item stack [MAX_STACK];
+ const char *args;
+ const CmdDispatch *cmdtable;
+ PUSH_KEEP_REFS
+
+ Interp() = interp;
+
+ if (objc <= 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, "command ...");
+ goto FAIL;
+ }
+
+ cmdtable = (const CmdDispatch*) data;
+ if (Tcl_GetIndexFromObjStruct(interp, objv[1], cmdtable, sizeof *cmdtable,
+ "command", TCL_EXACT, &index) != TCL_OK)
+ goto FAIL;
+
+ objv += 2; objc -= 2;
+ args = cmdtable[index].args + 2; /* skip return type and ':' */
+
+ for (i = 0; args[i] != 0; ++i) {
+ Assert(i < MAX_STACK);
+ if (args[i] == 'X') {
+ Assert(args[i+1] == 0);
+ stack[i].u.ptr = (const void*) (objv+i);
+ stack[i].u.len = objc-i;
+ break;
+ }
+ if ((args[i] == 0 && i != objc) || (args[i] != 0 && i >= objc)) {
+ char buf [10*MAX_STACK];
+ const char* s;
+ *buf = 0;
+ for (i = 0; args[i] != 0; ++i) {
+ if (*buf != 0)
+ strcat(buf, " ");
+ switch (args[i] & ~0x20) {
+ case 'C': s = "list"; break;
+ case 'I': s = "int"; break;
+ case 'N': s = "col"; break;
+ case 'O': s = "any"; break;
+ case 'S': s = "string"; break;
+ case 'V': s = "view"; break;
+ case 'X': s = "..."; break;
+ default: Assert(0); s = "?"; break;
+ }
+ strcat(buf, s);
+ if (args[i] & 0x20)
+ strcat(buf, "*");
+ }
+ Tcl_WrongNumArgs(interp, 2, objv-2, buf);
+ goto FAIL;
+ }
+ stack[i].o = objv[i];
+ if (!CastObjToItem(args[i], stack+i)) {
+ if (*Tcl_GetStringResult(interp) == 0) {
+ const char* s = "?";
+ switch (args[i] & ~0x20) {
+ case 'C': s = "list"; break;
+ case 'I': s = "integer"; break;
+ case 'N': s = "column name"; break;
+ case 'V': s = "view"; break;
+ }
+ Tcl_AppendResult(interp, cmdtable[index].name, ": invalid ", s,
+ NULL);
+ }
+ goto FAIL; /* TODO: append info about which arg is bad */
+ }
+ }
+
+ GetShared()->info->cmds = cmdtable; /* for ViewCmd_X */
+
+ type = cmdtable[index].proc(stack);
+ if (type == IT_unknown)
+ goto FAIL;
+
+ result = ItemAsObj(type, stack);
+ if (result == NULL)
+ goto FAIL;
+
+ Tcl_SetObjResult(interp, result);
+ ok = TCL_OK;
+
+FAIL:
+ POP_KEEP_REFS
+ return ok;
+}
+
+static void DoneShared (ClientData cd) {
+ Shared_p sh = (Shared_p) cd;
+ if (--sh->refs == 0)
+ free(sh->info);
+}
+
+static void InitShared (void) {
+ Shared_p sh = GetShared();
+ if (sh->refs++ == 0)
+ sh->info = calloc(1, sizeof(SharedInfo));
+ UngetShared(DoneShared, (ClientData) sh);
+}
+
+DLLEXPORT int Vlerq_Init (Tcl_Interp *interp) {
+ if (!MyInitStubs(interp) || Tcl_PkgRequire(interp, "Tcl", "8.4", 0) == NULL)
+ return TCL_ERROR;
+
+ Tcl_CreateObjCommand(interp, "vlerq", VlerqObjCmd, f_commands, NULL);
+ InitShared();
+ return Tcl_PkgProvide(interp, "vlerq", PACKAGE_VERSION);
+}
+
+DLLEXPORT int Vlerq_SafeInit (Tcl_Interp *interp) {
+ if (!MyInitStubs(interp) || Tcl_PkgRequire(interp, "Tcl", "8.4", 0) == NULL)
+ return TCL_ERROR;
+
+ /* UNSAFE is defined in the "opdefs_gen.h" file included above */
+ Tcl_CreateObjCommand(interp, "vlerq", VlerqObjCmd, f_commands + UNSAFE,
+ NULL);
+ InitShared();
+ return Tcl_PkgProvide(interp, "vlerq", PACKAGE_VERSION);
+}
+
+/* end of generated code */
diff --git a/vqtcl/buildsrc/vqtcl/library/m2mvfs.tcl b/vqtcl/buildsrc/vqtcl/library/m2mvfs.tcl
new file mode 100644
index 0000000..2d59df6
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/library/m2mvfs.tcl
@@ -0,0 +1,236 @@
+# m2mvfs.tcl -- In-memory VFS which appends its data as a MK starkit when done.
+
+# This VFS driver collects data in memory which then gets saved to a Metakit
+# data file when unmounted, using vlerq calls. Does not support deletions,
+# renames, and such. Can only be used with a single mountpoint at a time.
+#
+# 1.4 adjusted for vlerq 3
+# 1.5 fixed to actually work
+# 1.6 minor cleanup
+# 1.7 adjusted for vlerq 4
+# 1.8 allow overwriting files
+
+package provide vfs::m2m 1.8
+
+package require vfs
+package require vlerq
+
+namespace eval vfs::m2m {
+ namespace eval v {
+ variable outfn ;# output file name
+ # following lists are all indexed by the same directory ordinal number
+ variable dname ;# list of directory names
+ variable prows ;# list of parent row numbers
+ variable files ;# list of list of (name size date contents) tuples
+ }
+
+# public
+
+ proc Mount {mkfile local args} {
+ set v::outfn [file normalize $mkfile]
+ set v::dname [list ]
+ set v::prows [list -1]
+ set v::files [list {}]
+ ::vfs::filesystem mount $local [list ::vfs::m2m::handler -]
+ ::vfs::RegisterMount $local [list ::vfs::m2m::Unmount -]
+ return m2m
+ }
+
+ proc Unmount {db local} {
+ ::vfs::filesystem unmount $local
+ if {$v::outfn ne ""} {
+ set fd [::open $v::outfn a]
+ vlerq write [makeDirsView] $fd
+ ::close $fd
+ }
+ unset v::outfn v::dname v::prows v::files
+ }
+
+# private
+
+ proc makeDirsView {} {
+ set d {}
+ foreach f $v::files {
+ set x [lsort -index 0 -unique $f]
+ lappend d [vlerq def {name size:I date:I contents:B} \
+ [eval concat $x]]
+ }
+ set desc {name parent:I {files {name size:I date:I contents:B}}}
+ set dirs [vlerq data [vlerq mdef $desc] $v::dname $v::prows $d]
+ vlerq group $dirs {} dirs
+ }
+
+ proc handler {db cmd root path actual args} {
+ #puts [list M2M $db <$cmd> r: $root p: $path a: $actual $args]
+ switch $cmd {
+ matchindirectory { eval [linsert $args 0 $cmd $db $path $actual] }
+ fileattributes { eval [linsert $args 0 $cmd $db $root $path] }
+ default { eval [linsert $args 0 $cmd $db $path] }
+ }
+ }
+
+ proc fail {code} {
+ ::vfs::filesystem posixerror $::vfs::posix($code)
+ }
+
+ proc lookUp {db path} {
+ set parent 0
+ if {$path ne "."} {
+ set elems [file split $path]
+ set remain [llength $elems]
+ foreach e $elems {
+ set r ""
+ foreach r [lsearch -exact -int -all $v::prows $parent] {
+ if {$e eq [lindex $v::dname $r]} {
+ set parent $r
+ incr remain -1
+ break
+ }
+ }
+ if {$parent != $r} {
+ if {$remain == 1} {
+ set i [lsearch -exact \
+ [subFileNames [list ? ? $parent]] $e]
+ if {$i >= 0} {
+ # eval this 4-item result returns info about a file
+ return [list lindex $v::files $parent $i]
+ }
+ }
+ fail ENOENT
+ }
+ }
+ }
+ # evaluating this 3-item result returns the files subview
+ return [list lindex $v::files $parent]
+ }
+
+ proc isDir {tag} {
+ return [expr {[llength $tag] == 3}]
+ }
+
+ proc subDirNums {tag} {
+ lsearch -exact -int -all $v::prows [lindex $tag 2]
+ }
+
+ proc subFileNames {tag} {
+ set r {}
+ foreach x [lindex $v::files [lindex $tag 2]] { lappend r [lindex $x 0] }
+ return $r
+ }
+
+# methods
+
+ proc matchindirectory {db path actual pattern type} {
+ set o {}
+ if {$type == 0} { set type 20 }
+ set tag [lookUp $db $path]
+ if {$pattern ne ""} {
+ set c {}
+ if {[isDir $tag]} {
+ if {$type & 16} {
+ set c [subFileNames $tag]
+ }
+ if {$type & 4} {
+ foreach r [subDirNums $tag] {
+ lappend c [lindex $v::dname $r]
+ }
+ }
+ }
+ foreach x $c {
+ if {[string match $pattern $x]} {
+ lappend o [file join $actual $x]
+ }
+ }
+ } elseif {$type & ([isDir $tag]?4:16)} {
+ set o [list $actual]
+ }
+ return $o
+ }
+
+ proc fileattributes {db root path args} {
+ switch -- [llength $args] {
+ 0 { return [::vfs::listAttributes] }
+ 1 { return [eval [linsert $args 0 \
+ ::vfs::attributesGet $root $path]] }
+ 2 { return [eval [linsert $args 0 \
+ ::vfs::attributesSet $root $path]] }
+ }
+ }
+
+ proc open {db file mode permissions} {
+ switch -- $mode {
+ "" - r {
+ set tag [lookUp $db $file]
+ if {[isDir $tag]} { fail ENOENT }
+ foreach {name size date contents} [eval $tag] break
+ if {[string length $contents] != $size} {
+ set contents [vfs::zip -mode decompress $contents]
+ }
+ set fd [vfs::memchan]
+ fconfigure $fd -translation binary
+ puts -nonewline $fd $contents
+ fconfigure $fd -translation auto
+ seek $fd 0
+ return [list $fd]
+ }
+ w { ;# make sure the parent dir exists and create empty
+ set tag [lookUp $db [file dirname $file]]
+ set dpos [lindex $tag 2]
+ set curr [lindex $v::files $dpos]
+ set fpos [llength $curr]
+ lappend curr [list [file tail $file] 0 [clock seconds] ""]
+ lset v::files $dpos $curr
+ set fd [vfs::memchan]
+ return [list $fd [list ::vfs::m2m::doClose $db $dpos $fpos $fd]]
+ }
+ default { error "unsupported access mode: $mode" }
+ }
+ }
+
+ proc doClose {db dpos fpos fd} {
+ fconfigure $fd -translation binary
+ seek $fd 0
+ set d [read $fd]
+ set n [string length $d]
+ set z [vfs::zip -mode compress $d]
+ if {[string length $z] < $n} { set d $z }
+ lset v::files $dpos $fpos 1 $n
+ lset v::files $dpos $fpos 3 $d
+ }
+
+ proc access {db path mode} {
+ lookUp $db $path
+ }
+
+ proc stat {db path} {
+ set tag [lookUp $db $path]
+ set l 1
+ if {[isDir $tag]} {
+ set t directory
+ set s 0
+ set d 0
+ set c ""
+ incr l [llength [subFileNames $tag]]
+ incr l [llength [subDirNums $tag]]
+ } else {
+ set t file
+ foreach {n s d c} [eval $tag] break
+ }
+ return [list type $t size $s atime $d ctime $d mtime $d nlink $l \
+ csize [string length $c] gid 0 uid 0 ino 0 mode 0777]
+ }
+
+ proc createdirectory {db path} {
+ set tag [lookUp $db [file dirname $path]]
+ lappend v::dname [file tail $path]
+ lappend v::prows [lindex $tag 2]
+ lappend v::files {}
+ }
+
+ proc utime {db path atime mtime} {
+ set tag [lookUp $db $path]
+ if {![isDir $tag]} {
+ lset v::files [lindex $tag 2] [lindex $tag 3] 2 $mtime
+ }
+ }
+}
diff --git a/vqtcl/buildsrc/vqtcl/library/mkclvfs.tcl b/vqtcl/buildsrc/vqtcl/library/mkclvfs.tcl
new file mode 100644
index 0000000..467bcba
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/library/mkclvfs.tcl
@@ -0,0 +1,181 @@
+# mkclvfs.tcl -- Metakit Compatibility Layer Virtual File System driver
+# Rewritten from mk4vfs.tcl, orig by Matt Newman and Jean-Claude Wippler
+
+# 1.0 initial release
+# 1.1 view size renamed to count
+# 1.2 replace view calls by vget (simpler and faster)
+# 1.3 modified to use the vlerq extension i.s.o. thrive
+# 1.4 minor cleanup
+# 1.5 adjusted for vlerq 4
+
+package provide vfs::mkcl 1.5
+
+package require vfs
+package require vlerq
+
+namespace eval ::vfs::mkcl {
+ interp alias {} ::vfs::mkcl::vopen {} ::vlerq open
+ interp alias {} ::vfs::mkcl::vget {} ::vlerq get
+
+ namespace eval v {
+ variable seq 0 ;# used to generate a unique db handle
+ variable rootv ;# maps handle to the "dirs" root view
+ variable dname ;# maps handle to cached list of directory names
+ variable prows ;# maps handle to cached list of parent row numbers
+ }
+
+# public
+
+ proc Mount {mkfile local args} {
+ set db mkclvfs[incr v::seq]
+ set v::rootv($db) [vget [vopen $mkfile] 0 dirs]
+ set v::dname($db) [vget $v::rootv($db) * name]
+ set v::prows($db) [vget $v::rootv($db) * parent]
+ #parray v::dname
+ #parray v::prows
+ ::vfs::filesystem mount $local [list ::vfs::mkcl::handler $db]
+ ::vfs::RegisterMount $local [list ::vfs::mkcl::Unmount $db]
+ return $db
+ }
+
+ proc Unmount {db local} {
+ ::vfs::filesystem unmount $local
+ unset v::rootv($db) v::dname($db) v::prows($db)
+ }
+
+# private
+
+ proc handler {db cmd root path actual args} {
+ #puts [list MKCL $db <$cmd> r: $root p: $path a: $actual $args]
+ switch $cmd {
+ matchindirectory { eval [linsert $args 0 $cmd $db $path $actual] }
+ fileattributes { eval [linsert $args 0 $cmd $db $root $path] }
+ default { eval [linsert $args 0 $cmd $db $path] }
+ }
+ }
+
+ proc fail {code} {
+ ::vfs::filesystem posixerror $::vfs::posix($code)
+ }
+
+ proc lookUp {db path} {
+ set dirs $v::rootv($db)
+ set parent 0
+ set elems [file split $path]
+ set remain [llength $elems]
+ foreach e $elems {
+ set r ""
+ foreach r [lsearch -exact -int -all $v::prows($db) $parent] {
+ if {$e eq [lindex $v::dname($db) $r]} {
+ set parent $r
+ incr remain -1
+ break
+ }
+ }
+ if {$parent != $r} {
+ if {$remain == 1} {
+ set files [vget $dirs $parent files]
+ set i [lsearch -exact [vget $files * name] $e]
+ if {$i >= 0} {
+ # eval this 3-item result returns the info about 1 file
+ return [list vget $files $i]
+ }
+ }
+ fail ENOENT
+ }
+ }
+ # evaluating this 4-item result returns the files subview
+ list vget $dirs $parent files
+ }
+
+ proc isDir {tag} {
+ expr {[llength $tag] == 4}
+ }
+
+ if {$::tcl_version eq "8.4"} {
+ proc apply {cmd args} { eval [concat $cmd $args] }
+ } else {
+ proc apply {cmd args} { {*}$cmd {*}$args }
+ }
+
+# methods
+
+ proc matchindirectory {db path actual pattern type} {
+ set o {}
+ if {$type == 0} { set type 20 }
+ if {[catch {set tag [lookUp $db $path]} err]} { return {} }
+ if {$pattern ne ""} {
+ set c {}
+ if {[isDir $tag]} {
+ # collect file names
+ if {$type & 16} {
+ set c [apply $tag * 0]
+ }
+ # collect directory names
+ if {$type & 4} {
+ foreach r [lsearch -exact -int -all $v::prows($db) \
+ [lindex $tag 2]] {
+ lappend c [lindex $v::dname($db) $r]
+ }
+ }
+ }
+ foreach x $c {
+ if {[string match $pattern $x]} {
+ lappend o [file join $actual $x]
+ }
+ }
+ } elseif {$type & ([isDir $tag]?4:16)} {
+ set o [list $actual]
+ }
+ return $o
+ }
+
+ proc fileattributes {db root path args} {
+ switch -- [llength $args] {
+ 0 { return [::vfs::listAttributes] }
+ 1 { set index [lindex $args 0]
+ return [::vfs::attributesGet $root $path $index] }
+ 2 { fail EROFS }
+ }
+ }
+
+ proc open {db file mode permissions} {
+ if {$mode ne "" && $mode ne "r"} { fail EROFS }
+ set tag [lookUp $db $file]
+ if {[isDir $tag]} { fail ENOENT }
+ foreach {name size date contents} [apply $tag *] break
+ if {[string length $contents] != $size} {
+ set contents [::vfs::zip -mode decompress $contents]
+ }
+ set fd [::vfs::memchan]
+ fconfigure $fd -translation binary
+ puts -nonewline $fd $contents
+ fconfigure $fd -translation auto -encoding [encoding system]
+ seek $fd 0
+ list $fd
+ }
+
+ proc access {db path mode} {
+ if {$mode & 2} { fail EROFS }
+ lookUp $db $path
+ }
+
+ proc stat {db path} {
+ set tag [lookUp $db $path]
+ set l 1
+ if {[isDir $tag]} {
+ set t directory
+ set s 0
+ set d 0
+ set c ""
+ incr l [apply $tag #]
+ incr l [llength [lsearch -exact -int -all $v::prows($db) \
+ [lindex $tag 2]]]
+ } else {
+ set t file
+ foreach {n s d c} [apply $tag *] break
+ }
+ list type $t size $s atime $d ctime $d mtime $d nlink $l \
+ csize [string length $c] gid 0 uid 0 ino 0 mode 0777
+ }
+}
diff --git a/vqtcl/buildsrc/vqtcl/library/mklite.tcl b/vqtcl/buildsrc/vqtcl/library/mklite.tcl
new file mode 100644
index 0000000..4c09f70
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/library/mklite.tcl
@@ -0,0 +1,271 @@
+# mklite.tcl -- Compatibility layer for Metakit
+
+# 0.3 modified to use the vlerq extension i.s.o. thrive
+# 0.4 adjusted for vlerq 4
+# 0.5 support "mk::file open" (no other args) and more mk::select options
+
+package provide mklite 0.5
+
+package require vlerq
+
+namespace eval mklite {
+ variable mkdb ;# the mkdb array maps open db handles to view references
+
+# call emulateMk4tcl to define compatibility aliases in a specific namespace
+# if the MKLITE_DEBUG env var is defined, all calls and returns will be traced
+
+ proc emulateMk4tcl {{ns ::mk}} {
+ foreach x {channel cursor file get loop select view} {
+ # NOTE: clobbers existing mk::* cmds, may want to rename 'em first?
+ if {[info exists ::env(MKLITE_DEBUG)]} {
+ interp alias {} ${ns}::$x {} ::mklite::debug ::mklite::$x
+ } else {
+ interp alias {} ${ns}::$x {} ::mklite::$x
+ }
+ }
+ }
+
+ proc debug {args} {
+ puts ">>> [list $args]"
+ set r [uplevel 1 $args]
+ set s [regsub -all {[^ -~]} $r ?]
+ puts " << [string length $r]: [string range $s 0 49]"
+ return $r
+ }
+
+ proc mk_obj {path} {
+ variable mkdb
+ # memoize last result (without row number), it's likely to be used again
+ set pre [regsub {!\d+$} $path {}]
+ if {$mkdb(?) eq $pre} { return $mkdb(:) }
+ set n 0
+ foreach {x y} [regsub -all {[:.!]} :$path { & }] {
+ switch -- $x {
+ : { set r $mkdb($y) }
+ ! { set n $y }
+ . { if {[catch { vlerq get $r $n $y } r]} { return 0 } }
+ }
+ }
+ set mkdb(?) $pre
+ set mkdb(:) $r
+ return $r
+ }
+
+# partial emulation of the mk::* commands
+
+ proc file {cmd args} {
+ variable mkdb
+ variable mkpath
+ set db [lindex $args 0]
+ if {$db eq ""} { return [array get mkpath] }
+ set file [lindex $args 1]
+ switch $cmd {
+ open {
+ set mkdb(?) ""
+ if {$file ne ""} {
+ set mkdb($db) [vlerq open $file]
+ } else {
+ set mkdb($db) 0
+ }
+ set mkpath($db) $file
+ return $db
+ }
+ load {
+ fconfigure $file -translation binary
+ set mkdb($db) [vlerq load [read $file]]
+ return $db
+ }
+ close {
+ set mkdb(?) ""
+ unset mkdb($db) mkpath($db)
+ return
+ }
+ views {
+ return [vlerq get $mkdb($db) @ * 0]
+ }
+ }
+ error "mkfile $cmd?"
+ }
+
+ proc view {cmd path args} {
+ set a1 [lindex $args 0]
+ switch $cmd {
+ info {
+ return [vlerq get [mk_obj $path] @ * 0]
+ }
+ layout {
+ set layout "NOTYET"
+ if {[llength $args] > 0 && $layout != $a1} {
+ #error "view restructuring not supported"
+ }
+ return $layout
+ }
+ size {
+ set len [vlerq get [mk_obj $path] #]
+ if {[llength $args] > 0 && $len != $a1} {
+ error "view resizing not supported"
+ }
+ return $len
+ }
+ default { error "mkview $cmd?" }
+ }
+ }
+
+ proc cursor {cmd cursor args} {
+ upvar $cursor v
+ switch $cmd {
+ create {
+ NOTYET
+ }
+ incr {
+ NOTYET
+ }
+ pos -
+ position {
+ if {$args != ""} {
+ unset v
+ regsub {!-?\d+$} $v {} v
+ append v !$args
+ return $args
+ }
+ if {![regexp {\d+$} $v n]} {
+ set n -1
+ }
+ return $n
+ }
+ default { error "mkcursor $cmd?" }
+ }
+ }
+
+ proc get {path args} {
+ set vw [mk_obj $path]
+ set row [regsub {^.*!} $path {}]
+ set sized 0
+ if {[lindex $args 0] eq "-size"} {
+ incr sized
+ set args [lrange $args 1 end]
+ }
+ set ids 0
+ if {[llength $args] == 0} {
+ incr ids
+ set args [vlerq get $vw @ * 0]
+ }
+ set r {}
+ foreach x $args {
+ if {$ids} { lappend r $x }
+ set v [vlerq get $vw $row $x]
+ if {$sized} { set v [string length $v] }
+ lappend r $v
+ }
+ if {[llength $args] == 1} { set r [lindex $r 0] }
+ return $r
+ }
+
+ proc loop {cursor path args} {
+ upvar $cursor v
+ #unset -nocomplain v ;# avoids errors if v already exists as array
+ if {[llength $args] == 0} {
+ set args [list $path]
+ set path $v
+ regsub {!-?\d+$} $path {} path
+ }
+ set first [lindex $args 0]
+ set last [lindex $args 1]
+ switch [llength $args] {
+ 1 { set first 0
+ set limit [vlerq get [mk_obj $path] #]
+ set step 1 }
+ 2 { set limit [vlerq get [mk_obj $path] #]
+ set step 1 }
+ 3 { set step 1 }
+ 4 { set step [lindex $args 2] }
+ default { error "mkloop arg count?" }
+ }
+ set body [lindex $args end]
+ set code 0
+ for {set i $first} {$i < $limit} {incr i $step} {
+ set v $path!$i
+ set code [catch [list uplevel 1 $body] err]
+ switch $code {
+ 1 -
+ 2 { return -code $code $err }
+ 3 { break }
+ }
+ }
+ }
+
+ # from http://wiki.tcl.tk/43
+ proc _lreverse L {
+ set res {}
+ set i [llength $L]
+ #while {[incr i -1]>=0} {lappend res [lindex $L $i]}
+ while {$i} {lappend res [lindex $L [incr i -1]]} ;# rmax
+ set res
+ } ;# RS, tuned 10% faster by [rmax]
+
+ proc select {path args} {
+ set vw [mk_obj $path]
+ set n [vlerq get $vw #]
+ set r {}
+ for {set i 0} {$i < $n} {incr i} { lappend r $i }
+ set n [llength $args]
+ set sorts {}
+ for {set i 0} {$i < $n} {incr i} {
+ set match std
+ switch -- [lindex $args $i] {
+ -sort { lappend sorts [lindex $args [incr i]]; continue }
+ -rsort { lappend sorts - [lindex $args [incr i]]; continue }
+ -first { set first [lindex $args [incr i]]; continue }
+ -count { set count [lindex $args [incr i]]; continue }
+ -glob { set match glob; incr i }
+ -globnc { set match globnc; incr i }
+ -keyword { set match keyword; incr i }
+ }
+ set cols [lindex $args $i]
+ set k [lindex $args [incr i]]
+ set kwre "\\m$k"
+ # could use loop -collect, might be faster
+ set r2 {}
+ foreach x $r {
+ foreach c $cols {
+ set v [vlerq get $vw $x $c]
+ switch $match {
+ glob { set ok [string match $k $v] }
+ globnc { set ok [string match -nocase $k $v] }
+ keyword { set ok [regexp -nocase $kwre $v] }
+ default { set ok [expr {$k eq $v}] }
+ }
+ if {$ok} { lappend r2 $x; break }
+ }
+ }
+ set r $r2
+ }
+ if {[llength $sorts]} {
+ foreach x [_lreverse $sorts] {
+ if {$x eq "-"} {
+ set r [_lreverse $r]
+ } else {
+ set v [vlerq remap [vlerq tag [vlerq colmap $vw $x] N] $r]
+ set r [vlerq get [vlerq sort $v] * N]
+ }
+ }
+ }
+ if {[info exists first]} {
+ set r [lrange $r $first end]
+ }
+ if {[info exists count]} {
+ set r [lrange $r 0 [incr count -1]]
+ }
+ return $r
+ }
+
+ proc channel {path name mode} {
+ package require vfs ;# TODO: needs vfs, could use "chan create" in 8.5
+ if {$mode ne "r"} { error "mkchannel? mode $mode" }
+ set fd [vfs::memchan]
+ fconfigure $fd -translation binary
+ puts -nonewline $fd [get $path $name]
+ seek $fd 0
+ return $fd
+ }
+}
diff --git a/vqtcl/buildsrc/vqtcl/library/ratcl.tcl b/vqtcl/buildsrc/vqtcl/library/ratcl.tcl
new file mode 100644
index 0000000..f6b3cd5
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/library/ratcl.tcl
@@ -0,0 +1,230 @@
+# ratcl.tcl -- Relational algebra ond other utility operators for vlerq
+
+package provide ratcl 4
+package require vlerq 4
+
+namespace eval vlerq {}
+interp alias {} view {} vlerq view
+
+namespace eval ratcl {
+ namespace export vopdef
+
+ proc vopdef {name params body} {
+ proc ::vlerq::$name $params $body
+ }
+
+ vopdef as {v cmd} { interp alias {} $cmd {} view $v; return $cmd }
+ vopdef asview {l args} { vlerq def $args $l }
+ vopdef collect {v expr} { uplevel 1 [list view $v loop -collect $expr] }
+ vopdef freeze {v} { view $v emit | load }
+ vopdef index {v cond} { uplevel 1 [list view $v loop -index $cond] }
+ vopdef pick {v n} { view $v where {[lindex $n $(#)] != 0} }
+ vopdef project {v args} { view $v colmap $args | unique }
+ vopdef use {v w} { return $w }
+ vopdef where {v cond} { uplevel 1 [list view $v loop -where $cond] }
+
+ vopdef do {w cmds} {
+ upvar 1 _v v
+ set v $w
+ set x ""
+ foreach c [split $cmds \n] {
+ append x $c "\n "
+ if {![info complete $x]} continue
+ set x [string trim $x]
+ regsub {^#.*} $x {} x
+ if {$x eq ""} continue
+ set cm "view \$_v $x"
+ set v [uplevel 1 $cm]
+ set x ""
+ }
+ set w $v
+ unset v
+ return $w
+ }
+
+ vopdef debug {w cmds} {
+ upvar 1 _v v
+ set v $w
+ puts " rows-in col msec view-operation"
+ puts " ------- --- ---- --------------"
+ set x ""
+ set w " "
+ foreach c [split $cmds \n] {
+ append x $c \n $w
+ if {![info complete $x]} continue
+ set x [string trim $x]
+ if {[regexp {^#} $x]} {
+ puts [format {%20s %.58s} "" $x]
+ set x ""
+ }
+ switch -- $x {
+ "" { }
+ ? { puts "$w ?\n[view $v dump]" }
+ default {
+ if {[catch { view $v size } nr]} { set nr "" }
+ if {[catch { view $v width } nc]} { set nc "" }
+ set cm "view \$_v $x"
+ set us [lindex [time {
+ set v [uplevel 1 $cm]
+ catch {view $v size}
+ }] 0]
+ puts [format {%8s %4s %5.0f %s} \
+ $nr $nc [expr {$us/1000.0}] $x]
+ }
+ }
+ set x ""
+ }
+ if {[catch { view $v size } nr]} { set nr " -------" }
+ if {[catch { view $v width } nc]} { set nc " ---" }
+ puts [format {%8s %4s ---- --------------} $nr $nc]
+ set w $v
+ unset v
+ return $w
+ }
+
+ vopdef dump {vid {maxrows 20}} {
+ set n [view $vid size]
+ if {[view $vid width] == 0} { return " ($n rows, no columns)" }
+ set i -1
+ if {$n > $maxrows} { set vid [view $vid first $maxrows] }
+ foreach x [view $vid names] y [view $vid types] {
+ set v2 [view $vid onecol [incr i]]
+ switch $y {
+ B { set s { "[string length $($x)]b" } }
+ V { set s { "#[view $($x) size]" } }
+ default { set s { $($x) } }
+ }
+ set c [view $v2 collect $s]
+ set w [string length $x]
+ foreach z $c {
+ if {[string length $z] > $w} { set w [string length $z] }
+ }
+ if {$w > 50} { set w 50 }
+ switch $y {
+ B - I - L - F - D - V { append fmt " " %${w}s }
+ default { append fmt " " %-$w.${w}s }
+ }
+ append hdr " " [format %-${w}s $x]
+ append bar " " [string repeat - $w]
+ lappend d $c
+ }
+ set r [list $hdr $bar]
+ for {set i 0} {$i < $n} {incr i} {
+ if {$i >= $maxrows} break
+ set cmd [list format $fmt]
+ foreach x $d { lappend cmd [regsub -all {[^ -~]} [lindex $x $i] .] }
+ lappend r [eval $cmd]
+ }
+ if {$i < $n} { lappend r [string map {- .} $bar] }
+ ::join $r \n
+ }
+
+ vopdef html {vid} {
+ set names [view $vid names]
+ set types [view $vid types]
+ set o
+ append o {}
+ append o \n { | }
+ foreach x $names { append o $x | }
+ append o
\n
+ view $vid loop c {
+ append o {| } $c(#) |
+ set i -1
+ foreach x $names y $types val [view $vid get $c(#) *] {
+ switch $y {
+ b - B { set z [string length $val]b }
+ v - V { set z [view $val html] }
+ default {
+ set z [string map {& &\; < <\; > >\;} $val]
+ }
+ }
+ switch $y {
+ s - S - v - V { append o {} }
+ default { append o { | } }
+ }
+ append o $z |
+ }
+ append o
\n
+ }
+ append o
\n
+ }
+
+ vopdef transpose {v {p x}} {
+ set n [vlerq size $v]
+ foreach {pn pt} [split ${p}:S :] break
+ set m [view $v size | collect { "$pn$(#):$pt" }]
+ set c [view $v get @ | collect { [vlerq get $v * $(#)] }]
+ view $m def [eval [linsert $c 0 concat]]
+ }
+
+ vopdef freq {v i} {
+ set n [vlerq iota [vlerq width $v]]
+ llength $n ;# force $n to list, avoids assert in CastObjToItem, case 'n'
+ set g [vlerq group $v $n _]
+ view [vlerq colmap $g $n] pair [view ${i}:I def [vlerq counts $g _]]
+ }
+
+ vopdef sorton {v args} {
+ set n [view $v size]
+ if {[incr n -1] > 0} {
+ set dir +
+ set cols {}
+ # TODO: optimize, i.e. sort more at once and use faster reverse sort
+ foreach x $args {
+ switch -- $x {
+ + - - { set dir $x }
+ default { set cols [linsert $cols 0 $dir $x ]}
+ }
+ }
+ foreach {dir col} $cols {
+ set c [view $v onecol $col]
+ if {$dir eq "-"} {
+ set map [view $v onecol $col | reverse | sortmap | \
+ asview N:I | reverse | collect {$n-$(N)}]
+ } else {
+ set map [view $c sortmap]
+ }
+ set v [view $v remap $map]
+ }
+ }
+ return $v
+ }
+
+ vopdef read {fd {data ""}} {
+ fconfigure $fd -translation binary
+ while {[string length $data] < 8} {
+ append data [::read $fd [expr {8 - [string length $data]}]]
+ }
+ binary scan $data a3cI hdr ext siz
+ switch -- $hdr {
+ "JL\x1A" - "LJ\x1A" {
+ if {$ext < 0} {
+ set siz [expr {(($ext & 0x3F) << 36) + \
+ (($siz & 0xFFFFFFFF) << 4)}]
+ }
+ }
+ default { set siz -1 }
+ }
+ if {$siz < 0} {
+ while {![eof $fd]} {
+ append data [::read $fd]
+ }
+ } else {
+ incr siz -[string length $data]
+ while {$siz > 0} {
+ set more [::read $fd $siz]
+ append data $more
+ incr siz -[string length $more]
+ }
+ set more ""
+ }
+ vlerq load $data
+ }
+}
diff --git a/vqtcl/buildsrc/vqtcl/license.terms b/vqtcl/buildsrc/vqtcl/license.terms
new file mode 100644
index 0000000..9bd444f
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/license.terms
@@ -0,0 +1,26 @@
+This software is copyrighted by Jean-Claude Wippler and Equi4 Software and others.
+The following terms apply to all files associated with the software
+unless explicitly disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
diff --git a/vqtcl/buildsrc/vqtcl/pkgIndex.tcl.in b/vqtcl/buildsrc/vqtcl/pkgIndex.tcl.in
new file mode 100644
index 0000000..cfc6e6f
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/pkgIndex.tcl.in
@@ -0,0 +1,9 @@
+package ifneeded vlerq @PACKAGE_VERSION@ \
+ [list load [file join $dir lib@PACKAGE_NAME@@PACKAGE_VERSION@[info sharedlibext]] vlerq]
+
+package ifneeded ratcl @PACKAGE_VERSION@ \
+ [list source [file join $dir ratcl.tcl]]
+
+package ifneeded mklite 0.5 [list source [file join $dir mklite.tcl]]
+package ifneeded vfs::m2m 1.8 [list source [file join $dir m2mvfs.tcl]]
+package ifneeded vfs::mkcl 1.5 [list source [file join $dir mkclvfs.tcl]]
diff --git a/vqtcl/buildsrc/vqtcl/tclconfig/install-sh b/vqtcl/buildsrc/vqtcl/tclconfig/install-sh
new file mode 100755
index 0000000..0ff4b6a
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tclconfig/install-sh
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+#
+# install - install a program, script, or datafile
+# This comes from X11R5; it is not part of GNU.
+#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+
+instcmd="$mvprog"
+chmodcmd=""
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+fi
+
+if [ x"$dst" = x ]
+then
+ echo "install: no destination specified"
+ exit 1
+fi
+
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+if [ -d $dst ]
+then
+ dst="$dst"/`basename $src`
+fi
+
+# Make a temp file name in the proper directory.
+
+dstdir=`dirname $dst`
+dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+$doit $instcmd $src $dsttmp
+
+# and set any options; do chmod last to preserve setuid bits
+
+if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
+if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
+if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
+if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
+
+# Now rename the file to the real destination.
+
+$doit $rmcmd $dst
+$doit $mvcmd $dsttmp $dst
+
+
+exit 0
diff --git a/vqtcl/buildsrc/vqtcl/tclconfig/tcl.m4 b/vqtcl/buildsrc/vqtcl/tclconfig/tcl.m4
new file mode 100644
index 0000000..175d86d
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tclconfig/tcl.m4
@@ -0,0 +1,4000 @@
+# tcl.m4 --
+#
+# This file provides a set of autoconf macros to help TEA-enable
+# a Tcl extension.
+#
+# Copyright (c) 1999-2000 Ajuba Solutions.
+# Copyright (c) 2002-2005 ActiveState Corporation.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# RCS: @(#) $Id: tcl.m4 7 2009-02-20 14:00:31Z patthoyts $
+
+AC_PREREQ(2.50)
+
+dnl TEA extensions pass us the version of TEA they think they
+dnl are compatible with (must be set in TEA_INIT below)
+dnl TEA_VERSION="3.5"
+
+# Possible values for key variables defined:
+#
+# TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
+# TEA_PLATFORM - windows unix
+#
+
+#------------------------------------------------------------------------
+# TEA_PATH_TCLCONFIG --
+#
+# Locate the tclConfig.sh file and perform a sanity check on
+# the Tcl compile flags
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-tcl=...
+#
+# Defines the following vars:
+# TCL_BIN_DIR Full path to the directory containing
+# the tclConfig.sh file
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PATH_TCLCONFIG], [
+ dnl Make sure we are initialized
+ AC_REQUIRE([TEA_INIT])
+ #
+ # Ok, lets find the tcl configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tcl
+ #
+
+ if test x"${no_tcl}" = x ; then
+ # we reset no_tcl in case something fails here
+ no_tcl=true
+ AC_ARG_WITH(tcl,
+ AC_HELP_STRING([--with-tcl],
+ [directory containing tcl configuration (tclConfig.sh)]),
+ with_tclconfig=${withval})
+ AC_MSG_CHECKING([for Tcl configuration])
+ AC_CACHE_VAL(ac_cv_c_tclconfig,[
+
+ # First check to see if --with-tcl was specified.
+ if test x"${with_tclconfig}" != x ; then
+ case ${with_tclconfig} in
+ */tclConfig.sh )
+ if test -f ${with_tclconfig}; then
+ AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
+ with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'`
+ fi ;;
+ esac
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
+ fi
+ fi
+
+ # then check for a private Tcl installation
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ../tcl \
+ `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../tcl \
+ `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../../tcl \
+ `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Darwin, check in Framework installation locations
+ if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
+ `ls -d /Library/Frameworks 2>/dev/null` \
+ `ls -d /Network/Library/Frameworks 2>/dev/null` \
+ `ls -d /System/Library/Frameworks 2>/dev/null` \
+ ; do
+ if test -f "$i/Tcl.framework/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Windows, check in common installation locations
+ if test "${TEA_PLATFORM}" = "windows" \
+ -a x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d C:/Tcl/lib 2>/dev/null` \
+ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ${libdir} 2>/dev/null` \
+ `ls -d ${exec_prefix}/lib 2>/dev/null` \
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few other private locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tcl \
+ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ TCL_BIN_DIR="# no Tcl configs found"
+ AC_MSG_WARN([Can't find Tcl configuration definitions])
+ exit 0
+ else
+ no_tcl=
+ TCL_BIN_DIR=${ac_cv_c_tclconfig}
+ AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_PATH_TKCONFIG --
+#
+# Locate the tkConfig.sh file
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-tk=...
+#
+# Defines the following vars:
+# TK_BIN_DIR Full path to the directory containing
+# the tkConfig.sh file
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PATH_TKCONFIG], [
+ #
+ # Ok, lets find the tk configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tk
+ #
+
+ if test x"${no_tk}" = x ; then
+ # we reset no_tk in case something fails here
+ no_tk=true
+ AC_ARG_WITH(tk,
+ AC_HELP_STRING([--with-tk],
+ [directory containing tk configuration (tkConfig.sh)]),
+ with_tkconfig=${withval})
+ AC_MSG_CHECKING([for Tk configuration])
+ AC_CACHE_VAL(ac_cv_c_tkconfig,[
+
+ # First check to see if --with-tkconfig was specified.
+ if test x"${with_tkconfig}" != x ; then
+ case ${with_tkconfig} in
+ */tkConfig.sh )
+ if test -f ${with_tkconfig}; then
+ AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
+ with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'`
+ fi ;;
+ esac
+ if test -f "${with_tkconfig}/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
+ fi
+ fi
+
+ # then check for a private Tk library
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in \
+ ../tk \
+ `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../tk \
+ `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../../tk \
+ `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Darwin, check in Framework installation locations
+ if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
+ for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
+ `ls -d /Library/Frameworks 2>/dev/null` \
+ `ls -d /Network/Library/Frameworks 2>/dev/null` \
+ `ls -d /System/Library/Frameworks 2>/dev/null` \
+ ; do
+ if test -f "$i/Tk.framework/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in `ls -d ${libdir} 2>/dev/null` \
+ `ls -d ${exec_prefix}/lib 2>/dev/null` \
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # on Windows, check in common installation locations
+ if test "${TEA_PLATFORM}" = "windows" \
+ -a x"${ac_cv_c_tkconfig}" = x ; then
+ for i in `ls -d C:/Tcl/lib 2>/dev/null` \
+ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few other private locations
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tk \
+ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ TK_BIN_DIR="# no Tk configs found"
+ AC_MSG_WARN([Can't find Tk configuration definitions])
+ exit 0
+ else
+ no_tk=
+ TK_BIN_DIR=${ac_cv_c_tkconfig}
+ AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_LOAD_TCLCONFIG --
+#
+# Load the tclConfig.sh file
+#
+# Arguments:
+#
+# Requires the following vars to be set:
+# TCL_BIN_DIR
+#
+# Results:
+#
+# Subst the following vars:
+# TCL_BIN_DIR
+# TCL_SRC_DIR
+# TCL_LIB_FILE
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_LOAD_TCLCONFIG], [
+ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
+
+ if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
+ AC_MSG_RESULT([loading])
+ . ${TCL_BIN_DIR}/tclConfig.sh
+ else
+ AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
+ fi
+
+ # eval is required to do the TCL_DBGX substitution
+ eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
+ eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
+
+ # If the TCL_BIN_DIR is the build directory (not the install directory),
+ # then set the common variable name to the value of the build variables.
+ # For example, the variable TCL_LIB_SPEC will be set to the value
+ # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
+ # instead of TCL_BUILD_LIB_SPEC since it will work with both an
+ # installed and uninstalled version of Tcl.
+ if test -f ${TCL_BIN_DIR}/Makefile ; then
+ TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
+ TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
+ TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
+ elif test "`uname -s`" = "Darwin"; then
+ # If Tcl was built as a framework, attempt to use the libraries
+ # from the framework at the given location so that linking works
+ # against Tcl.framework installed in an arbitary location.
+ case ${TCL_DEFS} in
+ *TCL_FRAMEWORK*)
+ if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
+ for i in "`cd ${TCL_BIN_DIR}; pwd`" \
+ "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
+ if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
+ TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
+ break
+ fi
+ done
+ fi
+ if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
+ TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
+ TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
+ fi
+ ;;
+ esac
+ fi
+
+ # eval is required to do the TCL_DBGX substitution
+ eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
+ eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
+ eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
+ eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
+
+ AC_SUBST(TCL_VERSION)
+ AC_SUBST(TCL_BIN_DIR)
+ AC_SUBST(TCL_SRC_DIR)
+
+ AC_SUBST(TCL_LIB_FILE)
+ AC_SUBST(TCL_LIB_FLAG)
+ AC_SUBST(TCL_LIB_SPEC)
+
+ AC_SUBST(TCL_STUB_LIB_FILE)
+ AC_SUBST(TCL_STUB_LIB_FLAG)
+ AC_SUBST(TCL_STUB_LIB_SPEC)
+
+ AC_SUBST(TCL_LIBS)
+ AC_SUBST(TCL_DEFS)
+ AC_SUBST(TCL_EXTRA_CFLAGS)
+ AC_SUBST(TCL_LD_FLAGS)
+ AC_SUBST(TCL_SHLIB_LD_LIBS)
+])
+
+#------------------------------------------------------------------------
+# TEA_LOAD_TKCONFIG --
+#
+# Load the tkConfig.sh file
+#
+# Arguments:
+#
+# Requires the following vars to be set:
+# TK_BIN_DIR
+#
+# Results:
+#
+# Sets the following vars that should be in tkConfig.sh:
+# TK_BIN_DIR
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_LOAD_TKCONFIG], [
+ AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
+
+ if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
+ AC_MSG_RESULT([loading])
+ . ${TK_BIN_DIR}/tkConfig.sh
+ else
+ AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
+ fi
+
+ # eval is required to do the TK_DBGX substitution
+ eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
+ eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
+
+ # If the TK_BIN_DIR is the build directory (not the install directory),
+ # then set the common variable name to the value of the build variables.
+ # For example, the variable TK_LIB_SPEC will be set to the value
+ # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
+ # instead of TK_BUILD_LIB_SPEC since it will work with both an
+ # installed and uninstalled version of Tcl.
+ if test -f ${TK_BIN_DIR}/Makefile ; then
+ TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
+ TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
+ TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
+ elif test "`uname -s`" = "Darwin"; then
+ # If Tk was built as a framework, attempt to use the libraries
+ # from the framework at the given location so that linking works
+ # against Tk.framework installed in an arbitary location.
+ case ${TK_DEFS} in
+ *TK_FRAMEWORK*)
+ if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
+ for i in "`cd ${TK_BIN_DIR}; pwd`" \
+ "`cd ${TK_BIN_DIR}/../..; pwd`"; do
+ if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
+ TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
+ break
+ fi
+ done
+ fi
+ if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
+ TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
+ TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
+ fi
+ ;;
+ esac
+ fi
+
+ # eval is required to do the TK_DBGX substitution
+ eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
+ eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
+ eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
+ eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
+
+ # Ensure windowingsystem is defined
+ if test "${TEA_PLATFORM}" = "unix" ; then
+ case ${TK_DEFS} in
+ *MAC_OSX_TK*)
+ AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
+ TEA_WINDOWINGSYSTEM="aqua"
+ ;;
+ *)
+ TEA_WINDOWINGSYSTEM="x11"
+ ;;
+ esac
+ elif test "${TEA_PLATFORM}" = "windows" ; then
+ TEA_WINDOWINGSYSTEM="win32"
+ fi
+
+ AC_SUBST(TK_VERSION)
+ AC_SUBST(TK_BIN_DIR)
+ AC_SUBST(TK_SRC_DIR)
+
+ AC_SUBST(TK_LIB_FILE)
+ AC_SUBST(TK_LIB_FLAG)
+ AC_SUBST(TK_LIB_SPEC)
+
+ AC_SUBST(TK_STUB_LIB_FILE)
+ AC_SUBST(TK_STUB_LIB_FLAG)
+ AC_SUBST(TK_STUB_LIB_SPEC)
+
+ AC_SUBST(TK_LIBS)
+ AC_SUBST(TK_XINCLUDES)
+])
+
+#------------------------------------------------------------------------
+# TEA_ENABLE_SHARED --
+#
+# Allows the building of shared libraries
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-shared=yes|no
+#
+# Defines the following vars:
+# STATIC_BUILD Used for building import/export libraries
+# on Windows.
+#
+# Sets the following vars:
+# SHARED_BUILD Value of 1 or 0
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_ENABLE_SHARED], [
+ AC_MSG_CHECKING([how to build libraries])
+ AC_ARG_ENABLE(shared,
+ AC_HELP_STRING([--enable-shared],
+ [build and link with shared libraries (default: on)]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
+
+ if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ tcl_ok=$enableval
+ else
+ tcl_ok=yes
+ fi
+
+ if test "$tcl_ok" = "yes" ; then
+ AC_MSG_RESULT([shared])
+ SHARED_BUILD=1
+ else
+ AC_MSG_RESULT([static])
+ SHARED_BUILD=0
+ AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
+ fi
+ AC_SUBST(SHARED_BUILD)
+])
+
+#------------------------------------------------------------------------
+# TEA_ENABLE_THREADS --
+#
+# Specify if thread support should be enabled. If "yes" is specified
+# as an arg (optional), threads are enabled by default, "no" means
+# threads are disabled. "yes" is the default.
+#
+# TCL_THREADS is checked so that if you are compiling an extension
+# against a threaded core, your extension must be compiled threaded
+# as well.
+#
+# Note that it is legal to have a thread enabled extension run in a
+# threaded or non-threaded Tcl core, but a non-threaded extension may
+# only run in a non-threaded Tcl core.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-threads
+#
+# Sets the following vars:
+# THREADS_LIBS Thread library(s)
+#
+# Defines the following vars:
+# TCL_THREADS
+# _REENTRANT
+# _THREAD_SAFE
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_ENABLE_THREADS], [
+ AC_ARG_ENABLE(threads,
+ AC_HELP_STRING([--enable-threads],
+ [build with threads]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
+
+ if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ tcl_ok=$enableval
+ else
+ tcl_ok=yes
+ fi
+
+ if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
+ TCL_THREADS=1
+
+ if test "${TEA_PLATFORM}" != "windows" ; then
+ # We are always OK on Windows, so check what this platform wants:
+
+ # USE_THREAD_ALLOC tells us to try the special thread-based
+ # allocator that significantly reduces lock contention
+ AC_DEFINE(USE_THREAD_ALLOC, 1,
+ [Do we want to use the threaded memory allocator?])
+ AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
+ if test "`uname -s`" = "SunOS" ; then
+ AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
+ [Do we really want to follow the standard? Yes we do!])
+ fi
+ AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
+ AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ # Check a little harder for __pthread_mutex_init in the same
+ # library, as some systems hide it there until pthread.h is
+ # defined. We could alternatively do an AC_TRY_COMPILE with
+ # pthread.h, but that will work with libpthread really doesn't
+ # exist, like AIX 4.2. [Bug: 4359]
+ AC_CHECK_LIB(pthread, __pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthread"
+ else
+ AC_CHECK_LIB(pthreads, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthreads"
+ else
+ AC_CHECK_LIB(c, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ AC_CHECK_LIB(c_r, pthread_mutex_init,
+ tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -pthread"
+ else
+ TCL_THREADS=0
+ AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
+ fi
+ fi
+ fi
+ fi
+ fi
+ else
+ TCL_THREADS=0
+ fi
+ # Do checking message here to not mess up interleaved configure output
+ AC_MSG_CHECKING([for building with threads])
+ if test "${TCL_THREADS}" = 1; then
+ AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
+ AC_MSG_RESULT([yes (default)])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ # TCL_THREADS sanity checking. See if our request for building with
+ # threads is the same as the way Tcl was built. If not, warn the user.
+ case ${TCL_DEFS} in
+ *THREADS=1*)
+ if test "${TCL_THREADS}" = "0"; then
+ AC_MSG_WARN([
+ Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
+ that IS thread-enabled. It is recommended to use --enable-threads.])
+ fi
+ ;;
+ *)
+ if test "${TCL_THREADS}" = "1"; then
+ AC_MSG_WARN([
+ --enable-threads requested, but building against a Tcl that is NOT
+ thread-enabled. This is an OK configuration that will also run in
+ a thread-enabled core.])
+ fi
+ ;;
+ esac
+ AC_SUBST(TCL_THREADS)
+])
+
+#------------------------------------------------------------------------
+# TEA_ENABLE_SYMBOLS --
+#
+# Specify if debugging symbols should be used.
+# Memory (TCL_MEM_DEBUG) debugging can also be enabled.
+#
+# Arguments:
+# none
+#
+# TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
+# the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
+# Requires the following vars to be set in the Makefile:
+# CFLAGS_DEFAULT
+# LDFLAGS_DEFAULT
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-symbols
+#
+# Defines the following vars:
+# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
+# Sets to $(CFLAGS_OPTIMIZE) if false
+# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
+# Sets to $(LDFLAGS_OPTIMIZE) if false
+# DBGX Formerly used as debug library extension;
+# always blank now.
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_ENABLE_SYMBOLS], [
+ dnl Make sure we are initialized
+ AC_REQUIRE([TEA_CONFIG_CFLAGS])
+ AC_MSG_CHECKING([for build with symbols])
+ AC_ARG_ENABLE(symbols,
+ AC_HELP_STRING([--enable-symbols],
+ [build with debugging symbols (default: off)]),
+ [tcl_ok=$enableval], [tcl_ok=no])
+ DBGX=""
+ if test "$tcl_ok" = "no"; then
+ CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
+ LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
+ AC_MSG_RESULT([no])
+ else
+ CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
+ LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
+ if test "$tcl_ok" = "yes"; then
+ AC_MSG_RESULT([yes (standard debugging)])
+ fi
+ fi
+ if test "${TEA_PLATFORM}" != "windows" ; then
+ LDFLAGS_DEFAULT="${LDFLAGS}"
+ fi
+
+ AC_SUBST(TCL_DBGX)
+ AC_SUBST(CFLAGS_DEFAULT)
+ AC_SUBST(LDFLAGS_DEFAULT)
+
+ if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
+ AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
+ fi
+
+ if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
+ if test "$tcl_ok" = "all"; then
+ AC_MSG_RESULT([enabled symbols mem debugging])
+ else
+ AC_MSG_RESULT([enabled $tcl_ok debugging])
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_ENABLE_LANGINFO --
+#
+# Allows use of modern nl_langinfo check for better l10n.
+# This is only relevant for Unix.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-langinfo=yes|no (default is yes)
+#
+# Defines the following vars:
+# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_ENABLE_LANGINFO], [
+ AC_ARG_ENABLE(langinfo,
+ AC_HELP_STRING([--enable-langinfo],
+ [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
+ [langinfo_ok=$enableval], [langinfo_ok=yes])
+
+ HAVE_LANGINFO=0
+ if test "$langinfo_ok" = "yes"; then
+ AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
+ fi
+ AC_MSG_CHECKING([whether to use nl_langinfo])
+ if test "$langinfo_ok" = "yes"; then
+ AC_CACHE_VAL(tcl_cv_langinfo_h, [
+ AC_TRY_COMPILE([#include ], [nl_langinfo(CODESET);],
+ [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
+ AC_MSG_RESULT([$tcl_cv_langinfo_h])
+ if test $tcl_cv_langinfo_h = yes; then
+ AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
+ fi
+ else
+ AC_MSG_RESULT([$langinfo_ok])
+ fi
+])
+
+#--------------------------------------------------------------------
+# TEA_CONFIG_SYSTEM
+#
+# Determine what the system is (some things cannot be easily checked
+# on a feature-driven basis, alas). This can usually be done via the
+# "uname" command, but there are a few systems, like Next, where
+# this doesn't work.
+#
+# Arguments:
+# none
+#
+# Results:
+# Defines the following var:
+#
+# system - System/platform/version identification code.
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_CONFIG_SYSTEM], [
+ AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ tcl_cv_sys_version=windows
+ elif test -f /usr/lib/NextStep/software_version; then
+ tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+ tcl_cv_sys_version=`uname -s`-`uname -r`
+ if test "$?" -ne 0 ; then
+ AC_MSG_WARN([can't find uname command])
+ tcl_cv_sys_version=unknown
+ else
+ # Special check for weird MP-RAS system (uname returns weird
+ # results, and the version is kept in special file).
+
+ if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
+ fi
+ if test "`uname -s`" = "AIX" ; then
+ tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
+ fi
+ fi
+ fi
+ ])
+ system=$tcl_cv_sys_version
+])
+
+#--------------------------------------------------------------------
+# TEA_CONFIG_CFLAGS
+#
+# Try to determine the proper flags to pass to the compiler
+# for building shared libraries and other such nonsense.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines and substitutes the following vars:
+#
+# DL_OBJS - Name of the object file that implements dynamic
+# loading for Tcl on this system.
+# DL_LIBS - Library file(s) to include in tclsh and other base
+# applications in order for the "load" command to work.
+# LDFLAGS - Flags to pass to the compiler when linking object
+# files into an executable application binary such
+# as tclsh.
+# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
+# that tell the run-time dynamic linker where to look
+# for shared libraries such as libtcl.so. Depends on
+# the variable LIB_RUNTIME_DIR in the Makefile. Could
+# be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
+# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
+# that tell the run-time dynamic linker where to look
+# for shared libraries such as libtcl.so. Depends on
+# the variable LIB_RUNTIME_DIR in the Makefile.
+# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
+# of a shared library (may request position-independent
+# code, among other things).
+# SHLIB_LD - Base command to use for combining object files
+# into a shared library.
+# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
+# creating shared libraries. This symbol typically
+# goes at the end of the "ld" commands that build
+# shared libraries. The value of the symbol is
+# "${LIBS}" if all of the dependent libraries should
+# be specified when creating a shared library. If
+# dependent libraries should not be specified (as on
+# SunOS 4.x, where they cause the link to fail, or in
+# general if Tcl and Tk aren't themselves shared
+# libraries), then this symbol has an empty string
+# as its value.
+# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
+# extensions. An empty string means we don't know how
+# to use shared libraries on this platform.
+# LIB_SUFFIX - Specifies everything that comes after the "libfoo"
+# in a static or shared library name, using the $VERSION variable
+# to put the version in the right place. This is used
+# by platforms that need non-standard library names.
+# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
+# to have a version after the .so, and ${VERSION}.a
+# on AIX, since a shared library needs to have
+# a .a extension whereas shared objects for loadable
+# extensions have a .so extension. Defaults to
+# ${VERSION}${SHLIB_SUFFIX}.
+# TCL_NEEDS_EXP_FILE -
+# 1 means that an export file is needed to link to a
+# shared library.
+# TCL_EXP_FILE - The name of the installed export / import file which
+# should be used to link to the Tcl shared library.
+# Empty if Tcl is unshared.
+# TCL_BUILD_EXP_FILE -
+# The name of the built export / import file which
+# should be used to link to the Tcl shared library.
+# Empty if Tcl is unshared.
+# CFLAGS_DEBUG -
+# Flags used when running the compiler in debug mode
+# CFLAGS_OPTIMIZE -
+# Flags used when running the compiler in optimize mode
+# CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_CONFIG_CFLAGS], [
+ dnl Make sure we are initialized
+ AC_REQUIRE([TEA_INIT])
+
+ # Step 0.a: Enable 64 bit support?
+
+ AC_MSG_CHECKING([if 64bit support is requested])
+ AC_ARG_ENABLE(64bit,
+ AC_HELP_STRING([--enable-64bit],
+ [enable 64bit support (default: off)]),
+ [do64bit=$enableval], [do64bit=no])
+ AC_MSG_RESULT([$do64bit])
+
+ # Step 0.b: Enable Solaris 64 bit VIS support?
+
+ AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
+ AC_ARG_ENABLE(64bit-vis,
+ AC_HELP_STRING([--enable-64bit-vis],
+ [enable 64bit Sparc VIS support (default: off)]),
+ [do64bitVIS=$enableval], [do64bitVIS=no])
+ AC_MSG_RESULT([$do64bitVIS])
+
+ if test "$do64bitVIS" = "yes"; then
+ # Force 64bit on with VIS
+ do64bit=yes
+ fi
+
+ # Step 0.c: Cross-compiling options for Windows/CE builds?
+
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ AC_MSG_CHECKING([if Windows/CE build is requested])
+ AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no])
+ AC_MSG_RESULT([$doWince])
+ fi
+
+ # Step 1: set the variable "system" to hold the name and version number
+ # for the system.
+
+ TEA_CONFIG_SYSTEM
+
+ # Step 2: check for existence of -ldl library. This is needed because
+ # Linux can use either -ldl or -ldld for dynamic loading.
+
+ AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
+
+ # Require ranlib early so we can override it in special cases below.
+
+ AC_REQUIRE([AC_PROG_RANLIB])
+
+ # Step 3: set configuration options based on system name and version.
+ # This is similar to Tcl's unix/tcl.m4 except that we've added a
+ # "windows" case.
+
+ do64bit_ok=no
+ LDFLAGS_ORIG="$LDFLAGS"
+ # When ld needs options to work in 64-bit mode, put them in
+ # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
+ # is disabled by the user. [Bug 1016796]
+ LDFLAGS_ARCH=""
+ TCL_EXPORT_FILE_SUFFIX=""
+ UNSHARED_LIB_SUFFIX=""
+ TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
+ ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
+ TCL_LIB_VERSIONS_OK=ok
+ CFLAGS_DEBUG=-g
+ CFLAGS_OPTIMIZE=-O
+ if test "$GCC" = "yes" ; then
+ CFLAGS_OPTIMIZE=-O2
+ CFLAGS_WARNING="-Wall -Wno-implicit-int"
+ else
+ CFLAGS_WARNING=""
+ fi
+ TCL_NEEDS_EXP_FILE=0
+ TCL_BUILD_EXP_FILE=""
+ TCL_EXP_FILE=""
+dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
+dnl AC_CHECK_TOOL(AR, ar)
+ AC_CHECK_PROG(AR, ar, ar)
+ STLIB_LD='${AR} cr'
+ LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
+ case $system in
+ windows)
+ # This is a 2-stage check to make sure we have the 64-bit SDK
+ # We have to know where the SDK is installed.
+ # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
+ # MACHINE is IX86 for LINK, but this is used by the manifest,
+ # which requires x86|amd64|ia64.
+ MACHINE="X86"
+ if test "$do64bit" != "no" ; then
+ if test "x${MSSDK}x" = "xx" ; then
+ MSSDK="C:/Progra~1/Microsoft Platform SDK"
+ fi
+ MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
+ PATH64=""
+ case "$do64bit" in
+ amd64|x64|yes)
+ MACHINE="AMD64" ; # default to AMD64 64-bit build
+ PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
+ ;;
+ ia64)
+ MACHINE="IA64"
+ PATH64="${MSSDK}/Bin/Win64"
+ ;;
+ esac
+ if test ! -d "${PATH64}" ; then
+ AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
+ AC_MSG_WARN([Ensure latest Platform SDK is installed])
+ do64bit="no"
+ else
+ AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
+ do64bit_ok="yes"
+ fi
+ fi
+
+ if test "$doWince" != "no" ; then
+ if test "$do64bit" != "no" ; then
+ AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
+ fi
+ if test "$GCC" = "yes" ; then
+ AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
+ fi
+ TEA_PATH_CELIB
+ # Set defaults for common evc4/PPC2003 setup
+ # Currently Tcl requires 300+, possibly 420+ for sockets
+ CEVERSION=420; # could be 211 300 301 400 420 ...
+ TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
+ ARCH=ARM; # could be ARM MIPS X86EM ...
+ PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
+ if test "$doWince" != "yes"; then
+ # If !yes then the user specified something
+ # Reset ARCH to allow user to skip specifying it
+ ARCH=
+ eval `echo $doWince | awk -F, '{ \
+ if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
+ if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
+ if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
+ if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
+ if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
+ }'`
+ if test "x${ARCH}" = "x" ; then
+ ARCH=$TARGETCPU;
+ fi
+ fi
+ OSVERSION=WCE$CEVERSION;
+ if test "x${WCEROOT}" = "x" ; then
+ WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
+ if test ! -d "${WCEROOT}" ; then
+ WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
+ fi
+ fi
+ if test "x${SDKROOT}" = "x" ; then
+ SDKROOT="C:/Program Files/Windows CE Tools"
+ if test ! -d "${SDKROOT}" ; then
+ SDKROOT="C:/Windows CE Tools"
+ fi
+ fi
+ WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
+ SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
+ if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
+ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
+ AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
+ doWince="no"
+ else
+ # We could PATH_NOSPACE these, but that's not important,
+ # as long as we quote them when used.
+ CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
+ if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
+ CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
+ fi
+ CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
+ fi
+ fi
+
+ if test "$GCC" != "yes" ; then
+ if test "${SHARED_BUILD}" = "0" ; then
+ runtime=-MT
+ else
+ runtime=-MD
+ fi
+
+ if test "$do64bit" != "no" ; then
+ # All this magic is necessary for the Win64 SDK RC1 - hobbs
+ CC="\"${PATH64}/cl.exe\""
+ CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
+ RC="\"${MSSDK}/bin/rc.exe\""
+ lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
+ LINKBIN="\"${PATH64}/link.exe\""
+ CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
+ CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
+ # Avoid 'unresolved external symbol __security_cookie'
+ # errors, c.f. http://support.microsoft.com/?id=894573
+ TEA_ADD_LIBS([bufferoverflowU.lib])
+ elif test "$doWince" != "no" ; then
+ CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
+ if test "${TARGETCPU}" = "X86"; then
+ CC="\"${CEBINROOT}/cl.exe\""
+ else
+ CC="\"${CEBINROOT}/cl${ARCH}.exe\""
+ fi
+ CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
+ RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
+ arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
+ defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
+ if test "${SHARED_BUILD}" = "1" ; then
+ # Static CE builds require static celib as well
+ defs="${defs} _DLL"
+ fi
+ for i in $defs ; do
+ AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
+ done
+ AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
+ AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
+ CFLAGS_DEBUG="-nologo -Zi -Od"
+ CFLAGS_OPTIMIZE="-nologo -Ox"
+ lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
+ lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
+ LINKBIN="\"${CEBINROOT}/link.exe\""
+ AC_SUBST(CELIB_DIR)
+ else
+ RC="rc"
+ lflags="-nologo"
+ LINKBIN="link"
+ CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
+ CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
+ fi
+ fi
+
+ if test "$GCC" = "yes"; then
+ # mingw gcc mode
+ RC="windres"
+ CFLAGS_DEBUG="-g"
+ CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
+ SHLIB_LD="$CC -shared"
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
+ LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
+ else
+ SHLIB_LD="${LINKBIN} -dll ${lflags}"
+ # link -lib only works when -lib is the first arg
+ STLIB_LD="${LINKBIN} -lib ${lflags}"
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
+ PATHTYPE=-w
+ # For information on what debugtype is most useful, see:
+ # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
+ # This essentially turns it all on.
+ LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2"
+ LDFLAGS_OPTIMIZE="-release"
+ if test "$doWince" != "no" ; then
+ LDFLAGS_CONSOLE="-link ${lflags}"
+ LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
+ else
+ LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
+ LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
+ fi
+ fi
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".dll"
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
+
+ TCL_LIB_VERSIONS_OK=nodots
+ # Bogus to avoid getting this turned off
+ DL_OBJS="tclLoadNone.obj"
+ ;;
+ AIX-*)
+ if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
+ # AIX requires the _r compiler when gcc isn't being used
+ case "${CC}" in
+ *_r)
+ # ok ...
+ ;;
+ *)
+ CC=${CC}_r
+ ;;
+ esac
+ AC_MSG_RESULT([Using $CC for compiling with threads])
+ fi
+ LIBS="$LIBS -lc"
+ SHLIB_CFLAGS=""
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ DL_OBJS="tclLoadDl.o"
+ LD_LIBRARY_PATH_VAR="LIBPATH"
+
+ # Check to enable 64-bit flags for compiler/linker on AIX 4+
+ if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN([64bit mode not supported with GCC on $system])
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -q64"
+ LDFLAGS_ARCH="-q64"
+ RANLIB="${RANLIB} -X64"
+ AR="${AR} -X64"
+ SHLIB_LD_FLAGS="-b64"
+ fi
+ fi
+
+ if test "`uname -m`" = "ia64" ; then
+ # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ # AIX-5 has dl* in libc.so
+ DL_LIBS=""
+ if test "$GCC" = "yes" ; then
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ else
+ CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
+ fi
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ else
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="gcc -shared"
+ else
+ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ fi
+ SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ TCL_NEEDS_EXP_FILE=1
+ TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp'
+ fi
+
+ # AIX v<=4.1 has some different flags than 4.2+
+ if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
+ AC_LIBOBJ([tclLoadAix])
+ DL_LIBS="-lld"
+ fi
+
+ # On AIX <=v4 systems, libbsd.a has to be linked in to support
+ # non-blocking file IO. This library has to be linked in after
+ # the MATH_LIBS or it breaks the pow() function. The way to
+ # insure proper sequencing, is to add it to the tail of MATH_LIBS.
+ # This library also supplies gettimeofday.
+ #
+ # AIX does not have a timezone field in struct tm. When the AIX
+ # bsd library is used, the timezone global and the gettimeofday
+ # methods are to be avoided for timezone deduction instead, we
+ # deduce the timezone by comparing the localtime result on a
+ # known GMT value.
+
+ AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
+ if test $libbsd = yes; then
+ MATH_LIBS="$MATH_LIBS -lbsd"
+ AC_DEFINE(USE_DELTA_FOR_TZ, 1, [Do we need a special AIX hack for timezones?])
+ fi
+ ;;
+ BeOS*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="${CC} -nostart"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+
+ #-----------------------------------------------------------
+ # Check for inet_ntoa in -lbind, for BeOS (which also needs
+ # -lsocket, even if the network functions are in -lnet which
+ # is always linked to, for compatibility.
+ #-----------------------------------------------------------
+ AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
+ ;;
+ BSD/OS-2.1*|BSD/OS-3*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="shlicc -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ BSD/OS-4.*)
+ SHLIB_CFLAGS="-export-dynamic -fPIC"
+ SHLIB_LD="cc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ dgux*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ HP-UX-*.11.*)
+ # Use updated header definitions where possible
+ AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
+ # Needed by Tcl, but not most extensions
+ #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
+ #LIBS="$LIBS -lxnet" # Use the XOPEN network library
+
+ SHLIB_SUFFIX=".sl"
+ AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
+ LD_LIBRARY_PATH_VAR="SHLIB_PATH"
+ fi
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="gcc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ fi
+
+ # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
+ #CFLAGS="$CFLAGS +DAportable"
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = "yes" ; then
+ if test "$GCC" = "yes" ; then
+ hpux_arch=`${CC} -dumpmachine`
+ case $hpux_arch in
+ hppa64*)
+ # 64-bit gcc in use. Fix flags for GNU ld.
+ do64bit_ok=yes
+ SHLIB_LD="${CC} -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ ;;
+ *)
+ AC_MSG_WARN([64bit mode not supported with GCC on $system])
+ ;;
+ esac
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS +DD64"
+ LDFLAGS_ARCH="+DD64"
+ fi
+ fi
+ ;;
+ HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
+ SHLIB_SUFFIX=".sl"
+ AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS=""
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
+ LD_LIBRARY_PATH_VAR="SHLIB_PATH"
+ fi
+ ;;
+ IRIX-5.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ ;;
+ IRIX-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -mabi=n32"
+ LDFLAGS="$LDFLAGS -mabi=n32"
+ else
+ case $system in
+ IRIX-6.3)
+ # Use to build 6.2 compatible binaries on 6.3.
+ CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
+ ;;
+ *)
+ CFLAGS="$CFLAGS -n32"
+ ;;
+ esac
+ LDFLAGS="$LDFLAGS -n32"
+ fi
+ ;;
+ IRIX64-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+
+ # Check to enable 64-bit flags for compiler/linker
+
+ if test "$do64bit" = "yes" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN([64bit mode not supported by gcc])
+ else
+ do64bit_ok=yes
+ SHLIB_LD="ld -64 -shared -rdata_shared"
+ CFLAGS="$CFLAGS -64"
+ LDFLAGS_ARCH="-64"
+ fi
+ fi
+ ;;
+ Linux*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
+ # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
+ # when you inline the string and math operations. Turn this off to
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
+ # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS here:
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "`uname -m`" = "alpha" ; then
+ CFLAGS="$CFLAGS -mieee"
+ fi
+ if test $do64bit = yes; then
+ AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -m64"
+ AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_m64 = yes; then
+ CFLAGS="$CFLAGS -m64"
+ do64bit_ok=yes
+ fi
+ fi
+
+ # The combo of gcc + glibc has a bug related
+ # to inlining of functions like strtod(). The
+ # -fno-builtin flag should address this problem
+ # but it does not work. The -fno-inline flag
+ # is kind of overkill but it works.
+ # Disable inlining only when one of the
+ # files in compat/*.c is being linked in.
+ if test x"${USE_COMPAT}" != x ; then
+ CFLAGS="$CFLAGS -fno-inline"
+ fi
+
+ ;;
+ GNU*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ SHLIB_LD="${CC} -shared"
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ if test "`uname -m`" = "alpha" ; then
+ CFLAGS="$CFLAGS -mieee"
+ fi
+ ;;
+ Lynx*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ CFLAGS_OPTIMIZE=-02
+ SHLIB_LD="${CC} -shared "
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-mshared -ldl"
+ LD_FLAGS="-Wl,--export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ ;;
+ MP-RAS-02*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ MP-RAS-*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ NetBSD-*|FreeBSD-[[1-2]].*)
+ # NetBSD/SPARC needs -fPIC, -fpic will not do.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
+#ifdef __ELF__
+ yes
+#endif
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ if test $tcl_cv_ld_elf = yes; then
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
+ else
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
+ fi
+
+ # Ancient FreeBSD doesn't handle version numbers with dots.
+
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ OpenBSD-*)
+ # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
+ case `machine` in
+ sparc|sparc64)
+ SHLIB_CFLAGS="-fPIC";;
+ *)
+ SHLIB_CFLAGS="-fpic";;
+ esac
+ SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
+#ifdef __ELF__
+ yes
+#endif
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ if test $tcl_cv_ld_elf = yes; then
+ LDFLAGS=-Wl,-export-dynamic
+ else
+ LDFLAGS=""
+ fi
+
+ # OpenBSD doesn't do version numbers with dots.
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ FreeBSD-*)
+ # FreeBSD 3.* and greater have ELF.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "${TCL_THREADS}" = "1" ; then
+ # The -pthread needs to go in the CFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ fi
+ case $system in
+ FreeBSD-3.*)
+ # FreeBSD-3 doesn't handle version numbers with dots.
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ esac
+ ;;
+ Darwin-*)
+ CFLAGS_OPTIMIZE="-Os"
+ SHLIB_CFLAGS="-fno-common"
+ if test $do64bit = yes; then
+ case `arch` in
+ ppc)
+ AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
+ tcl_cv_cc_arch_ppc64, [
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
+ AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
+ tcl_cv_cc_arch_ppc64=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_arch_ppc64 = yes; then
+ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
+ do64bit_ok=yes
+ fi;;
+ i386)
+ AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
+ tcl_cv_cc_arch_x86_64, [
+ hold_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -arch x86_64"
+ AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
+ tcl_cv_cc_arch_x86_64=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_arch_x86_64 = yes; then
+ CFLAGS="$CFLAGS -arch x86_64"
+ do64bit_ok=yes
+ fi;;
+ *)
+ AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
+ esac
+ else
+ # Check for combined 32-bit and 64-bit fat build
+ echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
+ echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
+ fat_32_64=yes
+ fi
+ # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS here:
+ SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
+ AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
+ LDFLAGS=$hold_ldflags])
+ if test $tcl_cv_ld_single_module = yes; then
+ SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
+ fi
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".dylib"
+ DL_OBJS="tclLoadDyld.o"
+ DL_LIBS=""
+ # Don't use -prebind when building for Mac OS X 10.4 or later only:
+ test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
+ "`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
+ LDFLAGS="$LDFLAGS -prebind"
+ LDFLAGS="$LDFLAGS -headerpad_max_install_names"
+ AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
+ LDFLAGS=$hold_ldflags])
+ if test $tcl_cv_ld_search_paths_first = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
+ fi
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
+
+ # TEA specific: for Tk extensions, remove 64-bit arch flags from
+ # CFLAGS for combined 32-bit and 64-bit fat builds as neither TkAqua
+ # nor TkX11 can be built for 64-bit at present.
+ test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}" && \
+ CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`"
+ ;;
+ NEXTSTEP-*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="cc -nostdlib -r"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadNext.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OS/390-*)
+ CFLAGS_OPTIMIZE="" # Optimizer is buggy
+ AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
+ [Should OS/390 do the right thing with sockets?])
+ ;;
+ OSF1-1.0|OSF1-1.1|OSF1-1.2)
+ # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
+ SHLIB_CFLAGS=""
+ # Hack: make package name same as library name
+ SHLIB_LD='ld -R -export $@:'
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadOSF.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-1.*)
+ # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
+ SHLIB_CFLAGS="-fPIC"
+ if test "$SHARED_BUILD" = "1" ; then
+ SHLIB_LD="ld -shared"
+ else
+ SHLIB_LD="ld -non_shared"
+ fi
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-V*)
+ # Digital OSF/1
+ SHLIB_CFLAGS=""
+ if test "$SHARED_BUILD" = "1" ; then
+ SHLIB_LD='ld -shared -expect_unresolved "*"'
+ else
+ SHLIB_LD='ld -non_shared -expect_unresolved "*"'
+ fi
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -mieee"
+ else
+ CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
+ fi
+ # see pthread_intro(3) for pthread support on osf1, k.furukawa
+ if test "${TCL_THREADS}" = "1" ; then
+ CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
+ CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+ LIBS=`echo $LIBS | sed s/-lpthreads//`
+ if test "$GCC" = "yes" ; then
+ LIBS="$LIBS -lpthread -lmach -lexc"
+ else
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ fi
+ fi
+
+ ;;
+ QNX-6*)
+ # QNX RTP
+ # This may work for all QNX, but it was only reported for v6.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ # dlopen is in -lc on QNX
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SCO_SV-3.2*)
+ # Note, dlopen is available only on SCO 3.2.5 and greater. However,
+ # this test works, since "uname -s" was non-standard in 3.2.4 and
+ # below.
+ if test "$GCC" = "yes" ; then
+ SHLIB_CFLAGS="-fPIC -melf"
+ LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
+ else
+ SHLIB_CFLAGS="-Kpic -belf"
+ LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
+ fi
+ SHLIB_LD="ld -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SINIX*5.4*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SunOS-4*)
+ SHLIB_CFLAGS="-PIC"
+ SHLIB_LD="ld"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+
+ # SunOS can't handle version numbers with dots in them in library
+ # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
+ # requires an extra version number at the end of .so file names.
+ # So, the library has to have a name like libtcl75.so.1.0
+
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ SunOS-5.[[0-6]])
+ # Careful to not let 5.10+ fall into this case
+
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+ AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
+ AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
+ [Do we really want to follow the standard? Yes we do!])
+
+ SHLIB_CFLAGS="-KPIC"
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="$CC -shared"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ else
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ fi
+ ;;
+ SunOS-5*)
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+ AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
+ AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
+ [Do we really want to follow the standard? Yes we do!])
+
+ SHLIB_CFLAGS="-KPIC"
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = "yes" ; then
+ arch=`isainfo`
+ if test "$arch" = "sparcv9 sparc" ; then
+ if test "$GCC" = "yes" ; then
+ if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
+ AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -m64 -mcpu=v9"
+ LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+ SHLIB_CFLAGS="-fPIC"
+ fi
+ else
+ do64bit_ok=yes
+ if test "$do64bitVIS" = "yes" ; then
+ CFLAGS="$CFLAGS -xarch=v9a"
+ LDFLAGS_ARCH="-xarch=v9a"
+ else
+ CFLAGS="$CFLAGS -xarch=v9"
+ LDFLAGS_ARCH="-xarch=v9"
+ fi
+ # Solaris 64 uses this as well
+ #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
+ fi
+ elif test "$arch" = "amd64 i386" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN([64bit mode not supported with GCC on $system])
+ else
+ do64bit_ok=yes
+ CFLAGS="$CFLAGS -xarch=amd64"
+ LDFLAGS="$LDFLAGS -xarch=amd64"
+ fi
+ else
+ AC_MSG_WARN([64bit mode not supported for $arch])
+ fi
+ fi
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$GCC" = "yes" ; then
+ SHLIB_LD="$CC -shared"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "$do64bit_ok" = "yes" ; then
+ # We need to specify -static-libgcc or we need to
+ # add the path to the sparv9 libgcc.
+ # JH: static-libgcc is necessary for core Tcl, but may
+ # not be necessary for extensions.
+ SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
+ # for finding sparcv9 libgcc, get the regular libgcc
+ # path, remove so name and append 'sparcv9'
+ #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
+ #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
+ fi
+ else
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ fi
+ ;;
+ UNIX_SV* | UnixWare-5*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
+ # that don't grok the -Bexport option. Test that it does.
+ AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
+ LDFLAGS=$hold_ldflags])
+ if test $tcl_cv_ld_Bexport = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-Bexport"
+ fi
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ esac
+
+ if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+ AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
+ fi
+
+ # Step 4: disable dynamic loading if requested via a command-line switch.
+
+ AC_ARG_ENABLE(load,
+ AC_HELP_STRING([--enable-load],
+ [allow dynamic loading and "load" command (default: on)]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
+ if test "$tcl_ok" = "no"; then
+ DL_OBJS=""
+ fi
+
+ if test "x$DL_OBJS" != "x" ; then
+ BUILD_DLTEST="\$(DLTEST_TARGETS)"
+ else
+ echo "Can't figure out how to do dynamic loading or shared libraries"
+ echo "on this system."
+ SHLIB_CFLAGS=""
+ SHLIB_LD=""
+ SHLIB_SUFFIX=""
+ DL_OBJS="tclLoadNone.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS_ORIG"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ BUILD_DLTEST=""
+ fi
+ LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
+
+ # If we're running gcc, then change the C flags for compiling shared
+ # libraries to the right flags for gcc, instead of those for the
+ # standard manufacturer compiler.
+
+ if test "$DL_OBJS" != "tclLoadNone.o" ; then
+ if test "$GCC" = "yes" ; then
+ case $system in
+ AIX-*)
+ ;;
+ BSD/OS*)
+ ;;
+ IRIX*)
+ ;;
+ NetBSD-*|FreeBSD-*)
+ ;;
+ Darwin-*)
+ ;;
+ SCO_SV-3.2*)
+ ;;
+ windows)
+ ;;
+ *)
+ SHLIB_CFLAGS="-fPIC"
+ ;;
+ esac
+ fi
+ fi
+
+ if test "$SHARED_LIB_SUFFIX" = "" ; then
+ SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
+ fi
+ if test "$UNSHARED_LIB_SUFFIX" = "" ; then
+ UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
+ fi
+
+ AC_SUBST(DL_LIBS)
+
+ AC_SUBST(CFLAGS_DEBUG)
+ AC_SUBST(CFLAGS_OPTIMIZE)
+ AC_SUBST(CFLAGS_WARNING)
+
+ AC_SUBST(STLIB_LD)
+ AC_SUBST(SHLIB_LD)
+
+ AC_SUBST(SHLIB_LD_LIBS)
+ AC_SUBST(SHLIB_CFLAGS)
+
+ AC_SUBST(LD_LIBRARY_PATH_VAR)
+
+ # These must be called after we do the basic CFLAGS checks and
+ # verify any possible 64-bit or similar switches are necessary
+ TEA_TCL_EARLY_FLAGS
+ TEA_TCL_64BIT_FLAGS
+])
+
+#--------------------------------------------------------------------
+# TEA_SERIAL_PORT
+#
+# Determine which interface to use to talk to the serial port.
+# Note that #include lines must begin in leftmost column for
+# some compilers to recognize them as preprocessor directives,
+# and some build environments have stdin not pointing at a
+# pseudo-terminal (usually /dev/null instead.)
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines only one of the following vars:
+# HAVE_SYS_MODEM_H
+# USE_TERMIOS
+# USE_TERMIO
+# USE_SGTTY
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_SERIAL_PORT], [
+ AC_CHECK_HEADERS(sys/modem.h)
+ AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
+ AC_TRY_RUN([
+#include
+
+int main() {
+ struct termios t;
+ if (tcgetattr(0, &t) == 0) {
+ cfsetospeed(&t, 0);
+ t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ if test $tcl_cv_api_serial = no ; then
+ AC_TRY_RUN([
+#include
+
+int main() {
+ struct termio t;
+ if (ioctl(0, TCGETA, &t) == 0) {
+ t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no ; then
+ AC_TRY_RUN([
+#include
+
+int main() {
+ struct sgttyb t;
+ if (ioctl(0, TIOCGETP, &t) == 0) {
+ t.sg_ospeed = 0;
+ t.sg_flags |= ODDP | EVENP | RAW;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no ; then
+ AC_TRY_RUN([
+#include
+#include
+
+int main() {
+ struct termios t;
+ if (tcgetattr(0, &t) == 0
+ || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
+ cfsetospeed(&t, 0);
+ t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no; then
+ AC_TRY_RUN([
+#include
+#include
+
+int main() {
+ struct termio t;
+ if (ioctl(0, TCGETA, &t) == 0
+ || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
+ t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+ }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
+ fi
+ if test $tcl_cv_api_serial = no; then
+ AC_TRY_RUN([
+#include
+#include
+
+int main() {
+ struct sgttyb t;
+ if (ioctl(0, TIOCGETP, &t) == 0
+ || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
+ t.sg_ospeed = 0;
+ t.sg_flags |= ODDP | EVENP | RAW;
+ return 0;
+ }
+ return 1;
+}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
+ fi])
+ case $tcl_cv_api_serial in
+ termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
+ termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
+ sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
+ esac
+])
+
+#--------------------------------------------------------------------
+# TEA_MISSING_POSIX_HEADERS
+#
+# Supply substitutes for missing POSIX header files. Special
+# notes:
+# - stdlib.h doesn't define strtol, strtoul, or
+# strtod insome versions of SunOS
+# - some versions of string.h don't declare procedures such
+# as strstr
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# NO_DIRENT_H
+# NO_ERRNO_H
+# NO_VALUES_H
+# HAVE_LIMITS_H or NO_LIMITS_H
+# NO_STDLIB_H
+# NO_STRING_H
+# NO_SYS_WAIT_H
+# NO_DLFCN_H
+# HAVE_SYS_PARAM_H
+#
+# HAVE_STRING_H ?
+#
+# tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
+# CHECK on limits.h
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [
+ AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
+ AC_TRY_LINK([#include
+#include ], [
+#ifndef _POSIX_SOURCE
+# ifdef __Lynx__
+ /*
+ * Generate compilation error to make the test fail: Lynx headers
+ * are only valid if really in the POSIX environment.
+ */
+
+ missing_procedure();
+# endif
+#endif
+DIR *d;
+struct dirent *entryPtr;
+char *p;
+d = opendir("foobar");
+entryPtr = readdir(d);
+p = entryPtr->d_name;
+closedir(d);
+], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
+
+ if test $tcl_cv_dirent_h = no; then
+ AC_DEFINE(NO_DIRENT_H, 1, [Do we have ?])
+ fi
+
+ AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have ?])])
+ AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have ?])])
+ AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have ?])])
+ AC_CHECK_HEADER(limits.h,
+ [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have ?])],
+ [AC_DEFINE(NO_LIMITS_H, 1, [Do we have ?])])
+ AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
+ AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
+ if test $tcl_ok = 0; then
+ AC_DEFINE(NO_STDLIB_H, 1, [Do we have ?])
+ fi
+ AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
+ AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
+
+ # See also memmove check below for a place where NO_STRING_H can be
+ # set and why.
+
+ if test $tcl_ok = 0; then
+ AC_DEFINE(NO_STRING_H, 1, [Do we have ?])
+ fi
+
+ AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have ?])])
+ AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have ?])])
+
+ # OS/390 lacks sys/param.h (and doesn't need it, by chance).
+ AC_HAVE_HEADERS(sys/param.h)
+])
+
+#--------------------------------------------------------------------
+# TEA_PATH_X
+#
+# Locate the X11 header files and the X11 library archive. Try
+# the ac_path_x macro first, but if it doesn't find the X stuff
+# (e.g. because there's no xmkmf program) then check through
+# a list of possible directories. Under some conditions the
+# autoconf macro will return an include directory that contains
+# no include files, so double-check its result just to be safe.
+#
+# This should be called after TEA_CONFIG_CFLAGS as setting the
+# LIBS line can confuse some configure macro magic.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Sets the following vars:
+# XINCLUDES
+# XLIBSW
+# PKG_LIBS (appends to)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_PATH_X], [
+ if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
+ TEA_PATH_UNIX_X
+ fi
+])
+
+AC_DEFUN([TEA_PATH_UNIX_X], [
+ AC_PATH_X
+ not_really_there=""
+ if test "$no_x" = ""; then
+ if test "$x_includes" = ""; then
+ AC_TRY_CPP([#include ], , not_really_there="yes")
+ else
+ if test ! -r $x_includes/X11/Intrinsic.h; then
+ not_really_there="yes"
+ fi
+ fi
+ fi
+ if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
+ AC_MSG_CHECKING([for X11 header files])
+ found_xincludes="no"
+ AC_TRY_CPP([#include ], found_xincludes="yes", found_xincludes="no")
+ if test "$found_xincludes" = "no"; then
+ dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
+ for i in $dirs ; do
+ if test -r $i/X11/Intrinsic.h; then
+ AC_MSG_RESULT([$i])
+ XINCLUDES=" -I$i"
+ found_xincludes="yes"
+ break
+ fi
+ done
+ fi
+ else
+ if test "$x_includes" != ""; then
+ XINCLUDES="-I$x_includes"
+ found_xincludes="yes"
+ fi
+ fi
+ if test found_xincludes = "no"; then
+ AC_MSG_RESULT([couldn't find any!])
+ fi
+
+ if test "$no_x" = yes; then
+ AC_MSG_CHECKING([for X11 libraries])
+ XLIBSW=nope
+ dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
+ for i in $dirs ; do
+ if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
+ AC_MSG_RESULT([$i])
+ XLIBSW="-L$i -lX11"
+ x_libraries="$i"
+ break
+ fi
+ done
+ else
+ if test "$x_libraries" = ""; then
+ XLIBSW=-lX11
+ else
+ XLIBSW="-L$x_libraries -lX11"
+ fi
+ fi
+ if test "$XLIBSW" = nope ; then
+ AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
+ fi
+ if test "$XLIBSW" = nope ; then
+ AC_MSG_RESULT([could not find any! Using -lX11.])
+ XLIBSW=-lX11
+ fi
+ if test x"${XLIBSW}" != x ; then
+ PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
+ fi
+])
+
+#--------------------------------------------------------------------
+# TEA_BLOCKING_STYLE
+#
+# The statements below check for systems where POSIX-style
+# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
+# On these systems (mostly older ones), use the old BSD-style
+# FIONBIO approach instead.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# HAVE_SYS_IOCTL_H
+# HAVE_SYS_FILIO_H
+# USE_FIONBIO
+# O_NONBLOCK
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_BLOCKING_STYLE], [
+ AC_CHECK_HEADERS(sys/ioctl.h)
+ AC_CHECK_HEADERS(sys/filio.h)
+ TEA_CONFIG_SYSTEM
+ AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
+ case $system in
+ # There used to be code here to use FIONBIO under AIX. However, it
+ # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
+ # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
+ # code (JO, 5/31/97).
+
+ OSF*)
+ AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
+ AC_MSG_RESULT([FIONBIO])
+ ;;
+ SunOS-4*)
+ AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
+ AC_MSG_RESULT([FIONBIO])
+ ;;
+ *)
+ AC_MSG_RESULT([O_NONBLOCK])
+ ;;
+ esac
+])
+
+#--------------------------------------------------------------------
+# TEA_TIME_HANLDER
+#
+# Checks how the system deals with time.h, what time structures
+# are used on the system, and what fields the structures have.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# USE_DELTA_FOR_TZ
+# HAVE_TM_GMTOFF
+# HAVE_TM_TZADJ
+# HAVE_TIMEZONE_VAR
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_TIME_HANDLER], [
+ AC_CHECK_HEADERS(sys/time.h)
+ AC_HEADER_TIME
+ AC_STRUCT_TIMEZONE
+
+ AC_CHECK_FUNCS(gmtime_r localtime_r)
+
+ AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
+ AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;],
+ tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
+ if test $tcl_cv_member_tm_tzadj = yes ; then
+ AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
+ fi
+
+ AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
+ AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;],
+ tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
+ if test $tcl_cv_member_tm_gmtoff = yes ; then
+ AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
+ fi
+
+ #
+ # Its important to include time.h in this check, as some systems
+ # (like convex) have timezone functions, etc.
+ #
+ AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
+ AC_TRY_COMPILE([#include ],
+ [extern long timezone;
+ timezone += 1;
+ exit (0);],
+ tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
+ if test $tcl_cv_timezone_long = yes ; then
+ AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
+ else
+ #
+ # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+ #
+ AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
+ AC_TRY_COMPILE([#include ],
+ [extern time_t timezone;
+ timezone += 1;
+ exit (0);],
+ tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
+ if test $tcl_cv_timezone_time = yes ; then
+ AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
+ fi
+ fi
+])
+
+#--------------------------------------------------------------------
+# TEA_BUGGY_STRTOD
+#
+# Under Solaris 2.4, strtod returns the wrong value for the
+# terminating character under some conditions. Check for this
+# and if the problem exists use a substitute procedure
+# "fixstrtod" (provided by Tcl) that corrects the error.
+# Also, on Compaq's Tru64 Unix 5.0,
+# strtod(" ") returns 0.0 instead of a failure to convert.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Might defines some of the following vars:
+# strtod (=fixstrtod)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_BUGGY_STRTOD], [
+ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
+ if test "$tcl_strtod" = 1; then
+ AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
+ AC_TRY_RUN([
+ extern double strtod();
+ int main() {
+ char *infString="Inf", *nanString="NaN", *spaceString=" ";
+ char *term;
+ double value;
+ value = strtod(infString, &term);
+ if ((term != infString) && (term[-1] == 0)) {
+ exit(1);
+ }
+ value = strtod(nanString, &term);
+ if ((term != nanString) && (term[-1] == 0)) {
+ exit(1);
+ }
+ value = strtod(spaceString, &term);
+ if (term == (spaceString+1)) {
+ exit(1);
+ }
+ exit(0);
+ }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
+ tcl_cv_strtod_buggy=buggy)])
+ if test "$tcl_cv_strtod_buggy" = buggy; then
+ AC_LIBOBJ([fixstrtod])
+ USE_COMPAT=1
+ AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
+ fi
+ fi
+])
+
+#--------------------------------------------------------------------
+# TEA_TCL_LINK_LIBS
+#
+# Search for the libraries needed to link the Tcl shell.
+# Things like the math library (-lm) and socket stuff (-lsocket vs.
+# -lnsl) are dealt with here.
+#
+# Arguments:
+# Requires the following vars to be set in the Makefile:
+# DL_LIBS
+# LIBS
+# MATH_LIBS
+#
+# Results:
+#
+# Subst's the following var:
+# TCL_LIBS
+# MATH_LIBS
+#
+# Might append to the following vars:
+# LIBS
+#
+# Might define the following vars:
+# HAVE_NET_ERRNO_H
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_TCL_LINK_LIBS], [
+ #--------------------------------------------------------------------
+ # On a few very rare systems, all of the libm.a stuff is
+ # already in libc.a. Set compiler flags accordingly.
+ # Also, Linux requires the "ieee" library for math to work
+ # right (and it must appear before "-lm").
+ #--------------------------------------------------------------------
+
+ AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
+ AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
+
+ #--------------------------------------------------------------------
+ # Interactive UNIX requires -linet instead of -lsocket, plus it
+ # needs net/errno.h to define the socket-related error codes.
+ #--------------------------------------------------------------------
+
+ AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
+ AC_CHECK_HEADER(net/errno.h, [
+ AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have ?])])
+
+ #--------------------------------------------------------------------
+ # Check for the existence of the -lsocket and -lnsl libraries.
+ # The order here is important, so that they end up in the right
+ # order in the command line generated by make. Here are some
+ # special considerations:
+ # 1. Use "connect" and "accept" to check for -lsocket, and
+ # "gethostbyname" to check for -lnsl.
+ # 2. Use each function name only once: can't redo a check because
+ # autoconf caches the results of the last check and won't redo it.
+ # 3. Use -lnsl and -lsocket only if they supply procedures that
+ # aren't already present in the normal libraries. This is because
+ # IRIX 5.2 has libraries, but they aren't needed and they're
+ # bogus: they goof up name resolution if used.
+ # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
+ # To get around this problem, check for both libraries together
+ # if -lsocket doesn't work by itself.
+ #--------------------------------------------------------------------
+
+ tcl_checkBoth=0
+ AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
+ if test "$tcl_checkSocket" = 1; then
+ AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
+ LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
+ fi
+ if test "$tcl_checkBoth" = 1; then
+ tk_oldLibs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
+ fi
+ AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
+ [LIBS="$LIBS -lnsl"])])
+
+ # Don't perform the eval of the libraries here because DL_LIBS
+ # won't be set until we call TEA_CONFIG_CFLAGS
+
+ TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
+ AC_SUBST(TCL_LIBS)
+ AC_SUBST(MATH_LIBS)
+])
+
+#--------------------------------------------------------------------
+# TEA_TCL_EARLY_FLAGS
+#
+# Check for what flags are needed to be passed so the correct OS
+# features are available.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# _ISOC99_SOURCE
+# _LARGEFILE64_SOURCE
+# _LARGEFILE_SOURCE64
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_TCL_EARLY_FLAG],[
+ AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
+ AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
+ AC_TRY_COMPILE([[#define ]$1[ 1
+]$2], $3,
+ [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
+ [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
+ if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
+ AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
+ tcl_flags="$tcl_flags $1"
+ fi
+])
+
+AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
+ AC_MSG_CHECKING([for required early compiler flags])
+ tcl_flags=""
+ TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include ],
+ [char *p = (char *)strtoll; char *q = (char *)strtoull;])
+ TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include ],
+ [struct stat64 buf; int i = stat64("/", &buf);])
+ TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include ],
+ [char *p = (char *)open64;])
+ if test "x${tcl_flags}" = "x" ; then
+ AC_MSG_RESULT([none])
+ else
+ AC_MSG_RESULT([${tcl_flags}])
+ fi
+])
+
+#--------------------------------------------------------------------
+# TEA_TCL_64BIT_FLAGS
+#
+# Check for what is defined in the way of 64-bit features.
+#
+# Arguments:
+# None
+#
+# Results:
+#
+# Might define the following vars:
+# TCL_WIDE_INT_IS_LONG
+# TCL_WIDE_INT_TYPE
+# HAVE_STRUCT_DIRENT64
+# HAVE_STRUCT_STAT64
+# HAVE_TYPE_OFF64_T
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
+ AC_MSG_CHECKING([for 64-bit integer type])
+ AC_CACHE_VAL(tcl_cv_type_64bit,[
+ tcl_cv_type_64bit=none
+ # See if the compiler knows natively about __int64
+ AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
+ tcl_type_64bit=__int64, tcl_type_64bit="long long")
+ # See if we should use long anyway Note that we substitute in the
+ # type that is our current guess for a 64-bit type inside this check
+ # program, so it should be modified only carefully...
+ AC_TRY_COMPILE(,[switch (0) {
+ case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
+ }],tcl_cv_type_64bit=${tcl_type_64bit})])
+ if test "${tcl_cv_type_64bit}" = none ; then
+ AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
+ AC_MSG_RESULT([using long])
+ elif test "${tcl_cv_type_64bit}" = "__int64" \
+ -a "${TEA_PLATFORM}" = "windows" ; then
+ # We actually want to use the default tcl.h checks in this
+ # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
+ AC_MSG_RESULT([using Tcl header defaults])
+ else
+ AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
+ [What type should be used to define wide integers?])
+ AC_MSG_RESULT([${tcl_cv_type_64bit}])
+
+ # Now check for auxiliary declarations
+ AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
+ AC_TRY_COMPILE([#include
+#include ],[struct dirent64 p;],
+ tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
+ if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
+ AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in ?])
+ fi
+
+ AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
+ AC_TRY_COMPILE([#include ],[struct stat64 p;
+],
+ tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
+ if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
+ AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in ?])
+ fi
+
+ AC_CHECK_FUNCS(open64 lseek64)
+ AC_MSG_CHECKING([for off64_t])
+ AC_CACHE_VAL(tcl_cv_type_off64_t,[
+ AC_TRY_COMPILE([#include ],[off64_t offset;
+],
+ tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
+ dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
+ dnl functions lseek64 and open64 are defined.
+ if test "x${tcl_cv_type_off64_t}" = "xyes" && \
+ test "x${ac_cv_func_lseek64}" = "xyes" && \
+ test "x${ac_cv_func_open64}" = "xyes" ; then
+ AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in ?])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+])
+
+##
+## Here ends the standard Tcl configuration bits and starts the
+## TEA specific functions
+##
+
+#------------------------------------------------------------------------
+# TEA_INIT --
+#
+# Init various Tcl Extension Architecture (TEA) variables.
+# This should be the first called TEA_* macro.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines and substs the following vars:
+# CYGPATH
+# EXEEXT
+# Defines only:
+# TEA_VERSION
+# TEA_INITED
+# TEA_PLATFORM (windows or unix)
+#
+# "cygpath" is used on windows to generate native path names for include
+# files. These variables should only be used with the compiler and linker
+# since they generate native path names.
+#
+# EXEEXT
+# Select the executable extension based on the host type. This
+# is a lightweight replacement for AC_EXEEXT that doesn't require
+# a compiler.
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_INIT], [
+ # TEA extensions pass this us the version of TEA they think they
+ # are compatible with.
+ TEA_VERSION="3.5"
+
+ AC_MSG_CHECKING([for correct TEA configuration])
+ if test x"${PACKAGE_NAME}" = x ; then
+ AC_MSG_ERROR([
+The PACKAGE_NAME variable must be defined by your TEA configure.in])
+ fi
+ if test x"$1" = x ; then
+ AC_MSG_ERROR([
+TEA version not specified.])
+ elif test "$1" != "${TEA_VERSION}" ; then
+ AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
+ else
+ AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
+ fi
+ case "`uname -s`" in
+ *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*)
+ AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
+ EXEEXT=".exe"
+ TEA_PLATFORM="windows"
+ ;;
+ *)
+ CYGPATH=echo
+ EXEEXT=""
+ TEA_PLATFORM="unix"
+ ;;
+ esac
+
+ # Check if exec_prefix is set. If not use fall back to prefix.
+ # Note when adjusted, so that TEA_PREFIX can correct for this.
+ # This is needed for recursive configures, since autoconf propagates
+ # $prefix, but not $exec_prefix (doh!).
+ if test x$exec_prefix = xNONE ; then
+ exec_prefix_default=yes
+ exec_prefix=$prefix
+ fi
+
+ AC_SUBST(EXEEXT)
+ AC_SUBST(CYGPATH)
+
+ # This package name must be replaced statically for AC_SUBST to work
+ AC_SUBST(PKG_LIB_FILE)
+ # Substitute STUB_LIB_FILE in case package creates a stub library too.
+ AC_SUBST(PKG_STUB_LIB_FILE)
+
+ # We AC_SUBST these here to ensure they are subst'ed,
+ # in case the user doesn't call TEA_ADD_...
+ AC_SUBST(PKG_STUB_SOURCES)
+ AC_SUBST(PKG_STUB_OBJECTS)
+ AC_SUBST(PKG_TCL_SOURCES)
+ AC_SUBST(PKG_HEADERS)
+ AC_SUBST(PKG_INCLUDES)
+ AC_SUBST(PKG_LIBS)
+ AC_SUBST(PKG_CFLAGS)
+])
+
+#------------------------------------------------------------------------
+# TEA_ADD_SOURCES --
+#
+# Specify one or more source files. Users should check for
+# the right platform before adding to their list.
+# It is not important to specify the directory, as long as it is
+# in the generic, win or unix subdirectory of $(srcdir).
+#
+# Arguments:
+# one or more file names
+#
+# Results:
+#
+# Defines and substs the following vars:
+# PKG_SOURCES
+# PKG_OBJECTS
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_ADD_SOURCES], [
+ vars="$@"
+ for i in $vars; do
+ case $i in
+ [\$]*)
+ # allow $-var names
+ PKG_SOURCES="$PKG_SOURCES $i"
+ PKG_OBJECTS="$PKG_OBJECTS $i"
+ ;;
+ *)
+ # check for existence - allows for generic/win/unix VPATH
+ if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
+ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
+ ; then
+ AC_MSG_ERROR([could not find source file '$i'])
+ fi
+ PKG_SOURCES="$PKG_SOURCES $i"
+ # this assumes it is in a VPATH dir
+ i=`basename $i`
+ # handle user calling this before or after TEA_SETUP_COMPILER
+ if test x"${OBJEXT}" != x ; then
+ j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
+ else
+ j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
+ fi
+ PKG_OBJECTS="$PKG_OBJECTS $j"
+ ;;
+ esac
+ done
+ AC_SUBST(PKG_SOURCES)
+ AC_SUBST(PKG_OBJECTS)
+])
+
+#------------------------------------------------------------------------
+# TEA_ADD_STUB_SOURCES --
+#
+# Specify one or more source files. Users should check for
+# the right platform before adding to their list.
+# It is not important to specify the directory, as long as it is
+# in the generic, win or unix subdirectory of $(srcdir).
+#
+# Arguments:
+# one or more file names
+#
+# Results:
+#
+# Defines and substs the following vars:
+# PKG_STUB_SOURCES
+# PKG_STUB_OBJECTS
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_ADD_STUB_SOURCES], [
+ vars="$@"
+ for i in $vars; do
+ # check for existence - allows for generic/win/unix VPATH
+ if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
+ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
+ ; then
+ AC_MSG_ERROR([could not find stub source file '$i'])
+ fi
+ PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
+ # this assumes it is in a VPATH dir
+ i=`basename $i`
+ # handle user calling this before or after TEA_SETUP_COMPILER
+ if test x"${OBJEXT}" != x ; then
+ j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
+ else
+ j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
+ fi
+ PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
+ done
+ AC_SUBST(PKG_STUB_SOURCES)
+ AC_SUBST(PKG_STUB_OBJECTS)
+])
+
+#------------------------------------------------------------------------
+# TEA_ADD_TCL_SOURCES --
+#
+# Specify one or more Tcl source files. These should be platform
+# independent runtime files.
+#
+# Arguments:
+# one or more file names
+#
+# Results:
+#
+# Defines and substs the following vars:
+# PKG_TCL_SOURCES
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_ADD_TCL_SOURCES], [
+ vars="$@"
+ for i in $vars; do
+ # check for existence, be strict because it is installed
+ if test ! -f "${srcdir}/$i" ; then
+ AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
+ fi
+ PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
+ done
+ AC_SUBST(PKG_TCL_SOURCES)
+])
+
+#------------------------------------------------------------------------
+# TEA_ADD_HEADERS --
+#
+# Specify one or more source headers. Users should check for
+# the right platform before adding to their list.
+#
+# Arguments:
+# one or more file names
+#
+# Results:
+#
+# Defines and substs the following vars:
+# PKG_HEADERS
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_ADD_HEADERS], [
+ vars="$@"
+ for i in $vars; do
+ # check for existence, be strict because it is installed
+ if test ! -f "${srcdir}/$i" ; then
+ AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
+ fi
+ PKG_HEADERS="$PKG_HEADERS $i"
+ done
+ AC_SUBST(PKG_HEADERS)
+])
+
+#------------------------------------------------------------------------
+# TEA_ADD_INCLUDES --
+#
+# Specify one or more include dirs. Users should check for
+# the right platform before adding to their list.
+#
+# Arguments:
+# one or more file names
+#
+# Results:
+#
+# Defines and substs the following vars:
+# PKG_INCLUDES
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_ADD_INCLUDES], [
+ vars="$@"
+ for i in $vars; do
+ PKG_INCLUDES="$PKG_INCLUDES $i"
+ done
+ AC_SUBST(PKG_INCLUDES)
+])
+
+#------------------------------------------------------------------------
+# TEA_ADD_LIBS --
+#
+# Specify one or more libraries. Users should check for
+# the right platform before adding to their list. For Windows,
+# libraries provided in "foo.lib" format will be converted to
+# "-lfoo" when using GCC (mingw).
+#
+# Arguments:
+# one or more file names
+#
+# Results:
+#
+# Defines and substs the following vars:
+# PKG_LIBS
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_ADD_LIBS], [
+ vars="$@"
+ for i in $vars; do
+ if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
+ # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
+ i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
+ fi
+ PKG_LIBS="$PKG_LIBS $i"
+ done
+ AC_SUBST(PKG_LIBS)
+])
+
+#------------------------------------------------------------------------
+# TEA_ADD_CFLAGS --
+#
+# Specify one or more CFLAGS. Users should check for
+# the right platform before adding to their list.
+#
+# Arguments:
+# one or more file names
+#
+# Results:
+#
+# Defines and substs the following vars:
+# PKG_CFLAGS
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_ADD_CFLAGS], [
+ PKG_CFLAGS="$PKG_CFLAGS $@"
+ AC_SUBST(PKG_CFLAGS)
+])
+
+#------------------------------------------------------------------------
+# TEA_PREFIX --
+#
+# Handle the --prefix=... option by defaulting to what Tcl gave
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# If --prefix or --exec-prefix was not specified, $prefix and
+# $exec_prefix will be set to the values given to Tcl when it was
+# configured.
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_PREFIX], [
+ if test "${prefix}" = "NONE"; then
+ prefix_default=yes
+ if test x"${TCL_PREFIX}" != x; then
+ AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
+ prefix=${TCL_PREFIX}
+ else
+ AC_MSG_NOTICE([--prefix defaulting to /usr/local])
+ prefix=/usr/local
+ fi
+ fi
+ if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
+ -o x"${exec_prefix_default}" = x"yes" ; then
+ if test x"${TCL_EXEC_PREFIX}" != x; then
+ AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
+ exec_prefix=${TCL_EXEC_PREFIX}
+ else
+ AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
+ exec_prefix=$prefix
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_SETUP_COMPILER_CC --
+#
+# Do compiler checks the way we want. This is just a replacement
+# for AC_PROG_CC in TEA configure.in files to make them cleaner.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Sets up CC var and other standard bits we need to make executables.
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_SETUP_COMPILER_CC], [
+ # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
+ # in this macro, they need to go into TEA_SETUP_COMPILER instead.
+
+ # If the user did not set CFLAGS, set it now to keep
+ # the AC_PROG_CC macro from adding "-g -O2".
+ if test "${CFLAGS+set}" != "set" ; then
+ CFLAGS=""
+ fi
+
+ AC_PROG_CC
+ AC_PROG_CPP
+
+ AC_PROG_INSTALL
+
+ #--------------------------------------------------------------------
+ # Checks to see if the make program sets the $MAKE variable.
+ #--------------------------------------------------------------------
+
+ AC_PROG_MAKE_SET
+
+ #--------------------------------------------------------------------
+ # Find ranlib
+ #--------------------------------------------------------------------
+
+ AC_PROG_RANLIB
+
+ #--------------------------------------------------------------------
+ # Determines the correct binary file extension (.o, .obj, .exe etc.)
+ #--------------------------------------------------------------------
+
+ AC_OBJEXT
+ AC_EXEEXT
+])
+
+#------------------------------------------------------------------------
+# TEA_SETUP_COMPILER --
+#
+# Do compiler checks that use the compiler. This must go after
+# TEA_SETUP_COMPILER_CC, which does the actual compiler check.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Sets up CC var and other standard bits we need to make executables.
+#------------------------------------------------------------------------
+AC_DEFUN([TEA_SETUP_COMPILER], [
+ # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
+ AC_REQUIRE([TEA_SETUP_COMPILER_CC])
+
+ #------------------------------------------------------------------------
+ # If we're using GCC, see if the compiler understands -pipe. If so, use it.
+ # It makes compiling go faster. (This is only a performance feature.)
+ #------------------------------------------------------------------------
+
+ if test -z "$no_pipe" -a -n "$GCC"; then
+ AC_MSG_CHECKING([if the compiler understands -pipe])
+ OLDCC="$CC"
+ CC="$CC -pipe"
+ AC_TRY_COMPILE(,, AC_MSG_RESULT([yes]), CC="$OLDCC"
+ AC_MSG_RESULT([no]))
+ fi
+
+ #--------------------------------------------------------------------
+ # Common compiler flag setup
+ #--------------------------------------------------------------------
+
+ AC_C_BIGENDIAN
+ if test "${TEA_PLATFORM}" = "unix" ; then
+ TEA_TCL_LINK_LIBS
+ TEA_MISSING_POSIX_HEADERS
+ # Let the user call this, because if it triggers, they will
+ # need a compat/strtod.c that is correct. Users can also
+ # use Tcl_GetDouble(FromObj) instead.
+ #TEA_BUGGY_STRTOD
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_MAKE_LIB --
+#
+# Generate a line that can be used to build a shared/unshared library
+# in a platform independent manner.
+#
+# Arguments:
+# none
+#
+# Requires:
+#
+# Results:
+#
+# Defines the following vars:
+# CFLAGS - Done late here to note disturb other AC macros
+# MAKE_LIB - Command to execute to build the Tcl library;
+# differs depending on whether or not Tcl is being
+# compiled as a shared library.
+# MAKE_SHARED_LIB Makefile rule for building a shared library
+# MAKE_STATIC_LIB Makefile rule for building a static library
+# MAKE_STUB_LIB Makefile rule for building a stub library
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_MAKE_LIB], [
+ if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
+ MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
+ MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
+ MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)"
+ else
+ MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
+ MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
+ MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
+ fi
+
+ if test "${SHARED_BUILD}" = "1" ; then
+ MAKE_LIB="${MAKE_SHARED_LIB} "
+ else
+ MAKE_LIB="${MAKE_STATIC_LIB} "
+ fi
+
+ #--------------------------------------------------------------------
+ # Shared libraries and static libraries have different names.
+ # Use the double eval to make sure any variables in the suffix is
+ # substituted. (@@@ Might not be necessary anymore)
+ #--------------------------------------------------------------------
+
+ if test "${TEA_PLATFORM}" = "windows" ; then
+ if test "${SHARED_BUILD}" = "1" ; then
+ # We force the unresolved linking of symbols that are really in
+ # the private libraries of Tcl and Tk.
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
+ if test x"${TK_BIN_DIR}" != x ; then
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
+ fi
+ eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
+ else
+ eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
+ fi
+ # Some packages build their own stubs libraries
+ eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
+ if test "$GCC" = "yes"; then
+ PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
+ fi
+ # These aren't needed on Windows (either MSVC or gcc)
+ RANLIB=:
+ RANLIB_STUB=:
+ else
+ RANLIB_STUB="${RANLIB}"
+ if test "${SHARED_BUILD}" = "1" ; then
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
+ if test x"${TK_BIN_DIR}" != x ; then
+ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
+ fi
+ eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
+ RANLIB=:
+ else
+ eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
+ fi
+ # Some packages build their own stubs libraries
+ eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
+ fi
+
+ # These are escaped so that only CFLAGS is picked up at configure time.
+ # The other values will be substituted at make time.
+ CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
+ if test "${SHARED_BUILD}" = "1" ; then
+ CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
+ fi
+
+ AC_SUBST(MAKE_LIB)
+ AC_SUBST(MAKE_SHARED_LIB)
+ AC_SUBST(MAKE_STATIC_LIB)
+ AC_SUBST(MAKE_STUB_LIB)
+ AC_SUBST(RANLIB_STUB)
+])
+
+#------------------------------------------------------------------------
+# TEA_LIB_SPEC --
+#
+# Compute the name of an existing object library located in libdir
+# from the given base name and produce the appropriate linker flags.
+#
+# Arguments:
+# basename The base name of the library without version
+# numbers, extensions, or "lib" prefixes.
+# extra_dir Extra directory in which to search for the
+# library. This location is used first, then
+# $prefix/$exec-prefix, then some defaults.
+#
+# Requires:
+# TEA_INIT and TEA_PREFIX must be called first.
+#
+# Results:
+#
+# Defines the following vars:
+# ${basename}_LIB_NAME The computed library name.
+# ${basename}_LIB_SPEC The computed linker flags.
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_LIB_SPEC], [
+ AC_MSG_CHECKING([for $1 library])
+
+ # Look in exec-prefix for the library (defined by TEA_PREFIX).
+
+ tea_lib_name_dir="${exec_prefix}/lib"
+
+ # Or in a user-specified location.
+
+ if test x"$2" != x ; then
+ tea_extra_lib_dir=$2
+ else
+ tea_extra_lib_dir=NONE
+ fi
+
+ for i in \
+ `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
+ `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
+ `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
+ `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
+ `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
+ `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
+ `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
+ `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
+ if test -f "$i" ; then
+ tea_lib_name_dir=`dirname $i`
+ $1_LIB_NAME=`basename $i`
+ $1_LIB_PATH_NAME=$i
+ break
+ fi
+ done
+
+ if test "${TEA_PLATFORM}" = "windows"; then
+ $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
+ else
+ # Strip off the leading "lib" and trailing ".a" or ".so"
+
+ tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
+ $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
+ fi
+
+ if test "x${$1_LIB_NAME}" = x ; then
+ AC_MSG_ERROR([not found])
+ else
+ AC_MSG_RESULT([${$1_LIB_SPEC}])
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_PRIVATE_TCL_HEADERS --
+#
+# Locate the private Tcl include files
+#
+# Arguments:
+#
+# Requires:
+# TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
+# already been called.
+#
+# Results:
+#
+# Substs the following vars:
+# TCL_TOP_DIR_NATIVE
+# TCL_GENERIC_DIR_NATIVE
+# TCL_UNIX_DIR_NATIVE
+# TCL_WIN_DIR_NATIVE
+# TCL_BMAP_DIR_NATIVE
+# TCL_TOOL_DIR_NATIVE
+# TCL_PLATFORM_DIR_NATIVE
+# TCL_BIN_DIR_NATIVE
+# TCL_INCLUDES
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
+ AC_MSG_CHECKING([for Tcl private include files])
+
+ TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
+ TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
+ TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
+ TCL_UNIX_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
+ TCL_WIN_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
+ TCL_BMAP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/bitmaps\"
+ TCL_TOOL_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/tools\"
+ TCL_COMPAT_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/compat\"
+
+ if test "${TEA_PLATFORM}" = "windows"; then
+ TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE}
+ else
+ TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE}
+ fi
+ # We want to ensure these are substituted so as not to require
+ # any *_NATIVE vars be defined in the Makefile
+ TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
+ if test "`uname -s`" = "Darwin"; then
+ # If Tcl was built as a framework, attempt to use
+ # the framework's Headers and PrivateHeaders directories
+ case ${TCL_DEFS} in
+ *TCL_FRAMEWORK*)
+ if test -d "${TCL_BIN_DIR}/Headers" -a -d "${TCL_BIN_DIR}/PrivateHeaders"; then
+ TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"; else
+ TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"; fi
+ ;;
+ esac
+ fi
+
+ AC_SUBST(TCL_TOP_DIR_NATIVE)
+ AC_SUBST(TCL_GENERIC_DIR_NATIVE)
+ AC_SUBST(TCL_UNIX_DIR_NATIVE)
+ AC_SUBST(TCL_WIN_DIR_NATIVE)
+ AC_SUBST(TCL_BMAP_DIR_NATIVE)
+ AC_SUBST(TCL_TOOL_DIR_NATIVE)
+ AC_SUBST(TCL_PLATFORM_DIR_NATIVE)
+
+ AC_SUBST(TCL_INCLUDES)
+ AC_MSG_RESULT([Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}])
+])
+
+#------------------------------------------------------------------------
+# TEA_PUBLIC_TCL_HEADERS --
+#
+# Locate the installed public Tcl header files
+#
+# Arguments:
+# None.
+#
+# Requires:
+# CYGPATH must be set
+#
+# Results:
+#
+# Adds a --with-tclinclude switch to configure.
+# Result is cached.
+#
+# Substs the following vars:
+# TCL_INCLUDES
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
+ AC_MSG_CHECKING([for Tcl public headers])
+
+ AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
+
+ AC_CACHE_VAL(ac_cv_c_tclh, [
+ # Use the value from --with-tclinclude, if it was given
+
+ if test x"${with_tclinclude}" != x ; then
+ if test -f "${with_tclinclude}/tcl.h" ; then
+ ac_cv_c_tclh=${with_tclinclude}
+ else
+ AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
+ fi
+ else
+ if test "`uname -s`" = "Darwin"; then
+ # If Tcl was built as a framework, attempt to use
+ # the framework's Headers directory
+ case ${TCL_DEFS} in
+ *TCL_FRAMEWORK*)
+ list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
+ ;;
+ esac
+ fi
+
+ # Look in the source dir only if Tcl is not installed,
+ # and in that situation, look there before installed locations.
+ if test -f "${TCL_BIN_DIR}/Makefile" ; then
+ list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
+ fi
+
+ # Check order: pkg --prefix location, Tcl's --prefix location,
+ # relative to directory of tclConfig.sh.
+
+ eval "temp_includedir=${includedir}"
+ list="$list \
+ `ls -d ${temp_includedir} 2>/dev/null` \
+ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
+ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
+ if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
+ list="$list /usr/local/include /usr/include"
+ if test x"${TCL_INCLUDE_SPEC}" != x ; then
+ d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
+ list="$list `ls -d ${d} 2>/dev/null`"
+ fi
+ fi
+ for i in $list ; do
+ if test -f "$i/tcl.h" ; then
+ ac_cv_c_tclh=$i
+ break
+ fi
+ done
+ fi
+ ])
+
+ # Print a message based on how we determined the include path
+
+ if test x"${ac_cv_c_tclh}" = x ; then
+ AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
+ else
+ AC_MSG_RESULT([${ac_cv_c_tclh}])
+ fi
+
+ # Convert to a native path and substitute into the output files.
+
+ INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
+
+ TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
+
+ AC_SUBST(TCL_INCLUDES)
+])
+
+#------------------------------------------------------------------------
+# TEA_PRIVATE_TK_HEADERS --
+#
+# Locate the private Tk include files
+#
+# Arguments:
+#
+# Requires:
+# TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
+# already been called.
+#
+# Results:
+#
+# Substs the following vars:
+# TK_INCLUDES
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
+ AC_MSG_CHECKING([for Tk private include files])
+
+ TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
+ TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
+ TK_UNIX_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
+ TK_WIN_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
+ TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
+ TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
+ if test "${TEA_PLATFORM}" = "windows"; then
+ TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE}
+ else
+ TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE}
+ fi
+ # We want to ensure these are substituted so as not to require
+ # any *_NATIVE vars be defined in the Makefile
+ TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
+ if test "${TEA_WINDOWINGSYSTEM}" = "win32" \
+ -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
+ TK_INCLUDES="${TK_INCLUDES} -I${TK_XLIB_DIR_NATIVE}"
+ fi
+ if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
+ TK_INCLUDES="${TK_INCLUDES} -I${TK_SRC_DIR_NATIVE}/macosx"
+ fi
+ if test "`uname -s`" = "Darwin"; then
+ # If Tk was built as a framework, attempt to use
+ # the framework's Headers and PrivateHeaders directories
+ case ${TK_DEFS} in
+ *TK_FRAMEWORK*)
+ if test -d "${TK_BIN_DIR}/Headers" -a -d "${TK_BIN_DIR}/PrivateHeaders"; then
+ TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"; fi
+ ;;
+ esac
+ fi
+
+ AC_SUBST(TK_TOP_DIR_NATIVE)
+ AC_SUBST(TK_UNIX_DIR_NATIVE)
+ AC_SUBST(TK_WIN_DIR_NATIVE)
+ AC_SUBST(TK_GENERIC_DIR_NATIVE)
+ AC_SUBST(TK_XLIB_DIR_NATIVE)
+ AC_SUBST(TK_PLATFORM_DIR_NATIVE)
+
+ AC_SUBST(TK_INCLUDES)
+ AC_MSG_RESULT([Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}])
+])
+
+#------------------------------------------------------------------------
+# TEA_PUBLIC_TK_HEADERS --
+#
+# Locate the installed public Tk header files
+#
+# Arguments:
+# None.
+#
+# Requires:
+# CYGPATH must be set
+#
+# Results:
+#
+# Adds a --with-tkinclude switch to configure.
+# Result is cached.
+#
+# Substs the following vars:
+# TK_INCLUDES
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
+ AC_MSG_CHECKING([for Tk public headers])
+
+ AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files.], with_tkinclude=${withval})
+
+ AC_CACHE_VAL(ac_cv_c_tkh, [
+ # Use the value from --with-tkinclude, if it was given
+
+ if test x"${with_tkinclude}" != x ; then
+ if test -f "${with_tkinclude}/tk.h" ; then
+ ac_cv_c_tkh=${with_tkinclude}
+ else
+ AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
+ fi
+ else
+ if test "`uname -s`" = "Darwin"; then
+ # If Tk was built as a framework, attempt to use
+ # the framework's Headers directory.
+ case ${TK_DEFS} in
+ *TK_FRAMEWORK*)
+ list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
+ ;;
+ esac
+ fi
+
+ # Look in the source dir only if Tk is not installed,
+ # and in that situation, look there before installed locations.
+ if test -f "${TK_BIN_DIR}/Makefile" ; then
+ list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
+ fi
+
+ # Check order: pkg --prefix location, Tk's --prefix location,
+ # relative to directory of tkConfig.sh, Tcl's --prefix location,
+ # relative to directory of tclConfig.sh.
+
+ eval "temp_includedir=${includedir}"
+ list="$list \
+ `ls -d ${temp_includedir} 2>/dev/null` \
+ `ls -d ${TK_PREFIX}/include 2>/dev/null` \
+ `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
+ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
+ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
+ if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
+ list="$list /usr/local/include /usr/include"
+ fi
+ for i in $list ; do
+ if test -f "$i/tk.h" ; then
+ ac_cv_c_tkh=$i
+ break
+ fi
+ done
+ fi
+ ])
+
+ # Print a message based on how we determined the include path
+
+ if test x"${ac_cv_c_tkh}" = x ; then
+ AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
+ else
+ AC_MSG_RESULT([${ac_cv_c_tkh}])
+ fi
+
+ # Convert to a native path and substitute into the output files.
+
+ INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
+
+ TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
+
+ AC_SUBST(TK_INCLUDES)
+
+ if test "${TEA_WINDOWINGSYSTEM}" = "win32" \
+ -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
+ # On Windows and Aqua, we need the X compat headers
+ AC_MSG_CHECKING([for X11 header files])
+ if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
+ INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
+ TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
+ AC_SUBST(TK_XINCLUDES)
+ fi
+ AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_PROG_TCLSH
+# Determine the fully qualified path name of the tclsh executable
+# in the Tcl build directory or the tclsh installed in a bin
+# directory. This macro will correctly determine the name
+# of the tclsh executable even if tclsh has not yet been
+# built in the build directory. The tclsh found is always
+# associated with a tclConfig.sh file. This tclsh should be used
+# only for running extension test cases. It should never be
+# or generation of files (like pkgIndex.tcl) at build time.
+#
+# Arguments
+# none
+#
+# Results
+# Subst's the following values:
+# TCLSH_PROG
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PROG_TCLSH], [
+ AC_MSG_CHECKING([for tclsh])
+ if test -f "${TCL_BIN_DIR}/Makefile" ; then
+ # tclConfig.sh is in Tcl build directory
+ if test "${TEA_PLATFORM}" = "windows"; then
+ TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
+ else
+ TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
+ fi
+ else
+ # tclConfig.sh is in install location
+ if test "${TEA_PLATFORM}" = "windows"; then
+ TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
+ else
+ TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
+ fi
+ list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
+ `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
+ `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
+ for i in $list ; do
+ if test -f "$i/${TCLSH_PROG}" ; then
+ REAL_TCL_BIN_DIR="`cd "$i"; pwd`"
+ break
+ fi
+ done
+ TCLSH_PROG="${REAL_TCL_BIN_DIR}/${TCLSH_PROG}"
+ fi
+ AC_MSG_RESULT([${TCLSH_PROG}])
+ AC_SUBST(TCLSH_PROG)
+])
+
+#------------------------------------------------------------------------
+# TEA_PROG_WISH
+# Determine the fully qualified path name of the wish executable
+# in the Tk build directory or the wish installed in a bin
+# directory. This macro will correctly determine the name
+# of the wish executable even if wish has not yet been
+# built in the build directory. The wish found is always
+# associated with a tkConfig.sh file. This wish should be used
+# only for running extension test cases. It should never be
+# or generation of files (like pkgIndex.tcl) at build time.
+#
+# Arguments
+# none
+#
+# Results
+# Subst's the following values:
+# WISH_PROG
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PROG_WISH], [
+ AC_MSG_CHECKING([for wish])
+ if test -f "${TK_BIN_DIR}/Makefile" ; then
+ # tkConfig.sh is in Tk build directory
+ if test "${TEA_PLATFORM}" = "windows"; then
+ WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
+ else
+ WISH_PROG="${TK_BIN_DIR}/wish"
+ fi
+ else
+ # tkConfig.sh is in install location
+ if test "${TEA_PLATFORM}" = "windows"; then
+ WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
+ else
+ WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
+ fi
+ list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
+ `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
+ `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
+ for i in $list ; do
+ if test -f "$i/${WISH_PROG}" ; then
+ REAL_TK_BIN_DIR="`cd "$i"; pwd`"
+ break
+ fi
+ done
+ WISH_PROG="${REAL_TK_BIN_DIR}/${WISH_PROG}"
+ fi
+ AC_MSG_RESULT([${WISH_PROG}])
+ AC_SUBST(WISH_PROG)
+])
+
+#------------------------------------------------------------------------
+# TEA_PATH_CONFIG --
+#
+# Locate the ${1}Config.sh file and perform a sanity check on
+# the ${1} compile flags. These are used by packages like
+# [incr Tk] that load *Config.sh files from more than Tcl and Tk.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-$1=...
+#
+# Defines the following vars:
+# $1_BIN_DIR Full path to the directory containing
+# the $1Config.sh file
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PATH_CONFIG], [
+ #
+ # Ok, lets find the $1 configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-$1
+ #
+
+ if test x"${no_$1}" = x ; then
+ # we reset no_$1 in case something fails here
+ no_$1=true
+ AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
+ AC_MSG_CHECKING([for $1 configuration])
+ AC_CACHE_VAL(ac_cv_c_$1config,[
+
+ # First check to see if --with-$1 was specified.
+ if test x"${with_$1config}" != x ; then
+ case ${with_$1config} in
+ */$1Config.sh )
+ if test -f ${with_$1config}; then
+ AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
+ with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
+ fi;;
+ esac
+ if test -f "${with_$1config}/$1Config.sh" ; then
+ ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
+ else
+ AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
+ fi
+ fi
+
+ # then check for a private $1 installation
+ if test x"${ac_cv_c_$1config}" = x ; then
+ for i in \
+ ../$1 \
+ `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
+ `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
+ `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
+ ../../$1 \
+ `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
+ `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
+ ../../../$1 \
+ `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
+ `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
+ ${srcdir}/../$1 \
+ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
+ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
+ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
+ ; do
+ if test -f "$i/$1Config.sh" ; then
+ ac_cv_c_$1config=`(cd $i; pwd)`
+ break
+ fi
+ if test -f "$i/unix/$1Config.sh" ; then
+ ac_cv_c_$1config=`(cd $i/unix; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_$1config}" = x ; then
+ for i in `ls -d ${libdir} 2>/dev/null` \
+ `ls -d ${exec_prefix}/lib 2>/dev/null` \
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/$1Config.sh" ; then
+ ac_cv_c_$1config=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+
+ if test x"${ac_cv_c_$1config}" = x ; then
+ $1_BIN_DIR="# no $1 configs found"
+ AC_MSG_WARN([Cannot find $1 configuration definitions])
+ exit 0
+ else
+ no_$1=
+ $1_BIN_DIR=${ac_cv_c_$1config}
+ AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# TEA_LOAD_CONFIG --
+#
+# Load the $1Config.sh file
+#
+# Arguments:
+#
+# Requires the following vars to be set:
+# $1_BIN_DIR
+#
+# Results:
+#
+# Subst the following vars:
+# $1_SRC_DIR
+# $1_LIB_FILE
+# $1_LIB_SPEC
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_LOAD_CONFIG], [
+ AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
+
+ if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
+ AC_MSG_RESULT([loading])
+ . ${$1_BIN_DIR}/$1Config.sh
+ else
+ AC_MSG_RESULT([file not found])
+ fi
+
+ #
+ # If the $1_BIN_DIR is the build directory (not the install directory),
+ # then set the common variable name to the value of the build variables.
+ # For example, the variable $1_LIB_SPEC will be set to the value
+ # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
+ # instead of $1_BUILD_LIB_SPEC since it will work with both an
+ # installed and uninstalled version of Tcl.
+ #
+
+ if test -f ${$1_BIN_DIR}/Makefile ; then
+ AC_MSG_WARN([Found Makefile - using build library specs for $1])
+ $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
+ $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
+ $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
+ fi
+
+ AC_SUBST($1_VERSION)
+ AC_SUBST($1_BIN_DIR)
+ AC_SUBST($1_SRC_DIR)
+
+ AC_SUBST($1_LIB_FILE)
+ AC_SUBST($1_LIB_SPEC)
+
+ AC_SUBST($1_STUB_LIB_FILE)
+ AC_SUBST($1_STUB_LIB_SPEC)
+ AC_SUBST($1_STUB_LIB_PATH)
+])
+
+#------------------------------------------------------------------------
+# TEA_PATH_CELIB --
+#
+# Locate Keuchel's celib emulation layer for targeting Win/CE
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-celib=...
+#
+# Defines the following vars:
+# CELIB_DIR Full path to the directory containing
+# the include and platform lib files
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PATH_CELIB], [
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-celib
+
+ if test x"${no_celib}" = x ; then
+ # we reset no_celib in case something fails here
+ no_celib=true
+ AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval})
+ AC_MSG_CHECKING([for Windows/CE celib directory])
+ AC_CACHE_VAL(ac_cv_c_celibconfig,[
+ # First check to see if --with-celibconfig was specified.
+ if test x"${with_celibconfig}" != x ; then
+ if test -d "${with_celibconfig}/inc" ; then
+ ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
+ fi
+ fi
+
+ # then check for a celib library
+ if test x"${ac_cv_c_celibconfig}" = x ; then
+ for i in \
+ ../celib-palm-3.0 \
+ ../celib \
+ ../../celib-palm-3.0 \
+ ../../celib \
+ `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
+ ${srcdir}/../celib-palm-3.0 \
+ ${srcdir}/../celib \
+ `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
+ ; do
+ if test -d "$i/inc" ; then
+ ac_cv_c_celibconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+ if test x"${ac_cv_c_celibconfig}" = x ; then
+ AC_MSG_ERROR([Cannot find celib support library directory])
+ else
+ no_celib=
+ CELIB_DIR=${ac_cv_c_celibconfig}
+ CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
+ AC_MSG_RESULT([found $CELIB_DIR])
+ fi
+ fi
+])
+
+
+# Local Variables:
+# mode: autoconf
+# End:
diff --git a/vqtcl/buildsrc/vqtcl/tests/all.tcl b/vqtcl/buildsrc/vqtcl/tests/all.tcl
new file mode 100755
index 0000000..af48c35
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/all.tcl
@@ -0,0 +1,9 @@
+#!/usr/bin/env tclkit
+
+source [file join [file dir [info script]] initests.tcl]
+
+runAllTests
+
+eval unset [info vars ?]
+eval unset [info vars ??]
+#puts [info vars *]
\ No newline at end of file
diff --git a/vqtcl/buildsrc/vqtcl/tests/basic.test b/vqtcl/buildsrc/vqtcl/tests/basic.test
new file mode 100755
index 0000000..cba22c1
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/basic.test
@@ -0,0 +1,75 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+#puts pwd-[pwd]
+#puts auto-$auto_path
+#puts loaded-[info loaded]
+
+test 1 {} {
+ vlerq type ""
+} {}
+
+test 2 {} {
+ vlerq type [list 1 2 3]
+} list
+
+test 3 {} {
+ vlerq refs [list 1 2 3]
+} 1
+
+test 4 {} -body {
+ set v [list 1 2 3]
+ vlerq refs $v
+} -result 2 -cleanup { unset v }
+
+test 5 {} {
+ vlerq viewconv [vlerq def A {a b c}]
+} {data {mdef A} {a b c}}
+
+test 6 {0-bit ints} {
+ vlerq def A:I {0 0 0}
+} {data {mdef A:I} {0 0 0}}
+
+test 7 {1-bit ints} {
+ vlerq def A:I {0 1 1 0 1 0 0 0 1}
+} {data {mdef A:I} {0 1 1 0 1 0 0 0 1}}
+
+test 8 {2-bit ints} {
+ vlerq def A:I {0 1 2 3 2 1 0}
+} {data {mdef A:I} {0 1 2 3 2 1 0}}
+
+test 9 {4-bit ints} {
+ vlerq def A:I {0 1 14 15 2 13}
+} {data {mdef A:I} {0 1 14 15 2 13}}
+
+test 10 {8-bit ints} {
+ vlerq def A:I {0 -1 100 -100}
+} {data {mdef A:I} {0 -1 100 -100}}
+
+test 11 {16-bit ints} {
+ vlerq def A:I {1234 2345 3456}
+} {data {mdef A:I} {1234 2345 3456}}
+
+test 12 {32-bit ints} {
+ vlerq def A:I {123456 0 -654321}
+} {data {mdef A:I} {123456 0 -654321}}
+
+test 13 {64-bit ints} {
+ vlerq def A:L {12345678901 23456789012}
+} {data {mdef A:L} {12345678901 23456789012}}
+
+test 14 {32-bit floats} {
+ vlerq def A:F {1.25 2.5 3.75}
+} {data {mdef A:F} {1.25 2.5 3.75}}
+
+test 15 {64-bit floats} {
+ vlerq def A:D {1234567.25 2345678.75}
+} {data {mdef A:D} {1234567.25 2345678.75}}
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/bits.test b/vqtcl/buildsrc/vqtcl/tests/bits.test
new file mode 100755
index 0000000..ca54d24
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/bits.test
@@ -0,0 +1,76 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ vlerq bitruns {}
+} {}
+
+test 2 {} {
+ vlerq bitruns {0 1 0 0 1 1 1 0}
+} {0 1 1 2 3 1}
+
+test 3 {} {
+ vlerq bitruns {1 0 1 1 0 0 0 1}
+} {1 1 1 2 3 1}
+
+test 4 {} {
+ vlerq bitruns [split [string repeat 0 20] ""]
+} {0 20}
+
+test 5 {} {
+ vlerq bitruns [split [string repeat 01 10] ""]
+} {0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1}
+
+test 6 {} {
+ vlerq bitruns [split [string repeat 001 10] ""]
+} {0 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1}
+
+test 7 {} {
+ vlerq bitruns [split [string repeat 00001 10] ""]
+} {0 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1}
+
+test 8 {} {
+ vlerq bitruns [split [string repeat 000000001 10] ""]
+} {0 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1}
+
+test 9 {} {
+ vlerq bitruns [split [string repeat 0011 10] ""]
+} {0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2}
+
+test 10 {} {
+ vlerq bitruns [split [string repeat 0100111 5] ""]
+} {0 1 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3}
+
+test 11 {} {
+ vlerq bitruns [split [string repeat 011000 10] ""]
+} {0 1 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 3}
+
+test 12 {} {
+ set z [string repeat 0 100]
+ vlerq bitruns [split ${z}1${z} ""]
+} {0 100 1 100}
+
+test 13 {} {
+ set z [string repeat 0 1000]
+ vlerq bitruns [split ${z}1${z} ""]
+} {0 1000 1 1000}
+
+test 14 {} {
+ set z [string repeat 0 10000]
+ vlerq bitruns [split ${z}1${z} ""]
+} {0 10000 1 10000}
+
+test 15 {} {
+ set z [string repeat 0 10000]
+ vlerq bitruns [split ${z}1${z}1${z} ""]
+} {0 10000 1 10000 1 10000}
+
+unset -nocomplain z
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/blocked.test b/vqtcl/buildsrc/vqtcl/tests/blocked.test
new file mode 100755
index 0000000..233f8ff
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/blocked.test
@@ -0,0 +1,43 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+test 1 {structure of sample mkblk.db file} {
+ set bdb [vlerq open data/mkblk.db]
+ vlerq structure $bdb
+} ((II))
+
+test 2 {blocked view has 3 blocks} {
+ vlerq get $bdb 0 bv #
+} 4
+
+test 3 {blocked view structure and size} {
+ set v [vlerq blocked [vlerq get $bdb 0 bv]]
+ list [vlerq names $v] [vlerq structure $v] [vlerq size $v]
+} {{k1 k2} II 2500}
+
+test 4 {block sizes} {
+ vlerq counts [vlerq get $bdb 0 bv] _B
+} {999 999 500 2}
+
+test 5 {contents of last block} {
+ vlerq get $bdb 0 bv -1 _B *
+} {{999 -999} {1999 -1999}}
+
+test 6 {blocked view access} {
+ foreach x {0 1 998 999 1000 1998 1999 2000 2498 2499} {
+ lappend k1 [vlerq get $v $x k1]
+ lappend k2 [vlerq get $v $x k2]
+ }
+ list $k1 $k2
+} {{0 1 998 999 1000 1998 1999 2000 2498 2499}\
+ {0 -1 -998 -999 -1000 -1998 -1999 -2000 -2498 -2499}}
+
+unset -nocomplain v x k1 k2
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/column.test b/vqtcl/buildsrc/vqtcl/tests/column.test
new file mode 100755
index 0000000..5c86f1a
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/column.test
@@ -0,0 +1,113 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ vlerq colconv {}
+} {}
+
+test 2 {} {
+ vlerq type [vlerq colconv {}]
+} column
+
+test 3 {} {
+ vlerq colconv {1 2 3}
+} {1 2 3}
+
+test 4 {} {
+ vlerq type [vlerq colconv {1 2 3}]
+} column
+
+test 5 {} {
+ vlerq coerce {} I
+} {}
+
+test 6 {} {
+ vlerq coerce {0 1 1000 -0 -1 -1000} I
+} {0 1 1000 0 -1 -1000}
+
+test 7 {} {
+ vlerq coerce {a aa "" 0 1 A AA "" -0 -1} S
+} {a aa {} 0 1 A AA {} -0 -1}
+
+test 8 {} {
+ vlerq iota 0
+} {}
+
+test 9 {} {
+ vlerq iota 5
+} {0 1 2 3 4}
+
+test 10 {} {
+ vlerq omitmap {2 3 7} 9
+} {0 1 4 5 6 8}
+
+test 11 {} {
+ # 2007-02-06 new, allow unsorted map
+ vlerq omitmap {2 7 3} 9
+} {0 1 4 5 6 8}
+
+test 12 {} {
+ vlerq getcol [vlerq def A {a b c}] 0
+} {a b c}
+
+test 13 {} {
+ vlerq getcol [vlerq def A {a b c}] -1
+} {a b c}
+
+test 14 {} {
+ vlerq getcol [vlerq def A {a b c}] A
+} {a b c}
+
+test 15 {} {
+ vlerq getcol [vlerq def A:I {1 2 3}] A
+} {1 2 3}
+
+test 16 {} {
+ vlerq getcol [vlerq def {A B} {a A b B c C}] 0
+} {a b c}
+
+test 17 {} {
+ vlerq getcol [vlerq def {A B} {a A b B c C}] 1
+} {A B C}
+
+test 18 {} {
+ vlerq getcol [vlerq def {A B} {a A b B c C}] -2
+} {a b c}
+
+test 19 {} {
+ vlerq getcol [vlerq def {A B} {a A b B c C}] -1
+} {A B C}
+
+test 20 {} {
+ vlerq getcol [vlerq def {A B} {a A b B c C}] A
+} {a b c}
+
+test 21 {} {
+ vlerq getcol [vlerq def {A B} {a A b B c C}] B
+} {A B C}
+
+test 22 {} {
+ vlerq resizecol {0 11 22 33 44 55} 3 2
+} {0 11 22 0 0 33 44 55}
+
+test 23 {} {
+ set v [vlerq resizecol {0 11 22 33 44 55} 2 -3]
+} {0 11 55}
+
+test 24 {} {
+ set v [vlerq resizecol $v 2 7 ]
+} {0 11 0 0 0 0 0 0 0 55}
+
+test 25 {} {
+ set v [vlerq resizecol $v 1 -8]
+} {0 55}
+
+unset -nocomplain v
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/commit.test b/vqtcl/buildsrc/vqtcl/tests/commit.test
new file mode 100755
index 0000000..3fd9c14
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/commit.test
@@ -0,0 +1,250 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+set tmp [makeDirectory testfiles.tmp]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ set v [vlerq def A a]
+ set e [vlerq emit $v]
+ string length $e
+} 38
+
+test 2 {} {
+ binary scan $e H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 26 61 00 02 80 83 41 3a 53\
+ 81 82 88 81 8a 80 80 00 00 00 00 00 00 16 80 00\
+ 00 0b 00 00 00 0b }
+
+test 3 {} {
+ vlerq load $e
+} {data {mdef A} a}
+
+test 4 {} {
+ vlerq emitmods $v
+} ""
+
+test 5 {} {
+ set v [vlerq set $v 0 A x]
+} {data {mdef A} x}
+
+test 6 {} {
+ vlerq mutinfo $v
+} {{data {mdef A} {}}\
+ {data {mdef A} x}\
+ {data {mdef _:I} 1} 0 1 0 0}
+
+test 7 {} {
+ set d [vlerq emitmods $v]
+ string length $d
+} 43
+
+test 8 {} {
+ binary scan $d H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 2b 01 01 78 00 02 80 80 80\
+ 81 88 81 81 89 82 8a 81 8c 80 80 80 00 00 00 00\
+ 00 00 1b 90 00 00 0e 00 00 00 0d }
+
+test 9 {} {
+ vlerq loadmods $d [vlerq def A a]
+} {data {mdef A} x}
+
+test 10 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb 33 ccc}]
+ set e [vlerq emit $v]
+ string length $e
+} 55
+
+test 11 {} {
+ binary scan $e H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 37 0b 16 21 61 00 62 62 00\
+ 63 63 63 00 32 04 80 87 41 3a 49 2c 42 3a 53 83\
+ 83 88 89 8b 82 94 80 80 00 00 00 00 00 00 27 80\
+ 00 00 11 00 00 00 16 }
+
+test 12 {} {
+ vlerq load $e
+} {data {mdef {A:I B}} {11 22 33} {a bb ccc}}
+
+test 13 {} {
+ vlerq emitmods $v
+} ""
+
+test 14 {} {
+ set v [vlerq set $v 1 A 44 B dd]
+} {data {mdef {A:I B}} {11 44 33} {a dd ccc}}
+
+test 15 {} {
+ vlerq mutinfo $v
+} {{data {mdef {A:I B}} {} {}}\
+ {data {mdef {A:I B}} 44 dd}\
+ {data {mdef {_:I _:I}} 1 1} {0 0 0} {0 1 0} {0 0 0} 0}
+
+test 16 {} {
+ set d [vlerq emitmods $v]
+ string length $d
+} 50
+
+test 17 {} {
+ binary scan $d H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 32 04 01 2c 01 64 64 00 03\
+ 80 80 80 81 88 81 81 89 81 8a 81 8b 83 8c 81 8f\
+ 80 80 80 00 00 00 00 00 00 22 90 00 00 12 00 00\
+ 00 10 }
+
+test 18 {} {
+ vlerq loadmods $d [vlerq def {A:I B} {11 a 22 bb 33 ccc}]
+} {data {mdef {A:I B}} {11 44 33} {a dd ccc}}
+
+test 19 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb}]
+ set w [vlerq insert $v 1 [vlerq def {A:I B} {33 ccc 44 dddd}]]
+ set d [vlerq emitmods $w]
+ string length $d
+} 51
+
+test 20 {} {
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {33 44} {ccc dddd}} 0 0 {0 0} {0 0} {0 1 1 0} {}}
+
+test 21 {} {
+ binary scan $d H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 33 21 2c 63 63 63 00 64 64\
+ 64 64 00 54 14 80 80 80 80 82 82 88 89 8a 81 93\
+ 80 81 94 80 00 00 00 00 00 00 23 90 00 00 0e 00\
+ 00 00 15 }
+
+test 22 {} {
+ vlerq loadmods $d $v
+} {data {mdef {A:I B}} {11 33 44 22} {a ccc dddd bb}}
+
+test 23 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb 33 ccc}]
+ set w [vlerq delete $v 1 1]
+ set d [vlerq emitmods $w]
+ string length $d
+} 31
+
+test 24 {} {
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {} {}} 0 0 {0 1 0} {0 0} {0 0} {}}
+
+test 25 {} {
+ binary scan $d H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 1f 04 80 80 81 88 80 80 80\
+ 00 00 00 00 00 00 0f 90 00 00 06 00 00 00 09 }
+
+test 26 {} {
+ vlerq loadmods $d $v
+} {data {mdef {A:I B}} {11 33} {a ccc}}
+
+test 27 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb 33 ccc}]
+ set w [vlerq insert $v 1 [vlerq def {A:I B} {1 1 2 2}]]
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {1 2} {1 2}} 0 0 {0 0 0} {0 0 0} {0 1 1 0 0} {}}
+
+test 28 {} {
+ set w [vlerq insert $w 4 [vlerq def {A:I B} {3 3}]]
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {1 2 3} {1 2 3}} 0 0 {0 0 0} {0 0 0} {0 1 1 0 1 0} {}}
+
+test 29 {} {
+ vlerq loadmods [vlerq emitmods $w] $v
+} {data {mdef {A:I B}} {11 1 2 22 3 33} {a 1 2 bb 3 ccc}}
+
+test 30 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb}]
+ set w [vlerq insert $v 1 [vlerq def {A:I B} {1 c 2 d 3 e}]]
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {1 2 3} {c d e}} 0 0 {0 0} {0 0} {0 1 1 1 0} {}}
+
+test 31 {} {
+ set w [vlerq delete $w 2 1]
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {1 3} {c e}} 0 0 {0 0} {0 0} {0 1 1 0} {}}
+
+test 32 {} {
+ vlerq loadmods [vlerq emitmods $w] $v
+} {data {mdef {A:I B}} {11 1 3 22} {a c e bb}}
+
+test 33 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb 33 ccc 44 dddd 55 eeeee}]
+ set w [vlerq delete $v 1 1]
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {} {}} 0 0 {0 1 0 0 0} {0 0 0 0} {0 0 0 0} {}}
+
+test 34 {} {
+ set w [vlerq delete $w 2 1]
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {} {}} 0 0 {0 1 0 1 0} {0 0 0} {0 0 0} {}}
+
+test 35 {} {
+ vlerq loadmods [vlerq emitmods $w] $v
+} {data {mdef {A:I B}} {11 33 55} {a ccc eeeee}}
+
+test 36 {bitmaps are compressed} {
+ set v [vlerq tag 10000 A]
+ set w [vlerq set $v 5000 A -123]
+ set d [vlerq emitmods $w]
+ string length $d
+} 44 ;# would be 1292 uncompressed
+
+test 37 {} {
+ vlerq slice $w 4998 1 5
+} {data {mdef A:I} {4998 4999 -123 5001 5002}}
+
+test 38 {} {
+ lreplace [vlerq mutinfo $w] 3 5 ? ? ?
+} {{data {mdef A:I} {}} {data {mdef A:I} -123} {data {mdef _:I} 1} ? ? ? 0}
+
+test 39 {} {
+ binary scan $d H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 2c 00 04 e2 20 01 38 70 01\
+ 85 80 80 80 87 88 81 81 8f 81 90 80 80 00 00 00\
+ 00 00 00 1c 90 00 00 0b 00 00 00 11 }
+
+test 40 {} {
+ vlerq slice [vlerq loadmods $d $v] 4998 1 5
+} {data {mdef A:I} {4998 4999 -123 5001 5002}}
+
+test 41 {} {
+ set v [vlerq def {A B} {a A b B c C d D e E}]
+ set w [vlerq set [vlerq set $v 3 A 3] 1 B 1]
+ set d [vlerq emitmods $w]
+ string length $d
+} 54
+
+test 42 {set high row, then low row} {
+ vlerq mutinfo $w
+} {{data {mdef {A B}} {} {}}\
+ {data {mdef {A B}} {b 3} {1 D}}\
+ {data {mdef {_:I _:I}} {0 1} {1 0}}\
+ {0 0 0 0 0} {0 1 0 1 0} {0 0 0 0 0} {1 0}}
+
+test 43 {} {
+ binary scan $d H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 36 0a 10 33 00 02 01 31 00\
+ 02 80 80 80 81 88 82 81 89 82 8a 81 8c 80 81 8d\
+ 82 8e 81 90 80 80 80 00 00 00 00 00 00 26 90 00\
+ 00 15 00 00 00 11 }
+
+test 44 {} {
+ vlerq loadmods $d $v
+} {data {mdef {A B}} {a b c 3 e} {A 1 C D E}}
+
+unset -nocomplain d e v w
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/emit.test b/vqtcl/buildsrc/vqtcl/tests/emit.test
new file mode 100755
index 0000000..25958a3
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/emit.test
@@ -0,0 +1,219 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+set tmp [makeDirectory testfiles.tmp]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ set v [vlerq emit 123]
+ string length $v
+} 27
+
+test 2 {} {
+ vlerq load $v
+} 123
+
+test 3 {} -body {
+ binary scan $v H* w
+ regsub -all {..} $w {& }
+} -match glob -result {4? 4? 1a 00 00 00 00 1b 80 80 fb 80 00 00 00 00\
+ 00 00 0b 80 00 00 03 00 00 00 08 }
+test 4 {} {
+ set fd [open $tmp/t1.db w]
+ fconfigure $fd -translation binary
+ set r [vlerq write 124 $fd]
+ close $fd
+ set r
+} 27
+
+test 5 {} {
+ vlerq open $tmp/t1.db
+} 124
+
+test 6 {} {
+ vlerq save 125 $tmp/t2.db
+} 27
+
+test 7 {} {
+ vlerq open $tmp/t2.db
+} 125
+
+test 8 {} {
+ set v [vlerq emit [vlerq def A {a b c}]]
+ string length $v
+} 42
+
+test 9 {} {
+ vlerq load $v
+} {data {mdef A} {a b c}}
+
+test 10 {} -body {
+ binary scan $v H* w
+ regsub -all {..} $w {& }
+} -match glob -result {4? 4? 1a 00 00 00 00 2a 61 00 62 00 63 00 2a 80\
+ 83 41 3a 53 83 86 88 81 8e 80 80 00 00 00 00 00\
+ 00 1a 80 00 00 0b 00 00 00 0f }
+test 11 {} {
+ set fd [open $tmp/t3.db w]
+ fconfigure $fd -translation binary
+ set r [vlerq write [vlerq def A {a b d}] $fd]
+ close $fd
+ set r
+} 42
+
+test 12 {} {
+ vlerq open $tmp/t3.db
+} {data {mdef A} {a b d}}
+
+test 13 {} {
+ vlerq save [vlerq def A {a b e}] $tmp/t4.db
+} 42
+
+test 14 {} {
+ vlerq open $tmp/t4.db
+} {data {mdef A} {a b e}}
+
+test 15 {fix binary input conversion: used Tcl string i.s.o. bytearray} {
+ binary scan [vlerq emit [vlerq def A:B \xAB\xAC\xAD\xAE\xAF]] H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 29 ab ac ad ae af 05 80 83\
+ 41 3a 42 81 85 88 81 8d 80 80 00 00 00 00 00 00\
+ 19 80 00 00 0b 00 00 00 0e }
+
+test 16 {fix to preserve null bytes inside B fields} {
+ binary scan [vlerq emit [vlerq def A:B \xAB\x00\xAC\x00\xAD]] H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 29 ab 00 ac 00 ad 05 80 83\
+ 41 3a 42 81 85 88 81 8d 80 80 00 00 00 00 00 00\
+ 19 80 00 00 0b 00 00 00 0e }
+
+test 17 {} {
+ set v [vlerq group [vlerq def A {a aa aaa}] {} v]
+ set w [vlerq group 123 {} w]
+ set x [vlerq group [vlerq def {B C} {b c bb cc}] {} x]
+ set y [vlerq pair $v [vlerq pair $w $x]]
+} {data {mdef {{v A} {w {}} {x {B C}}}} {{data {mdef A} {a aa aaa}}}\
+ 123\
+ {{data {mdef {B C}} {b bb} {c cc}}}}
+test 18 {} {
+ set z [vlerq emit $y]
+ binary scan $z H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 63 61 00 61 61 00 61 61 61\
+ 00 32 04 80 83 89 88 82 91 80 80 80 fb 62 00 62\
+ 62 00 32 63 00 63 63 00 32 80 82 85 9d 81 a2 80\
+ 85 a3 81 a8 80 80 95 76 5b 41 3a 53 5d 2c 77 3a\
+ 56 2c 78 5b 42 3a 53 2c 43 3a 53 5d 81 87 93 83\
+ 9a 8c a9 80 00 00 00 00 00 00 53 80 00 00 1e 00\
+ 00 00 35 }
+
+test 19 {} {
+ vlerq load $z
+} {data {mdef {{v A} {w {}} {x {B C}}}} {{data {mdef A} {a aa aaa}}}\
+ 123\
+ {{data {mdef {B C}} {b bb} {c cc}}}}
+test 20 {} {
+ set z [vlerq emit [vlerq def {{A B}} [list [vlerq def B {1 2}] \
+ [vlerq def B {3 4 5}]]]]
+ binary scan $z H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 3d 31 00 32 00 22 33 00 34\
+ 00 35 00 2a 80 82 84 88 81 8c 80 80 83 86 8d 81\
+ 93 80 80 86 41 5b 42 3a 53 5d 82 8e 94 80 00 00\
+ 00 00 00 00 2d 80 00 00 0b 00 00 00 22 }
+
+test 21 {} {
+ set z [vlerq emit [vlerq def A:V [list [vlerq def B {1 2}] \
+ [vlerq def C {3 4 5}]]]]
+ binary scan $z H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 42 31 00 32 00 22 33 00 34\
+ 00 35 00 2a 80 83 42 3a 53 82 84 88 81 8c 80 80\
+ 83 43 3a 53 83 86 8d 81 93 80 80 83 41 3a 56 82\
+ 96 94 80 00 00 00 00 00 00 32 80 00 00 08 00 00\
+ 00 2a }
+
+test 22 {} {
+ vlerq load $z
+} {data {mdef {{A {}}}} {{data {mdef B} {1 2}} {data {mdef C} {3 4 5}}}}
+
+test 23 {0-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:I {0 0 0}]]
+} {data {mdef A:I} {0 0 0}}
+
+test 24 {1-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:I {0 1 1 0 1 0 0 0 1}]]
+} {data {mdef A:I} {0 1 1 0 1 0 0 0 1}}
+
+test 25 {2-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:I {0 1 2 3 2 1 0}]]
+} {data {mdef A:I} {0 1 2 3 2 1 0}}
+
+test 26 {4-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:I {0 1 14 15 2 13}]]
+} {data {mdef A:I} {0 1 14 15 2 13}}
+
+test 27 {8-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:I {0 -1 100 -100}]]
+} {data {mdef A:I} {0 -1 100 -100}}
+
+test 28 {16-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:I {1234 2345 3456}]]
+} {data {mdef A:I} {1234 2345 3456}}
+
+test 29 {32-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:I {123456 0 -654321}]]
+} {data {mdef A:I} {123456 0 -654321}}
+
+test 30 {64-bit ints} {
+ vlerq load [vlerq emit [vlerq def A:L {12345678901 23456789012}]]
+} {data {mdef A:L} {12345678901 23456789012}}
+
+test 31 {32-bit floats} {
+ vlerq load [vlerq emit [vlerq def A:F {1.25 2.5 3.75}]]
+} {data {mdef A:F} {1.25 2.5 3.75}}
+
+test 32 {64-bit floats} {
+ vlerq load [vlerq emit [vlerq def A:D {1234567.25 2345678.75}]]
+} {data {mdef A:D} {1234567.25 2345678.75}}
+
+test 33 {} {
+ set v [vlerq tag 10000 A]
+ vlerq get [vlerq meta $v]
+} {A I {}}
+
+test 34 {} {
+ string length [vlerq emit $v]
+} 20035
+
+test 35 {} {
+ vlerq def A {1 {}}
+} {data {mdef A} {1 {}}}
+
+test 36 {F117, 2006-12-16} {
+ set z [vlerq emit [vlerq def A {1 {}}]]
+ binary scan $z H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 26 31 00 02 80 83 41 3a 53\
+ 82 82 88 81 8a 80 80 00 00 00 00 00 00 16 80 00\
+ 00 0b 00 00 00 0b }
+
+test 37 {F117, 2006-12-16} {
+ vlerq load [vlerq emit [vlerq def A {1 {}}]]
+} {data {mdef A} {1 {}}}
+
+test 38 {} {
+ vlerq def A {{} 1}
+} {data {mdef A} {{} 1}}
+
+test 39 {} {
+ vlerq load [vlerq emit [vlerq def A {{} 1}]]
+} {data {mdef A} {{} 1}}
+
+unset -nocomplain r v w x y z fd
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/error.test b/vqtcl/buildsrc/vqtcl/tests/error.test
new file mode 100755
index 0000000..c0eaf9c
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/error.test
@@ -0,0 +1,208 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {vlerq without command name} -body {
+ vlerq
+} -returnCodes 1 -result {wrong # args: should be "vlerq command ..."}
+
+test 2 {vlerq with a bad command name} -body {
+ vlerq ?
+} -returnCodes 1 -result {bad command "?": must be open, save, append, bitruns, blocked, clone, coerce, colconv, colmap, colomit, compare, compat, concat, counts, countscol, countview, data, debug, def, delete, deps, emit, emitmods, except, exceptmap, first, get, getcol, getinfo, group, grouped, hashcol, hashfind, hashview, ijoin, insert, intersect, iota, isectmap, join, last, load, loadmods, loop, max, mdef, mdesc, meta, min, mutinfo, namecol, names, omitmap, onecol, pair, product, ref, refs, remap, remapsub, rename, repeat, replace, resizecol, reverse, rowcmp, roweq, rowhash, set, size, slice, sort, sortmap, spread, step, strlookup, structdesc, structure, sum, tag, take, to, type, types, ungroup, union, unionmap, unique, uniquemap, view, viewascol, viewconv, width, or write}
+
+test 3 {colconv without list} -body {
+ vlerq colconv
+} -returnCodes 1 -result {wrong # args: should be "vlerq colconv list"}
+
+test 4 {colconv with a non-list} -body {
+ vlerq colconv "\{"
+} -returnCodes 1 -result {unmatched open brace in list}
+
+test 5 {viewconv without value} -body {
+ vlerq viewconv
+} -returnCodes 1 -result {wrong # args: should be "vlerq viewconv view"}
+
+test 6 {type without value} -body {
+ vlerq type
+} -returnCodes 1 -result {wrong # args: should be "vlerq type any"}
+
+test 7 {refs without value} -body {
+ vlerq refs
+} -returnCodes 1 -result {wrong # args: should be "vlerq refs any"}
+
+test 8 {meta without view} -body {
+ vlerq meta
+} -returnCodes 1 -result {wrong # args: should be "vlerq meta view"}
+
+test 9 {size without view} -body {
+ vlerq size
+} -returnCodes 1 -result {wrong # args: should be "vlerq size view"}
+
+test 10 {negative size} {
+ catch { vlerq size -123 } ;# TODO: return proper error message
+} 1
+
+test 11 {bad variable reference} -body {
+ vlerq size @?
+} -returnCodes 1 -result {can't read "?": no such variable}
+
+test 12 {ref without varname} -body {
+ vlerq ref
+} -returnCodes 1 -result {wrong # args: should be "vlerq ref any ..."}
+
+test 13 {to with too few args} -body {
+ vlerq to ?
+} -returnCodes 1 -result {wrong # args: should be "vlerq to any any"}
+
+test 14 {non-existent view operation} -body {
+ vlerq viewconv {foo bar}
+} -returnCodes 1 -match glob -result {bad command "foo": must be open, *}
+
+test 15 {locate the load path of the vlerq extension} -body {
+ foreach x [info loaded] {
+ foreach {path name} $x break
+ if {$name eq "Vlerq"} break
+ }
+ set path
+ # match either a reasonable real path or the empty string if statically linked
+} -match regexp -result {^(.*/(?:(?:libvlerq)|(?:vqtcl)).*\..*|)$}
+
+test 16 {open is not allowed in safe interpreters} -body {
+ set i [interp create -safe]
+ load $path Vlerq $i
+ catch { $i eval {vlerq open} } msg
+ interp delete $i
+ set msg
+} -match glob -result {bad command "open": must be append, *}
+
+test 17 {open should be supported in normal interpreters} {
+ catch { vlerq open } msg
+ set msg
+} {wrong # args: should be "vlerq open string"}
+
+test 18 {open file which does not exist} -body {
+ vlerq open blah-blah-blah
+} -returnCodes 1 -result {cannot open file: blah-blah-blah}
+
+test 19 {define zero-width view with data} -body {
+ vlerq def {} {1 2 3}
+} -returnCodes 1 -result {cannot insert in zero-width view}
+
+test 20 {define with incorrect number of items} -body {
+ vlerq def {A B} {1 2 3}
+} -returnCodes 1 -result {item count not a multiple of column width}
+
+test 21 {view cmd without args} -body {
+ vlerq view
+} -returnCodes 1 -result {wrong # args: should be "view arg ?op ...? ?| ...?"}
+
+test 22 {} -body {
+ vlerq view 3 | ?
+} -returnCodes 1 -match glob -result {bad command "?": must be open, *}
+
+test 23 {untyped sum} -body {
+ set x [vlerq sum [vlerq def A {1 2 3 4}] A]
+} -returnCodes 1 -result {} ;# TODO: sum should return an error message
+
+test 24 {} -body {
+ vlerq def A:I [list ""]
+} -returnCodes 1 -result {expected integer but got ""}
+
+test 25 {} -body {
+ vlerq def A:I 1.2
+} -returnCodes 1 -result {expected integer but got "1.2"}
+
+test 26 {} -body {
+ vlerq def A:L 2.3
+} -returnCodes 1 -result {expected integer but got "2.3"}
+
+test 27 {} -body {
+ vlerq def A:F a
+} -returnCodes 1 -result {expected floating-point number but got "a"}
+
+test 28 {} -body {
+ vlerq def A:D b
+} -returnCodes 1 -result {expected floating-point number but got "b"}
+
+test 29 {} -body {
+ vlerq def A { {}? }
+} -returnCodes 1 -result \
+ {list element in braces followed by "?" instead of space}
+
+test 30 {} -body {
+ vlerq data [vlerq mdef A] { {}? }
+} -returnCodes 1 -result \
+ {list element in braces followed by "?" instead of space}
+
+test 31 {F118, 2006-12-16} -body {
+ vlerq get [vlerq def a {1 2 3 4}] 4 a
+} -returnCodes 1 -result {row index out of range}
+
+test 32 {} -body {
+ vlerq get [vlerq def a {1 2 3 4}] -5 a
+} -returnCodes 1 -result {row index out of range}
+
+test 33 {} -body {
+ vlerq get [vlerq def a {1 2 3 4}] 0 1
+} -returnCodes 1 -result {column index out of range}
+
+test 34 {} -body {
+ vlerq get [vlerq def a {1 2 3 4}] 0 -2
+} -returnCodes 1 -result {column index out of range}
+
+test 35 {} -body {
+ vlerq get [vlerq def a {1 2 3 4}] -5 -2
+} -returnCodes 1 -result {row index out of range}
+
+test 36 {} -body {
+ vlerq mdesc {a]b[,}
+} -returnCodes 1 -result {invalid view}
+
+test 37 {} -body {
+ vlerq mdef {{a b c}}
+} -returnCodes 1 -result {invalid view}
+
+test 38 {} -body {
+ vlerq rename
+} -returnCodes 1 -result {wrong # args: should be "vlerq rename view any"}
+
+test 39 {} -body {
+ vlerq getcol
+} -returnCodes 1 -result {wrong # args: should be "vlerq getcol view col"}
+
+test 40 {} -body {
+ vlerq group
+} -returnCodes 1 \
+ -result {wrong # args: should be "vlerq group view col* string"}
+
+test 41 {} -body {
+ # F142, 2007-03-02
+ vlerq def a:0 1
+} -returnCodes 1 -result {invalid view}
+
+test 42 {F150} -body {
+ vlerq colmap [vlerq def A {}] B
+} -returnCodes 1 -result {colmap: invalid column name}
+
+test 43 {F151 concat} -body {
+ set v [vlerq def {A B} {}]
+ set w [vlerq def A {}]
+ vlerq concat $v $w
+} -returnCodes 1 -result {invalid view}
+
+test 44 {F151 union} -body {
+ vlerq union $v $w
+} -returnCodes 1 -result {invalid view}
+
+test 45 {incompatible intersect} -body {
+ vlerq intersect $v $w
+} -returnCodes 1 -result {invalid view}
+
+unset -nocomplain v w x i
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/file.test b/vqtcl/buildsrc/vqtcl/tests/file.test
new file mode 100755
index 0000000..0f6970b
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/file.test
@@ -0,0 +1,190 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ vlerq meta [vlerq open data/lkit-le.db]
+} {mdef {{dirs {name parent:I {files {name size:I date:I contents:B}}}}}}
+
+test 2 {} {
+ vlerq meta [vlerq open data/lkit-be.db]
+} {mdef {{dirs {name parent:I {files {name size:I date:I contents:B}}}}}}
+
+test 3 {} -body {
+ set v [vlerq get [vlerq open data/lkit-le.db] 0 0]
+} -match glob -result {data *\
+ { lib app-listk cgi1.6} {-1 0 1 1}\
+ {{data * {main.tcl ChangeLog} {67 167} {1039266154 1046092593} {* *}}\
+ {data * {} {} {} {}}\
+ {data * {pkgIndex.tcl listk.tcl tcl2html.tcl} {72 2452 5801}\
+ {1039266186 1046093102 1046093789} {* * *}}\
+ {data * {pkgIndex.tcl cgi.tcl} {532 65885} {1020940611 1020940611} {* *}}}}
+
+test 4 {} {
+ list [string length [vlerq get $v 0 2 0 3]] \
+ [string length [vlerq get $v 0 2 1 3]] \
+ [string length [vlerq get $v 2 2 0 3]] \
+ [string length [vlerq get $v 2 2 1 3]] \
+ [string length [vlerq get $v 2 2 2 3]] \
+ [string length [vlerq get $v 3 2 0 3]] \
+ [string length [vlerq get $v 3 2 1 3]]
+} {54 130 72 1132 2434 317 15621}
+
+test 5 {} -body {
+ set w [vlerq get [vlerq open data/lkit-be.db] 0 0]
+} -match glob -result {data *\
+ { lib app-listk cgi1.6} {-1 0 1 1}\
+ {{data * {ChangeLog main.tcl} {167 67} {1046092593 1039266154} {* *}}\
+ {data * {} {} {} {}}\
+ {data * {listk.tcl pkgIndex.tcl tcl2html.tcl} {2452 72 5801}\
+ {1046093102 1039266186 1046093789} {* * *}}\
+ {data * {cgi.tcl pkgIndex.tcl} {65885 532} {1020940611 1020940611} {* *}}}}
+
+test 6 {} {
+ list [string length [vlerq get $w 0 2 0 3]] \
+ [string length [vlerq get $w 0 2 1 3]] \
+ [string length [vlerq get $w 2 2 0 3]] \
+ [string length [vlerq get $w 2 2 1 3]] \
+ [string length [vlerq get $w 2 2 2 3]] \
+ [string length [vlerq get $w 3 2 0 3]] \
+ [string length [vlerq get $w 3 2 1 3]]
+} {130 54 1132 72 2434 15621 317}
+
+test 7 {} -body {
+ set fd [open data/lkit-le.db]
+ fconfigure $fd -translation binary
+ set data [read $fd]
+ close $fd
+ vlerq get [vlerq load $data] 0 0
+} -match glob -result {data *\
+ { lib app-listk cgi1.6} {-1 0 1 1}\
+ {{data * {main.tcl ChangeLog} {67 167} {1039266154 1046092593} {* *}}\
+ {data * {} {} {} {}}\
+ {data * {pkgIndex.tcl listk.tcl tcl2html.tcl} {72 2452 5801}\
+ {1039266186 1046093102 1046093789} {* * *}}\
+ {data * {pkgIndex.tcl cgi.tcl} {532 65885} {1020940611 1020940611} {* *}}}}
+
+test 8 {} -body {
+ set fd [open data/lkit-be.db]
+ fconfigure $fd -translation binary
+ set data [read $fd]
+ close $fd
+ vlerq get [vlerq load $data] 0 0
+} -match glob -result {data *\
+ { lib app-listk cgi1.6} {-1 0 1 1}\
+ {{data * {ChangeLog main.tcl} {167 67} {1046092593 1039266154} {* *}}\
+ {data * {} {} {} {}}\
+ {data * {listk.tcl pkgIndex.tcl tcl2html.tcl} {2452 72 5801}\
+ {1046093102 1039266186 1046093789} {* * *}}\
+ {data * {cgi.tcl pkgIndex.tcl} {65885 532} {1020940611 1020940611} {* *}}}}
+
+test 9 {} {
+ vlerq structure $v
+} SI(SIIB)
+
+test 10 {} {
+ vlerq structdesc $v
+} {name:S,parent:I,files[name:S,size:I,date:I,contents:B]}
+
+test 11 {} {
+ vlerq compat $v $w
+} 1
+
+test 12 {} {
+ vlerq compare $v $w
+} 1
+
+test 13 {} {
+ vlerq compare $w $v
+} -1
+
+test 14 {} {
+ set r {}
+ foreach i {0 1 2 3} {
+ lappend r [vlerq compare [vlerq get $v $i 2] [vlerq get $w $i 2]]
+ }
+ set r
+} {1 0 1 1}
+
+test 15 {} {
+ set r {}
+ foreach i {0 1 2 3} {
+ lappend r [vlerq compare [vlerq get $w $i 2] [vlerq get $v $i 2]]
+ }
+ set r
+} {-1 0 -1 -1}
+
+test 16 {} {
+ set r {}
+ foreach i {0 1 2 3} {
+ lappend r [vlerq compare [vlerq sort [vlerq get $v $i 2]] \
+ [vlerq sort [vlerq get $w $i 2]]]
+ }
+ set r
+} {0 0 0 0}
+
+test 17 {} {
+ vlerq open data/gtest.db
+} {data {mdef {{frequents {drinker bar perweek:I}}\
+ {likes {drinker beer perday:I}}\
+ {serves {bar beer quantity:I}}}}\
+ {{data {mdef {drinker bar perweek:I}}\
+ {adam woody sam norm wilt norm lola norm woody pierre}\
+ {lolas cheers cheers cheers joes joes lolas lolas lolas frankies}\
+ {1 5 5 3 2 1 6 2 1 0}}}\
+ {{data {mdef {drinker beer perday:I}}\
+ {adam wilt sam norm norm nan woody lola}\
+ {bud rollingrock bud rollingrock bud sierranevada pabst mickies}\
+ {2 1 2 3 2 1 2 5}}}\
+ {{data {mdef {bar beer quantity:I}}\
+ {cheers cheers joes joes joes lolas lolas winkos frankies}\
+ {bud samaddams bud samaddams mickies mickies pabst rollingrock snafu}\
+ {500 255 217 13 2222 1515 333 432 5}}}}
+
+test 18 {} {
+ set v [vlerq def {A {B C}} [list a [vlerq def C {1 2 3}] \
+ b [vlerq def C {4 5 6 7}]]]
+ vlerq get $v
+} {a {data {mdef C} {1 2 3}} b {data {mdef C} {4 5 6 7}}}
+
+test 19 {} {
+ vlerq get [vlerq load [vlerq emit $v]]
+} {a {data {mdef C} {1 2 3}} b {data {mdef C} {4 5 6 7}}}
+
+test 20 {} {
+ set v [vlerq def {A B:V} [list a [vlerq def C {1 2 3}] \
+ b [vlerq def {D E} {4 5 6 7}]]]
+ vlerq get $v
+} {a {data {mdef C} {1 2 3}} b {data {mdef {D E}} {4 6} {5 7}}}
+
+test 21 {} {
+ vlerq meta [vlerq load [vlerq emit $v]]
+} {mdef {A {B {}}}}
+
+test 22 {} {
+ set z [vlerq emit $v]
+ binary scan $z H* w
+ regsub -all {..} [string replace $w 0 3 4?4?] {& }
+} {4? 4? 1a 00 00 00 00 5e 61 00 62 00 22 31 00 32\
+ 00 33 00 2a 34 00 36 00 22 35 00 37 00 22 80 83\
+ 43 3a 53 83 86 8d 81 93 80 80 87 44 3a 53 2c 45\
+ 3a 53 82 84 94 81 98 80 84 99 81 9d 80 80 87 41\
+ 3a 53 2c 42 3a 56 82 84 88 81 8c 80 9f 9e 80 00\
+ 00 00 00 00 00 4e 80 00 00 11 00 00 00 3d }
+
+test 23 {} {
+ vlerq get [vlerq load [vlerq emit $v]] 0 *
+} {a {data {mdef C} {1 2 3}}}
+
+test 24 {} {
+ vlerq get [vlerq load [vlerq emit $v]] 1 *
+} {b {data {mdef {D E}} {4 6} {5 7}}}
+
+unset -nocomplain r v w i z fd
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/get.test b/vqtcl/buildsrc/vqtcl/tests/get.test
new file mode 100755
index 0000000..0347fb3
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/get.test
@@ -0,0 +1,72 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ set v [vlerq data [vlerq mdef {A B}] {a b c} {d e f}]
+ vlerq get $v
+} {a d b e c f}
+
+test 2 {} { vlerq get 5 # } 5
+test 3 {} { vlerq get 5 * } {{} {} {} {} {}}
+test 4 {} { vlerq get 5 * * } {}
+test 5 {} { vlerq get 5 * # } {0 1 2 3 4}
+
+test 6 {} { vlerq get 5 @ # } 0
+test 7 {} { vlerq get 5 @ * 0 } {}
+test 8 {} { vlerq get 5 @ * } {}
+test 9 {} { vlerq get 5 @ * * } {}
+test 10 {} { vlerq get 5 @ * # } {}
+
+test 11 {} { vlerq get 5 @ @ # } 3
+test 12 {} { vlerq get 5 @ @ * 0 } {name type subv}
+test 13 {} { vlerq get 5 @ @ * 1 } {S S V}
+test 14 {} { vlerq get 5 @ @ * 2 } {{} {} {}}
+test 15 {} { vlerq get 5 @ @ * -1 } {{} {} {}}
+test 16 {} { vlerq get 5 @ @ * -2 } {S S V}
+test 17 {} { vlerq get 5 @ @ * -3 } {name type subv}
+test 18 {} { vlerq get 5 @ @ * } {{name S {}} {type S {}} {subv V {}}}
+test 19 {} { vlerq get 5 @ @ * * } {name S {} type S {} subv V {}}
+test 20 {} { vlerq get 5 @ @ * # } {0 1 2}
+
+test 21 {} { vlerq get "" # } 0
+test 22 {} { vlerq get "" * 0 } {}
+test 23 {} { vlerq get "" * } {}
+test 24 {} { vlerq get "" * * } {}
+test 25 {} { vlerq get "" * # } {}
+
+test 26 {} { vlerq get "" @ # } 3
+test 27 {} { vlerq get "" @ * 0 } {name type subv}
+test 28 {} { vlerq get "" @ * 1 } {S S V}
+test 29 {} { vlerq get "" @ * 2 } {{} {} {}}
+test 30 {} { vlerq get "" @ * -1 } {{} {} {}}
+test 31 {} { vlerq get "" @ * -2 } {S S V}
+test 32 {} { vlerq get "" @ * -3 } {name type subv}
+test 33 {} { vlerq get "" @ * } {{name S {}} {type S {}} {subv V {}}}
+test 34 {} { vlerq get "" @ * * } {name S {} type S {} subv V {}}
+test 35 {} { vlerq get "" @ * # } {0 1 2}
+
+test 36 {} { vlerq get "" @ * name } {name type subv}
+test 37 {} { vlerq get "" @ * type } {S S V}
+test 38 {} { vlerq get "" @ * subv } {{} {} {}}
+
+test 39 {} { vlerq get "" @ 0 } {name name type S subv {}}
+test 40 {} { vlerq get "" @ 1 } {name type type S subv {}}
+test 41 {} { vlerq get "" @ 2 } {name subv type V subv {}}
+
+test 42 {} { vlerq get "" @ # * # } {0 1 2}
+
+test 43 {} {
+ vlerq get [vlerq def A {a b c}] * #
+} {0 1 2}
+
+test 43 {} {
+ vlerq get [vlerq def A {a b c}] -2 #
+} 1
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/hash.test b/vqtcl/buildsrc/vqtcl/tests/hash.test
new file mode 100755
index 0000000..a368165
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/hash.test
@@ -0,0 +1,431 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ vlerq hashcol I {}
+} {}
+
+test 2 {} {
+ vlerq hashcol I {0 1 10 -0 -1 -10}
+} {0 1 10 0 -1 -10}
+
+test 3 {} {
+ vlerq hashcol L {0 -0 123456789 12345678901 12345678902}
+} {0 0 123456789 -539222985 -539222988}
+
+test 4 {} tcl8.4 {
+ vlerq hashcol D {0 -0 12345.6789 12345.678901 12345.678902}
+} {0 -2147483648 -1493572489 -1494073142 -1500863666}
+
+test 5 {} tcl8.4 {
+ vlerq hashcol F {0 -0 12345.6789 12345.678901 12345.678902}
+} {0 -2147483648 1178658487 1178658487 1178658487}
+
+test 6 {} {
+ vlerq hashcol S {"" a aa A 0 1 -0}
+} {0 698601184 1080305280 -107479360 -938362831 1636964016 1298176885}
+
+test 7 {} {
+ vlerq hashcol B {"" a aa A 0 1 -0}
+} {3166080 698601184 1080305280 -107479360 -938362831 1636964016 1298176885}
+
+test 8 {} {
+ vlerq hashview {}
+} {}
+
+test 9 {} {
+ vlerq hashview [vlerq meta ""]
+} {-236896329 -54087954 589683543}
+
+test 10 {} {
+ vlerq rowhash [vlerq meta ""] 1
+} -54087954
+
+test 11 {} {
+ vlerq rowhash [vlerq def A:B abc] 0
+} -307079773
+
+test 12 {} {
+ vlerq getinfo {} {} 0
+} {{} {0 0 0 0} {}}
+
+test 13 {} {
+ set v [vlerq def A:I {1 2 1 2 1 3}]
+ vlerq getinfo $v $v 0
+} {{0 1 5} {0 0 0 2 0 3 0 1} {1 2 1 2 1 3}}
+
+test 14 {} {
+ set v [vlerq def A {a b a b a c}]
+ set h [vlerq getinfo $v $v 0]
+} {{0 1 5} {2 0 3 1 0 0 0 0}\
+ {698601184 -1021039261 698601184 -1021039261 698601184 1554287586}}
+
+test 15 {} {
+ eval [linsert $h 0 vlerq hashfind $v 1 $v]
+} 1
+
+test 16 {} {
+ eval [linsert $h 0 vlerq hashfind [vlerq def A x] 0 $v]
+} -1
+
+test 17 {} {
+ vlerq getinfo {} {} 1
+} {{} {} {}}
+
+test 18 {} {
+ set v [vlerq def A:I {1 2 1 2 1 3}]
+ vlerq getinfo $v $v 1
+} {{0 1 5} {3 5 6} {0 2 4 1 3 5}}
+
+test 19 {} {
+ set v [vlerq def A {a b a b a c}]
+ vlerq getinfo $v $v 1
+} {{0 1 5} {3 5 6} {0 2 4 1 3 5}}
+
+test 20 {} {
+ vlerq uniquemap {}
+} {}
+
+test 21 {} {
+ vlerq uniquemap [vlerq def A:I {1 2 1 2 1 3}]
+} {0 1 5}
+
+test 22 {} {
+ vlerq uniquemap [vlerq def A:I {1 2 3 4 5 6}]
+} {0 1 2 3 4 5}
+
+test 23 {} {
+ vlerq uniquemap [vlerq def A {a b a b a c}]
+} {0 1 5}
+
+test 24 {} {
+ vlerq uniquemap [vlerq def A {a a a a a a}]
+} {0}
+
+test 25 {} {
+ vlerq uniquemap [vlerq data [vlerq mdef {A B:I}] {a 0 a 0 a -0} \
+ {1 0 0 0 -0 0}]
+} {0 1 2 5}
+
+test 26 {} {
+ vlerq unique [vlerq def A {a b a b a c}]
+} {data {mdef A} {a b c}}
+
+test 27 {} {
+ vlerq isectmap [vlerq def A {d b a}] [vlerq def A {a b c}]
+} {1 2}
+
+test 28 {} {
+ vlerq intersect [vlerq def A {a b c}] [vlerq def A {d b a}]
+} {data {mdef A} {a b}}
+
+test 29 {} {
+ vlerq except [vlerq def A {a b c d e}] [vlerq def A {d b a}]
+} {data {mdef A} {c e}}
+
+test 30 {} {
+ vlerq union [vlerq def A {a b c}] [vlerq def A {e b a d}]
+} {data {mdef A} {a b c e d}}
+
+test 31 {} {
+ set v [vlerq def A {a b c d e}]
+ vlerq getinfo $v $v 1
+} {{0 1 2 3 4} {1 2 3 4 5} {0 1 2 3 4}}
+
+test 32 {} {
+ set v [vlerq def A {a b b c c c}]
+ vlerq getinfo $v $v 1
+} {{0 1 3} {1 3 6} {0 1 2 3 4 5}}
+
+test 33 {} {
+ set v [vlerq def A {a b a b a c}]
+ vlerq getinfo $v $v 1
+} {{0 1 5} {3 5 6} {0 2 4 1 3 5}}
+
+test 34 {} {
+ set v [vlerq def A {a b c d d}]
+ vlerq getinfo $v $v 1
+} {{0 1 2 3} {1 2 3 5} {0 1 2 3 4}}
+
+test 35 {} {
+ vlerq group [vlerq def A {a b c d e}] 0 G
+} {data {mdef {A {G {}}}} {a b c d e} {1 1 1 1 1}}
+
+test 36 {} {
+ vlerq group [vlerq def A {a b b c c c}] 0 G
+} {data {mdef {A {G {}}}} {a b c} {1 2 3}}
+
+test 37 {} {
+ vlerq group [vlerq def A {a b b c c c}] {} G
+} {data {mdef {{G A}}} {{data {mdef A} {a b b c c c}}}}
+
+test 38 {} {
+ vlerq group [vlerq def A {a b a b a c}] 0 G
+} {data {mdef {A {G {}}}} {a b c} {3 2 1}}
+
+test 39 {} {
+ vlerq group [vlerq def A {a b a b a c}] A G
+} {data {mdef {A {G {}}}} {a b c} {3 2 1}}
+
+test 40 {} {
+ set v [vlerq group [vlerq def {A B:I} {a 0 b 1 c 1 d 1 d 0}] 0 G]
+} {data {mdef {A {G B:I}}} {a b c d} {{data {mdef B:I} 0}\
+ {data {mdef B:I} 1}\
+ {data {mdef B:I} 1}\
+ {data {mdef B:I} {1 0}}}}
+test 41 {} {
+ vlerq hashcol V [vlerq getcol $v 1]
+} {1 0 0 3}
+
+test 42 {} {
+ vlerq hashcol V [vlerq getcol $v G]
+} {1 0 0 3}
+
+test 43 {} {
+ vlerq getinfo [vlerq def A {a b c}] [vlerq def A {a b c d e a b c d e}] 2
+} {{0 1 2} {2 4 6} {0 5 1 6 2 7}}
+
+test 44 {} {
+ vlerq getinfo [vlerq def A {a b c}] [vlerq def A {a c a c}] 2
+} {{0 1 2} {2 2 4} {0 2 1 3}}
+
+test 45 {} {
+ vlerq getinfo [vlerq def A {a b c d}] [vlerq def A {a b c e a b c e}] 2
+} {{0 1 2 3} {2 4 6 6} {0 4 1 5 2 6}}
+
+test 46 {} {
+ vlerq getinfo [vlerq def A {a b c}] [vlerq def A {d e f}] 2
+} {{0 1 2} {0 0 0} {}}
+
+test 47 {} {
+ vlerq getinfo [vlerq def A a] [vlerq def A {a b a b a b}] 2
+} {0 3 {0 2 4}}
+
+test 48 {} {
+ vlerq getinfo [vlerq def A {a a a}] [vlerq def A {a b a b a b}] 2
+} {{0 0 0} 3 {0 2 4}}
+
+test 49 {} {
+ set v [vlerq def {B C} {c d e f c d d e}]
+ set w [vlerq def {B C} {c d c d d e}]
+ vlerq getinfo $v $w 2
+} {{0 1 0 2} {2 2 3} {0 1 2}}
+
+test 50 {} {
+ set v [vlerq def {A B} {}]
+ set w [vlerq def {B C} {}]
+ vlerq isectmap [vlerq namecol $v] [vlerq namecol $w]
+} 1
+
+test 51 {} {
+ vlerq isectmap [vlerq namecol $w] [vlerq namecol $v]
+} 0
+
+test 52 {} {
+ vlerq join [vlerq def A {a b c}] [vlerq def A {a b c d e a b c d e}] J
+} {data {mdef {A {J {}}}} {a b c} {2 2 2}}
+
+test 53 {} {
+ vlerq join [vlerq def A {a b c}] [vlerq def A {a c a c}] J
+} {data {mdef {A {J {}}}} {a b c} {2 0 2}}
+
+test 54 {} {
+ vlerq join [vlerq def A {a b c d}] [vlerq def A {a b c e a b c e}] J
+} {data {mdef {A {J {}}}} {a b c d} {2 2 2 0}}
+
+test 55 {} {
+ vlerq join [vlerq def A {a b c}] [vlerq def A {d e f}] J
+} {data {mdef {A {J {}}}} {a b c} {0 0 0}}
+
+test 56 {} {
+ vlerq join [vlerq def A a] [vlerq def A {a b a b a b}] J
+} {data {mdef {A {J {}}}} a 3}
+
+test 57 {} {
+ vlerq join [vlerq def A {a a a}] [vlerq def A {a b a b a b}] J
+} {data {mdef {A {J {}}}} {a a a} {3 3 3}}
+
+test 58 {} {
+ set v [vlerq data [vlerq mdef {A B}] {a b c} {A B C}]
+ set w [vlerq data [vlerq mdef {A C}] {a c a c} {1 3 1 3}]
+ vlerq join $v $w J
+} {data {mdef {A B {J C}}} {a b c} {A B C} {{data {mdef C} {1 1}}\
+ {data {mdef C} {}}\
+ {data {mdef C} {3 3}}}}
+test 59 {} {
+ vlerq ungroup [vlerq join $v $w J] -1
+} {data {mdef {A B C}} {a a c c} {A A C C} {1 1 3 3}}
+
+test 60 {} {
+ vlerq ungroup [vlerq join $v $w J] J
+} {data {mdef {A B C}} {a a c c} {A A C C} {1 1 3 3}}
+
+test 61 {} {
+ vlerq ijoin $v $w
+} {data {mdef {A B C}} {a a c c} {A A C C} {1 1 3 3}}
+
+test 62 {} {
+ set v [vlerq def {A B C} {a c d a e f e c d a d e}]
+ set w [vlerq def {B C D} {c d e c d f d e f}]
+ vlerq ijoin $v $w
+} {data {mdef {A B C D}} {a a e e a} {c c c c d} {d d d d e} {e f e f f}}
+
+test 63 {} {
+ vlerq join [vlerq def A {a b c}] [vlerq def B {A B C}] J
+} {data {mdef {A {J B}}} {a b c} {{data {mdef B} {A B C}}\
+ {data {mdef B} {A B C}}\
+ {data {mdef B} {A B C}}}}
+test 64 {} {
+ set v [vlerq data [vlerq mdef {A B}] {a b c} {A B C}]
+ vlerq join $v $v J
+} {data {mdef {A B {J {}}}} {a b c} {A B C} {1 1 1}}
+
+test 65 {} {
+ set v [vlerq def {A B C} {a c d a e f e c d a d e}]
+ set w [vlerq def {B C D} {c d e c d f d e f}]
+ vlerq join $v $w J
+} {data {mdef {A B C {J D}}} {a a e a} {c e c d} {d f d e}\
+ {{data {mdef D} {e f}}\
+ {data {mdef D} {}}\
+ {data {mdef D} {e f}}\
+ {data {mdef D} f}}}
+test 66 {} {
+ set r {}
+ foreach x {a b c d e f g} {
+ lappend r [vlerq strlookup $x {b c d e f}]
+ }
+ set r
+} {-1 0 1 2 3 4 -1}
+
+test 67 {} {
+ # vlerq cvstrac #38
+ vlerq except [vlerq def {a b} {1 2 3 4 1 2}] [vlerq def {a b} {3 4}]
+} {data {mdef {a b}} {1 1} {2 2}}
+
+test 68 {} {
+ vlerq except [vlerq def {a b} {1 2 3 4}] [vlerq def {a b} {3 4}]
+} {data {mdef {a b}} 1 2}
+
+set v [vlerq group [vlerq def {a b} {1 2 3 4 5 6 7 8}] a g]
+
+test 69 {} {
+ vlerq loop $v -collect { [vlerq rowhash $v $(#)] }
+} {-1702861950 -1165893242 -1501528190 1853940110}
+
+test 70 {} {
+ vlerq getinfo $v $v 0
+} {{0 1 2 3} {4 0 0 3 0 0 2 1} {-1702861950 -1165893242 -1501528190 1853940110}}
+
+test 71 {} {
+ # bt: failed on 2006-12-02
+ set v [vlerq group [vlerq def {a b} {1 2 3 4 5 6 7 8}] a g]
+ vlerq get [vlerq except $v [vlerq slice $v 2 2 2]]
+} {3 {data {mdef b} 4} 7 {data {mdef b} 8}}
+
+test 72 {} {
+ set v [vlerq def {a b} {1 {2 3 4} 2 {3 4 5} 3 4}]
+ set w [vlerq loop $v -collect { [vlerq def d $(b)] }]
+ set w [vlerq def {{c d}} $w]
+ set v [vlerq pair $v $w]
+} {data {mdef {a b {c d}}} {1 2 3}\
+ {{2 3 4} {3 4 5} 4}\
+ {{data {mdef d} {2 3 4}}\
+ {data {mdef d} {3 4 5}}\
+ {data {mdef d} 4}}}
+test 73 {} {
+ vlerq ungroup $v c
+} {data {mdef {a b d}} {1 1 1 2 2 2 3}\
+ {{2 3 4} {2 3 4} {2 3 4} {3 4 5} {3 4 5} {3 4 5} 4}\
+ {2 3 4 3 4 5 4}}
+
+test 74 {join ok} {
+ vlerq join [vlerq def a {1 3}] [vlerq def {a b} {1 2 3 4}] J
+} {data {mdef {a {J b}}} {1 3} {{data {mdef b} 2} {data {mdef b} 4}}}
+
+test 75 {join bad: F115} {
+ vlerq join [vlerq def a:I {1 3}] [vlerq def {a:I b} {1 2 3 4}] J
+} {data {mdef {a:I {J b}}} {1 3} {{data {mdef b} 2} {data {mdef b} 4}}}
+
+test 76 {} {
+ set v [vlerq def A {1 2 3 4 5}]
+ set w [vlerq def A {4 2 2 6 4}]
+ vlerq exceptmap $v $w
+} {0 2 4}
+
+test 77 {} {
+ set v [vlerq def A {4 2 2 6 4}]
+ set w [vlerq def A {1 2 3 4 5}]
+ vlerq unionmap $v $w
+} {0 2 4}
+
+test 78 {} {
+ set v [vlerq def {a b c} {1 a b 2 c d}]
+ vlerq group $v {a c} g
+} {data {mdef {a c {g b}}} {1 2} {b d} {{data {mdef b} a} {data {mdef b} c}}}
+
+test 79 {} {
+ # bt: failed on 2007-02-05, see fff/138
+ vlerq group $v {c a} g
+} {data {mdef {c a {g b}}} {b d} {1 2} {{data {mdef b} a} {data {mdef b} c}}}
+
+test 80 {} {
+ vlerq getinfo $v $v 1
+} {{0 1} {1 2} {0 1}}
+
+test 81 {} {
+ vlerq grouped [vlerq colmap $v b] {1 2} {0 1} g
+} {data {mdef {{g b}}} {{data {mdef b} a} {data {mdef b} c}}}
+
+test 82 {} {
+ set v [vlerq def {A B C} {a c d a e f e c d a d e}]
+ set w [vlerq def {B C D} {c d e c d f d e f}]
+ vlerq ijoin $v $w
+} {data {mdef {A B C D}} {a a e e a} {c c c c d} {d d d d e} {e f e f f}}
+
+test 83 {} {
+ vlerq join $v $w J
+} {data {mdef {A B C {J D}}} {a a e a} {c e c d} {d f d e}\
+ {{data {mdef D} {e f}}\
+ {data {mdef D} {}}\
+ {data {mdef D} {e f}}\
+ {data {mdef D} f}}}
+
+test 84 {} {
+ vlerq isectmap [vlerq meta $v] [vlerq meta $w]
+} {1 2}
+
+test 85 {} {
+ vlerq isectmap [vlerq meta $w] [vlerq meta $v]
+} {0 1}
+
+test 86 {} {
+ # bt: failed on 2007-02-10, see fff/140
+ set x [vlerq colmap $v {C A B}]
+ vlerq ijoin $x $w
+} {data {mdef {C A B D}} {d d d d e} {a a e e a} {c c c c d} {e f e f f}}
+
+test 87 {} {
+ vlerq join $x $w J
+} {data {mdef {C A B {J D}}} {d f d e} {a a e a} {c e c d}\
+ {{data {mdef D} {e f}}\
+ {data {mdef D} {}}\
+ {data {mdef D} {e f}}\
+ {data {mdef D} f}}}
+
+test 88 {} {
+ vlerq isectmap [vlerq meta $x] [vlerq meta $w]
+} {0 2}
+
+test 89 {} {
+ vlerq isectmap [vlerq meta $w] [vlerq meta $x]
+} {0 1}
+
+unset -nocomplain r v w x h
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/indirect.test b/vqtcl/buildsrc/vqtcl/tests/indirect.test
new file mode 100755
index 0000000..be9d5c2
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/indirect.test
@@ -0,0 +1,91 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ set v [vlerq def A {a b c d e f}]
+ vlerq remap $v {}
+} {data {mdef A} {}}
+
+test 2 {} {
+ vlerq remap $v {1 3 5}
+} {data {mdef A} {b d f}}
+
+test 3 {} {
+ vlerq remap $v {5 3 1 0 2 4}
+} {data {mdef A} {f d b a c e}}
+
+test 4 {} {
+ vlerq remap $v {1 -1 -2 4 3 -1 5}
+} {data {mdef A} {b b b e d d f}}
+
+test 5 {} {
+ vlerq step $v 6 0 1 1
+} {data {mdef A} {a b c d e f}}
+
+test 6 {} {
+ vlerq step 0 1 1 1 1
+} 0
+
+test 7 {} {
+ vlerq step $v 5 1 1 1
+} {data {mdef A} {b c d e f}}
+
+test 8 {} {
+ vlerq step $v 3 0 2 1
+} {data {mdef A} {a a b b c c}}
+
+test 9 {} {
+ vlerq step $v 6 0 1 2
+} {data {mdef A} {a c e a c e}}
+
+test 10 {} {
+ vlerq step $v 6 -1 1 -1
+
+} {data {mdef A} {f e d c b a}}
+
+test 11 {} {
+ vlerq step $v 12 3 1 1
+} {data {mdef A} {d e f a b c d e f a b c}}
+
+test 12 {} {
+ vlerq step $v 12 3 1 -1
+} {data {mdef A} {d c b a f e d c b a f e}}
+
+test 13 {} {
+ vlerq concat [vlerq def A {}] [vlerq def A {1 2 3}]
+} {data {mdef A} {1 2 3}}
+
+test 14 {} {
+ vlerq concat [vlerq def A {a b c}] [vlerq def A {1 2 3}]
+} {data {mdef A} {a b c 1 2 3}}
+
+test 15 {} {
+ set v [vlerq data [vlerq mdef {A B}] {a b c} {1 2 3}]
+ vlerq meta [vlerq grouped $v {1 2 3} {0 1 2} G]
+} {mdef {{G {A B}}}}
+
+test 16 {} {
+ vlerq grouped $v {1 2 3} {0 1 2} G
+} {data {mdef {{G {A B}}}} {{data {mdef {A B}} a 1}\
+ {data {mdef {A B}} b 2}\
+ {data {mdef {A B}} c 3}}}
+test 17 {} {
+ set v [vlerq data [vlerq mdef {A B}] {a b c d e f} {1 2 3 4 5 6}]
+ vlerq grouped $v {1 3 6} {0 1 2 3 4 5} G
+} {data {mdef {{G {A B}}}} {{data {mdef {A B}} a 1}\
+ {data {mdef {A B}} {b c} {2 3}}\
+ {data {mdef {A B}} {d e f} {4 5 6}}}}
+test 18 {} {
+ vlerq grouped $v {1 3 6} {5 3 4 0 1 2} G
+} {data {mdef {{G {A B}}}} {{data {mdef {A B}} f 6}\
+ {data {mdef {A B}} {d e} {4 5}}\
+ {data {mdef {A B}} {a b c} {1 2 3}}}}
+unset -nocomplain v
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/initests.tcl b/vqtcl/buildsrc/vqtcl/tests/initests.tcl
new file mode 100644
index 0000000..d896feb
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/initests.tcl
@@ -0,0 +1,57 @@
+# common test setup script
+
+#puts "vars: [info vars ?] [info vars ??]"
+
+if {[info exists testsInited]} return
+
+package require Tcl 8.4
+
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ package require tcltest 2.2
+ namespace import tcltest::*
+}
+
+singleProcess true ;# run without forking
+
+testsDirectory [file dirname [info script]]
+
+# if run from the tests directory, move one level up
+if {[pwd] eq [testsDirectory]} {
+ cd ..
+}
+
+temporaryDirectory [pwd]
+workingDirectory [file dirname [testsDirectory]]
+
+# TextMate support on Mac OS X: run make before running any test from editor
+if {[info exists env(TM_FILENAME)]} {
+ if {[catch { exec make } msg]} {
+ puts stderr $msg
+ exit 1
+ }
+}
+
+proc readfile {filename} {
+ set fd [open $filename]
+ set data [read $fd]
+ close $fd
+ return $data
+}
+
+# extract version number from configure.in
+regexp {AC_INIT\(\[vqtcl\],\s*\[([.\d]+)\]\)} [readfile configure.in] - version
+unset -
+
+# make sure the pkgIndex.tcl is found
+if {[lsearch $auto_path [workingDirectory]] < 0} {
+ lappend auto_path [workingDirectory]
+}
+
+testConstraint 64bit [expr {$tcl_platform(wordSize) == 8}]
+testConstraint bigendian [expr {$tcl_platform(byteOrder) eq "bigEndian"}]
+testConstraint kitten [file exists [temporaryDirectory]/kitten.kit]
+testConstraint metakit [expr {![catch { package require Mk4tcl }]}]
+testConstraint tcl$tcl_version 1
+testConstraint vfs [expr {![catch { package require vfs }]}]
+
+set testsInited 1
diff --git a/vqtcl/buildsrc/vqtcl/tests/kitten.test b/vqtcl/buildsrc/vqtcl/tests/kitten.test
new file mode 100755
index 0000000..2f1bc6c
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/kitten.test
@@ -0,0 +1,45 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {load mkclvfs package} vfs {
+ if {[file exists src_tcl/mkclvfs.tcl]} {
+ source src_tcl/mkclvfs.tcl
+ } else {
+ source library/mkclvfs.tcl
+ }
+ package require vfs::mkcl
+} 1.5
+
+test 2 {} -constraints {vfs kitten} -body {
+ set fs [vfs::mkcl::Mount [temporaryDirectory]/kitten.kit /kitten]
+} -match glob -result mkclvfs*
+
+test 3 {} {vfs kitten} {
+ lsort -dict [glob -directory /kitten -tails -types f *]
+} {ChangeLog main.tcl}
+
+test 4 {} {vfs kitten} {
+ lsort -dict [glob -directory /kitten -tails -types d *]
+} {doc lib}
+
+test 5 {} -constraints {vfs kitten} -body {
+ lsort -dict [glob -directory /kitten/lib -tails -types f *]
+} -match glob -result {httpdist.tcl * md5.tcl}
+
+test 6 {} -constraints {vfs kitten} -body {
+ lsort -dict [glob -directory /kitten/lib -tails -types d *]
+} -match glob -result {ascenc-0.11 autoproxy * tls-1.4 wcb2.8 wikit yeti-0.4}
+
+test 7 {} {vfs kitten} {
+ vfs::unmount /kitten
+} {}
+
+unset -nocomplain fs
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/l.large.test b/vqtcl/buildsrc/vqtcl/tests/l.large.test
new file mode 100755
index 0000000..aaa2b66
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/l.large.test
@@ -0,0 +1,77 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+# large file tests, skipped by default because they take a lot of time
+
+source [file join [file dir [info script]] initests.tcl]
+set tmp [makeDirectory testfiles.tmp]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+proc bigview {n} {
+ vlerq repeat [vlerq group [vlerq def A [vlerq iota $n]] {} _B] $n
+}
+
+test 1 {} {
+ set v [bigview 10]
+ vlerq structdesc $v
+} {_B[A:S]}
+
+test 2 {} {
+ vlerq size [vlerq blocked $v]
+} 100
+
+test 3 {} {
+ vlerq save $v $tmp/b1.db
+} 346
+
+test 4 {} -body {
+ vlerq size [vlerq blocked [vlerq open $tmp/b1.db]]
+} -result 100 -cleanup { file delete $tmp/b1.db }
+
+test 5 {} {
+ # correct: gives same result on 32b- and 64b on 2006-12-13
+ string length [vlerq emit [bigview 7088]]
+} 268571360
+
+test 6 {} {
+ # wrong: gave different result (268651792) on 32b and 64b on 2006-12-13
+ # diff = 16 bytes less
+ string length [vlerq emit [bigview 7089]]
+} 268651808
+
+test 7 {} {
+ set v [bigview 10000]
+ vlerq size [vlerq blocked $v]
+} 100000000
+
+test 8 {} {
+ # wrong: gave different result (539080016) on 32b and 64b on 2006-12-13
+ # diff 40160 bytes = 2510x 16 bytes less
+ vlerq save $v $tmp/b2.db
+} 539120176
+
+test 9 {} -body {
+ vlerq size [vlerq blocked [vlerq open $tmp/b2.db]]
+} -result 100000000 -cleanup { file delete $tmp/b2.db }
+
+test 10 {} {
+ set v [bigview 20000]
+ vlerq size [vlerq blocked $v]
+} 400000000
+
+test 11 {} 64bit {
+ vlerq save $v $tmp/b3.db
+} 2378195504
+
+test 12 {} -constraints 64bit -body {
+ vlerq size [vlerq blocked [vlerq open $tmp/b3.db]]
+} -result 400000000 -cleanup { file delete $tmp/b3.db }
+
+test 13 {} {
+ vlerq size [vlerq blocked [bigview 40000]]
+} 1600000000
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/l.leaks.test b/vqtcl/buildsrc/vqtcl/tests/l.leaks.test
new file mode 100644
index 0000000..8db3886
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/l.leaks.test
@@ -0,0 +1,44 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+# memory leaks tests, skipped by default because this may take a lot of time
+
+source [file join [file dir [info script]] initests.tcl]
+
+set cmd {vlerq open data/mkblk.db}
+set cmd {vlerq def {A B C} {1 2 3 4 5 6 7 8 9}}
+set cmd {vlerq loop [vlerq def A {1 2}] { append a $(A) }; unset a "" }
+
+proc memuse {} {
+ set out [exec ps l -p [pid]]
+ lindex [split $out \n] 1 [lsearch $out RSS]
+}
+
+test 0 {} {
+ package require vlerq
+} $version
+
+memuse
+
+test 1 {} {
+ memuse
+} [memuse]
+
+test 2 {} {
+ eval $cmd
+ return
+} {}
+
+test 3 {} {
+ eval $cmd
+ memuse
+} [memuse]
+
+test 4 {} {
+ for {set i 0} {$i < 10000} {incr i} {
+ eval $cmd
+ }
+ memuse
+} [memuse]
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/loop.test b/vqtcl/buildsrc/vqtcl/tests/loop.test
new file mode 100755
index 0000000..996d33a
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/loop.test
@@ -0,0 +1,123 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+set v [vlerq def {A B C} {1 2 3 11 22 33 111 222 333}]
+
+test 1 {} {
+ set i 0
+ vlerq loop $v c { incr i }
+ set i
+} 3
+
+test 2 {} {
+ set r {}
+ vlerq loop $v c { lappend r $c(#) }
+ set r
+} {0 1 2}
+
+test 3 {} {
+ set r {}
+ vlerq loop $v c { lappend r $c(B) $c(A) }
+ set r
+} {2 1 22 11 222 111}
+
+set w [vlerq def A {1 2 3 4 5 6 7 8 9}]
+
+test 4 {} {
+ vlerq loop $w c -index 1
+} {0 1 2 3 4 5 6 7 8}
+
+test 5 {} {
+ vlerq loop $w c -index { $c(A) % 2 }
+} {0 2 4 6 8}
+
+test 6 {} {
+ vlerq loop $w c -index { $c(A) > 3 && $c(A) < 6 }
+} {3 4}
+
+test 7 {} {
+ vlerq loop $w c -index { $c(A) == $c(#) + 1 }
+} {0 1 2 3 4 5 6 7 8}
+
+test 8 {} {
+ vlerq get [vlerq loop $w c -where 1]
+} {1 2 3 4 5 6 7 8 9}
+
+test 9 {} {
+ vlerq get [vlerq loop $w c -where { $c(A) % 2 }]
+} {1 3 5 7 9}
+
+test 10 {} {
+ vlerq get [vlerq loop $w c -where { $c(A) > 3 && $c(A) < 6 }]
+} {4 5}
+
+test 11 {} {
+ vlerq get [vlerq loop $w c -where { $c(A) == $c(#) + 1 }]
+} {1 2 3 4 5 6 7 8 9}
+
+test 12 {loop var must end up in current namespace} {
+ namespace eval t1 { vlerq loop $w c1 -index { $c1(A) % 2 } }
+ list [info exists c1] [array get t1::c1]
+} {0 {A 9}}
+namespace forget t1
+
+unset c
+test 13 {loop with parray} -body {
+ vlerq loop [vlerq def {A B C} {1 2 3 11 22 33 111 222 333}] c {parray c}
+} -output {}
+
+test 14 {loop on single column} {
+ set r {}
+ vlerq loop [vlerq def A {1 2 3}] c { lappend r $c(A) }
+ set r
+} {1 2 3}
+unset c
+
+test 15 {try to loop on non-array} {
+ set c 1
+ catch { vlerq loop [vlerq def A {1 2 3}] c { lappend r $c(A) } } r
+ unset c
+ set r
+} {can't trace "c(#)": variable isn't array}
+
+test 16 {} {
+ set r {}
+ vlerq loop [vlerq def A {1 2 3}] {
+ lappend r x$(A)
+ if {$(A) >= 2} break
+ lappend r y$(A)
+ }
+ set r
+} {x1 y1 x2}
+
+test 17 {} {
+ set r {}
+ vlerq loop [vlerq def A {1 2 3}] {
+ lappend r x$(A)
+ if {$(A) >= 2} continue
+ lappend r y$(A)
+ }
+ set r
+} {x1 y1 x2 x3}
+
+test 18 {} {
+ set r {}
+ set c [catch {
+ vlerq loop [vlerq def A {1 2 3}] {
+ lappend r x$(A)
+ if {$(A) >= 2} { error booh! }
+ lappend r y$(A)
+ }
+ } e]
+ lappend r $c $e
+} {x1 y1 x2 1 booh!}
+
+unset -nocomplain r c e v w i
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/m2m.test b/vqtcl/buildsrc/vqtcl/tests/m2m.test
new file mode 100755
index 0000000..26b3a76
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/m2m.test
@@ -0,0 +1,93 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {load m2mvfs package} vfs {
+ if {[file exists src_tcl/m2mvfs.tcl]} {
+ source src_tcl/m2mvfs.tcl
+ } else {
+ source library/m2mvfs.tcl
+ }
+ package require vfs::m2m
+} 1.8
+
+test 2 {} vfs {
+ vfs::m2m::Mount "" mem
+} {m2m}
+
+test 3 {} vfs {
+ ::vfs::filesystem unmount mem
+ # TODO: detect repeated mounts, should probably be an error
+ vfs::m2m::Mount m2m.tmp mem
+} {m2m}
+
+test 4 {} vfs {
+ glob -nocomplain mem/*
+} {}
+
+test 5 {} -constraints vfs -body {
+ set fd [open mem/aa w]
+} -match regexp -result {^(rechan\d+|mem\d+)$}
+
+test 6 {} vfs {
+ glob -nocomplain mem/*
+} mem/aa
+
+test 7 {} vfs {
+ file size mem/aa
+} 0
+
+test 8 {} vfs {
+ puts -nonewline $fd haha
+ close $fd
+ file size mem/aa
+} 4
+
+test 9 {} vfs {
+ file mkdir mem/d
+} {}
+
+test 10 {} vfs {
+ set fd [open mem/d/ff w]
+ puts -nonewline $fd wow
+ close $fd
+ file size mem/d/ff
+} 3
+
+test 11 {} vfs {
+ set fd [open mem/d/eee w]
+ puts -nonewline $fd "Hello world!"
+ close $fd
+ file size mem/d/eee
+} 12
+
+test 12 {} vfs {
+ glob mem/*
+} {mem/aa mem/d}
+
+test 13 {} vfs {
+ glob mem/d/*
+} {mem/d/ff mem/d/eee}
+
+test 14 {} vfs {
+ file delete m2m.tmp
+ vfs::unmount mem
+} {}
+
+test 15 {} vfs {
+ file size m2m.tmp
+} 191
+
+test 16 {} vfs {
+ #puts [exec xxd m2m.tmp]
+ file delete m2m.tmp
+} {}
+
+unset -nocomplain fd
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/mkcl.test b/vqtcl/buildsrc/vqtcl/tests/mkcl.test
new file mode 100755
index 0000000..6b7d9da
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/mkcl.test
@@ -0,0 +1,133 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {load mkclvfs package} vfs {
+ if {[file exists src_tcl/mkclvfs.tcl]} {
+ source src_tcl/mkclvfs.tcl
+ } else {
+ source library/mkclvfs.tcl
+ }
+ package require vfs::mkcl
+} 1.5
+
+test 2 {} -constraints vfs -body {
+ set fs [vfs::mkcl::Mount data/lkit-le.db /try1]
+} -match glob -result mkclvfs*
+
+test 3 {} vfs {
+ glob -directory /try1 *
+} {/try1/main.tcl /try1/ChangeLog /try1/lib}
+
+test 4 {} -constraints vfs -body {
+ file stat /try1/lib sb
+ puts ""
+ parray sb
+} -match glob -output {
+sb(atime) = 0
+sb(ctime) = 0
+sb(dev) = *
+sb(gid) = 0
+sb(ino) = 0
+sb(mode) = 16895
+sb(mtime) = 0
+sb(nlink) = 3
+sb(size) = 0
+sb(type) = directory
+sb(uid) = 0
+}
+
+test 5 {} -constraints vfs -body {
+ file stat /try1/ChangeLog sb
+ puts ""
+ parray sb
+} -match glob -output {
+sb(atime) = 1046092593
+sb(ctime) = 1046092593
+sb(dev) = *
+sb(gid) = 0
+sb(ino) = 0
+sb(mode) = 33279
+sb(mtime) = 1046092593
+sb(nlink) = 1
+sb(size) = 167
+sb(type) = file
+sb(uid) = 0
+}
+
+test 6 {} vfs {
+ set fd [open /try1/ChangeLog]
+ set data \n
+ append data [read $fd]
+ close $fd
+ set data
+} {
+2003-02-24 jcw
+ * tcl2html.tcl: added Jeff Hobb's code to show tcl file nicely
+ * listk.tcl: adjusted to use the above for *.tcl files
+ * all: added change log
+}
+
+test 7 {} vfs {
+ file size /try1/lib/cgi1.6/cgi.tcl
+} 65885
+
+test 8 {} vfs {
+ vfs::unmount /try1
+} {}
+
+test 9 {} -constraints vfs -body {
+ set fs [vfs::mkcl::Mount data/lkit-be.db /try2]
+} -match glob -result mkclvfs*
+
+test 10 {} vfs {
+ glob -directory /try2 *
+} {/try2/ChangeLog /try2/main.tcl /try2/lib}
+
+test 11 {} -constraints vfs -body {
+ file stat /try2/ChangeLog sb
+ puts ""
+ parray sb
+} -match glob -output {
+sb(atime) = 1046092593
+sb(ctime) = 1046092593
+sb(dev) = *
+sb(gid) = 0
+sb(ino) = 0
+sb(mode) = 33279
+sb(mtime) = 1046092593
+sb(nlink) = 1
+sb(size) = 167
+sb(type) = file
+sb(uid) = 0
+}
+
+test 12 {} vfs {
+ set fd [open /try2/ChangeLog]
+ set data \n
+ append data [read $fd]
+ close $fd
+ set data
+} {
+2003-02-24 jcw
+ * tcl2html.tcl: added Jeff Hobb's code to show tcl file nicely
+ * listk.tcl: adjusted to use the above for *.tcl files
+ * all: added change log
+}
+
+test 13 {} vfs {
+ file size /try2/lib/cgi1.6/cgi.tcl
+} 65885
+
+test 14 {} vfs {
+ vfs::unmount /try2
+} {}
+
+unset -nocomplain fs fd sb
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/mklite.test b/vqtcl/buildsrc/vqtcl/tests/mklite.test
new file mode 100755
index 0000000..af46336
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/mklite.test
@@ -0,0 +1,204 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {load mkclvfs package} {
+ if {[file exists src_tcl/mklite.tcl]} {
+ source src_tcl/mklite.tcl
+ } else {
+ source library/mklite.tcl
+ }
+ package require mklite
+} 0.5
+
+test 2 {open mk file} {
+ mklite::file open db data/gtest.db -readonly
+} db
+
+test 3 {root names via vlerq} {
+ vlerq names [vlerq open data/gtest.db]
+} {frequents likes serves}
+
+test 4 {root names} {
+ mklite::file views db
+} {frequents likes serves}
+
+test 5 {mk compatibility layer} {
+ mklite::emulateMk4tcl
+} {}
+
+test 6 {view sizes} {
+ set F db.frequents
+ set L db.likes
+ set S db.serves
+ list [mk::view size $F] [mk::view size $L] [mk::view size $S]
+} {10 8 9}
+
+test 7 {view names} {
+ list [mk::view info $F] [mk::view info $L] [mk::view info $S]
+} {{drinker bar perweek} {drinker beer perday} {bar beer quantity}}
+
+test 8 {get all cols} {
+ mk::get $F!2
+} {drinker sam bar cheers perweek 5}
+
+test 9 {get all cols sizes} {
+ mk::get $F!2 -size
+} {drinker 3 bar 6 perweek 1}
+
+test 10 {get one col} {
+ mk::get $F!2 bar
+} cheers
+
+test 11 {get one col size} {
+ mk::get $F!2 -size bar
+} 6
+
+test 12 {get several cols} {
+ mk::get $F!2 bar drinker
+} {cheers sam}
+
+test 13 {get several cols sizes} {
+ mk::get $F!2 -size bar drinker
+} {6 3}
+
+test 14 {frequents data} {
+ set r ""
+ mk::loop c $F { append r " " [mk::get $c drinker bar perweek] \n }
+ set r
+} { \
+ adam lolas 1
+ woody cheers 5
+ sam cheers 5
+ norm cheers 3
+ wilt joes 2
+ norm joes 1
+ lola lolas 6
+ norm lolas 2
+ woody lolas 1
+ pierre frankies 0
+}
+
+test 15 {likes data} {
+ set r ""
+ mk::loop c $L { append r " " [mk::get $c drinker beer perday] \n }
+ set r
+} { \
+ adam bud 2
+ wilt rollingrock 1
+ sam bud 2
+ norm rollingrock 3
+ norm bud 2
+ nan sierranevada 1
+ woody pabst 2
+ lola mickies 5
+}
+
+test 16 {serves data} {
+ set r ""
+ mk::loop c $S { append r " " [mk::get $c bar beer quantity] \n }
+ set r
+} { \
+ cheers bud 500
+ cheers samaddams 255
+ joes bud 217
+ joes samaddams 13
+ joes mickies 2222
+ lolas mickies 1515
+ lolas pabst 333
+ winkos rollingrock 432
+ frankies snafu 5
+}
+
+test 17 {select} {
+ mk::select $F drinker norm
+} {3 5 7}
+
+test 18 {select bar} {
+ mk::select $F bar lolas
+} {0 6 7 8}
+
+test 19 {select glob} {
+ mk::select $F -glob bar *e*
+} {1 2 3 4 5 9}
+
+test 20 {select globnc} {
+ mk::select $F -globnc bar *E*
+} {1 2 3 4 5 9}
+
+test 21 {select keyword} {
+ mk::select $S -keyword beer M
+} {4 5}
+
+test 22 {select multiple or} {
+ mk::select $S -glob {bar beer} *e*
+} {0 1 2 3 4 5 8}
+
+test 23 {select sort} {
+ mk::select $S -sort beer
+} {0 2 4 5 6 7 1 3 8}
+
+test 24 {select rsort} {
+ mk::select $S -rsort beer
+} {8 3 1 7 6 5 4 2 0}
+
+test 25 {select count} {
+ mk::select $F -count 2 drinker norm
+} {3 5}
+
+test 26 {select first} {
+ mk::select $F -first 2 drinker norm
+} 7
+
+test 27 {select glob and count} {
+ mk::select $F -glob bar *e* -count 3
+} {1 2 3}
+
+test 28 {select multiple criteria} {
+ mk::select $F bar lolas drinker norm
+} 7
+
+test 29 {select nothing} {
+ mk::select $F bar maid
+} {}
+
+test 30 {select multiple criteria empty} {
+ mk::select $F drinker woody bar joes
+} {}
+
+test 31 {list of open files} {
+ mk::file open
+} {db data/gtest.db}
+
+test 32 {} {
+ mk::file close db
+} {}
+
+test 33 {} {
+ catch { mk::file close db }
+} 1
+
+test 34 {} {
+ catch { mklite::file views db }
+} 1
+
+test 35 {load mk file} {
+ mklite::file open db
+ set fd [open data/gtest.db]
+ mklite::file load db $fd
+ close $fd
+ mklite::file views db
+} {frequents likes serves}
+
+test 36 {} {
+ mk::file close db
+} {}
+
+unset -nocomplain c r S F L fd
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/mutable.test b/vqtcl/buildsrc/vqtcl/tests/mutable.test
new file mode 100755
index 0000000..585a7a6
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/mutable.test
@@ -0,0 +1,324 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {} {
+ package require vlerq
+} $version
+
+test 1 {} {
+ vlerq set [vlerq def A {a b c}] 1 A XYZ
+} {data {mdef A} {a XYZ c}}
+
+test 2 {} {
+ vlerq set [vlerq def A:B {d e f}] 1 A ABC
+} {data {mdef A:B} {d ABC f}}
+
+test 3 {} {
+ vlerq set [vlerq def A:I {1 2 3}] 1 A 22
+} {data {mdef A:I} {1 22 3}}
+
+test 4 {} {
+ vlerq set [vlerq def A:L {1 2 3}] 1 A 112233445566
+} {data {mdef A:L} {1 112233445566 3}}
+
+test 5 {} {
+ vlerq set [vlerq def A:F {1.5 2.5 3.5}] 1 A 4.5
+} {data {mdef A:F} {1.5 4.5 3.5}}
+
+test 6 {} {
+ vlerq set [vlerq def A:D {1.1 2.2 3.3}] 1 A 4.567890123
+} {data {mdef A:D} {1.1 4.567890123 3.3}}
+
+test 7 {} {
+ set v [vlerq group [vlerq def {A B} {a A1 a A2 b B1 b B2}] A G]
+} {data {mdef {A {G B}}} {a b} {{data {mdef B} {A1 A2}}\
+ {data {mdef B} {B1 B2}}}}
+test 8 {} {
+ vlerq set $v 1 G [vlerq def B {1 2 3}]
+} {data {mdef {A {G B}}} {a b} {{data {mdef B} {A1 A2}}\
+ {data {mdef B} {1 2 3}}}}
+test 9 {} {
+ set v [vlerq def A {a b c d e}]
+ vlerq size [vlerq delete $v 1 3]
+} 2
+
+test 10 {} {
+ vlerq delete $v 1 3
+} {data {mdef A} {a e}}
+
+test 11 {} {
+ vlerq mutinfo [vlerq delete $v 1 3]
+} {{data {mdef A} {}} 0 0 {0 1 1 1 0} {0 0} {0 0} {}}
+
+test 12 {} {
+ vlerq delete $v 0 3
+} {data {mdef A} {d e}}
+
+test 13 {} {
+ vlerq delete $v 2 3
+} {data {mdef A} {a b}}
+
+test 14 {} {
+ vlerq replace $v 1 3 [vlerq def A {1 2 3}]
+} {data {mdef A} {a 1 2 3 e}}
+
+test 15 {} {
+ vlerq mutinfo [vlerq replace $v 1 3 [vlerq def A {1 2 3}]]
+} {{data {mdef A} {1 2 3}} 0 0 {0 1 1 1 0} {0 0} {0 1 1 1 0} {}}
+
+test 16 {} {
+ vlerq append $v [vlerq def A {1 2 3}]
+} {data {mdef A} {a b c d e 1 2 3}}
+
+test 17 {} {
+ vlerq mutinfo [vlerq append $v [vlerq def A {1 2 3}]]
+} {{data {mdef A} {1 2 3}} 0 0 {0 0 0 0 0} {0 0 0 0 0} {0 0 0 0 0 1 1 1} {}}
+
+test 18 {} {
+ set v [vlerq insert $v 2 [vlerq def A {1 2 3}]]
+} {data {mdef A} {a b 1 2 3 c d e}}
+
+test 19 {} {
+ vlerq mutinfo $v
+} {{data {mdef A} {1 2 3}} 0 0 {0 0 0 0 0} {0 0 0 0 0} {0 0 1 1 1 0 0 0} {}}
+
+test 20 {} {
+ vlerq set $v 3 A zz
+} {data {mdef A} {a b 1 zz 3 c d e}}
+
+set v [vlerq def {A B C} {1 2 3 11 22 33 111 222 333}]
+
+test 21 {} {
+ set w [vlerq set $v 1 B x22]
+} {data {mdef {A B C}} {1 11 111} {2 x22 222} {3 33 333}}
+
+test 22 {} {
+ vlerq mutinfo $w
+} {{data {mdef {A B C}} {} {} {}}\
+ {data {mdef {A B C}} 11 x22 33}\
+ {data {mdef {_:I _:I _:I}} 0 1 0} {0 0 0} {0 1 0} {0 0 0} 0}
+
+test 23 {check row count is still 3} {
+ vlerq size $w
+} 3
+
+test 24 {verify new contents} {
+ vlerq get $w
+} {1 2 3 11 x22 33 111 222 333}
+
+test 25 {check v has not changed} {
+ vlerq get $v
+} {1 2 3 11 22 33 111 222 333}
+
+test 26 {insert one row} {
+ set w [vlerq insert $v 1 [vlerq def {A B C} {x y z}]]
+} {data {mdef {A B C}} {1 x 11 111} {2 y 22 222} {3 z 33 333}}
+
+test 27 {} {
+ vlerq size $w
+} 4
+
+test 28 {verify new contents} {
+ vlerq get $w
+} {1 2 3 x y z 11 22 33 111 222 333}
+
+test 29 {check v has not changed} {
+ vlerq get $v
+} {1 2 3 11 22 33 111 222 333}
+
+test 30 {delete one row} {
+ set w [vlerq delete $v 1 1]
+} {data {mdef {A B C}} {1 111} {2 222} {3 333}}
+
+test 31 {} {
+ vlerq get $w #
+} 2
+
+test 32 {verify new contents} {
+ vlerq get $w
+} {1 2 3 111 222 333}
+
+test 33 {check v has not changed} {
+ vlerq get $v
+} {1 2 3 11 22 33 111 222 333}
+
+test 34 {} {
+ set w [vlerq group $v A G]
+ vlerq get $w 0 G
+} {data {mdef {B C}} 2 3}
+
+test 35 {set one item in subview} {
+ vlerq set [vlerq get $w 0 G] 0 B bb
+} {data {mdef {B C}} bb 3}
+
+test 36 {set one item in subview} {
+ set w [vlerq group [vlerq set $v 2 A 1] A G]
+ vlerq set [vlerq get $w 0 G] 1 B bb
+} {data {mdef {B C}} {2 bb} {3 333}}
+
+test 37 {} {
+ set v [vlerq def {A B C} {a b c aa bb cc aaa bbb ccc}]
+ vlerq set $v 1 A x B y C z
+} {data {mdef {A B C}} {a x aaa} {b y bbb} {c z ccc}}
+
+test 38 {} {
+ vlerq set [vlerq def {A B C} {a b c aa bb cc}] -1 A xx
+} {data {mdef {A B C}} {a xx} {b bb} {c cc}}
+
+test 39 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+} {data {mdef A} {1 a b 2}}
+
+test 40 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq append $v [vlerq def A {x y}]
+} {data {mdef A} {1 a b 2 x y}}
+
+test 41 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq insert $v 0 [vlerq def A {x y}]
+} {data {mdef A} {x y 1 a b 2}}
+
+test 42 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq insert $v 1 [vlerq def A {x y}]
+} {data {mdef A} {1 x y a b 2}}
+
+test 43 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq insert $v 2 [vlerq def A {x y}]
+} {data {mdef A} {1 a x y b 2}}
+
+test 44 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq insert $v 3 [vlerq def A {x y}]
+} {data {mdef A} {1 a b x y 2}}
+
+test 45 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq insert $v 4 [vlerq def A {x y}]
+} {data {mdef A} {1 a b 2 x y}}
+
+test 46 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 0 1
+} {data {mdef A} {a b 2}}
+
+test 47 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 1 1
+} {data {mdef A} {1 b 2}}
+
+test 48 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 2 1
+} {data {mdef A} {1 a 2}}
+
+test 49 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 3 1
+} {data {mdef A} {1 a b}}
+
+test 50 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 0 2
+} {data {mdef A} {b 2}}
+
+test 51 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 1 2
+} {data {mdef A} {1 2}}
+
+test 52 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 2 2
+} {data {mdef A} {1 a}}
+
+test 53 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 0 3
+} {data {mdef A} 2}
+
+test 54 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 1 3
+} {data {mdef A} 1}
+
+test 55 {} {
+ set v [vlerq insert [vlerq def A {1 2}] 1 [vlerq def A {a b}]]
+ vlerq delete $v 0 4
+} {data {mdef A} {}}
+
+test 56 {insertion when there are no columns} {
+ vlerq insert 3 0 5
+} 8
+
+test 57 {} {
+ set v [vlerq def A {a b c d e f g h i j k l m n o p q r s t u v w x y z}]
+ for {set i 1} {$i < 25} {incr i 2} {
+ set v [vlerq set $v $i A $i]
+ }
+ set v
+} {data {mdef A} {a 1 c 3 e 5 g 7 i 9 k 11 m 13 o 15 q 17 s 19 u 21 w 23 y z}}
+
+test 58 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb 33 ccc}]
+ set w [vlerq insert $v 2 [vlerq def {A:I B} {1 1 2 2}]]
+} {data {mdef {A:I B}} {11 22 1 2 33} {a bb 1 2 ccc}}
+
+test 59 {2nd insert before} {
+ set w [vlerq insert $w 1 [vlerq def {A:I B} {3 3}]]
+} {data {mdef {A:I B}} {11 3 22 1 2 33} {a 3 bb 1 2 ccc}}
+
+test 60 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb 33 ccc}]
+ set w [vlerq insert $v 1 [vlerq def {A:I B} {1 1 2 2}]]
+} {data {mdef {A:I B}} {11 1 2 22 33} {a 1 2 bb ccc}}
+
+test 61 {2nd insert after} {
+ set w [vlerq insert $w 4 [vlerq def {A:I B} {3 3}]]
+} {data {mdef {A:I B}} {11 1 2 22 3 33} {a 1 2 bb 3 ccc}}
+
+test 62 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb}]
+ set w [vlerq insert $v 1 [vlerq def {A:I B} {1 c 2 d 3 e}]]
+} {data {mdef {A:I B}} {11 1 2 3 22} {a c d e bb}}
+
+test 63 {delete inside insert} {
+ set w [vlerq delete $w 2 1]
+} {data {mdef {A:I B}} {11 1 3 22} {a c e bb}}
+
+test 64 {} {
+ vlerq mutinfo $w
+} {{data {mdef {A:I B}} {1 3} {c e}} 0 0 {0 0} {0 0} {0 1 1 0} {}}
+
+test 65 {} {
+ set v [vlerq def {A:I B} {11 a 22 bb 33 ccc 44 dddd 55 eeeee}]
+ set w [vlerq delete $v 1 1]
+} {data {mdef {A:I B}} {11 33 44 55} {a ccc dddd eeeee}}
+
+test 66 {two independent deletes} {
+ vlerq delete $w 2 1
+} {data {mdef {A:I B}} {11 33 55} {a ccc eeeee}}
+
+test 67 {set high row, then low row} {
+ set v [vlerq def {A B} {a A b B c C d D e E}]
+ set w [vlerq set [vlerq set $v 3 A 3] 1 B 1]
+} {data {mdef {A B}} {a b c 3 e} {A 1 C D E}}
+
+test 68 {} {
+ vlerq mutinfo $w
+} {{data {mdef {A B}} {} {}}\
+ {data {mdef {A B}} {b 3} {1 D}}\
+ {data {mdef {_:I _:I}} {0 1} {1 0}}\
+ {0 0 0 0 0} {0 1 0 1 0} {0 0 0 0 0} {1 0}}
+
+test 69 {} {
+ vlerq insert [vlerq def A {}] 0 [vlerq def A {1 2 3}]
+} {data {mdef A} {1 2 3}}
+
+unset -nocomplain v w i
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/ops.test b/vqtcl/buildsrc/vqtcl/tests/ops.test
new file mode 100755
index 0000000..63fe88a
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/ops.test
@@ -0,0 +1,464 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load extension} {
+ package require vlerq
+} $version
+
+test 1 {view of empty string} {
+ vlerq viewconv {}
+} {}
+
+test 2 {view with no columns} {
+ vlerq viewconv 5
+} 5
+
+test 3 {view type of empty meta view} {
+ vlerq type [vlerq viewconv {}]
+} view
+
+test 4 {view type of no-column view} {
+ vlerq type [vlerq viewconv 5]
+} view
+
+test 5 {refcount of empty meta view} {
+ vlerq refs [vlerq viewconv {}]
+} 1
+
+test 6 {refcount of no-column view} {
+ vlerq refs [vlerq viewconv 5]
+} 1
+
+test 7 {size of empty view} {
+ vlerq size ""
+} 0
+
+test 8 {size of no-column view} {
+ vlerq size 5
+} 5
+
+test 9 {width of empty view} {
+ vlerq size [vlerq meta ""]
+} 3
+
+test 10 {width of no-column view} {
+ vlerq size [vlerq meta 5]
+} 0
+
+test 11 {meta meta view} {
+ set m [vlerq meta ""]
+} {mdef {name type {subv {}}}}
+
+test 12 {size of meta meta view} {
+ vlerq size $m
+} 3
+
+test 13 {width of meta meta view} {
+ vlerq size [vlerq meta $m]
+} 3
+
+test 14 {meta meta meta view} {
+ vlerq meta $m
+} {mdef {name type {subv {}}}}
+
+test 15 {empty meta view} {
+ set e [vlerq get $m 2 2]
+} {}
+
+test 16 {size of empty meta view} {
+ vlerq size $e
+} 0
+
+test 17 {width of empty meta view} {
+ vlerq size [vlerq meta $e]
+} 3
+
+test 18 {meta empty meta view} {
+ vlerq meta $e
+} {mdef {name type {subv {}}}}
+
+test 19 {contents of meta meta view} {
+ vlerq get $m
+} {name S {} type S {} subv V {}}
+
+test 20 {empty meta view from list} {
+ # this could trigger a different code path, see updateViewStrRep
+ set v [lreplace x 0 0]
+ vlerq viewconv $v
+} {}
+
+test 21 {no-column view from list} {
+ # this could trigger a different code path, see updateViewStrRep
+ set v [list 7]
+ vlerq viewconv $v
+} 7
+
+test 22 {to operator} {
+ vlerq to 12 v
+ vlerq size $v
+} 12
+
+test 23 {to operator result} {
+ vlerq to 12 v
+} 12
+
+test 24 {to result use} {
+ vlerq size @v
+} 12
+
+test 25 {to must set local var} -body {
+ # bt: failed on 2006-12-02
+ unset -nocomplain a
+ proc a {} { vlerq to [vlerq def a {1 2 3 4}] a; set a }
+ a
+} -result {data {mdef a} {1 2 3 4}} -cleanup { rename a "" }
+
+test 26 {data with meta view} {
+ set v [vlerq data [vlerq meta ""] {A B} {S I} {"" ""}]
+} {mdef {A B:I}}
+
+test 27 {mdef operator} {
+ vlerq mdef {A:S B:I}
+} {mdef {A B:I}}
+
+test 28 {mdesc operator} {
+ vlerq mdesc {A,B:I,C[D:L,E:F],F:V}
+} {mdef {A B:I {C {D:L E:F}} {F {}}}}
+
+test 29 {data operator} {
+ set v [vlerq data [vlerq mdef {A:S B:I}] {a b} {1 2}]
+} {data {mdef {A B:I}} {a b} {1 2}}
+
+test 30 {} {
+ set v [vlerq data [vlerq mdef {A B}] {a b c} {d e f}]
+ vlerq colmap $v {}
+} 3
+
+test 31 {} {
+ vlerq colmap $v 1
+} {data {mdef B} {d e f}}
+
+test 32 {} {
+ vlerq colmap $v {1 0}
+} {data {mdef {B A}} {d e f} {a b c}}
+
+test 33 {} {
+ vlerq colmap $v {0 1 0}
+} {data {mdef {A B A}} {a b c} {d e f} {a b c}}
+
+test 34 {} {
+ vlerq colmap $v B
+} {data {mdef B} {d e f}}
+
+test 35 {} {
+ vlerq colmap $v {B A}
+} {data {mdef {B A}} {d e f} {a b c}}
+
+test 36 {} {
+ vlerq colmap $v {A B A}
+} {data {mdef {A B A}} {a b c} {d e f} {a b c}}
+
+test 37 {} {
+ vlerq colmap $v {-1 -2}
+} {data {mdef {B A}} {d e f} {a b c}}
+
+test 38 {} {
+ vlerq repeat [vlerq def A {a b c}] 2
+} {data {mdef A} {a b c a b c}}
+
+test 39 {} {
+ vlerq spread [vlerq def A {a b c}] 2
+} {data {mdef A} {a a b b c c}}
+
+test 40 {} {
+ set v [vlerq data [vlerq mdef {A B}] {a b} {c d}]
+ set w [vlerq data [vlerq mdef {C D}] {1 2} {3 4}]
+ vlerq product $v $w
+} {data {mdef {A B C D}} {a a b b} {c c d d} {1 2 1 2} {3 4 3 4}}
+
+test 41 {} {
+ vlerq clone [vlerq def A {a b c}]
+} {data {mdef A} {}}
+
+test 42 {} {
+ vlerq reverse [vlerq def A {a b c}]
+} {data {mdef A} {c b a}}
+
+test 43 {} {
+ vlerq first [vlerq def A {a b c}] 0
+} {data {mdef A} {}}
+
+test 44 {} {
+ vlerq first [vlerq def A {a b c}] 2
+} {data {mdef A} {a b}}
+
+test 45 {} {
+ vlerq first [vlerq def A {a b c}] 4
+} {data {mdef A} {a b c}}
+
+test 46 {} {
+ vlerq last [vlerq def A {a b c}] 0
+} {data {mdef A} {}}
+
+test 47 {} {
+ vlerq last [vlerq def A {a b c}] 2
+} {data {mdef A} {b c}}
+
+test 48 {} {
+ vlerq last [vlerq def A {a b c}] 4
+} {data {mdef A} {a b c}}
+
+test 49 {} {
+ vlerq slice [vlerq def A {a b c d e f g h i}] 1 2 3
+} {data {mdef A} {b d f}}
+
+test 50 {} {
+ vlerq slice [vlerq def A {a b c d e f g h i}] 7 -2 3
+} {data {mdef A} {h f d}}
+
+test 51 {} {
+ vlerq names ""
+} {name type subv}
+
+test 52 {} {
+ vlerq names [vlerq meta ""]
+} {name type subv}
+
+test 53 {} {
+ vlerq types ""
+} {S S V}
+
+test 54 {} {
+ vlerq types [vlerq meta ""]
+} {S S V}
+
+test 55 {} {
+ vlerq take [vlerq def A {a b c}] 2
+} {data {mdef A} {a b}}
+
+test 56 {} {
+ vlerq take [vlerq def A {a b c}] 7
+} {data {mdef A} {a b c a b c a}}
+
+test 57 {} {
+ vlerq take [vlerq def A {a b c}] -2
+} {data {mdef A} {c b}}
+
+test 58 {} {
+ vlerq take [vlerq def A {a b c}] -7
+} {data {mdef A} {c b a c b a c}}
+
+test 59 {} {
+ vlerq namecol ""
+} {data {mdef name} {name type subv}}
+
+test 60 {} {
+ vlerq structure 123
+} {}
+
+test 61 {} {
+ vlerq structure ""
+} SSV
+
+test 62 {} {
+ vlerq structdesc 123
+} {}
+
+test 63 {} {
+ vlerq structdesc ""
+} {name:S,type:S,subv:V}
+
+test 64 {} {
+ vlerq compat 12 34
+} 1
+
+test 65 {} {
+ vlerq compat "" ""
+} 1
+
+test 66 {} {
+ vlerq compat 12 ""
+} 0
+
+test 67 {} {
+ vlerq compat "" 34
+} 0
+
+test 68 {} {
+ vlerq compat "" [vlerq meta ""]
+} 1
+
+test 69 {} {
+ vlerq compat [vlerq def A {1 2 3}] [vlerq def B {1 2 3}]
+} 1
+
+test 70 {} {
+ vlerq compat [vlerq def A {1 2 3}] [vlerq def A:I {1 2 3}]
+} 0
+
+test 71 {} {
+ vlerq compat [vlerq def {{A {B C}}} {}] [vlerq def {{D {E F}}} {}]
+} 1
+
+test 72 {} {
+ vlerq compat [vlerq def {{A {B C}}} {}] [vlerq def {{A {B C:I}}} {}]
+} 0
+
+test 73 {} {
+ vlerq def A ""
+} {data {mdef A} {}}
+
+test 74 {} {
+ vlerq def A {a b c}
+} {data {mdef A} {a b c}}
+
+test 75 {} {
+ vlerq def {A B} ""
+} {data {mdef {A B}} {} {}}
+
+test 76 {} {
+ vlerq def {A B} {a b c d}
+} {data {mdef {A B}} {a c} {b d}}
+
+test 77 {} {
+ vlerq def {A B:I} {a 1 b 02 c -03}
+} {data {mdef {A B:I}} {a b c} {1 2 -3}}
+
+test 78 {} {
+ vlerq tag 0 T
+} {data {mdef T:I} {}}
+
+test 79 {} {
+ vlerq tag 5 T
+} {data {mdef T:I} {0 1 2 3 4}}
+
+test 80 {} {
+ vlerq tag [vlerq def A {a b c}] T
+} {data {mdef {A T:I}} {a b c} {0 1 2}}
+
+test 81 {} {
+ vlerq tag [vlerq def {A B} {a A b B c C}] T
+} {data {mdef {A B T:I}} {a b c} {A B C} {0 1 2}}
+
+test 82 {} {
+ set v [vlerq def {A B C} {1 2 3 4 5 6 7 8 9}]
+ vlerq rename $v {B X}
+} {data {mdef {A X C}} {1 4 7} {2 5 8} {3 6 9}}
+
+test 83 {} {
+ vlerq rename $v {B X -1 Y}
+} {data {mdef {A X Y}} {1 4 7} {2 5 8} {3 6 9}}
+
+test 84 {} {
+ vlerq rename $v {A B B C C A}
+} {data {mdef {B C A}} {1 4 7} {2 5 8} {3 6 9}}
+
+test 85 {omit} {
+ set T [vlerq def {A B C D} {a b c d a b e f b c e f e d c d e d e f a b d e}]
+ vlerq colomit $T {2 3}
+} {data {mdef {A B}} {a a b e e a} {b b c d d b}}
+
+test 86 {omit reorder} {
+ vlerq colomit $T {3 2}
+} {data {mdef {A B}} {a a b e e a} {b b c d d b}}
+
+test 87 {omit named} {
+ set T [vlerq def {A B C D} {a b c d a b e f b c e f e d c d e d e f a b d e}]
+ vlerq colomit $T {C D}
+} {data {mdef {A B}} {a a b e e a} {b b c d d b}}
+
+test 88 {omit named reorder} {
+ vlerq colomit $T {D C}
+} {data {mdef {A B}} {a a b e e a} {b b c d d b}}
+
+test 89 {} {
+ set v [vlerq def {A B C} {1 2 3 4 5 6}]
+ vlerq colomit $v {C B}
+} {data {mdef A} {1 4}}
+
+test 90 {} {
+ vlerq colomit $v {A A}
+} {data {mdef {B C}} {2 5} {3 6}}
+
+test 91 {} {
+ vlerq colomit $v {}
+} {data {mdef {A B C}} {1 4} {2 5} {3 6}}
+
+test 92 {} {
+ vlerq viewascol [vlerq def {A B:I C} {1 2 3 4 5 6 7 8 9}]
+} {{1 4 7} {2 5 8} {3 6 9}}
+
+test 93 {} {
+ set v [vlerq def {A B} {1 2 3 4 1 2}]
+ vlerq rowcmp $v 0 $v 1
+} -1
+
+test 94 {} {
+ set v [vlerq def {A B} {1 2 3 4 1 2}]
+ vlerq rowcmp $v 0 $v 2
+} 0
+
+test 95 {} {
+ vlerq def {} {}
+} 0
+
+test 96 {} {
+ set v [vlerq def {A B} {a b c d e f}]
+ vlerq onecol $v A
+} {data {mdef A} {a c e}}
+
+test 97 {} {
+ set v [vlerq def {A B} {a b c d e f}]
+ vlerq onecol $v -1
+} {data {mdef B} {b d f}}
+
+test 98 {empty string col} {
+ vlerq load [vlerq emit [vlerq def A {"" "" ""}]]
+} {data {mdef A} {{} {} {}}}
+
+test 99 {16-bit getter} {
+ vlerq load [vlerq emit [vlerq def A:I {123 456 789}]]
+} {data {mdef A:I} {123 456 789}}
+
+test 100 {} {
+ vlerq pair [vlerq def A {a b c}] [vlerq def B {1 2 3}]
+} {data {mdef {A B}} {a b c} {1 2 3}}
+
+test 101 {} {
+ vlerq pair [vlerq def A {a b c}] 2
+} {data {mdef A} {a b}}
+
+test 102 {} {
+ vlerq pair [vlerq def A {a b c}] 3
+} {data {mdef A} {a b c}}
+
+test 103 {} {
+ vlerq pair [vlerq def A {a b c}] 4
+} {data {mdef A} {a b c}}
+
+test 104 {} {
+ vlerq pair 2 [vlerq def A {a b c}]
+} {data {mdef A} {a b}}
+
+test 105 {} {
+ vlerq pair 3 [vlerq def A {a b c}]
+} {data {mdef A} {a b c}}
+
+test 106 {} {
+ vlerq pair 4 [vlerq def A {a b c}]
+} {data {mdef A} {a b c}}
+
+test 107 {} {
+ # bt: crashed on 2007-02-10, see fff/139
+ vlerq pair [vlerq def A {a b c}] [vlerq def B {1 2}]
+} {data {mdef {A B}} {a b} {1 2}}
+
+test 108 {} {
+ vlerq pair [vlerq def A {a b}] [vlerq def B {1 2 3}]
+} {data {mdef {A B}} {a b} {1 2}}
+
+unset -nocomplain T e v w m
+
+::tcltest::cleanupTests
diff --git a/vqtcl/buildsrc/vqtcl/tests/ratcl.test b/vqtcl/buildsrc/vqtcl/tests/ratcl.test
new file mode 100755
index 0000000..7a6466d
--- /dev/null
+++ b/vqtcl/buildsrc/vqtcl/tests/ratcl.test
@@ -0,0 +1,376 @@
+#!/usr/bin/env tclkit
+# %renumber<^\s*test >%
+
+source [file join [file dir [info script]] initests.tcl]
+
+test 0 {load ratcl package} {
+ if {[file exists src_tcl/ratcl.tcl]} {
+ source src_tcl/ratcl.tcl
+ } else {
+ source library/ratcl.tcl
+ }
+ package require ratcl
+} 4
+
+test 1 {} {
+ view {A B} def {1 2 11 22 111 222} | reverse | get
+} {111 222 11 22 1 2}
+
+test 2 {} {
+ view {A B} def {1 2 11 22 111 222} | reverse | dump
+} { \
+ A B
+ --- ---
+ 111 222
+ 11 22
+ 1 2 }
+
+test 3 {} {
+ view 3 | dump
+} { (3 rows, no columns)}
+
+test 4 {} {
+ view "" | dump
+} { \
+ name type subv
+ ---- ---- ----}
+
+# tests copied from v3
+set v [view {A B C} def {1 2 3 11 22 33 111 222 333}]
+
+test 5 {} {
+ view $v names
+} {A B C}
+
+test 6 {} {
+ view $v types
+} {S S S}
+
+test 7 {} {
+ view $v width
+} 3
+
+test 8 {} {
+ vlerq get $v *
+} {{1 2 3} {11 22 33} {111 222 333}}
+
+test 9 {} {
+ view $v first 2 | get *
+} {{1 2 3} {11 22 33}}
+
+test 10 {} {
+ view $v last 2 | get *
+} {{11 22 33} {111 222 333}}
+
+test 11 {} {
+ view $v reverse | get *
+} {{111 222 333} {11 22 33} {1 2 3}}
+
+test 12 {} {
+ view $v repeat 2 | get *
+} {{1 2 3} {11 22 33} {111 222 333} {1 2 3} {11 22 33} {111 222 333}}
+
+test 13 {} {
+ view $v spread 2 | get *
+} {{1 2 3} {1 2 3} {11 22 33} {11 22 33} {111 222 333} {111 222 333}}
+
+test 14 {} {
+ view $v dump
+} { \
+ A B C
+ --- --- ---
+ 1 2 3
+ 11 22 33
+ 111 222 333}
+
+test 15 {} -body {
+ view $v html
+} -match glob -result {
+ | A | B | C |
+| 0 | 1 | 2 | 3 |
+| 1 | 11 | 22 | 33 |
+| 2 | 111 | 222 | 333 |
+
+}
+
+test 16 {} {
+ namespace eval blah {
+ namespace import ::ratcl::vopdef
+ vopdef haha {v} { return abc }
+ }
+ view - haha
+} {abc}
+
+namespace forget blah
+
+test 17 {transpose} {
+ set v [view {A B C} def {1 2 3 4 5 6 7 8 9} | transpose]
+ list [view $v names] [view $v structure] [view $v get]
+} {{x0 x1 x2} SSS {1 4 7 2 5 8 3 6 9}}
+
+test 18 {transpose ints} {
+ set v [view {A:I B:I C:I} def {1 2 3 4 5 6 7 8 9} | transpose X:I]
+ list [view $v names] [view $v structure] [view $v get]
+} {{X0 X1 X2} III {1 4 7 2 5 8 3 6 9}}
+
+test 19 {use vop} {
+ view 1 use 2
+} 2
+
+test 20 {do vop} {
+ set T [view {A B C D} def {a b c d a b e f b c e f e d c d e d e f a b d e}]
+ view $T do {
+ transpose
+ get
+ }
+} {a a b e e a b b c d d b c e e c e d d f f d f e}
+
+test 21 {debug vop} -body {
+ set T [view {A B C D} def {a b c d a b e f b c e f e d c d e d e f a b d e}]
+ view $T debug transpose | get
+} -match glob -output {\
+ rows-in col msec view-operation
+ ------- --- ---- --------------
+ 6 4 ?? transpose
+ 4 6 ---- --------------
+} -result {a a b e e a b b c d d b c e e c e d d f f d f e}
+
+test 22 {use and debug vops} -body {
+ view - debug {
+ use {A B}
+ def {1 2 3 4 5 6}
+ transpose
+ get
+ }
+} -result {1 3 5 2 4 6} -match glob -output {\
+ rows-in col msec view-operation
+ ------- --- ---- --------------
+ ?? use {A B}
+ ?? def {1 2 3 4 5 6}
+ 3 2 ?? transpose
+ 2 3 ?? get
+ ------- --- ---- --------------
+}
+
+test 23 {debug comments} -body {
+ view $T debug {
+ # start
+ transpose
+ # empty lines are not shown
+
+ structure
+ # end
+ }
+} -result SSSSSS -match glob -output {\
+ rows-in col msec view-operation
+ ------- --- ---- --------------
+ # start
+ 6 4 ?? transpose
+ # empty lines are not shown
+ 4 6 ?? structure
+ # end
+ ------- --- ---- --------------
+}
+
+test 24 {frequency table} {
+ view A def {a b a b b c} | freq N | get
+} {a 2 b 3 c 1}
+
+test 25 {frequency table on unique values} {
+ view A def {b a c} | freq N | get
+} {b 1 a 1 c 1}
+
+test 26 {frequency table on a single value} {
+ view A def {a a a a} | freq N | get
+} {a 4}
+
+test 27 {} {
+ view {1 2 3} asview A:I | structdesc
+} A:I
+
+test 28 {} {
+ view {1 2 3} asview A | structdesc
+} A:S
+
+test 29 {} {
+ view 10 asview len:I | get
+} 10
+
+test 30 {} {
+ view [view 10 asview len:I] min len 50
+} 10
+
+test 31 {} {
+ set v [vlerq def {A B} {1 a 1 b 1 b 2 c 3 c}]
+ view $v project A | get
+} {1 2 3}
+
+test 32 {} {
+ view $v project B | get
+} {a b c}
+
+test 33 {} {
+ view $v project A B | get
+} {1 a 1 b 2 c 3 c}
+
+test 34 {} {
+ view $v project | get
+} {}
+
+test 35 {} {
+ view A:I def {1 2 3 4 5 6 9 10 11 12} | pick {1 1 0 1 1 0 0 1 1 0} | get
+} {1 2 4 5 10 11}
+
+test 36 {} {
+ set v [vlerq def {A B} {1 2 3 4}]
+ set w [vlerq reverse $v]
+} {data {mdef {A B}} {3 1} {4 2}}
+
+test 37 {} {
+ set v [vlerq def {A B} {1 2 3 4}]
+ set w [vlerq reverse $v]
+ vlerq pair $v $w
+} {data {mdef {A B A B}} {1 3} {2 4} {3 1} {4 2}}
+
+test 38 {} {
+ set v [vlerq def {A B} {1 2 3 4}]
+ set w [vlerq reverse $v]
+ view $v pair $w | get
+} {1 2 3 4 3 4 1 2}
+
+test 39 {} {
+ set v [vlerq def {A B} {1 2 3 4}]
+ set w [vlerq reverse $v]
+ # 2006-12-08 failed because dump could not handle duplicate column names
+ view $v pair $w | dump
+} { \
+ A B A B
+ - - - -
+ 1 2 3 4
+ 3 4 1 2}
+
+test 40 {} -body {
+ set v [vlerq def {A B} {1 2 3 4}]
+ set w [vlerq reverse $v]
+ view $v pair $w | html
+} -match glob -result {