pmqs / Info-ZIP-Family-Tree-for-Zip

Other
0 stars 1 forks source link

Patch against 3.0 to compile with gcc-14.1 (part 2) #1

Open heitbaum opened 5 months ago

heitbaum commented 5 months ago

Ref:

--- unix/configure      2008-06-20 03:32:20.000000000 +0000
+++ unix/configure      2024-05-01 09:27:12.149292690 +0000
@@ -509,17 +509,68 @@
 # Check for missing functions
 # add NO_'function_name' to flags if missing

-for func in rmdir strchr strrchr rename mktemp mktime mkstemp
-do
-  echo Check for $func
-  echo "int main(){ $func(); return 0; }" > conftest.c
-  $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
-  [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
-done
+echo Check for rmdir
+cat > conftest.c << _EOF_
+#include <unistd.h>
+int main() { rmdir(""); return 0; }
+_EOF_
+$CC -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RMDIR"
+
+echo Check for strchr
+cat > conftest.c << _EOF_
+#include <string.h>
+int main() { strchr("", 0); return 0; }
+_EOF_
+$CC -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRCHR"
+
+echo Check for strrchr
+cat > conftest.c << _EOF_
+#include <string.h>
+int main() { strrchr("",0); return 0; }
+_EOF_
+$CC -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRRCHR"
+
+echo Check for rename
+cat > conftest.c << _EOF_
+#include <stdio.h>
+int main() { rename("",""); return 0; }
+_EOF_
+$CC -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RENAME"
+
+echo Check for mktemp
+cat > conftest.c << _EOF_
+#include <stdlib.h>
+int main() { mktemp(""); return 0; }
+_EOF_
+$CC -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTEMP"
+
+echo Check for mktime
+cat > conftest.c << _EOF_
+#include <time.h>
+int main() { struct tm *t; mktime(t); return 0; }
+_EOF_
+$CC -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTIME"
+
+echo Check for mkstemp
+cat > conftest.c << _EOF_
+#include <stdlib.h>
+int main() { mkstemp(""); return 0; }
+_EOF_
+$CC -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKSTEMP"

 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 ] && CFLAGS="${CFLAGS} -DZMEM"
heitbaum commented 5 months ago

@pmqs im happy to rewrite this to match suit this version of zip, let me know if the approach suits, and i will rework.

pmqs commented 5 months ago

Many thanks for taking the time to send a patch @heitbaum

I see you've posted the change over at https://sourceforge.net/p/infozip/bugs/72. That's the official place to send the change.

This repo is intended to be a snapshot of code that is out in the wild. It isn't for onward development of the code. That said, it is good to keep a record of what you've created, so I'll leave the change in-place.

Thanks again