]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix FreeBSD build: prefer struct xvfsconf to struct vfsconf
authorTim Kientzle <kientzle@acm.org>
Sun, 4 Sep 2016 23:07:27 +0000 (16:07 -0700)
committerTim Kientzle <kientzle@acm.org>
Sun, 4 Sep 2016 23:07:27 +0000 (16:07 -0700)
CMakeLists.txt
build/cmake/config.h.in
configure.ac
libarchive/archive_read_disk_posix.c

index f5917fbae06d8214f089b50bf7c413ddf5ff4052..7aec17f9919a990300f12f16fa187718b7d40e77 100644 (file)
@@ -1278,6 +1278,10 @@ CHECK_C_SOURCE_COMPILES(
   "#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct vfsconf v; return sizeof(v);}"
   HAVE_STRUCT_VFSCONF)
 
+CHECK_C_SOURCE_COMPILES(
+  "#include <sys/types.h>\n#include <sys/mount.h>\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(
index e6a9c517573e56869663f47c36860ef36461a2c6..b066b2ceb978ee1761c378baae4f607d6336b7a2 100644 (file)
@@ -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
 
index bda5e6eb01da7f27304ad20507a9137c5d1a1836..f49acb961a4607318b25a57472b2c74d722c3328 100644 (file)
@@ -624,6 +624,13 @@ AC_CHECK_TYPES(struct vfsconf,,,
        #include <sys/mount.h>
        ])
 
+AC_CHECK_TYPES(struct xvfsconf,,,
+       [#if HAVE_SYS_TYPES_H
+       #include <sys/types.h>
+       #endif
+       #include <sys/mount.h>
+       ])
+
 # There are several variants of readdir_r around; we only
 # accept the POSIX-compliant version.
 AC_COMPILE_IFELSE(
index 5901a879c4973c9870363e7354da423193ef5313..19604b6a36a4a53035cd6f315221e58d35ea18c9 100644 (file)
@@ -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;