Check for vasprintf() and add a replacement if it wasn't found.

This commit is contained in:
Juan RP
2011-01-25 12:39:05 +01:00
parent 4bba48a6a0
commit 81fa8da4ce
2 changed files with 58 additions and 3 deletions

26
configure vendored
View File

@@ -4,6 +4,7 @@
# Ensure that we do not inherit these from env
STRLCPY=
STRLCAT=
VASPRINTF=
OS=
BUILD=
HOST=
@@ -275,6 +276,29 @@ if [ -n "$BUILD_PIE" ]; then
check_compiler_flag pie "" PROG_LDFLAGS
fi
#
# Check for vasprintf().
#
printf "Checking for vasprintf() ... "
cat <<EOF >_vasprintf.c
#define _GNU_SOURCE
#include <stdio.h>
int main(void) {
vasprintf(NULL, NULL, NULL);
return 0;
}
EOF
if $XCC _vasprintf.c -o _vasprintf 2>/dev/null; then
VASPRINTF=yes
else
VASPRINTF=no
fi
echo "$VASPRINTF."
rm -f _vasprint.c _vasprintf
if [ "$VASPRINTF" = "yes" ]; then
echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK
fi
#
# Check for strlcpy().
#
@@ -298,6 +322,7 @@ rm -f _strlcpy.c _strlcpy
if [ "$STRLCPY" = no ]; then
echo "COMPAT_SRCS += compat/strlcpy.o" >>$CONFIG_MK
echo "#include \"strlcpy.h\"" >>$CONFIG_H
else
echo "CPPFLAGS += -DHAVE_STRLCPY" >> $CONFIG_MK
fi
@@ -323,6 +348,7 @@ rm -f _strlcat.c _strlcat
if [ "$STRLCAT" = no ]; then
echo "COMPAT_SRCS += compat/strlcat.o" >>$CONFIG_MK
echo "#include \"strlcat.h\"" >>$CONFIG_H
else
echo "CPPFLAGS += -DHAVE_STRLCAT" >>$CONFIG_MK
fi