Package: src:unzip
Version: 6.0-28
Severity: normal
Tags: upstream patch

unzip's hand-written configure script does several tests for the
existence of functions without including the appropriate headers. These
tests will behave incorrectly with later versions of GCC, where missing
prototypes are fatal errors by default.

When I tested this with (non-Debian) GCC 14.2, it caused a build failure
on the "typedef FILE DIR;" line in unix/unix.c, because NO_DIR had been
incorrectly defined.

I've attached a patch that fixes most of the tests -- I don't have a
system with mbschr so I don't know what the headers for that one should
be.

Thanks,

-- 
Adam Sampson <a...@offog.org>                         <http://offog.org/>
Fix FTBFS with GCC 14.2.

Add missing #includes in configure tests to fix missing prototypes.

Add return type of main where not specified.

--- unzip-6.0-28/unix/configure 2009-04-16 20:25:12.000000000 +0100
+++ unzip-6.0-28/unix/configure 2025-02-19 12:21:59.861582725 +0000
@@ -401,14 +401,17 @@
 rm -f "${temp_file}"
 
 echo Check for memset
-echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
+cat > conftest.c << _EOF_
+#include <string.h>
+int main(){ char k; memset(&k,0,0); return 0; }
+_EOF_
 $CC -o conftest conftest.c >/dev/null 2>/dev/null
 [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DZMEM"
 
 echo Check for errno declaration
 cat > conftest.c << _EOF_
 #include <errno.h>
-main()
+int main()
 {
   errno = 0;
   return 0;
@@ -419,6 +422,8 @@
 
 echo Check for directory libraries
 cat > conftest.c << _EOF_
+#include <sys/types.h>
+#include <dirent.h>
 int main() { return closedir(opendir(".")); }
 _EOF_
 
@@ -439,7 +444,10 @@
 
 # Dynix/ptx 1.3 needed this
 echo Check for readlink
-echo "int main(){ return readlink(); }" > conftest.c
+cat > conftest.c << _EOF_
+#include <unistd.h>
+int main(){ return readlink(); }
+_EOF_
 $CC -o conftest conftest.c >/dev/null 2>/dev/null
 if [ $? -ne 0 ]; then
   $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
@@ -514,6 +522,7 @@
   for func in mbschr mbsrchr
   do
     echo Check for MBCS $func
+    # XXX needs #include
     echo "int main() { $func(); return 0; }" > conftest.c
     $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
     [ $? -eq 0 ] && CFLAGSR="${CFLAGSR} -D`echo $func | tr '[a-z]' 
'[A-Z]'`=$func"
@@ -523,7 +532,8 @@
 # needed for AIX (and others ?) when mmap is used
 echo Check for valloc
 cat > conftest.c << _EOF_
-main()
+#include <stdlib.h>
+int main()
 {
 #ifdef MMAP
     valloc();

Reply via email to