From 04d66a25716cb7738dad3170cca4d0a4683db08a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 27 Jun 2023 06:42:06 +0000 Subject: Remove compat/dirent*.h and some other compat/*.c files: Modern C-compilers all have those now --- compat/dirent.h | 21 --- compat/dirent2.h | 53 ------- compat/memcmp.c | 64 -------- compat/opendir.c | 110 ------------- compat/strstr.c | 70 --------- compat/strtol.c | 77 ---------- compat/strtoul.c | 214 -------------------------- unix/Makefile.in | 15 -- unix/configure | 435 ++++++---------------------------------------------- unix/configure.ac | 38 +---- unix/tcl.m4 | 34 ---- unix/tclConfig.h.in | 15 -- unix/tclUnixPort.h | 12 +- win/tcl.dsp | 44 ------ 14 files changed, 50 insertions(+), 1152 deletions(-) delete mode 100644 compat/dirent.h delete mode 100644 compat/dirent2.h delete mode 100644 compat/memcmp.c delete mode 100644 compat/opendir.c delete mode 100644 compat/strstr.c delete mode 100644 compat/strtol.c delete mode 100644 compat/strtoul.c diff --git a/compat/dirent.h b/compat/dirent.h deleted file mode 100644 index fa6222a..0000000 --- a/compat/dirent.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * dirent.h -- - * - * This file is a replacement for in systems that - * support the old BSD-style with a "struct direct". - * - * Copyright (c) 1991 The Regents of the University of California. - * Copyright (c) 1994 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 _DIRENT -#define _DIRENT - -#include - -#define dirent direct - -#endif /* _DIRENT */ diff --git a/compat/dirent2.h b/compat/dirent2.h deleted file mode 100644 index 5be08ba..0000000 --- a/compat/dirent2.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * dirent.h -- - * - * Declarations of a library of directory-reading procedures - * in the POSIX style ("struct dirent"). - * - * Copyright (c) 1991 The Regents of the University of California. - * Copyright (c) 1994 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 _DIRENT -#define _DIRENT - -/* - * Dirent structure, which holds information about a single - * directory entry. - */ - -#define MAXNAMLEN 255 -#define DIRBLKSIZ 512 - -struct dirent { - long d_ino; /* Inode number of entry */ - short d_reclen; /* Length of this record */ - short d_namlen; /* Length of string in d_name */ - char d_name[MAXNAMLEN + 1]; /* Name must be no longer than this */ -}; - -/* - * State that keeps track of the reading of a directory (clients - * should never look inside this structure; the fields should - * only be accessed by the library procedures). - */ - -typedef struct _dirdesc { - int dd_fd; - long dd_loc; - long dd_size; - char dd_buf[DIRBLKSIZ]; -} DIR; - -/* - * Procedures defined for reading directories: - */ - -extern void closedir (DIR *dirp); -extern DIR * opendir (char *name); -extern struct dirent * readdir (DIR *dirp); - -#endif /* _DIRENT */ diff --git a/compat/memcmp.c b/compat/memcmp.c deleted file mode 100644 index c4e25a8..0000000 --- a/compat/memcmp.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * memcmp.c -- - * - * Source code for the "memcmp" library routine. - * - * Copyright (c) 1998 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#include "tclPort.h" - -/* - * Here is the prototype just in case it is not included in tclPort.h. - */ - -int memcmp(const void *s1, const void *s2, size_t n); - -/* - *---------------------------------------------------------------------- - * - * memcmp -- - * - * Compares two bytes sequences. - * - * Results: - * Compares its arguments, looking at the first n bytes (each interpreted - * as an unsigned char), and returns an integer less than, equal to, or - * greater than 0, according as s1 is less than, equal to, or greater - * than s2 when taken to be unsigned 8 bit numbers. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -memcmp( - const void *s1, /* First string. */ - const void *s2, /* Second string. */ - size_t n) /* Length to compare. */ -{ - const unsigned char *ptr1 = (const unsigned char *) s1; - const unsigned char *ptr2 = (const unsigned char *) s2; - - for ( ; n-- ; ptr1++, ptr2++) { - unsigned char u1 = *ptr1, u2 = *ptr2; - - if (u1 != u2) { - return (u1-u2); - } - } - return 0; -} - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ diff --git a/compat/opendir.c b/compat/opendir.c deleted file mode 100644 index b9e7166..0000000 --- a/compat/opendir.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * opendir.c -- - * - * This file provides dirent-style directory-reading procedures for V7 - * Unix systems that don't have such procedures. The origin of this code - * is unclear, but it seems to have come originally from Larry Wall. - */ - -#include "tclInt.h" - -#undef DIRSIZ -#define DIRSIZ(dp) \ - ((sizeof(struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) - -/* - * open a directory. - */ - -DIR * -opendir( - char *name) -{ - DIR *dirp; - int fd; - const char *myname; - - myname = ((*name == '\0') ? "." : name); - if ((fd = open(myname, 0, 0)) == -1) { - return NULL; - } - dirp = (DIR *) attemptckalloc(sizeof(DIR)); - if (dirp == NULL) { - /* unreachable? */ - close(fd); - return NULL; - } - dirp->dd_fd = fd; - dirp->dd_loc = 0; - return dirp; -} - -/* - * read an old style directory entry and present it as a new one - */ -#ifndef pyr -#define ODIRSIZ 14 - -struct olddirect { - ino_t od_ino; - char od_name[ODIRSIZ]; -}; -#else /* a Pyramid in the ATT universe */ -#define ODIRSIZ 248 - -struct olddirect { - long od_ino; - short od_fill1, od_fill2; - char od_name[ODIRSIZ]; -}; -#endif - -/* - * get next entry in a directory. - */ - -struct dirent * -readdir( - DIR *dirp) -{ - struct olddirect *dp; - static struct dirent dir; - - for (;;) { - if (dirp->dd_loc == 0) { - dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ); - if (dirp->dd_size <= 0) { - return NULL; - } - } - if (dirp->dd_loc >= dirp->dd_size) { - dirp->dd_loc = 0; - continue; - } - dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc); - dirp->dd_loc += sizeof(struct olddirect); - if (dp->od_ino == 0) { - continue; - } - dir.d_ino = dp->od_ino; - strncpy(dir.d_name, dp->od_name, ODIRSIZ); - dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */ - dir.d_namlen = strlen(dir.d_name); - dir.d_reclen = DIRSIZ(&dir); - return &dir; - } -} - -/* - * close a directory. - */ - -void -closedir( - DIR *dirp) -{ - close(dirp->dd_fd); - dirp->dd_fd = -1; - dirp->dd_loc = 0; - ckfree(dirp); -} diff --git a/compat/strstr.c b/compat/strstr.c deleted file mode 100644 index 35386d0..0000000 --- a/compat/strstr.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * strstr.c -- - * - * Source code for the "strstr" library routine. - * - * Copyright (c) 1988-1993 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#include "tcl.h" -#ifndef NULL -#define NULL 0 -#endif - -/* - *---------------------------------------------------------------------- - * - * strstr -- - * - * Locate the first instance of a substring in a string. - * - * Results: - * If string contains substring, the return value is the location of the - * first matching instance of substring in string. If string doesn't - * contain substring, the return value is 0. Matching is done on an exact - * character-for-character basis with no wildcards or special characters. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -char * -strstr( - const char *string, /* String to search. */ - const char *substring) /* Substring to try to find in string. */ -{ - const char *a, *b; - - /* - * First scan quickly through the two strings looking for a - * single-character match. When it's found, then compare the rest of the - * substring. - */ - - b = substring; - if (*b == 0) { - return (char *)string; - } - for ( ; *string != 0; string += 1) { - if (*string != *b) { - continue; - } - a = string; - while (1) { - if (*b == 0) { - return (char *)string; - } - if (*a++ != *b++) { - break; - } - } - b = substring; - } - return NULL; -} diff --git a/compat/strtol.c b/compat/strtol.c deleted file mode 100644 index a9866f4..0000000 --- a/compat/strtol.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * strtol.c -- - * - * Source code for the "strtol" library procedure. - * - * Copyright (c) 1988 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#include "tclInt.h" - -/* - *---------------------------------------------------------------------- - * - * strtol -- - * - * Convert an ASCII string into an integer. - * - * Results: - * The return value is the integer equivalent of string. If endPtr is - * non-NULL, then *endPtr is filled in with the character after the last - * one that was part of the integer. If string doesn't contain a valid - * integer value, then zero is returned and *endPtr is set to string. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -long int -strtol( - const char *string, /* String of ASCII digits, possibly preceded - * by white space. For bases greater than 10, - * either lower- or upper-case digits may be - * used. */ - char **endPtr, /* Where to store address of terminating - * character, or NULL. */ - int base) /* Base for conversion. Must be less than 37. - * If 0, then the base is chosen from the - * leading characters of string: "0x" means - * hex, "0" means octal, anything else means - * decimal. */ -{ - const char *p; - long result; - - /* - * Skip any leading blanks. - */ - - p = string; - while (isspace(UCHAR(*p))) { - p += 1; - } - - /* - * Check for a sign. - */ - - if (*p == '-') { - p += 1; - result = -(strtoul(p, endPtr, base)); - } else { - if (*p == '+') { - p += 1; - } - result = strtoul(p, endPtr, base); - } - if ((result == 0) && (endPtr != 0) && (*endPtr == p)) { - *endPtr = (char *) string; - } - return result; -} diff --git a/compat/strtoul.c b/compat/strtoul.c deleted file mode 100644 index af63036..0000000 --- a/compat/strtoul.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * strtoul.c -- - * - * Source code for the "strtoul" library procedure. - * - * Copyright (c) 1988 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#include "tclInt.h" - -/* - * The table below is used to convert from ASCII digits to a numerical - * equivalent. It maps from '0' through 'z' to integers (100 for non-digit - * characters). - */ - -static const char cvtIn[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* '0' - '9' */ - 100, 100, 100, 100, 100, 100, 100, /* punctuation */ - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'A' - 'Z' */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, - 100, 100, 100, 100, 100, 100, /* punctuation */ - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'a' - 'z' */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35}; - -/* - *---------------------------------------------------------------------- - * - * strtoul -- - * - * Convert an ASCII string into an integer. - * - * Results: - * The return value is the integer equivalent of string. If endPtr is - * non-NULL, then *endPtr is filled in with the character after the last - * one that was part of the integer. If string doesn't contain a valid - * integer value, then zero is returned and *endPtr is set to string. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -unsigned long int -strtoul( - const char *string, /* String of ASCII digits, possibly preceded - * by white space. For bases greater than 10, - * either lower- or upper-case digits may be - * used. */ - char **endPtr, /* Where to store address of terminating - * character, or NULL. */ - int base) /* Base for conversion. Must be less than 37. - * If 0, then the base is chosen from the - * leading characters of string: "0x" means - * hex, "0" means octal, anything else means - * decimal. */ -{ - const char *p; - unsigned long int result = 0; - unsigned digit; - int anyDigits = 0; - int negative=0; - int overflow=0; - - /* - * Skip any leading blanks. - */ - - p = string; - while (isspace(UCHAR(*p))) { - p += 1; - } - if (*p == '-') { - negative = 1; - p += 1; - } else { - if (*p == '+') { - p += 1; - } - } - - /* - * If no base was provided, pick one from the leading characters of the - * string. - */ - - if (base == 0) { - if (*p == '0') { - p += 1; - if ((*p == 'x') || (*p == 'X')) { - p += 1; - base = 16; - } else { - /* - * Must set anyDigits here, otherwise "0" produces a "no - * digits" error. - */ - - anyDigits = 1; - base = 8; - } - } else { - base = 10; - } - } else if (base == 16) { - /* - * Skip a leading "0x" from hex numbers. - */ - - if ((p[0] == '0') && ((p[1] == 'x') || (p[1] == 'X'))) { - p += 2; - } - } - - /* - * Sorry this code is so messy, but speed seems important. Do different - * things for base 8, 10, 16, and other. - */ - - if (base == 8) { - unsigned long maxres = ULONG_MAX >> 3; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > 7) { - break; - } - if (result > maxres) { overflow = 1; } - result = (result << 3); - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } else if (base == 10) { - unsigned long maxres = ULONG_MAX / 10; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > 9) { - break; - } - if (result > maxres) { overflow = 1; } - result *= 10; - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } else if (base == 16) { - unsigned long maxres = ULONG_MAX >> 4; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > ('z' - '0')) { - break; - } - digit = cvtIn[digit]; - if (digit > 15) { - break; - } - if (result > maxres) { overflow = 1; } - result = (result << 4); - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } else if (base >= 2 && base <= 36) { - unsigned long maxres = ULONG_MAX / base; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > ('z' - '0')) { - break; - } - digit = cvtIn[digit]; - if (digit >= ( (unsigned) base )) { - break; - } - if (result > maxres) { overflow = 1; } - result *= base; - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } - - /* - * See if there were any digits at all. - */ - - if (!anyDigits) { - p = string; - } - - if (endPtr != 0) { - /* unsafe, but required by the strtoul prototype */ - *endPtr = (char *) p; - } - - if (overflow) { - errno = ERANGE; - return ULONG_MAX; - } - if (negative) { - return -result; - } - return result; -} diff --git a/unix/Makefile.in b/unix/Makefile.in index 7497135..d2bd30e 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1881,27 +1881,12 @@ tclXtTest.o: $(UNIX_DIR)/tclXtTest.c # relocatable. #-------------------------------------------------------------------------- -opendir.o: $(COMPAT_DIR)/opendir.c - $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/opendir.c - mkstemp.o: $(COMPAT_DIR)/mkstemp.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/mkstemp.c -memcmp.o: $(COMPAT_DIR)/memcmp.c - $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/memcmp.c - strncasecmp.o: $(COMPAT_DIR)/strncasecmp.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strncasecmp.c -strstr.o: $(COMPAT_DIR)/strstr.c - $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strstr.c - -strtol.o: $(COMPAT_DIR)/strtol.c - $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtol.c - -strtoul.o: $(COMPAT_DIR)/strtoul.c - $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtoul.c - waitpid.o: $(COMPAT_DIR)/waitpid.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/waitpid.c diff --git a/unix/configure b/unix/configure index 7bb92a4..e1623fe 100755 --- a/unix/configure +++ b/unix/configure @@ -1604,53 +1604,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1722,6 +1675,53 @@ fi } # ac_fn_c_try_cpp +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -4158,102 +4158,6 @@ printf "%s\n" "$ac_cv_path_EGREP" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dirent.h" >&5 -printf %s "checking dirent.h... " >&6; } -if test ${tcl_cv_dirent_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main (void) -{ - -#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 -if ac_fn_c_try_link "$LINENO" -then : - tcl_cv_dirent_h=yes -else $as_nop - tcl_cv_dirent_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_dirent_h" >&5 -printf "%s\n" "$tcl_cv_dirent_h" >&6; } - - if test $tcl_cv_dirent_h = no; then - -printf "%s\n" "#define NO_DIRENT_H 1" >>confdefs.h - - fi - - ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes -then : - tcl_ok=1 -else $as_nop - tcl_ok=0 -fi - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtol" >/dev/null 2>&1 -then : - -else $as_nop - tcl_ok=0 -fi -rm -rf conftest* - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtoul" >/dev/null 2>&1 -then : - -else $as_nop - tcl_ok=0 -fi -rm -rf conftest* - - if test $tcl_ok = 0; then - -printf "%s\n" "#define NO_STDLIB_H 1" >>confdefs.h - - fi ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes then : @@ -8120,32 +8024,6 @@ else $as_nop esac fi -ac_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" -if test "x$ac_cv_func_opendir" = xyes -then : - printf "%s\n" "#define HAVE_OPENDIR 1" >>confdefs.h - -else $as_nop - case " $LIBOBJS " in - *" opendir.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS opendir.$ac_objext" - ;; -esac - -fi -ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" -if test "x$ac_cv_func_strtol" = xyes -then : - printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h - -else $as_nop - case " $LIBOBJS " in - *" strtol.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtol.$ac_objext" - ;; -esac - -fi ac_fn_c_check_func "$LINENO" "waitpid" "ac_cv_func_waitpid" if test "x$ac_cv_func_waitpid" = xyes then : @@ -9537,77 +9415,6 @@ fi #-------------------------------------------------------------------- -# Some system have no memcmp or it does not work with 8 bit data, this -# checks it and add memcmp.o to LIBOBJS if needed -#-------------------------------------------------------------------- - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 -printf %s "checking for working memcmp... " >&6; } -if test ${ac_cv_func_memcmp_working+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - ac_cv_func_memcmp_working=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main (void) -{ - - /* Some versions of memcmp are not 8-bit clean. */ - char c0 = '\100', c1 = '\200', c2 = '\201'; - if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) - return 1; - - /* The Next x86 OpenStep bug shows up only when comparing 16 bytes - or more and with at least one buffer not starting on a 4-byte boundary. - William Lewis provided this test program. */ - { - char foo[21]; - char bar[21]; - int i; - for (i = 0; i < 4; i++) - { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - if (memcmp (a, b, 16) >= 0) - return 1; - } - return 0; - } - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - ac_cv_func_memcmp_working=yes -else $as_nop - ac_cv_func_memcmp_working=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 -printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } -test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in - *" memcmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" - ;; -esac - - - -#-------------------------------------------------------------------- # Some system like SunOS 4 and other BSD like systems have no memmove # (we assume they have bcopy instead). {The replacement define is in # compat/string.h} @@ -9629,136 +9436,6 @@ fi #-------------------------------------------------------------------- -# On some systems strstr is broken: it returns a pointer even if -# the original string is empty. -#-------------------------------------------------------------------- - - - ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" -if test "x$ac_cv_func_strstr" = xyes -then : - tcl_ok=1 -else $as_nop - tcl_ok=0 -fi - - if test "$tcl_ok" = 1; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking proper strstr implementation" >&5 -printf %s "checking proper strstr implementation... " >&6; } -if test ${tcl_cv_strstr_unbroken+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - tcl_cv_strstr_unbroken=unknown -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int main() { - exit(strstr("\0test", "test") ? 1 : 0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - tcl_cv_strstr_unbroken=ok -else $as_nop - tcl_cv_strstr_unbroken=broken -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strstr_unbroken" >&5 -printf "%s\n" "$tcl_cv_strstr_unbroken" >&6; } - if test "$tcl_cv_strstr_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 - fi - fi - if test "$tcl_ok" = 0; then - case " $LIBOBJS " in - *" strstr.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strstr.$ac_objext" - ;; -esac - - USE_COMPAT=1 - 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_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" -if test "x$ac_cv_func_strtoul" = xyes -then : - tcl_ok=1 -else $as_nop - tcl_ok=0 -fi - - if test "$tcl_ok" = 1; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking proper strtoul implementation" >&5 -printf %s "checking proper strtoul implementation... " >&6; } -if test ${tcl_cv_strtoul_unbroken+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - tcl_cv_strtoul_unbroken=unknown -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int main() { - char *term, *string = "0"; - exit(strtoul(string,&term,0) != 0 || term != string+1); -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - tcl_cv_strtoul_unbroken=ok -else $as_nop - tcl_cv_strtoul_unbroken=broken -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtoul_unbroken" >&5 -printf "%s\n" "$tcl_cv_strtoul_unbroken" >&6; } - if test "$tcl_cv_strtoul_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 - fi - fi - if test "$tcl_ok" = 0; then - case " $LIBOBJS " in - *" strtoul.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtoul.$ac_objext" - ;; -esac - - USE_COMPAT=1 - fi - - -#-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- @@ -9917,24 +9594,6 @@ fi #-------------------------------------------------------------------- -# 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_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" -if test "x$ac_cv_func_opendir" = xyes -then : - -else $as_nop - -printf "%s\n" "#define USE_DIRENT2_H 1" >>confdefs.h - -fi - - -#-------------------------------------------------------------------- # The check below checks whether 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 diff --git a/unix/configure.ac b/unix/configure.ac index a695390..653a203 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -229,7 +229,7 @@ AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD, 1, [Is getcwd Posix-compliant?])]) # Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really # define USEGETWD even if the posix getcwd exists. Add a test ? -AC_REPLACE_FUNCS(mkstemp opendir strtol waitpid) +AC_REPLACE_FUNCS(mkstemp waitpid) AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR, 1, [Do we have strerror()])]) AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD, 1, [Do we have getwd()])]) AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3, 1, [Do we have wait3()])]) @@ -377,13 +377,6 @@ AC_CHECK_TYPES([blkcnt_t]) AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS, 1, [Do we have fstatfs()?])]) #-------------------------------------------------------------------- -# Some system have no memcmp or it does not work with 8 bit data, this -# checks it and add memcmp.o to LIBOBJS if needed -#-------------------------------------------------------------------- - -AC_FUNC_MEMCMP - -#-------------------------------------------------------------------- # Some system like SunOS 4 and other BSD like systems have no memmove # (we assume they have bcopy instead). {The replacement define is in # compat/string.h} @@ -394,26 +387,6 @@ AC_CHECK_FUNC(memmove, , [ AC_DEFINE(NO_STRING_H, 1, [Do we have ?]) ]) #-------------------------------------------------------------------- -# On some systems strstr is broken: it returns a pointer even if -# the original string is empty. -#-------------------------------------------------------------------- - -SC_TCL_CHECK_BROKEN_FUNC(strstr, [ - exit(strstr("\0test", "test") ? 1 : 0); -]) - -#-------------------------------------------------------------------- -# Check for strtoul function. This is tricky because under some -# versions of AIX strtoul returns an incorrect terminator -# pointer for the string "0". -#-------------------------------------------------------------------- - -SC_TCL_CHECK_BROKEN_FUNC(strtoul, [ - char *term, *string = "0"; - exit(strtoul(string,&term,0) != 0 || term != string+1); -]) - -#-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- @@ -439,15 +412,6 @@ AC_CHECK_TYPES([intptr_t, uintptr_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, 1, [May we include ?])]) - -#-------------------------------------------------------------------- # The check below checks whether 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 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 874860b..fc0cfb7 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1932,8 +1932,6 @@ dnl # preprocessing tests use only CPPFLAGS. # Results: # # Defines some of the following vars: -# NO_DIRENT_H -# NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H # NO_DLFCN_H @@ -1943,38 +1941,6 @@ dnl # preprocessing tests use only CPPFLAGS. #-------------------------------------------------------------------- AC_DEFUN([SC_MISSING_POSIX_HEADERS], [ - AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#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(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) - 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) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 49906d0..cd81d4e 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -178,9 +178,6 @@ /* Define to 1 if you have the `open64' function. */ #undef HAVE_OPEN64 -/* Define to 1 if you have the `opendir' function. */ -#undef HAVE_OPENDIR - /* Define to 1 if you have the `OSSpinLockLock' function. */ #undef HAVE_OSSPINLOCKLOCK @@ -217,9 +214,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - /* Define to 1 if the system has the type `struct addrinfo'. */ #undef HAVE_STRUCT_ADDRINFO @@ -334,9 +328,6 @@ /* Is Darwin CoreFoundation unavailable for 64-bit? */ #undef NO_COREFOUNDATION_64 -/* Do we have ? */ -#undef NO_DIRENT_H - /* Do we have ? */ #undef NO_DLFCN_H @@ -364,9 +355,6 @@ /* Do we have realpath() */ #undef NO_REALPATH -/* Do we have ? */ -#undef NO_STDLIB_H - /* Do we have strerror() */ #undef NO_STRERROR @@ -459,9 +447,6 @@ /* Is getcwd Posix-compliant? */ #undef USEGETWD -/* May we include ? */ -#undef USE_DIRENT2_H - /* Are we building with DTrace support? */ #undef USE_DTRACE diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 8ac5060..8f13ecd 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -7,7 +7,7 @@ * file that contains #ifdefs to handle different flavors of UNIX. This * file sets up the union of all UNIX-related things needed by any of the * Tcl core files. This file depends on configuration #defines such as - * NO_DIRENT_H that are set up by the "configure" script. + * HAVE_SYS_PARAM_H that are set up by the "configure" script. * * Much of the material in this file was originally contributed by Karl * Lehenbauer, Mark Diekhans and Peter da Silva. @@ -40,15 +40,7 @@ # include #endif #include -#ifdef USE_DIRENT2_H -# include "../compat/dirent2.h" -#else -#ifdef NO_DIRENT_H -# include "../compat/dirent.h" -#else -# include -#endif -#endif +#include /* *--------------------------------------------------------------------------- diff --git a/win/tcl.dsp b/win/tcl.dsp index aff1000..93e093c 100644 --- a/win/tcl.dsp +++ b/win/tcl.dsp @@ -136,14 +136,6 @@ CFG=tcl - Win32 Debug Static # PROP Default_Filter "" # Begin Source File -SOURCE=..\compat\dirent.h -# End Source File -# Begin Source File - -SOURCE=..\compat\dirent2.h -# End Source File -# Begin Source File - SOURCE=..\compat\dlfcn.h # End Source File # Begin Source File @@ -156,48 +148,12 @@ SOURCE=..\compat\limits.h # End Source File # Begin Source File -SOURCE=..\compat\memcmp.c -# End Source File -# Begin Source File - -SOURCE=..\compat\opendir.c -# End Source File -# Begin Source File - SOURCE=..\compat\README # End Source File # Begin Source File -SOURCE=..\compat\stdlib.h -# End Source File -# Begin Source File - SOURCE=..\compat\string.h # End Source File -# Begin Source File - -SOURCE=..\compat\strncasecmp.c -# End Source File -# Begin Source File - -SOURCE=..\compat\strstr.c -# End Source File -# Begin Source File - -SOURCE=..\compat\strtol.c -# End Source File -# Begin Source File - -SOURCE=..\compat\strtoul.c -# End Source File -# Begin Source File - -SOURCE=..\compat\tclErrno.h -# End Source File -# Begin Source File - -SOURCE=..\compat\waitpid.c -# End Source File # End Group # Begin Group "doc" -- cgit v0.12