qb: Extend check_header.

Now the check_header function can test any number of header files
instead of only four.
This commit is contained in:
orbea 2018-12-14 14:37:21 -08:00
parent bd2fb04a47
commit 9be245ad75

View File

@ -115,18 +115,19 @@ check_pkgconf() # $1 = HAVE_$1 $2 = package $3 = version $4 = critical error
fi
}
check_header() #$1 = HAVE_$1 $2..$5 = header files
check_header() #$1 = HAVE_$1 $2, $3, ... = header files
{ tmpval="$(eval "printf %s \"\$HAVE_$1\"")"
[ "$tmpval" = 'no' ] && return 0
CHECKHEADER="$2"
printf %s\\n "#include <$2>" > "$TEMP_C"
[ "$3" != '' ] && CHECKHEADER="$3" && printf %s\\n "#include <$3>" >> "$TEMP_C"
[ "$4" != '' ] && CHECKHEADER="$4" && printf %s\\n "#include <$4>" >> "$TEMP_C"
[ "$5" != '' ] && CHECKHEADER="$5" && printf %s\\n "#include <$5>" >> "$TEMP_C"
printf %s\\n "int main(void) { return 0; }" >> "$TEMP_C"
answer='no'
rm -f -- "$TEMP_C"
val="$1"
header="$2"
shift
for head do
CHECKHEADER="$head"
printf %s\\n "#include <$head>" >> "$TEMP_C"
done
printf %s\\n "int main(void) { return 0; }" >> "$TEMP_C"
answer='no'
eval "set -- $INCLUDE_DIRS"
"$CC" -o "$TEMP_EXE" "$TEMP_C" "$@" >>config.log 2>&1 && answer='yes'
eval "HAVE_$val=\"$answer\""