nixpkgs/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch
Randy Eckenrode 1364837d91
unzip: fix configure script when using clang 16
Clang 16 makes implicit int and function declarations an error by
default in any mode except for C89. The configure script has two of
these that cause it to misdetect features when using Clang 16.

* Implicit `int main` in the errno check. This is fixed by adding the
  missing `int`.
* Implicit definitions of `opendir` and `closedir`. These are fixed by
  including the required headers.
2023-05-31 23:42:53 -04:00

22 lines
452 B
Diff

--- a/unix/configure 2009-04-16 15:25:12.000000000 -0400
+++ b/unix/configure 2023-05-30 15:18:33.670321348 -0400
@@ -408,7 +408,7 @@
echo Check for errno declaration
cat > conftest.c << _EOF_
#include <errno.h>
-main()
+int main()
{
errno = 0;
return 0;
@@ -419,6 +419,8 @@
echo Check for directory libraries
cat > conftest.c << _EOF_
+#include <sys/types.h>
+#include <dirent.h>
int main() { return closedir(opendir(".")); }
_EOF_