diff options
author | sebres <sebres@users.sourceforge.net> | 2018-06-04 13:49:38 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2018-06-04 13:49:38 (GMT) |
commit | 240e6b50d2dfd9d501eeb3e180be594f51f6f03c (patch) | |
tree | 77b0d64512ce4d48c46357baf46a09cd09f9b771 /unix | |
parent | 6a4d06759ed9c9ac3c94860c9d7b17c076f28b7e (diff) | |
download | tcl-240e6b50d2dfd9d501eeb3e180be594f51f6f03c.zip tcl-240e6b50d2dfd9d501eeb3e180be594f51f6f03c.tar.gz tcl-240e6b50d2dfd9d501eeb3e180be594f51f6f03c.tar.bz2 |
fixes [92564326a9] if compiled on some x86 systems (with dirent64 but without DIR64, partially cherry-picked from https://www.androwish.org/index.html/info/6119b8ac2aee8411).
Diffstat (limited to 'unix')
-rwxr-xr-x | unix/configure | 64 | ||||
-rw-r--r-- | unix/tcl.m4 | 11 | ||||
-rw-r--r-- | unix/tclConfig.h.in | 3 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 13 |
4 files changed, 85 insertions, 6 deletions
diff --git a/unix/configure b/unix/configure index 7ff9f72..61d922a 100755 --- a/unix/configure +++ b/unix/configure @@ -9643,6 +9643,70 @@ _ACEOF fi + echo "$as_me:$LINENO: checking for DIR64" >&5 +echo $ECHO_N "checking for DIR64... $ECHO_C" >&6 +if test "${tcl_cv_DIR64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <dirent.h> +int +main () +{ +struct dirent64 *p; DIR64 d = opendir64("."); + p = readdir64(d); rewinddir64(d); closedir64(d); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_DIR64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_DIR64=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_DIR64" >&5 +echo "${ECHO_T}$tcl_cv_DIR64" >&6 + if test "x${tcl_cv_DIR64}" = "xyes" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DIR64 1 +_ACEOF + + fi + echo "$as_me:$LINENO: checking for struct stat64" >&5 echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 if test "${tcl_cv_struct_stat64+set}" = set; then diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 6b6d373..294ecf0 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2749,7 +2749,7 @@ AC_DEFUN([SC_TCL_EARLY_FLAGS],[ # Might define the following vars: # TCL_WIDE_INT_IS_LONG # TCL_WIDE_INT_TYPE -# HAVE_STRUCT_DIRENT64 +# HAVE_STRUCT_DIRENT64, HAVE_DIR64 # HAVE_STRUCT_STAT64 # HAVE_TYPE_OFF64_T # @@ -2785,6 +2785,15 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?]) fi + AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[ + AC_TRY_COMPILE([#include <sys/types.h> +#include <dirent.h>],[struct dirent64 *p; DIR64 d = opendir64("."); + p = readdir64(d); rewinddir64(d); closedir64(d);], + tcl_cv_DIR64=yes,tcl_cv_DIR64=no)]) + if test "x${tcl_cv_DIR64}" = "xyes" ; then + AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?]) + fi + AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[ AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p; ], diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 9774ce9..0879c7a 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -193,6 +193,9 @@ /* Is 'struct dirent64' in <sys/types.h>? */ #undef HAVE_STRUCT_DIRENT64 +/* Is 'DIR64' in <sys/types.h>? */ +#undef HAVE_DIR64 + /* Is 'struct stat64' in <sys/stat.h>? */ #undef HAVE_STRUCT_STAT64 diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index a248213..9a923ef 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -58,16 +58,19 @@ */ #ifdef HAVE_STRUCT_DIRENT64 -typedef DIR64 TclDIR; -typedef struct dirent64 Tcl_DirEntry; +typedef struct dirent64 Tcl_DirEntry; # define TclOSreaddir readdir64 +#else +typedef struct dirent Tcl_DirEntry; +# define TclOSreaddir readdir +#endif +#ifdef HAVE_DIR64 +typedef DIR64 TclDIR; # define TclOSopendir opendir64 # define TclOSrewinddir rewinddir64 # define TclOSclosedir closedir64 #else -typedef DIR TclDIR; -typedef struct dirent Tcl_DirEntry; -# define TclOSreaddir readdir +typedef DIR TclDIR; # define TclOSopendir opendir # define TclOSrewinddir rewinddir # define TclOSclosedir closedir |