Improve detection of UNIX-style systems in minizip.
Not all toolchains on UNIX-style operating systems predefine
"unix". For example, it's missing on NetBSD, OpenBSD/gcc, AIX,
HP-UX. There is no single macro defined everywhere, but checking
both "__unix__" and "__unix" should cover everything except macOS,
which is already checked for using "__APPLE__".
Note that case sensitivity should default to off on macOS and
cygwin, so the check there is different.
diff --git a/contrib/minizip/make_vms.com b/contrib/minizip/make_vms.com
index 9ac13a9..4a0a77e 100644
--- a/contrib/minizip/make_vms.com
+++ b/contrib/minizip/make_vms.com
@@ -2,7 +2,7 @@
$ open/write zdef vmsdefs.h
$ copy sys$input: zdef
$ deck
-#define unix
+#define __unix__
#define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from
#define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator
#define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c
index d871b3f..8e19534 100644
--- a/contrib/minizip/miniunz.c
+++ b/contrib/minizip/miniunz.c
@@ -93,8 +93,7 @@
LocalFileTimeToFileTime(&ftLocal,&ftm);
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
CloseHandle(hFile);
-#else
-#if defined(unix) || defined(__APPLE__)
+#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
(void)dosdate;
struct utimbuf ut;
struct tm newdate;
@@ -116,7 +115,6 @@
(void)dosdate;
(void)tmu_date;
#endif
-#endif
}
@@ -127,9 +125,7 @@
int ret=0;
#ifdef _WIN32
ret = _mkdir(dirname);
-#elif unix
- ret = mkdir (dirname,0775);
-#elif __APPLE__
+#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
ret = mkdir (dirname,0775);
#else
(void)dirname;
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index 26ee8d0..4d93d22 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -91,8 +91,7 @@
}
return ret;
}
-#else
-#if defined(unix) || defined(__APPLE__)
+#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
/* f: name of file to get info on, tmzip: return value: access,
modification and creation times, dt: dostime */
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
@@ -143,7 +142,6 @@
return 0;
}
#endif
-#endif
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c
index b5783ca..feaec67 100644
--- a/contrib/minizip/unzip.c
+++ b/contrib/minizip/unzip.c
@@ -88,7 +88,7 @@
#ifndef CASESENSITIVITYDEFAULT_NO
-# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
+# if (!defined(__unix__) && !defined(__unix) || defined(__CYGWIN__)) && !defined(CASESENSITIVITYDEFAULT_YES)
# define CASESENSITIVITYDEFAULT_NO
# endif
#endif