+++ /dev/null
-/*
- * tclAppInit.c --
- *
- * Provides a default version of the main program and Tcl_AppInit
- * procedure for Tcl applications (without Tk).
- *
- * Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id: tclAppInit.c,v 1.1 1997/09/16 15:36:36 stanleyg Exp $";
-#endif /* not lint */
-
-#include "tcl.h"
-
-/*
- * The following variable is a special hack that is needed in order for
- * Sun shared libraries to be used for Tcl.
- */
-
-extern int matherr();
-int *tclDummyMathPtr = (int *) matherr;
-\f
-/*
- *----------------------------------------------------------------------
- *
- * main --
- *
- * This is the main program for the application.
- *
- * Results:
- * None: Tcl_Main never returns here, so this procedure never
- * returns either.
- *
- * Side effects:
- * Whatever the application does.
- *
- *----------------------------------------------------------------------
- */
-
-int
-main(argc, argv)
- int argc; /* Number of command-line arguments. */
- char **argv; /* Values of command-line arguments. */
-{
- Tcl_Main(argc, argv, Tcl_AppInit);
- return 0; /* Needed only to prevent compiler warning. */
-}
-\f
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_AppInit --
- *
- * This procedure performs application-specific initialization.
- * Most applications, especially those that incorporate additional
- * packages, will have their own version of this procedure.
- *
- * Results:
- * Returns a standard Tcl completion code, and leaves an error
- * message in interp->result if an error occurs.
- *
- * Side effects:
- * Depends on the startup script.
- *
- *----------------------------------------------------------------------
- */
-
-int
-Tcl_AppInit(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
-{
- if (Tcl_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
-
- /*
- * Call the init procedures for included packages. Each call should
- * look like this:
- *
- * if (Mod_Init(interp) == TCL_ERROR) {
- * return TCL_ERROR;
- * }
- *
- * where "Mod" is the name of the module.
- */
- if (FCGI_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
-
- /*
- * Call Tcl_CreateCommand for application-specific commands, if
- * they weren't already created by the init procedures called above.
- */
-
- /*
- * Specify a user-specific startup file to invoke if the application
- * is run interactively. Typically the startup file is "~/.apprc"
- * where "app" is the name of the application. If this line is deleted
- * then no user-specific startup file will be run under any conditions.
- */
-
- tcl_RcFileName = "~/.tclshrc";
- return TCL_OK;
-}
+++ /dev/null
-/*
- * tclFCGI.c --
- *
- * TCL functions needed to set up FastCGI commands
- *
- * Copyright (c) 1996 Open Market, Inc.
- *
- * See the file "LICENSE.TERMS" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id: tclFCGI.c,v 1.1 1997/09/16 15:36:36 stanleyg Exp $";
-#endif /* not lint */
-
-#include <tcl.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/fcntl.h>
-#include "fcgiapp.h"
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-extern char **environ;
-static char **requestEnviron = NULL;
-
-
-/*
- * For each variable in the array envp, either set or unset it
- * in the interpreter interp.
- */
-static void DoTclEnv(Tcl_Interp *interp, char **envp, int set)
-{
- int i;
- char *p, *p1;
- for (i = 0; ; i++) {
- if ((p = envp[i]) == NULL) {
- break;
- }
- p1 = strchr(p, '=');
- *p1 = '\0';
- if(set) {
- Tcl_SetVar2(interp, "env", p, p1 + 1, TCL_GLOBAL_ONLY);
- } else {
- Tcl_UnsetVar2(interp, "env", p, TCL_GLOBAL_ONLY);
- }
- *p1 = '=';
- }
-}
-
-
-/*
- * If running as FastCGI, grab FDs 1 and 2 so the Tcl open
- * command won't see them and think it has discovered stdout/stderr.
- * Grab the FDs using /dev/null so that attempts to write
- * to stdout/stderr before calling FCGI_Accept are a no-op rather
- * than crashing Tcl.
- */
-static void GrabFDs(void)
-{
- if(FCGX_IsCGI()) {
- return;
- }
- for (;;) {
- int fd = open("/dev/null", O_WRONLY, 0);
- if(fd >= 2) {
- break;
- }
- }
-}
-
-
-static int FcgiAcceptCmd(
- ClientData dummy, Tcl_Interp *interp, int argc, char **argv)
-{
- char **savedEnviron;
- int acceptStatus;
- /*
- * Unmake Tcl variable settings for the request just completed.
- */
- if(requestEnviron != NULL) {
- DoTclEnv(interp, requestEnviron, FALSE);
- requestEnviron = NULL;
- }
- /*
- * Call FCGI_Accept but preserve environ.
- */
- savedEnviron = environ;
- acceptStatus = FCGI_Accept();
- requestEnviron = environ;
- environ = savedEnviron;
- /*
- * Make Tcl variable settings for the new request.
- */
- if(acceptStatus >= 0 && !FCGX_IsCGI()) {
- DoTclEnv(interp, requestEnviron, TRUE);
- } else {
- requestEnviron = NULL;
- }
- sprintf(interp->result, "%d", acceptStatus);
- return TCL_OK;
-}
-
-
-static int FcgiFinishCmd(
- ClientData dummy, Tcl_Interp *interp, int argc, char **argv)
-{
- /*
- * Unmake Tcl variable settings for the completed request.
- */
- if(requestEnviron != NULL) {
- DoTclEnv(interp, requestEnviron, FALSE);
- requestEnviron = NULL;
- }
- /*
- * Call FCGI_Finish.
- */
- FCGI_Finish();
- sprintf(interp->result, "%d", 0);
- return TCL_OK;
-}
-
-
-static int FcgiSetExitStatusCmd(
- ClientData dummy, Tcl_Interp *interp, int argc, char **argv)
-{
- if (argc != 2) {
- sprintf(interp->result, "wrong # args");
- return TCL_ERROR;
- }
- FCGI_SetExitStatus(atoi(argv[1]));
- sprintf(interp->result, "%d", 0);
- return TCL_OK;
-}
-
-
-static int FcgiStartFilterDataCmd(
- ClientData dummy, Tcl_Interp *interp, int argc, char **argv)
-{
- sprintf(interp->result, "%d", FCGI_StartFilterData());
- return TCL_OK;
-}
-
-
-int FCGI_Init(Tcl_Interp *interp) {
- GrabFDs();
- Tcl_CreateCommand(
- interp, "FCGI_Accept", FcgiAcceptCmd, 0, NULL);
- Tcl_CreateCommand(
- interp, "FCGI_Finish", FcgiFinishCmd, 0, NULL);
- Tcl_CreateCommand(
- interp, "FCGI_SetExitStatus", FcgiSetExitStatusCmd, 0, NULL);
- Tcl_CreateCommand(
- interp, "FCGI_StartFilterData", FcgiStartFilterDataCmd, 0, NULL);
- return TCL_OK;
-}
+++ /dev/null
-#
-# This file is a Makefile for Tcl. 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.
-#
-# @(#) Makefile.in 1.24 95/07/27 12:40:13
-
-# Current Tcl version; used in various names.
-
-VERSION = 7.4
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# Directory from which applications will reference the library of Tcl
-# scripts (note: you can set the TCL_LIBRARY environment variable at
-# run-time to override this value):
-TCL_LIBRARY = $(prefix)/lib/tcl$(VERSION)
-
-# Path name to use when installing library scripts:
-SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY)
-
-# Directory in which to install the archive libtcl.a:
-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
-
-# Directory in which to install the program tclsh:
-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
-
-# Directory in which to install the include file tcl.h:
-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include
-
-# Top-level directory in which to install manual entries:
-MAN_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/man
-
-# Directory in which to install manual entry for tclsh:
-MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1
-
-# Directory in which to install manual entries for Tcl's C library
-# procedures:
-MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
-
-# Directory in which to install manual entries for the built-in
-# Tcl commands:
-MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann
-
-# Additional libraries to use when linking. The "LIBS" part will be
-# replaced (or has already been replaced) with relevant libraries as
-# determined by the configure script.
-LIBS = ../fcgi-devel-kit/libfcgi/libfcgi.a @LIBS@
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = -g -I../fcgi-devel-kit/include -include ../fcgi-devel-kit/include/fcgi_stdio.h
-
-# To disable ANSI-C procedure prototypes reverse the comment characters
-# on the following lines:
-PROTO_FLAGS =
-#PROTO_FLAGS = -DNO_PROTOTYPE
-
-# Mathematical functions like sin and atan2 are enabled for expressions
-# by default. To disable them, reverse the comment characters on the
-# following pairs of lines:
-MATH_FLAGS =
-#MATH_FLAGS = -DTCL_NO_MATH
-MATH_LIBS = @MATH_LIBS@
-#MATH_LIBS =
-
-# To compile for non-UNIX systems (so that only the non-UNIX-specific
-# commands are available), reverse the comment characters on the
-# following pairs of lines. In addition, you'll have to provide your
-# own replacement for the "panic" procedure (see panic.c for what
-# the current one does).
-GENERIC_FLAGS =
-#GENERIC_FLAGS = -DTCL_GENERIC_ONLY
-UNIX_OBJS = panic.o tclEnv.o tclGlob.o tclMain.o tclMtherr.o \
- tclUnixAZ.o tclUnixStr.o tclUnixUtil.o
-#UNIX_OBJS =
-
-# To enable memory debugging reverse the comment characters on the following
-# lines. Warning: if you enable memory debugging, you must do it
-# *everywhere*, including all the code that calls Tcl, and you must use
-# ckalloc and ckfree everywhere instead of malloc and free.
-MEM_DEBUG_FLAGS =
-#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# Tcl used to let the configure script choose which program to use
-# for installing, but there are just too many different versions of
-# "install" around; better to use the install-sh script that comes
-# with the distribution, which is slower but guaranteed to work.
-
-INSTALL = @srcdir@/install-sh -c
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-COMPAT_OBJS = @LIBOBJS@
-AC_FLAGS = @DEFS@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-RANLIB = @RANLIB@
-SRC_DIR = @srcdir@
-VPATH = @srcdir@
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-
-CC = @CC@
-CC_SWITCHES = ${CFLAGS} -I. -I${SRC_DIR} ${AC_FLAGS} ${MATH_FLAGS} \
-${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
--DTCL_LIBRARY=\"${TCL_LIBRARY}\"
-
-GENERIC_OBJS = regexp.o tclAsync.o tclBasic.o tclCkalloc.o \
- tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclExpr.o tclGet.o \
- tclHash.o tclHistory.o tclLink.o tclParse.o tclProc.o \
- tclUtil.o tclVar.o tclFCGI.o
-
-OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS}
-
-SRCS= regexp.c tclAsync.c tclBasic.c tclCkalloc.c \
- tclCmdAH.c tclCmdIL.c tclCmdMZ.c tclExpr.c tclGet.c \
- tclHash.c tclHistory.c tclLink.c tclParse.c tclProc.c \
- tclUtil.c tclVar.c panic.c tclEnv.c tclGlob.c tclMain.c \
- tclMtherr.c tclUnixAZ.c tclUnixStr.c tclUnixUtil.c \
- tclTest.c tclAppInit.c tclFCGI.c
-
-all: libtcl.a tclsh
-
-libtcl.a: ${OBJS}
- rm -f libtcl.a
- ar cr libtcl.a ${OBJS}
- $(RANLIB) libtcl.a
-
-tclsh: tclAppInit.o libtcl.a
- ${CC} ${CC_SWITCHES} tclAppInit.o libtcl.a ${LIBS} ${MATH_LIBS} -o tclsh
-
-tcltest: tclTest.o libtcl.a
- ${CC} ${CC_SWITCHES} tclTest.o libtcl.a ${LIBS} ${MATH_LIBS} -o tcltest
-
-test: tcltest
- @cwd=`pwd`; \
- cd $(SRC_DIR); TCL_LIBRARY=`pwd`/library; export TCL_LIBRARY; \
- cd $$cwd; ( echo cd $(SRC_DIR)/tests\; source all ) | ./tcltest
-
-configInfo: Makefile
- @rm -f configInfo
- @echo "# Definitions and libraries needed to build Tcl applications" >> configInfo
- @echo "# (generated by the configure script):" >> configInfo
- @echo "TCL_CC_SWITCHES = ${AC_FLAGS} ${MEM_DEBUG_FLAGS}" >> configInfo
- @echo "TCL_LIBS = ${LIBS} ${MATH_LIBS}" >> configInfo
-
-install: install-binaries install-libraries install-man
-
-install-binaries: libtcl.a tclsh
- @for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @echo "Installing libtcl.a"
- @$(INSTALL_DATA) libtcl.a $(LIB_INSTALL_DIR)/libtcl$(VERSION).a
- @$(RANLIB) $(LIB_INSTALL_DIR)/libtcl$(VERSION).a
- @echo "Installing tclsh"
- @$(INSTALL_PROGRAM) tclsh $(BIN_INSTALL_DIR)/tclsh$(VERSION)
-
-install-libraries:
- @for i in $(INSTALL_ROOT)$(prefix)/lib $(INCLUDE_INSTALL_DIR) \
- $(SCRIPT_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @echo "Installing tcl.h"
- @$(INSTALL_DATA) $(SRC_DIR)/tcl.h $(INCLUDE_INSTALL_DIR)
- @for i in $(SRC_DIR)/library/*.tcl $(SRC_DIR)/library/tclIndex $(SRC_DIR)/tclAppInit.c; \
- do \
- echo "Installing $$i"; \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
- done;
-
-install-man:
- @for i in $(MAN_INSTALL_DIR) $(MAN1_INSTALL_DIR) $(MAN3_INSTALL_DIR) $(MANN_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @cd $(SRC_DIR)/doc; for i in *.1; \
- do \
- echo "Installing doc/$$i"; \
- rm -f $(MAN1_INSTALL_DIR)/$$i; \
- sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
- $$i > $(MAN1_INSTALL_DIR)/$$i; \
- chmod 444 $(MAN1_INSTALL_DIR)/$$i; \
- done;
- @cd $(SRC_DIR)/doc; for i in *.3; \
- do \
- echo "Installing doc/$$i"; \
- rm -f $(MAN3_INSTALL_DIR)/$$i; \
- sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
- $$i > $(MAN3_INSTALL_DIR)/$$i; \
- chmod 444 $(MAN3_INSTALL_DIR)/$$i; \
- done;
- @cd $(SRC_DIR)/doc; for i in *.n; \
- do \
- echo "Installing doc/$$i"; \
- rm -f $(MANN_INSTALL_DIR)/$$i; \
- sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
- $$i > $(MANN_INSTALL_DIR)/$$i; \
- chmod 444 $(MANN_INSTALL_DIR)/$$i; \
- done;
-
-Makefile: $(SRC_DIR)/Makefile.in
- $(SHELL) config.status
-
-clean:
- rm -f *.a *.o core errs *~ \#* TAGS *.E a.out errors tclsh tcltest \
- config.info
-
-distclean: clean
- rm -f Makefile config.status config.cache
-
-depend:
- makedepend -- $(CC_SWITCHES) -- $(SRCS)
-
-fixstrtod.o: $(SRC_DIR)/compat/fixstrtod.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/fixstrtod.c
-
-getcwd.o: $(SRC_DIR)/compat/getcwd.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/getcwd.c
-
-opendir.o: $(SRC_DIR)/compat/opendir.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/opendir.c
-
-strerror.o: $(SRC_DIR)/compat/strerror.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strerror.c
-
-strncasecmp.o: $(SRC_DIR)/compat/strncasecmp.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strncasecmp.c
-
-strstr.o: $(SRC_DIR)/compat/strstr.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strstr.c
-
-strtod.o: $(SRC_DIR)/compat/strtod.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtod.c
-
-strtol.o: $(SRC_DIR)/compat/strtol.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtol.c
-
-strtoul.o: $(SRC_DIR)/compat/strtoul.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtoul.c
-
-tmpnam.o: $(SRC_DIR)/compat/tmpnam.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/tmpnam.c
-
-waitpid.o: $(SRC_DIR)/compat/waitpid.c
- $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/waitpid.c
-
-.c.o:
- $(CC) -c $(CC_SWITCHES) $<
-
-#
-# Target to check for proper usage of UCHAR macro.
-#
-
-checkuchar:
- -egrep isalnum\|isalpha\|iscntrl\|isdigit\|islower\|isprint\|ispunct\|isspace\|isupper\|isxdigit $(SRCS) | grep -v UCHAR
-
-#
-# Target to make sure that only symbols with "Tcl" prefixes are
-# exported.
-#
-
-checkexports: libtcl.a
- -nm -p libtcl.a | awk '$$2 ~ /[TDB]/ { print $$3 }' | sort -n | grep -v '^[Tt]cl'
-
-#
-# Target to create a proper Tcl distribution from information in the
-# master source directory. DISTDIR must be defined to indicate where
-# to put the distribution.
-#
-
-configure: configure.in
- autoconf
-dist: configure
- rm -rf $(DISTDIR)
- mkdir $(DISTDIR)
- cp Makefile.in $(DISTDIR)
- chmod 664 $(DISTDIR)/Makefile.in
- cp -p $(SRCS) $(DISTDIR)
- cp -p tclRegexp.h tcl.h tclInt.h tclPort.h patchlevel.h $(DISTDIR)
- cp configure configure.in $(DISTDIR)
- chmod 775 $(DISTDIR)/configure $(DISTDIR)/configure.in
- cp -p changes README porting.notes porting.old license.terms \
- install-sh $(DISTDIR)
- chmod +x $(DISTDIR)/install-sh
- mkdir $(DISTDIR)/library
- cp -p license.terms library/*.tcl library/tclIndex $(DISTDIR)/library
- mkdir $(DISTDIR)/doc
- cp -p license.terms doc/*.[13n] doc/man.macros $(DISTDIR)/doc
- mkdir $(DISTDIR)/compat
- cp -p license.terms compat/*.c compat/*.h compat/README \
- $(DISTDIR)/compat
- mkdir $(DISTDIR)/tests
- cp -p license.terms $(DISTDIR)/tests
- cp -p tests/*.test tests/README tests/all tests/defs $(DISTDIR)/tests
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
+++ /dev/null
-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.
-AC_INIT(tcl.h)
-# @(#) configure.in 1.15 95/06/27 21:53:14
-
-AC_PROG_INSTALL
-AC_PROG_RANLIB
-AC_PREFIX_PROGRAM(tclsh)
-AC_PROG_CC
-AC_C_CROSS
-AC_SUBST(CC)
-
-#--------------------------------------------------------------------
-# On SVR4 systems, force linking with the socket libs
-#--------------------------------------------------------------------
-AC_CHECK_LIB(socket, main, [LIBS="$LIBS -lsocket"])
-AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])
-AC_SUBST(LIBS)
-
-#--------------------------------------------------------------------
-# Supply substitutes for missing POSIX library procedures, or
-# set flags so Tcl uses alternate procedures.
-#--------------------------------------------------------------------
-
-AC_REPLACE_FUNCS(getcwd opendir strerror strstr)
-AC_REPLACE_FUNCS(strtol tmpnam waitpid)
-AC_CHECK_FUNC(getwd, , AC_DEFINE(NO_GETWD))
-AC_CHECK_FUNC(wait3, , AC_DEFINE(NO_WAIT3))
-
-#--------------------------------------------------------------------
-# 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_SUBST(MATH_LIBS)
-AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
-
-#--------------------------------------------------------------------
-# Supply substitutes for missing POSIX header files. Special
-# notes:
-# - Sprite's dirent.h exists but is bogus.
-# - 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
-#--------------------------------------------------------------------
-
-AC_HAVE_HEADERS(unistd.h)
-AC_MSG_CHECKING(dirent.h)
-AC_TRY_LINK([#include <sys/types.h>
-#include <dirent.h>], [
-#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_ok=yes, tcl_ok=no)
-AC_EGREP_HEADER([Sprite version.* NOT POSIX], dirent.h, tcl_ok=no)
-if test $tcl_ok = no; then
- AC_DEFINE(NO_DIRENT_H)
-fi
-AC_MSG_RESULT($tcl_ok)
-AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
-AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H))
-AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
-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)
-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)
-if test $tcl_ok = 0; then
- AC_DEFINE(NO_STRING_H)
-fi
-AC_CHECK_HEADER(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
-AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
-
-#--------------------------------------------------------------------
-# On some systems strstr is broken: it returns a pointer even
-# even if the original string is empty.
-#--------------------------------------------------------------------
-
-AC_MSG_CHECKING([proper strstr implementation])
-AC_TRY_RUN([
-extern int strstr();
-int main()
-{
- exit(strstr("\0test", "test") ? 1 : 0);
-}
-], tcl_ok=yes, tcl_ok=no)
-if test $tcl_ok = yes; then
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT([broken, using substitute])
- LIBOBJS="$LIBOBJS strstr.o"
-fi
-
-#--------------------------------------------------------------------
-# Check for strtoul function. This is tricky because under some
-# versions of AIX strtoul returns an incorrect terminator
-# pointer for the string "0".
-#--------------------------------------------------------------------
-
-AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0)
-AC_TRY_RUN([
-extern int strtoul();
-int main()
-{
- char *string = "0";
- char *term;
- int value;
- value = strtoul(string, &term, 0);
- if ((value != 0) || (term != (string+1))) {
- exit(1);
- }
- exit(0);
-}], , tcl_ok=0)
-if test $tcl_ok = 0; then
- test -n "$verbose" && echo " Adding strtoul.o."
- LIBOBJS="$LIBOBJS strtoul.o"
-fi
-
-#--------------------------------------------------------------------
-# Check for the strtod function. This is tricky because in some
-# versions of Linux strtod mis-parses strings starting with "+".
-#--------------------------------------------------------------------
-
-AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0)
-AC_TRY_RUN([
-extern double strtod();
-int main()
-{
- char *string = " +69";
- char *term;
- double value;
- value = strtod(string, &term);
- if ((value != 69) || (term != (string+4))) {
- exit(1);
- }
- exit(0);
-}], , tcl_ok=0)
-if test $tcl_ok = 0; then
- test -n "$verbose" && echo " Adding strtod.o."
- LIBOBJS="$LIBOBJS strtod.o"
-fi
-
-#--------------------------------------------------------------------
-# 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" that corrects the error.
-#--------------------------------------------------------------------
-
-AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
-if test "$tcl_strtod" = 1; then
- AC_MSG_CHECKING([for Solaris strtod bug])
- AC_TRY_RUN([
- extern double strtod();
- int main()
- {
- char *string = "NaN";
- char *term;
- strtod(string, &term);
- if ((term != string) && (term[-1] == 0)) {
- exit(1);
- }
- exit(0);
- }], AC_MSG_RESULT(ok), [
- AC_MSG_RESULT(buggy)
- LIBOBJS="$LIBOBJS fixstrtod.o"
- AC_DEFINE(strtod, fixstrtod)
- ])
-fi
-
-#--------------------------------------------------------------------
-# Check for various typedefs and provide substitutes if
-# they don't exist.
-#--------------------------------------------------------------------
-
-AC_TYPE_MODE_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_TYPE_UID_T
-
-#--------------------------------------------------------------------
-# If a system doesn't have an opendir function (man, that's old!)
-# then we have to supply a different version of dirent.h which
-# is compatible with the substitute version of opendir that's
-# provided. This version only works with V7-style directories.
-#--------------------------------------------------------------------
-
-AC_CHECK_FUNC(opendir, , AC_DEFINE(USE_DIRENT2_H))
-
-#--------------------------------------------------------------------
-# Check for the existence of sys_errlist (this is only needed if
-# there's no strerror, but I don't know how to conditionalize the
-# check).
-#--------------------------------------------------------------------
-
-AC_MSG_CHECKING(sys_errlist)
-AC_TRY_LINK(, [
-extern char *sys_errlist[];
-extern int sys_nerr;
-sys_errlist[sys_nerr-1][0] = 0;
-], tcl_ok=yes, tcl_ok=no)
-AC_MSG_RESULT($tcl_ok)
-if test $tcl_ok = no; then
- AC_DEFINE(NO_SYS_ERRLIST)
-fi
-
-#--------------------------------------------------------------------
-# The check below checks whether <sys/wait.h> defines the type
-# "union wait" correctly. It's needed because of weirdness in
-# HP-UX where "union wait" is defined in both the BSD and SYS-V
-# environments. Checking the usability of WIFEXITED seems to do
-# the trick.
-#--------------------------------------------------------------------
-
-AC_MSG_CHECKING([union wait])
-AC_TRY_LINK([#include <sys/types.h>
-#include <sys/wait.h>], [
-union wait x;
-WIFEXITED(x); /* Generates compiler error if WIFEXITED
- * uses an int. */
-], tcl_ok=yes, tcl_ok=no)
-AC_MSG_RESULT($tcl_ok)
-if test $tcl_ok = no; then
- AC_DEFINE(NO_UNION_WAIT)
-fi
-
-#--------------------------------------------------------------------
-# Check to see whether the system supports the matherr function
-# and its associated type "struct exception".
-#--------------------------------------------------------------------
-
-AC_MSG_CHECKING([matherr support])
-AC_TRY_COMPILE([#include <math.h>], [
-struct exception x;
-x.type = DOMAIN;
-x.type = SING;
-], tcl_ok=yes, tcl_ok=no)
-AC_MSG_RESULT($tcl_ok)
-if test $tcl_ok = yes; then
- AC_DEFINE(NEED_MATHERR)
-fi
-
-#--------------------------------------------------------------------
-# Check to see whether the system provides a vfork kernel call.
-# If not, then use fork instead. Also, check for a problem with
-# Solaris 2.4 and vforks and signals that can core dumps can occur
-# if a vforked child resets a signal handler. If the problem
-# exists, then use fork instead of vfork.
-#--------------------------------------------------------------------
-
-AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0)
-if test "$tcl_ok" = 1; then
- AC_MSG_CHECKING([Solaris 2.4 vfork/signal bug]);
- AC_TRY_RUN([
- #include <stdio.h>
- #include <signal.h>
- #include <sys/wait.h>
- int gotSignal = 0;
- sigProc(sig)
- int sig;
- {
- gotSignal = 1;
- }
- main()
- {
- int pid, sts;
- (void) signal(SIGCHLD, sigProc);
- pid = vfork();
- if (pid < 0) {
- exit(1);
- } else if (pid == 0) {
- (void) signal(SIGCHLD, SIG_DFL);
- _exit(0);
- } else {
- (void) wait(&sts);
- }
- exit((gotSignal) ? 0 : 1);
- }], AC_MSG_RESULT(ok), [
- AC_MSG_RESULT(buggy)
- tcl_ok=0
- ])
-fi
-rm -f core
-if test "$tcl_ok" = 0; then
- AC_DEFINE(vfork, fork)
-fi
-
-#--------------------------------------------------------------------
-# Check whether there is an strncasecmp function on this system.
-# This is a bit tricky because under SCO it's in the socket
-# library.
-#--------------------------------------------------------------------
-
-AC_CHECK_FUNC(strncasecmp, ,
- AC_CHECK_LIB(socket, strncasecmp, , [LIBOBJS="$LIBOBJS strncasecmp.o"]))
-
-#--------------------------------------------------------------------
-# The code below deals with several issues related to gettimeofday:
-# 1. Some systems don't provide a gettimeofday function at all
-# (set NO_GETTOD if this is the case).
-# 2. SGI systems don't use the BSD form of the gettimeofday function,
-# but they have a BSDgettimeofday function that can be used instead.
-# 3. See if gettimeofday is declared in the <sys/time.h> header file.
-# if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can
-# declare it.
-#--------------------------------------------------------------------
-
-AC_CHECK_FUNC(BSDgettimeofday, AC_DEFINE(HAVE_BSDGETTIMEOFDAY),
- AC_CHECK_FUNC(gettimeofday, , AC_DEFINE(NO_GETTOD)))
-AC_MSG_CHECKING([for gettimeofday declaration])
-AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [
- AC_MSG_RESULT(missing)
- AC_DEFINE(GETTOD_NOT_DECLARED)
-])
-
-AC_OUTPUT(Makefile)