]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Implement POSIX readdir_r checks in CMakeLists.txt.
authorTim Kientzle <kientzle@gmail.com>
Thu, 27 Jan 2011 06:29:22 +0000 (01:29 -0500)
committerTim Kientzle <kientzle@gmail.com>
Thu, 27 Jan 2011 06:29:22 +0000 (01:29 -0500)
Fix a mistake in the configure.ac version.

SVN-Revision: 2953

CMakeLists.txt
configure.ac

index f2029aaf4d34ef2a58b5a26920f857b495bad0ad..65c99a37f10a8ed57d0441376ce5e5e969945988 100644 (file)
@@ -518,7 +518,6 @@ CHECK_FUNCTION_EXISTS_GLIBC(nl_langinfo HAVE_NL_LANGINFO)
 CHECK_FUNCTION_EXISTS_GLIBC(openat HAVE_OPENAT)
 CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE)
 CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL)
-CHECK_FUNCTION_EXISTS_GLIBC(readdir_r HAVE_READDIR_R)
 CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK)
 CHECK_FUNCTION_EXISTS_GLIBC(readlinkat HAVE_READLINKAT)
 CHECK_FUNCTION_EXISTS_GLIBC(select HAVE_SELECT)
@@ -559,6 +558,12 @@ CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF)
 CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP)
 CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY)
 
+# Make sure we have the POSIX version of readdir_r, not the
+# older 2-argument version.
+CHECK_C_SOURCE_COMPILES(
+  "#include <dirent.h>\nint main() {DIR *d; struct dirent e,*r; return readdir_r(d,&e,&r);}"
+  HAVE_READDIR_R)
+
 # To verify major(), we need to both include the header
 # of interest and verify that the result can be linked.
 # CHECK_FUNCTION_EXISTS doesn't accept a header argument,
index 25dabacd770f1216137f20b961f4d69c164c2c92..ae23ac412add87fb224df20203b341298249f5b5 100644 (file)
@@ -443,7 +443,7 @@ AC_CHECK_FUNCS([cygwin_conv_path])
 AC_COMPILE_IFELSE(
  [AC_LANG_PROGRAM([[#include <dirent.h>]],
                   [[DIR *dir; struct dirent e, *r;
-                   exit(readdir_r(dir, &e, &r));]])],
+                   return(readdir_r(dir, &e, &r));]])],
  [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])]
 )