From b134b7beb27e5ccf73392ae7b9e8b0a04bad05a3 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 17 Oct 2001 09:28:16 +0000 Subject: Changes to make more use of what autoconf can discover. Also adds *lots* more cacheing of discovered values, which not only speeds up reconfiguring, but also makes mistakes easier to override. --- generic/tcl.h | 53 +--- unix/Makefile.in | 8 +- unix/configure | 792 +++++++++++++++++++++++++++++++++++------------------ unix/configure.in | 92 +++---- unix/tcl.m4 | 259 ++++++++++++------ unix/tclUnixPort.h | 25 +- 6 files changed, 784 insertions(+), 445 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 335ad28..79f1f40 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.102.2.15 2001/10/15 14:58:54 dkf Exp $ + * RCS: @(#) $Id: tcl.h,v 1.102.2.16 2001/10/17 09:28:16 dkf Exp $ */ #ifndef _TCL @@ -170,25 +170,6 @@ extern "C" { #ifndef RESOURCE_INCLUDED -/* - * Must #define before *any* #include of system headers or all hell - * tends to break loose... - * - * _LARGEFILE64_SOURCE requests the presence (transitional) 64-bit - * interface to file operations. - * - * _ISOC99_SOURCE requests the presence of strtoll() and strtoull() on - * some platforms (e.g. glibc2.1-based Linux.) - */ -#define _LARGEFILE64_SOURCE 1 -#define _ISOC99_SOURCE 1 -/* - * *Not* the following definition... - * - * #define _LARGEFILE_SOURCE 1 - */ - - #ifndef BUFSIZ # include #endif @@ -391,6 +372,10 @@ typedef TCL_WIDE_INT_TYPE Tcl_WideInt; # ifdef __WIN32__ typedef __int64 Tcl_WideInt; # else +/* + * Type of 64-bit values on 32-bit systems. I think this is the ISO + * C99 standard way of writing this type. + */ typedef long long Tcl_WideInt; # endif /* __WIN32__ */ # endif /* _LP64 | __ALPHA | __alpha | _AIX */ @@ -398,46 +383,38 @@ typedef long long Tcl_WideInt; #endif /* TCL_WIDE_INT_TYPE */ #ifdef TCL_WIDE_INT_IS_LONG +# include typedef long Tcl_WideInt; +# ifdef __WIN32__ +typedef long Tcl_SeekOffset; +# else typedef off_t Tcl_SeekOffset; +# endif typedef struct stat Tcl_StatBuf; -typedef struct dirent Tcl_DirEntry; # define Tcl_WideAsLong(val) ((long)(val)) # define Tcl_LongAsWide(val) ((long)(val)) # define Tcl_WideAsDouble(val) ((double)((long)(val))) # define Tcl_DoubleAsWide(val) ((long)((double)(val))) -# define Tcl_PlatformStat stat -# define Tcl_PlatformLStat lstat -# define Tcl_PlatformSeek lseek -# define Tcl_PlatformOpen open -# define Tcl_PlatformReaddir readdir #else /* TCL_WIDE_INT_IS_LONG */ -/* - * Type of 64-bit values on 32-bit systems. I think this is the ISO - * C99 standard way of writing this type. - */ # define TCL_PRINTF_SUPPORTS_LL # ifdef __WIN32__ -typedef Tcl_WideInt Tcl_SeekOffset; typedef struct _stati64 Tcl_StatBuf; # define TCL_LL_MODIFIER "I64" # define TCL_LL_MODIFIER_SIZE 3 # else -typedef off64_t Tcl_SeekOffset; +# include +# ifdef HAVE_STRUCT_STAT64 typedef struct stat64 Tcl_StatBuf; +# else +typedef struct stat Tcl_StatBuf; +# endif /* HAVE_STRUCT_STAT64 */ # define TCL_LL_MODIFIER "ll" # define TCL_LL_MODIFIER_SIZE 2 # endif -typedef struct dirent64 Tcl_DirEntry; # define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) # define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) # define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) # define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) -# define Tcl_PlatformStat stat64 -# define Tcl_PlatformLStat lstat64 -# define Tcl_PlatformSeek lseek64 -# define Tcl_PlatformOpen open64 -# define Tcl_PlatformReaddir readdir64 #endif /* TCL_WIDE_INT_IS_LONG */ diff --git a/unix/Makefile.in b/unix/Makefile.in index 31ae68e..d95ed8e 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.83 2001/09/10 00:33:09 mdejong Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.83.4.1 2001/10/17 09:28:16 dkf Exp $ VERSION = @TCL_VERSION@ @@ -1031,9 +1031,15 @@ strtod.o: $(COMPAT_DIR)/strtod.c strtol.o: $(COMPAT_DIR)/strtol.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtol.c +strtoll.o: $(COMPAT_DIR)/strtoll.c + $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtoll.c + strtoul.o: $(COMPAT_DIR)/strtoul.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtoul.c +strtoull.o: $(COMPAT_DIR)/strtoull.c + $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtoull.c + tmpnam.o: $(COMPAT_DIR)/tmpnam.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/tmpnam.c diff --git a/unix/configure b/unix/configure index 67cb2e9..f8d9f82 100755 --- a/unix/configure +++ b/unix/configure @@ -410,7 +410,7 @@ else fi -# RCS: @(#) $Id: configure.in,v 1.72 2001/08/12 21:17:43 mdejong Exp $ +# RCS: @(#) $Id: configure.in,v 1.72.6.1 2001/10/15 14:58:55 dkf Exp $ TCL_VERSION=8.4 TCL_MAJOR_VERSION=8 @@ -937,13 +937,122 @@ fi cross_compiling=$ac_cv_c_cross echo "$ac_t""$ac_cv_c_cross" 1>&6 -echo $ac_n "checking for 64-bit integer type""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'tcl_cv_type_64bit'+set}'`\" = set"; then + + + echo $ac_n "checking for required early compiler flags""... $ac_c" 1>&6 + tcl_flags="" + + if eval "test \"`echo '$''{'tcl_cv_flag__isoc99_source'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { return 0; } +int t() { +char *p = (char *)strtoll; char *q = (char *)strtoull; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + tcl_cv_flag__isoc99_source=no +else + rm -rf conftest* + cat > conftest.$ac_ext < +int main() { return 0; } +int t() { +char *p = (char *)strtoll; char *q = (char *)strtoull; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + tcl_cv_flag__isoc99_source=yes +else + rm -rf conftest* + tcl_cv_flag__isoc99_source=no +fi +rm -f conftest* + +fi +rm -f conftest* + +fi + + if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define _ISOC99_SOURCE 1 +EOF + + tcl_flags="$tcl_flags _ISOC99_SOURCE" + fi + + if eval "test \"`echo '$''{'tcl_cv_flag__largefile64_source'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { return 0; } +int t() { +struct stat64 buf; int i = stat64("/", &buf); +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + tcl_cv_flag__largefile64_source=no +else + rm -rf conftest* + cat > conftest.$ac_ext < +int main() { return 0; } +int t() { +struct stat64 buf; int i = stat64("/", &buf); +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + tcl_cv_flag__largefile64_source=yes +else + rm -rf conftest* + tcl_cv_flag__largefile64_source=no +fi +rm -f conftest* + +fi +rm -f conftest* + +fi + + if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define _LARGEFILE64_SOURCE 1 +EOF + + tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" + fi + if test "x${tcl_flags}" = "x" ; then + echo "$ac_t""none" 1>&6 + else + echo "$ac_t""${tcl_flags}" 1>&6 + fi + + + echo $ac_n "checking for 64-bit integer type""... $ac_c" 1>&6 + if eval "test \"`echo '$''{'tcl_cv_type_64bit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext < -int main() { - exit(!(sizeof(long long) > sizeof(long))); -} - + int main() {exit(!(sizeof(long long) > sizeof(long)));} + EOF eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then tcl_cv_type_64bit="long long" -else - tcl_cv_type_64bit=none fi fi rm -fr conftest* @@ -982,20 +1087,123 @@ rm -f conftest* fi -if test "${tcl_cv_type_64bit}" = none ; then - cat >> confdefs.h <<\EOF + if test "${tcl_cv_type_64bit}" = none ; then + cat >> confdefs.h <<\EOF #define TCL_WIDE_INT_IS_LONG 1 EOF - echo "$ac_t""using long" 1>&6 -else - cat >> confdefs.h <&6 + else + cat >> confdefs.h <&6 + echo "$ac_t""${tcl_cv_type_64bit}" 1>&6 + + # Now check for auxiliary declarations + echo $ac_n "checking for struct dirent64""... $ac_c" 1>&6 + if eval "test \"`echo '$''{'tcl_cv_struct_dirent64'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { return 0; } +int t() { +struct dirent64 p; + +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + tcl_cv_struct_dirent64=yes +else + rm -rf conftest* + tcl_cv_struct_dirent64=no +fi +rm -f conftest* + +fi + + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_DIRENT64 1 +EOF + + fi + echo "$ac_t""${tcl_cv_struct_dirent64}" 1>&6 + + echo $ac_n "checking for struct stat64""... $ac_c" 1>&6 + if eval "test \"`echo '$''{'tcl_cv_struct_stat64'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { return 0; } +int t() { +struct stat64 p; + +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + tcl_cv_struct_stat64=yes +else + rm -rf conftest* + tcl_cv_struct_stat64=no +fi +rm -f conftest* + fi + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_STAT64 1 +EOF + + fi + echo "$ac_t""${tcl_cv_struct_stat64}" 1>&6 + + echo $ac_n "checking for off64_t""... $ac_c" 1>&6 + if eval "test \"`echo '$''{'tcl_cv_type_off64_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { return 0; } +int t() { +off64_t offset; + +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + tcl_cv_type_off64_t=yes +else + rm -rf conftest* + tcl_cv_type_off64_t=no +fi +rm -f conftest* + +fi + + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_TYPE_OFF64_T 1 +EOF + + fi + echo "$ac_t""${tcl_cv_type_off64_t}" 1>&6 + fi + #-------------------------------------------------------------------- # Supply substitutes for missing POSIX library procedures, or # set flags so Tcl uses alternate procedures. @@ -1009,7 +1217,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 cat > conftest.$ac_ext < #include @@ -1464,7 +1672,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1497,7 +1705,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1530,7 +1738,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1563,7 +1771,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1596,7 +1804,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1621,7 +1829,7 @@ tcl_ok=0 fi cat > conftest.$ac_ext < EOF @@ -1635,7 +1843,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -1649,7 +1857,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -1674,7 +1882,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1699,7 +1907,7 @@ tcl_ok=0 fi cat > conftest.$ac_ext < EOF @@ -1713,7 +1921,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -1743,7 +1951,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1776,7 +1984,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1814,7 +2022,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1853,18 +2061,19 @@ done echo $ac_n "checking termios vs. termio vs. sgtty""... $ac_c" 1>&6 - + if eval "test \"`echo '$''{'tcl_cv_api_serial'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then - tk_ok=no + tcl_cv_api_serial=no else cat > conftest.$ac_ext < - -main() -{ +main() { struct termios t; if (tcgetattr(0, &t) == 0) { cfsetospeed(&t, 0); @@ -1876,30 +2085,22 @@ main() EOF eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - tk_ok=termios + tcl_cv_api_serial=termios else - tk_ok=no + tcl_cv_api_serial=no fi fi rm -fr conftest* - - if test $tk_ok = termios; then - cat >> confdefs.h <<\EOF -#define USE_TERMIOS 1 -EOF - - else + if test $tcl_cv_api_serial = no ; then if test "$cross_compiling" = yes; then - tk_ok=no + tcl_cv_api_serial=no else cat > conftest.$ac_ext < - -main() -{ +main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; @@ -1910,30 +2111,23 @@ main() EOF eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - tk_ok=termio + tcl_cv_api_serial=termio else - tk_ok=no + tcl_cv_api_serial=no fi fi rm -fr conftest* - - if test $tk_ok = termio; then - cat >> confdefs.h <<\EOF -#define USE_TERMIO 1 -EOF - - else + fi + if test $tcl_cv_api_serial = no ; then if test "$cross_compiling" = yes; then - tk_ok=none + tcl_cv_api_serial=none else cat > conftest.$ac_ext < - -main() -{ +main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0) { t.sg_ospeed = 0; @@ -1945,31 +2139,24 @@ main() EOF eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - tk_ok=sgtty + tcl_cv_api_serial=sgtty else - tk_ok=none + tcl_cv_api_serial=none fi fi rm -fr conftest* - - if test $tk_ok = sgtty; then - cat >> confdefs.h <<\EOF -#define USE_SGTTY 1 -EOF - - else + fi + if test $tcl_cv_api_serial = no ; then if test "$cross_compiling" = yes; then - tk_ok=no + tcl_cv_api_serial=no else cat > conftest.$ac_ext < #include - -main() -{ +main() { struct termios t; if (tcgetattr(0, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -1982,31 +2169,24 @@ main() EOF eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - tk_ok=termios + tcl_cv_api_serial=termios else - tk_ok=no + tcl_cv_api_serial=no fi fi rm -fr conftest* - - if test $tk_ok = termios; then - cat >> confdefs.h <<\EOF -#define USE_TERMIOS 1 -EOF - - else + fi + if test $tcl_cv_api_serial = no; then if test "$cross_compiling" = yes; then - tk_ok=no + tcl_cv_api_serial=no else cat > conftest.$ac_ext < #include - -main() -{ +main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -2018,31 +2198,24 @@ main() EOF eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - tk_ok=termio + tcl_cv_api_serial=termio else - tk_ok=no + tcl_cv_api_serial=no fi fi rm -fr conftest* - - if test $tk_ok = termio; then - cat >> confdefs.h <<\EOF -#define USE_TERMIO 1 -EOF - - else + fi + if test $tcl_cv_api_serial = no; then if test "$cross_compiling" = yes; then - tk_ok=none + tcl_cv_api_serial=none else cat > conftest.$ac_ext < #include - -main() -{ +main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -2055,25 +2228,30 @@ main() EOF eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - tk_ok=sgtty + tcl_cv_api_serial=sgtty else - tk_ok=none + tcl_cv_api_serial=none fi fi rm -fr conftest* + fi +fi - if test $tk_ok = sgtty; then - cat >> confdefs.h <<\EOF + case $tcl_cv_api_serial in + termios) cat >> confdefs.h <<\EOF +#define USE_TERMIOS 1 +EOF +;; + termio) cat >> confdefs.h <<\EOF +#define USE_TERMIO 1 +EOF +;; + sgtty) cat >> confdefs.h <<\EOF #define USE_SGTTY 1 EOF - - fi - fi - fi - fi - fi - fi - echo "$ac_t""$tk_ok" 1>&6 +;; + esac + echo "$ac_t""$tcl_cv_api_serial" 1>&6 #-------------------------------------------------------------------- @@ -2086,9 +2264,12 @@ EOF # special flag. #-------------------------------------------------------------------- -echo $ac_n "checking fd_set and sys/select""... $ac_c" 1>&6 -cat > conftest.$ac_ext <&6 +if eval "test \"`echo '$''{'tcl_cv_type_fd_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < int main() { return 0; } @@ -2098,34 +2279,48 @@ fd_set readMask, writeMask; EOF if eval $ac_compile; then rm -rf conftest* - tk_ok=yes + tcl_cv_type_fd_set=yes else rm -rf conftest* - tk_ok=no + tcl_cv_type_fd_set=no fi rm -f conftest* -if test $tk_ok = no; then - cat > conftest.$ac_ext <&6 +tk_ok=$tcl_cv_type_fd_set +if test $tcl_cv_type_fd_set = no; then + echo $ac_n "checking for fd_mask in sys/select""... $ac_c" 1>&6 + if eval "test \"`echo '$''{'tcl_cv_grep_fd_mask'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "fd_mask" >/dev/null 2>&1; then rm -rf conftest* - tk_ok=yes + tcl_cv_grep_fd_mask=present +else + rm -rf conftest* + tcl_cv_grep_fd_mask=missing fi rm -f conftest* - if test $tk_ok = yes; then +fi + + echo "$ac_t""$tcl_cv_grep_fd_mask" 1>&6 + if test $tcl_cv_grep_fd_mask = present; then cat >> confdefs.h <<\EOF #define HAVE_SYS_SELECT_H 1 EOF + tk_ok=yes fi fi -echo "$ac_t""$tk_ok" 1>&6 if test $tk_ok = no; then cat >> confdefs.h <<\EOF #define NO_FD_SET 1 @@ -2142,7 +2337,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2178,7 +2373,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -2211,7 +2406,7 @@ if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2244,7 +2439,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -2275,7 +2470,7 @@ if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -2313,7 +2508,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 - cat > conftest.$ac_ext <&6 +else + cat > conftest.$ac_ext < int main() { return 0; } @@ -2370,21 +2568,29 @@ struct tm tm; tm.tm_tzadj; EOF if eval $ac_compile; then rm -rf conftest* - cat >> confdefs.h <<\EOF -#define HAVE_TM_TZADJ 1 -EOF - - echo "$ac_t""yes" 1>&6 + tcl_cv_member_tm_tzadj=yes else rm -rf conftest* - echo "$ac_t""no" 1>&6 + tcl_cv_member_tm_tzadj=no fi rm -f conftest* +fi + + echo "$ac_t""$tcl_cv_member_tm_tzadj" 1>&6 + if test $tcl_cv_member_tm_tzadj = yes ; then + cat >> confdefs.h <<\EOF +#define HAVE_TM_TZADJ 1 +EOF + + fi echo $ac_n "checking tm_gmtoff in struct tm""... $ac_c" 1>&6 - cat > conftest.$ac_ext <&6 +else + cat > conftest.$ac_ext < int main() { return 0; } @@ -2394,26 +2600,33 @@ struct tm tm; tm.tm_gmtoff; EOF if eval $ac_compile; then rm -rf conftest* - cat >> confdefs.h <<\EOF -#define HAVE_TM_GMTOFF 1 -EOF - - echo "$ac_t""yes" 1>&6 + tcl_cv_member_tm_gmtoff=yes else rm -rf conftest* - echo "$ac_t""no" 1>&6 + tcl_cv_member_tm_gmtoff=no fi rm -f conftest* +fi + + echo "$ac_t""$tcl_cv_member_tm_gmtoff" 1>&6 + if test $tcl_cv_member_tm_gmtoff = yes ; then + cat >> confdefs.h <<\EOF +#define HAVE_TM_GMTOFF 1 +EOF + + fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # - have_timezone=no echo $ac_n "checking long timezone variable""... $ac_c" 1>&6 - cat > conftest.$ac_ext <&6 +else + cat > conftest.$ac_ext < int main() { return 0; } @@ -2425,48 +2638,58 @@ extern long timezone; EOF if eval $ac_compile; then rm -rf conftest* - have_timezone=yes - cat >> confdefs.h <<\EOF -#define HAVE_TIMEZONE_VAR 1 -EOF - - echo "$ac_t""yes" 1>&6 + tcl_cv_timezone_long=yes else rm -rf conftest* - echo "$ac_t""no" 1>&6 + tcl_cv_timezone_long=no fi rm -f conftest* +fi - # - # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. - # - if test "$have_timezone" = no; then - echo $ac_n "checking time_t timezone variable""... $ac_c" 1>&6 - cat > conftest.$ac_ext <&6 + if test $tcl_cv_timezone_long = yes ; then + cat >> confdefs.h <<\EOF +#define HAVE_TIMEZONE_VAR 1 +EOF + + else + # + # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. + # + echo $ac_n "checking time_t timezone variable""... $ac_c" 1>&6 + if eval "test \"`echo '$''{'tcl_cv_timezone_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < int main() { return 0; } int t() { extern time_t timezone; - timezone += 1; - exit (0); + timezone += 1; + exit (0); ; return 0; } EOF if eval $ac_compile; then rm -rf conftest* - cat >> confdefs.h <<\EOF -#define HAVE_TIMEZONE_VAR 1 -EOF - - echo "$ac_t""yes" 1>&6 + tcl_cv_timezone_time=yes else rm -rf conftest* - echo "$ac_t""no" 1>&6 + tcl_cv_timezone_time=no fi rm -f conftest* +fi + + echo "$ac_t""$tcl_cv_timezone_time" 1>&6 + if test $tcl_cv_timezone_time = yes ; then + cat >> confdefs.h <<\EOF +#define HAVE_TIMEZONE_VAR 1 +EOF + + fi fi @@ -2480,7 +2703,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2512,7 +2735,7 @@ if eval "test \"`echo '$''{'ac_cv_func_fstatfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < #include @@ -2982,7 +3205,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3000,7 +3223,7 @@ 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 < EOF @@ -3021,7 +3244,7 @@ if test "$cross_compiling" = yes; then ac_cv_header_stdc=no else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3055,7 +3278,7 @@ if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3086,7 +3309,7 @@ if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3117,7 +3340,7 @@ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3148,7 +3371,7 @@ if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -3188,7 +3411,7 @@ if eval "test \"`echo '$''{'ac_cv_func_opendir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -cat > conftest.$ac_ext <&6 +else + cat > conftest.$ac_ext < #include @@ -3252,20 +3478,22 @@ int t() { union wait x; WIFEXITED(x); /* Generates compiler error if WIFEXITED * uses an int. */ - + ; return 0; } EOF if eval $ac_link; then rm -rf conftest* - tcl_ok=yes + tcl_cv_union_wait=yes else rm -rf conftest* - tcl_ok=no + tcl_cv_union_wait=no fi rm -f conftest* -echo "$ac_t""$tcl_ok" 1>&6 -if test $tcl_ok = no; then +fi + +echo "$ac_t""$tcl_cv_union_wait" 1>&6 +if test $tcl_cv_union_wait = no; then cat >> confdefs.h <<\EOF #define NO_UNION_WAIT 1 EOF @@ -3278,30 +3506,35 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking matherr support""... $ac_c" 1>&6 -cat > conftest.$ac_ext <&6 +else + cat > conftest.$ac_ext < int main() { return 0; } int t() { -struct exception x; -x.type = DOMAIN; -x.type = SING; - + struct exception x; + x.type = DOMAIN; + x.type = SING; + ; return 0; } EOF if eval $ac_compile; then rm -rf conftest* - tcl_ok=yes + tcl_cv_func_matherr=yes else rm -rf conftest* - tcl_ok=no + tcl_cv_func_matherr=no fi rm -f conftest* -echo "$ac_t""$tcl_ok" 1>&6 -if test $tcl_ok = yes; then +fi + +echo "$ac_t""$tcl_cv_func_matherr" 1>&6 +if test $tcl_cv_func_matherr = yes; then cat >> confdefs.h <<\EOF #define NEED_MATHERR 1 EOF @@ -3319,7 +3552,7 @@ if eval "test \"`echo '$''{'ac_cv_func_strncasecmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 -cat > conftest.$ac_ext <&6 +else + cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "gettimeofday" >/dev/null 2>&1; then rm -rf conftest* - echo "$ac_t""present" 1>&6 + tcl_cv_grep_gettimeofday=present else rm -rf conftest* - - echo "$ac_t""missing" 1>&6 + tcl_cv_grep_gettimeofday=missing +fi +rm -f conftest* + +fi + +echo "$ac_t""$tcl_cv_grep_gettimeofday" 1>&6 +if test $tcl_cv_grep_gettimeofday = missing ; then cat >> confdefs.h <<\EOF #define GETTOD_NOT_DECLARED 1 EOF - fi -rm -f conftest* - #-------------------------------------------------------------------- # The following code checks to see whether it is possible to get @@ -3579,7 +3818,7 @@ else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&6 -cat > conftest.$ac_ext <&6 +else + cat > conftest.$ac_ext <&6 -if test $tcl_ok = yes; then +fi + +echo "$ac_t""$tcl_cv_char_signed" 1>&6 +if test $tcl_cv_char_signed = yes; then cat >> confdefs.h <<\EOF #define HAVE_SIGNED_CHAR 1 EOF @@ -3676,7 +3920,7 @@ if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < EOF @@ -3845,7 +4089,7 @@ if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < EOF @@ -4655,7 +4899,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -4716,7 +4960,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -4746,7 +4990,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' echo $ac_n "checking for ELF""... $ac_c" 1>&6 cat > conftest.$ac_ext <&6 LDFLAGS="${LDFLAGS} -Wl,-Bexport" cat > conftest.$ac_ext <&6 cat > conftest.$ac_ext < int main() { return 0; } @@ -5129,7 +5373,7 @@ EOF else echo $ac_n "checking a.out.h""... $ac_c" 1>&6 cat > conftest.$ac_ext < int main() { return 0; } @@ -5166,7 +5410,7 @@ EOF else echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6 cat > conftest.$ac_ext < int main() { return 0; } @@ -5319,7 +5563,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -5355,7 +5599,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF diff --git a/unix/configure.in b/unix/configure.in index 5727e17..edb5f63 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ 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(../generic/tcl.h) -# RCS: @(#) $Id: configure.in,v 1.72.6.1 2001/10/15 14:58:55 dkf Exp $ +# RCS: @(#) $Id: configure.in,v 1.72.6.2 2001/10/17 09:28:16 dkf Exp $ TCL_VERSION=8.4 TCL_MAJOR_VERSION=8 @@ -61,25 +61,10 @@ fi fi AC_C_CROSS -AC_MSG_CHECKING([for 64-bit integer type]) -AC_CACHE_VAL(tcl_cv_type_64bit,[ - AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], - tcl_cv_type_64bit=__int64, - AC_TRY_RUN([ -#include -int main() { - exit(!(sizeof(long long) > sizeof(long))); -} -], - tcl_cv_type_64bit="long long", - tcl_cv_type_64bit=none, tcl_cv_type_64bit=none))]) -if test "${tcl_cv_type_64bit}" = none ; then - AC_DEFINE(TCL_WIDE_INT_IS_LONG) - AC_MSG_RESULT(using long) -else - AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) - AC_MSG_RESULT(${tcl_cv_type_64bit}) -fi + +SC_TCL_EARLY_FLAGS + +SC_TCL_64BIT_FLAGS #-------------------------------------------------------------------- # Supply substitutes for missing POSIX library procedures, or @@ -129,16 +114,23 @@ SC_SERIAL_PORT # special flag. #-------------------------------------------------------------------- -AC_MSG_CHECKING([fd_set and sys/select]) -AC_TRY_COMPILE([#include ], - [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no) -if test $tk_ok = no; then - AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes) - if test $tk_ok = yes; then +AC_MSG_CHECKING([for fd_set in sys/types]) +AC_CACHE_VAL(tcl_cv_type_fd_set, + AC_TRY_COMPILE([#include ],[fd_set readMask, writeMask;], + tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)) +AC_MSG_RESULT($tcl_cv_type_fd_set) +tk_ok=$tcl_cv_type_fd_set +if test $tcl_cv_type_fd_set = no; then + AC_MSG_CHECKING([for fd_mask in sys/select]) + AC_CACHE_VAL(tcl_cv_grep_fd_mask, + AC_HEADER_EGREP(fd_mask, sys/select.h, + tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)) + AC_MSG_RESULT($tcl_cv_grep_fd_mask) + if test $tcl_cv_grep_fd_mask = present; then AC_DEFINE(HAVE_SYS_SELECT_H) + tk_ok=yes fi fi -AC_MSG_RESULT($tk_ok) if test $tk_ok = no; then AC_DEFINE(NO_FD_SET) fi @@ -275,14 +267,15 @@ AC_CHECK_FUNC(opendir, , [AC_DEFINE(USE_DIRENT2_H)]) #-------------------------------------------------------------------- AC_MSG_CHECKING([union wait]) -AC_TRY_LINK([#include +AC_CACHE_VAL(tcl_cv_union_wait, + AC_TRY_LINK([#include #include ], [ 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 + ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no)) +AC_MSG_RESULT($tcl_cv_union_wait) +if test $tcl_cv_union_wait = no; then AC_DEFINE(NO_UNION_WAIT) fi @@ -292,13 +285,14 @@ fi #-------------------------------------------------------------------- AC_MSG_CHECKING([matherr support]) -AC_TRY_COMPILE([#include ], [ -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_CACHE_VAL(tcl_cv_func_matherr, + AC_TRY_COMPILE([#include ], [ + struct exception x; + x.type = DOMAIN; + x.type = SING; + ], tcl_cv_func_matherr=yes, tcl_cv_func_matherr=no)) +AC_MSG_RESULT($tcl_cv_func_matherr) +if test $tcl_cv_func_matherr = yes; then AC_DEFINE(NEED_MATHERR) fi @@ -335,10 +329,13 @@ AC_CHECK_FUNC(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_CACHE_VAL(tcl_cv_grep_gettimeofday, + AC_EGREP_HEADER(gettimeofday, sys/time.h, + tcl_cv_grep_gettimeofday=present, tcl_cv_grep_gettimeofday=missing)) +AC_MSG_RESULT($tcl_cv_grep_gettimeofday) +if test $tcl_cv_grep_gettimeofday = missing ; then AC_DEFINE(GETTOD_NOT_DECLARED) -]) +fi #-------------------------------------------------------------------- # The following code checks to see whether it is possible to get @@ -348,12 +345,13 @@ AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [ AC_C_CHAR_UNSIGNED AC_MSG_CHECKING([signed char declarations]) -AC_TRY_COMPILE(, [ -signed char *p; -p = 0; -], tcl_ok=yes, tcl_ok=no) -AC_MSG_RESULT($tcl_ok) -if test $tcl_ok = yes; then +AC_CACHE_VAL(tcl_cv_char_signed, + AC_TRY_COMPILE(, [ + signed char *p; + p = 0; + ], tcl_cv_char_signed=yes, tcl_cv_char_signed=no)) +AC_MSG_RESULT($tcl_cv_char_signed) +if test $tcl_cv_char_signed = yes; then AC_DEFINE(HAVE_SIGNED_CHAR) fi diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 0fafaf3..98dbe76 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1316,14 +1316,15 @@ dnl AC_CHECK_TOOL(AR, ar, :) # # 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. +# 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: +# Defines only one of the following vars (if any): # USE_TERMIOS # USE_TERMIO # USE_SGTTY @@ -1332,12 +1333,10 @@ dnl AC_CHECK_TOOL(AR, ar, :) AC_DEFUN(SC_SERIAL_PORT, [ AC_MSG_CHECKING([termios vs. termio vs. sgtty]) - + AC_CACHE_VAL(tcl_cv_api_serial, [ AC_TRY_RUN([ #include - -main() -{ +main() { struct termios t; if (tcgetattr(0, &t) == 0) { cfsetospeed(&t, 0); @@ -1345,32 +1344,23 @@ main() return 0; } return 1; -}], tk_ok=termios, tk_ok=no, tk_ok=no) - - if test $tk_ok = termios; then - AC_DEFINE(USE_TERMIOS) - else +}], 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 - -main() -{ +main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; - }], tk_ok=termio, tk_ok=no, tk_ok=no) - - if test $tk_ok = termio; then - AC_DEFINE(USE_TERMIO) - else + }], 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 - -main() -{ +main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0) { t.sg_ospeed = 0; @@ -1378,17 +1368,13 @@ main() return 0; } return 1; -}], tk_ok=sgtty, tk_ok=none, tk_ok=none) - - if test $tk_ok = sgtty; then - AC_DEFINE(USE_SGTTY) - else +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) + fi + if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include #include - -main() -{ +main() { struct termios t; if (tcgetattr(0, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -1397,17 +1383,13 @@ main() return 0; } return 1; -}], tk_ok=termios, tk_ok=no, tk_ok=no) - - if test $tk_ok = termios; then - AC_DEFINE(USE_TERMIOS) - else +}], 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 - -main() -{ +main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -1415,17 +1397,13 @@ main() return 0; } return 1; - }], tk_ok=termio, tk_ok=no, tk_ok=no) - - if test $tk_ok = termio; then - AC_DEFINE(USE_TERMIO) - else + }], 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 - -main() -{ +main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -1434,17 +1412,14 @@ main() return 0; } return 1; -}], tk_ok=sgtty, tk_ok=none, tk_ok=none) - - if test $tk_ok = sgtty; then - AC_DEFINE(USE_SGTTY) - fi - fi - fi - fi - fi - fi - AC_MSG_RESULT($tk_ok) +}], 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);; + termio) AC_DEFINE(USE_TERMIO);; + sgtty) AC_DEFINE(USE_SGTTY);; + esac + AC_MSG_RESULT($tcl_cv_api_serial) ]) #-------------------------------------------------------------------- @@ -1718,44 +1693,52 @@ AC_DEFUN(SC_TIME_HANDLER, [ AC_CHECK_FUNCS(gmtime_r localtime_r) AC_MSG_CHECKING([tm_tzadj in struct tm]) - AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;], - [AC_DEFINE(HAVE_TM_TZADJ) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + AC_CACHE_VAL(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)) + AC_MSG_RESULT($tcl_cv_member_tm_tzadj) + if test $tcl_cv_member_tm_tzadj = yes ; then + AC_DEFINE(HAVE_TM_TZADJ) + fi AC_MSG_CHECKING([tm_gmtoff in struct tm]) - AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], - [AC_DEFINE(HAVE_TM_GMTOFF) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + AC_CACHE_VAL(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)) + AC_MSG_RESULT($tcl_cv_member_tm_gmtoff) + if test $tcl_cv_member_tm_gmtoff = yes ; then + AC_DEFINE(HAVE_TM_GMTOFF) + fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # - have_timezone=no AC_MSG_CHECKING([long timezone variable]) - AC_TRY_COMPILE([#include ], + AC_CACHE_VAL(tcl_cv_var_timezone, + AC_TRY_COMPILE([#include ], [extern long timezone; timezone += 1; exit (0);], - [have_timezone=yes + tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)) + AC_MSG_RESULT($tcl_cv_timezone_long) + if test $tcl_cv_timezone_long = yes ; then + AC_DEFINE(HAVE_TIMEZONE_VAR) + else + # + # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. + # + AC_MSG_CHECKING([time_t timezone variable]) + AC_CACHE_VAL(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)) + AC_MSG_RESULT($tcl_cv_timezone_time) + if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) - - # - # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. - # - if test "$have_timezone" = no; then - AC_MSG_CHECKING([time_t timezone variable]) - AC_TRY_COMPILE([#include ], - [extern time_t timezone; - timezone += 1; - exit (0);], - [AC_DEFINE(HAVE_TIMEZONE_VAR) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + fi fi ]) @@ -1896,3 +1879,111 @@ AC_DEFUN(SC_TCL_LINK_LIBS, [ AC_SUBST(TCL_LIBS) AC_SUBST(MATH_LIBS) ]) + +#-------------------------------------------------------------------- +# SC_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 +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_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) + tcl_flags="$tcl_flags $1" + fi]) + +AC_DEFUN(SC_TCL_EARLY_FLAGS,[ + AC_MSG_CHECKING([for required early compiler flags]) + tcl_flags="" + SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include ], + [char *p = (char *)strtoll; char *q = (char *)strtoull;]) + SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include ], + [struct stat64 buf; int i = stat64("/", &buf);]) + if test "x${tcl_flags}" = "x" ; then + AC_MSG_RESULT(none) + else + AC_MSG_RESULT(${tcl_flags}) + fi]) + +#-------------------------------------------------------------------- +# SC_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(SC_TCL_64BIT_FLAGS, [ + AC_MSG_CHECKING([for 64-bit integer type]) + AC_CACHE_VAL(tcl_cv_type_64bit,[ + AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], + tcl_cv_type_64bit=__int64,tcl_cv_type_64bit=none + AC_TRY_RUN([#include + int main() {exit(!(sizeof(long long) > sizeof(long)));} + ], tcl_cv_type_64bit="long long"))]) + if test "${tcl_cv_type_64bit}" = none ; then + AC_DEFINE(TCL_WIDE_INT_IS_LONG) + AC_MSG_RESULT(using long) + else + AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) + AC_MSG_RESULT(${tcl_cv_type_64bit}) + + # Now check for auxiliary declarations + AC_MSG_CHECKING([for struct dirent64]) + AC_CACHE_VAL(tcl_cv_struct_dirent64,[ + AC_TRY_COMPILE([#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) + fi + AC_MSG_RESULT(${tcl_cv_struct_dirent64}) + + AC_MSG_CHECKING([for struct stat64]) + AC_CACHE_VAL(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) + fi + AC_MSG_RESULT(${tcl_cv_struct_stat64}) + + 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)]) + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + AC_DEFINE(HAVE_TYPE_OFF64_T) + fi + AC_MSG_RESULT(${tcl_cv_type_off64_t}) + fi]) diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 4ca092a..1f1158b 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.18 2001/08/30 08:53:15 vincentdarley Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.18.6.1 2001/10/17 09:28:17 dkf Exp $ */ #ifndef _TCLUNIXPORT @@ -56,6 +56,29 @@ # include #endif #endif +#ifdef HAVE_STRUCT_DIRENT64 +typedef struct dirent64 Tcl_DirEntry; +# define Tcl_PlatformReaddir readdir64 +#else +typedef struct dirent Tcl_DirEntry; +# define Tcl_PlatformReaddir readdir +#endif +#ifdef HAVE_TYPE_OFF64_T +typedef off64_t Tcl_SeekOffset; +# define Tcl_PlatformSeek lseek64 +# define Tcl_PlatformOpen open64 +#else +typedef off_t Tcl_SeekOffset; +# define Tcl_PlatformSeek lseek +# define Tcl_PlatformOpen open +#endif +#ifdef HAVE_STRUCT_STAT64 +# define Tcl_PlatformStat stat64 +# define Tcl_PlatformLStat lstat64 +#else +# define Tcl_PlatformStat stat +# define Tcl_PlatformLStat lstat +#endif #include #ifdef HAVE_SYS_SELECT_H # include -- cgit v0.12