home *** CD-ROM | disk | FTP | other *** search
- 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)
- AC_PROG_INSTALL
- AC_PROG_RANLIB
- CC=${CC-cc}
- AC_SUBST(CC)
-
- #--------------------------------------------------------------------
- # 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_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
- AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
- AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))
-
- #--------------------------------------------------------------------
- # 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_UNISTD_H
- AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
- #include <dirent.h>], [
- DIR *d;
- struct dirent *entryPtr;
- char *p;
- d = opendir("foobar");
- entryPtr = readdir(d);
- p = entryPtr->d_name;
- closedir(d);
- ], tcl_ok=1, tcl_ok=0)
- AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=0)
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_DIRENT_H)
- fi
- AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H))
- AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
- AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
- AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
- AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
- AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
- AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_STDLIB_H)
- fi
- AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
- AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
- AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_STRING_H)
- fi
- AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
- AC_HEADER_CHECK(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_TEST_PROGRAM([
- extern int strstr();
- int main()
- {
- exit(strstr("\0test", "test") ? 1 : 0);
- }
- ], , [LIBOBJS="$LIBOBJS strstr.o"])
-
- #--------------------------------------------------------------------
- # Check for strtoul function. This is tricky because under some
- # versions of AIX strtoul returns an incorrect terminator
- # pointer for the string "0".
- #--------------------------------------------------------------------
-
- AC_FUNC_CHECK(strtoul, tcl_ok=1, tcl_ok=0)
- AC_TEST_PROGRAM([
- 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
- LIBOBJS="$LIBOBJS strtoul.o"
- fi
-
- #--------------------------------------------------------------------
- # Check for the strtod function. This is tricky because under
- # some versions of Linux it mis-parses the string "+".
- #--------------------------------------------------------------------
-
- AC_FUNC_CHECK(strtod, tcl_ok=1, tcl_ok=0)
- AC_TEST_PROGRAM([
- extern double strtod();
- int main()
- {
- char *string = "+";
- char *term;
- double value;
- value = strtod(string, &term);
- if (term != string) {
- exit(1);
- }
- exit(0);
- }], , tcl_ok=0)
- if test $tcl_ok = 0; then
- LIBOBJS="$LIBOBJS strtod.o"
- fi
-
- #--------------------------------------------------------------------
- # Check for various typedefs and provide substitutes if
- # they don't exist.
- #--------------------------------------------------------------------
-
- AC_MODE_T
- AC_PID_T
- AC_SIZE_T
- AC_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_FUNC_CHECK(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_COMPILE_CHECK(sys_errlist, , [
- extern char *sys_errlist[];
- extern int sys_nerr;
- sys_errlist[sys_nerr-1][0] = 0;
- ], , AC_DEFINE(NO_SYS_ERRLIST))
-
- #--------------------------------------------------------------------
- # 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_COMPILE_CHECK([union wait], [#include <sys/types.h>
- #include <sys/wait.h>], [
- union wait x;
- WIFEXITED(x); /* Generates compiler error if WIFEXITED
- * uses an int. */
- ], , AC_DEFINE(NO_UNION_WAIT))
-
- #--------------------------------------------------------------------
- # Check to see whether the system supports the matherr function
- # and its associated type "struct exception".
- #--------------------------------------------------------------------
-
- AC_COMPILE_CHECK([matherr support], [#include <math.h>], [
- struct exception x;
- x.type = DOMAIN;
- x.type = SING;
- ], [LIBOBJS="$LIBOBJS tclMtherr.o"; AC_DEFINE(NEED_MATHERR)])
-
- AC_OUTPUT(Makefile)
-