From: Tim Kientzle Date: Thu, 27 Jan 2011 06:29:22 +0000 (-0500) Subject: Implement POSIX readdir_r checks in CMakeLists.txt. X-Git-Tag: v3.0.0a~709 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8f97841a6ebc6ccca66565ce7ef954fc24ad229;p=thirdparty%2Flibarchive.git Implement POSIX readdir_r checks in CMakeLists.txt. Fix a mistake in the configure.ac version. SVN-Revision: 2953 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f2029aaf4..65c99a37f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 \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, diff --git a/configure.ac b/configure.ac index 25dabacd7..ae23ac412 100644 --- a/configure.ac +++ b/configure.ac @@ -443,7 +443,7 @@ AC_CHECK_FUNCS([cygwin_conv_path]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[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])] )