]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
unzip: disable build on Windows
authorMartin Matuska <martin@matuska.de>
Fri, 14 Jul 2023 15:37:19 +0000 (17:37 +0200)
committerMartin Matuska <martin@matuska.de>
Fri, 14 Jul 2023 18:49:31 +0000 (20:49 +0200)
Bsdunzip has not been ported to Windows yet.
Add header checks for fcntl.h and sys/queue.h
Add function check for fcntl()

CMakeLists.txt
build/cmake/config.h.in
configure.ac
unzip/bsdunzip.c

index d2315adbbf6028fdd4133bc0d855379283279bd7..646484b79ed358dd9e82c33d12c1c3bad71a886a 100644 (file)
@@ -225,8 +225,13 @@ OPTION(ENABLE_CPIO "Enable cpio building" ON)
 OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE)
 OPTION(ENABLE_CAT "Enable cat building" ON)
 OPTION(ENABLE_CAT_SHARED "Enable dynamic build of cat" FALSE)
-OPTION(ENABLE_UNZIP "Enable unzip building" ON)
-OPTION(ENABLE_UNZIP_SHARED "Enable dynamic build of unzip" FALSE)
+IF(WIN32 AND NOT CYGWIN)
+       SET(ENABLE_UNZIP FALSE)
+       SET(ENABLE_UNZIP_SHARED FALSE)
+ELSE()
+       OPTION(ENABLE_UNZIP "Enable unzip building" ON)
+       OPTION(ENABLE_UNZIP_SHARED "Enable dynamic build of unzip" FALSE)
+ENDIF()
 OPTION(ENABLE_XATTR "Enable extended attribute support" ON)
 OPTION(ENABLE_ACL "Enable ACL support" ON)
 OPTION(ENABLE_ICONV "Enable iconv support" ON)
@@ -689,6 +694,7 @@ CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
 int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS)
 
 LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
+LA_CHECK_INCLUDE_FILE("fnmatch.h" HAVE_FNMATCH_H)
 LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H)
 LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
 LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H)
@@ -728,6 +734,7 @@ LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H)
 LA_CHECK_INCLUDE_FILE("sys/mount.h" HAVE_SYS_MOUNT_H)
 LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
 LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H)
+LA_CHECK_INCLUDE_FILE("sys/queue.h" HAVE_SYS_QUEUE_H)
 LA_CHECK_INCLUDE_FILE("sys/richacl.h" HAVE_SYS_RICHACL_H)
 LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H)
 LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
@@ -1366,6 +1373,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(fchmod HAVE_FCHMOD)
 CHECK_FUNCTION_EXISTS_GLIBC(fchown HAVE_FCHOWN)
 CHECK_FUNCTION_EXISTS_GLIBC(fcntl HAVE_FCNTL)
 CHECK_FUNCTION_EXISTS_GLIBC(fdopendir HAVE_FDOPENDIR)
+CHECK_FUNCTION_EXISTS_GLIBC(fnmatch HAVE_FNMATCH)
 CHECK_FUNCTION_EXISTS_GLIBC(fork HAVE_FORK)
 CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT)
 CHECK_FUNCTION_EXISTS_GLIBC(fstatat HAVE_FSTATAT)
index 2046609719e6fe179574772c3905804483c86303..3de2ebd8c0ac31a7b1e2bec445f4e4899dd4aba0 100644 (file)
@@ -588,6 +588,12 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the `flistxattr' function. */
 #cmakedefine HAVE_FLISTXATTR 1
 
+/* Define to 1 if you have the `fnmatch' function. */
+#cmakedefine HAVE_FNMATCH 1
+
+/* Define to 1 if you have the <fnmatch.h> header file. */
+#cmakedefine HAVE_FNMATCH_H 1
+
 /* Define to 1 if you have the `fork' function. */
 #cmakedefine HAVE_FORK 1
 
@@ -1106,6 +1112,9 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the <sys/poll.h> header file. */
 #cmakedefine HAVE_SYS_POLL_H 1
 
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#cmakedefine HAVE_SYS_QUEUE_H 1
+
 /* Define to 1 if you have the <sys/richacl.h> header file. */
 #cmakedefine HAVE_SYS_RICHACL_H 1
 
index 7d50c02958203ddf4d7be4dc2aac61384cc4d6b2..a2a0a5c25be3faa0744a91b58cb0d5b514a3d15a 100644 (file)
@@ -271,13 +271,21 @@ esac
 # Options for building bsdunzip.
 #
 # Default is to build bsdunzip, but allow people to override that.
+# Bsdunzip has not yet been ported for Windows
 #
-AC_ARG_ENABLE([bsdunzip],
-       [AS_HELP_STRING([--enable-bsdunzip], [enable build of bsdunzip (default)])
-       AS_HELP_STRING([--enable-bsdunzip=static], [force static build of bsdunzip])
-       AS_HELP_STRING([--enable-bsdunzip=shared], [force dynamic build of bsdunzip])
-AS_HELP_STRING([--disable-bsdunzip], [disable build of bsdunzip])],
-       [], [enable_bsdunzip=yes])
+case "$host_os" in
+  *mingw* | *msys*)
+       enable_bsdunzip=no
+       ;;
+  *)
+       AC_ARG_ENABLE([bsdunzip],
+         [AS_HELP_STRING([--enable-bsdunzip], [enable build of bsdunzip (default)])
+         AS_HELP_STRING([--enable-bsdunzip=static], [force static build of bsdunzip])
+         AS_HELP_STRING([--enable-bsdunzip=shared], [force dynamic build of bsdunzip])
+         AS_HELP_STRING([--disable-bsdunzip], [disable build of bsdunzip])],
+         [], [enable_bsdunzip=yes])
+       ;;
+esac
 
 case "$enable_bsdunzip" in
 yes)
@@ -316,7 +324,7 @@ AC_HEADER_DIRENT
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h])
 AC_CHECK_HEADERS([copyfile.h ctype.h])
-AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
+AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h fnmatch.h grp.h])
 
 AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable],
     [ac_cv_have_decl_EXT2_IOC_GETFLAGS],
@@ -349,7 +357,7 @@ AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h])
 AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h])
 AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h])
 AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h])
-AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h])
+AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h sys/queue.h])
 AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h])
 AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h])
 AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h])
@@ -718,7 +726,7 @@ AC_FUNC_VPRINTF
 # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
 AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
 AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r])
-AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork])
+AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fnmatch fork])
 AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
 AC_CHECK_FUNCS([futimens futimes futimesat])
 AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r])
index 3280963bfd65d8d494363e4f75c02dd149dbff5c..469c69fd6efb95f4b110783ecace8724d2bbbb5c 100644 (file)
@@ -38,7 +38,9 @@
 
 #include "bsdunzip_platform.h"
 
+#ifdef HAVE_SYS_QUEUE_H
 #include <sys/queue.h>
+#endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
@@ -52,7 +54,9 @@
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+#ifdef HAVE_FNMATCH_H
 #include <fnmatch.h>
+#endif
 #ifdef HAVE_STDARG_H
 #include <stdarg.h>
 #endif
@@ -313,8 +317,12 @@ match_pattern(struct pattern_list *list, const char *str)
        struct pattern *entry;
 
        STAILQ_FOREACH(entry, list, link) {
+#ifdef HAVE_FNMATCH
                if (fnmatch(entry->pattern, str, C_opt ? FNM_CASEFOLD : 0) == 0)
                        return (1);
+#else
+#error "Unsupported platform: fnmatch() is required"
+#endif
        }
        return (0);
 }