1From 8810f2643c9372a8083272dc1fc157427646d961 Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Wed, 10 Aug 2022 17:16:23 -0700 4Subject: [PATCH 1/2] configure: Specify correct function signatures and 5 declarations 6 7Include needed system headers in configure tests, this is needed because 8newer compilers are getting stricter about the C99 specs and turning 9-Wimplicit-function-declaration into hard error e.g. clang-15+ 10 11Upstream-Status: Inactive-Upstream 12Signed-off-by: Khem Raj <raj.khem@gmail.com> 13--- 14 unix/configure | 79 +++++++++++++++++++++++++++++++++++++++++--------- 15 1 file changed, 66 insertions(+), 13 deletions(-) 16 17diff --git a/unix/configure b/unix/configure 18index 1d9a9bb..f2b3d02 100644 19--- a/unix/configure 20+++ b/unix/configure 21@@ -513,21 +513,70 @@ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null 22 # Check for missing functions 23 # add NO_'function_name' to flags if missing 24 25-for func in rmdir strchr strrchr rename mktemp mktime mkstemp 26-do 27- echo Check for $func 28- echo "int main(){ $func(); return 0; }" > conftest.c 29- $CC $CFLAGS $LDFLAGS $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null 30- [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`" 31-done 32+echo Check for rmdir 33+cat > conftest.c << _EOF_ 34+#include <unistd.h> 35+int main(){ rmdir(NULL); return 0; } 36+_EOF_ 37+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 38+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RMDIR" 39+ 40+echo Check for strchr 41+cat > conftest.c << _EOF_ 42+#include <string.h> 43+int main(){ strchr(NULL,0); return 0; } 44+_EOF_ 45+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 46+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRCHR" 47 48+echo Check for strrchr 49+cat > conftest.c << _EOF_ 50+#include <string.h> 51+int main(){ strrchr(NULL,0); return 0; } 52+_EOF_ 53+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 54+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRRCHR" 55+ 56+echo Check for rename 57+cat > conftest.c << _EOF_ 58+#include <stdio.h> 59+int main(){ rename(NULL,NULL); return 0; } 60+_EOF_ 61+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 62+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RENAME" 63+ 64+echo Check for mktemp 65+cat > conftest.c << _EOF_ 66+#include <stdlib.h> 67+int main(){ mktemp(NULL); return 0; } 68+_EOF_ 69+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 70+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTEMP" 71+ 72+echo Check for mktime 73+cat > conftest.c << _EOF_ 74+#include <time.h> 75+int main(){ mktime(NULL); return 0; } 76+_EOF_ 77+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 78+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTIME" 79+ 80+echo Check for mkstemp 81+cat > conftest.c << _EOF_ 82+#include <stdlib.h> 83+int main(){ return mkstemp(NULL); } 84+_EOF_ 85+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 86+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKSTEMP" 87 88 echo Check for memset 89-echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c 90+cat > conftest.c << _EOF_ 91+#include <string.h> 92+int main(){ char k; memset(&k,0,0); return 0; } 93+_EOF_ 94 $CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 95 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM" 96 97- 98 echo Check for memmove 99 cat > conftest.c << _EOF_ 100 #include <string.h> 101@@ -548,7 +597,7 @@ $CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null 102 echo Check for errno declaration 103 cat > conftest.c << _EOF_ 104 #include <errno.h> 105-main() 106+int main() 107 { 108 errno = 0; 109 return 0; 110@@ -625,14 +674,18 @@ CFLAGS="${CFLAGS} ${OPT}" 111 112 echo Check for valloc 113 cat > conftest.c << _EOF_ 114-main() 115+#include <stdlib.h> 116+int main() 117 { 118 #ifdef MMAP 119- valloc(); 120+ valloc(0); 121 #endif 122+ return 0; 123 } 124 _EOF_ 125-$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null 126+#$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null 127+$CC ${CFLAGS} -c conftest.c 128+echo "===========================================" 129 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC" 130 131 132-- 1332.37.1 134 135