From: Tim Kientzle Date: Sun, 4 Sep 2016 23:07:27 +0000 (-0700) Subject: Fix FreeBSD build: prefer struct xvfsconf to struct vfsconf X-Git-Tag: v3.2.2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a847b45528d7f5476380e31cc22ea6a5d85435bf;p=thirdparty%2Flibarchive.git Fix FreeBSD build: prefer struct xvfsconf to struct vfsconf --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f5917fbae..7aec17f99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1278,6 +1278,10 @@ CHECK_C_SOURCE_COMPILES( "#include \n#include \nint main(void) { struct vfsconf v; return sizeof(v);}" HAVE_STRUCT_VFSCONF) +CHECK_C_SOURCE_COMPILES( + "#include \n#include \nint main(void) { struct xvfsconf v; return sizeof(v);}" + HAVE_STRUCT_XVFSCONF) + # Make sure we have the POSIX version of readdir_r, not the # older 2-argument version. CHECK_C_SOURCE_COMPILES( diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index e6a9c5175..b066b2ceb 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -929,6 +929,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have `struct vfsconf'. */ #cmakedefine HAVE_STRUCT_VFSCONF 1 +/* Define to 1 if you have `struct xvfsconf'. */ +#cmakedefine HAVE_STRUCT_XVFSCONF 1 + /* Define to 1 if you have the `symlink' function. */ #cmakedefine HAVE_SYMLINK 1 diff --git a/configure.ac b/configure.ac index bda5e6eb0..f49acb961 100644 --- a/configure.ac +++ b/configure.ac @@ -624,6 +624,13 @@ AC_CHECK_TYPES(struct vfsconf,,, #include ]) +AC_CHECK_TYPES(struct xvfsconf,,, + [#if HAVE_SYS_TYPES_H + #include + #endif + #include + ]) + # There are several variants of readdir_r around; we only # accept the POSIX-compliant version. AC_COMPILE_IFELSE( diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 5901a879c..19604b6a3 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -1504,10 +1504,19 @@ setup_current_filesystem(struct archive_read_disk *a) struct tree *t = a->tree; struct statfs sfs; #if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC) -# if defined(HAVE_STRUCT_VFSCONF) - struct vfsconf vfc; -# else +/* TODO: configure should set GETVFSBYNAME_ARG_TYPE to make + * this accurate; some platforms have both and we need the one that's + * used by getvfsbyname() + * + * Then the following would become: + * #if defined(GETVFSBYNAME_ARG_TYPE) + * GETVFSBYNAME_ARG_TYPE vfc; + * #endif + */ +# if defined(HAVE_STRUCT_XVFSCONF) struct xvfsconf vfc; +# else + struct vfsconf vfc; # endif #endif int r, xr = 0;