Tcl Source Code

Artifact [e79d5f0216]
Login

Artifact e79d5f02169a2fca43e911f3401e1b9d82983594:

Attachment "a" to ticket [1240568fff] added by tww-china 2005-07-19 06:04:42.
--- unix/tcl.m4.orig	Mon Jul 18 11:45:18 2005
+++ unix/tcl.m4	Mon Jul 18 17:52:33 2005
@@ -484,13 +484,11 @@
 	AC_CHECK_FUNCS(pthread_attr_setstacksize)
 	AC_CHECK_FUNCS(pthread_atfork)
 	LIBS=$ac_saved_libs
-	AC_CHECK_FUNCS(readdir_r)
-	if test "x$ac_cv_func_readdir_r" = "xyes"; then
-            AC_MSG_CHECKING([how many args readdir_r takes])
-	    # IRIX 5.3 has a 2 arg version of readdir_r
-	    # while other systems have a 3 arg version.
-	    AC_CACHE_VAL(tcl_cv_two_arg_readdir_r,
-	        AC_TRY_COMPILE([#include <stdlib.h>
+	AC_CHECK_FUNCS(readdir_r,
+            [AC_MSG_CHECKING([how many args readdir_r takes])
+	    # IRIX 5.3 has a 2-arg version of readdir_r
+	    # while other systems have a 3-arg version.
+	    AC_TRY_COMPILE([#include <stdlib.h>
 #include <sys/types.h>
 #ifdef NO_DIRENT_H
 # include <sys/dir.h>  /* logic from tcl/compat/dirent.h *
@@ -498,10 +496,12 @@
 #else
 # include <dirent.h>
 #endif
+
+extern struct dirent *readdir_r(DIR *, struct dirent *);
 ], [readdir_r(NULL, NULL);],
-	        tcl_cv_two_arg_readdir_r=yes, tcl_cv_two_arg_readdir_r=no))
-	    AC_CACHE_VAL(tcl_cv_three_arg_readdir_r,
-	        AC_TRY_COMPILE([#include <stdlib.h>
+		[AC_MSG_RESULT([2])
+		AC_DEFINE(HAVE_TWO_ARG_READDIR_R)],
+	        [AC_TRY_COMPILE([#include <stdlib.h>
 #include <sys/types.h>
 #ifdef NO_DIRENT_H
 # include <sys/dir.h>  /* logic from tcl/compat/dirent.h *
@@ -509,18 +509,12 @@
 #else
 # include <dirent.h>
 #endif
+
+extern int readdir_r(DIR *, struct dirent *, struct dirent **);
 ], [readdir_r(NULL, NULL, NULL);],
-	        tcl_cv_three_arg_readdir_r=yes, tcl_cv_three_arg_readdir_r=no))
-	    if test "x$tcl_cv_two_arg_readdir_r" = "xyes" ; then
-                AC_MSG_RESULT([2])
-	        AC_DEFINE(HAVE_TWO_ARG_READDIR_R)
-	    elif test "x$tcl_cv_three_arg_readdir_r" = "xyes" ; then
-                AC_MSG_RESULT([3])
-	        AC_DEFINE(HAVE_THREE_ARG_READDIR_R)
-	    else
-	        AC_MSG_ERROR([unknown number of args for readdir_r])
-	    fi
-	fi
+		    [AC_MSG_RESULT([3])
+		    AC_DEFINE(HAVE_THREE_ARG_READDIR_R)],
+		    [AC_MSG_ERROR([unknown number of args for readdir_r])])])])
     else
 	TCL_THREADS=0
 	AC_MSG_RESULT([no (default)])