configure: use a var with the function name to test.

This commit is contained in:
Juan RP 2011-01-25 12:42:34 +01:00
parent 81fa8da4ce
commit 64cd7cf0a4

26
configure vendored
View File

@ -279,8 +279,10 @@ fi
# #
# Check for vasprintf(). # Check for vasprintf().
# #
printf "Checking for vasprintf() ... " func=vasprintf
cat <<EOF >_vasprintf.c printf "Checking for $func() ... "
cat <<EOF >_$func.c
#define _GNU_SOURCE #define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
int main(void) { int main(void) {
@ -288,13 +290,13 @@ int main(void) {
return 0; return 0;
} }
EOF EOF
if $XCC _vasprintf.c -o _vasprintf 2>/dev/null; then if $XCC _$func.c -o _$func 2>/dev/null; then
VASPRINTF=yes VASPRINTF=yes
else else
VASPRINTF=no VASPRINTF=no
fi fi
echo "$VASPRINTF." echo "$VASPRINTF."
rm -f _vasprint.c _vasprintf rm -f _$func.c _$func
if [ "$VASPRINTF" = "yes" ]; then if [ "$VASPRINTF" = "yes" ]; then
echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK
fi fi
@ -302,8 +304,9 @@ fi
# #
# Check for strlcpy(). # Check for strlcpy().
# #
printf "Checking for strlcpy() ... " func=strlcpy
cat <<EOF >_strlcpy.c printf "Checking for $func() ... "
cat <<EOF >_$func.c
#include <string.h> #include <string.h>
int main(void) { int main(void) {
const char s1[] = "foo"; const char s1[] = "foo";
@ -312,13 +315,13 @@ int main(void) {
return 0; return 0;
} }
EOF EOF
if $XCC _strlcpy.c -o _strlcpy 2>/dev/null; then if $XCC _$func.c -o _$func 2>/dev/null; then
STRLCPY=yes STRLCPY=yes
else else
STRLCPY=no STRLCPY=no
fi fi
echo "$STRLCPY." echo "$STRLCPY."
rm -f _strlcpy.c _strlcpy rm -f _$func.c _$func
if [ "$STRLCPY" = no ]; then if [ "$STRLCPY" = no ]; then
echo "COMPAT_SRCS += compat/strlcpy.o" >>$CONFIG_MK echo "COMPAT_SRCS += compat/strlcpy.o" >>$CONFIG_MK
echo "#include \"strlcpy.h\"" >>$CONFIG_H echo "#include \"strlcpy.h\"" >>$CONFIG_H
@ -328,7 +331,8 @@ fi
# #
# Check for strlcat(). # Check for strlcat().
printf "Checking for strlcat() ... " func=strlcat
printf "Checking for $func() ... "
cat <<EOF > _strlcat.c cat <<EOF > _strlcat.c
#include <string.h> #include <string.h>
int main(void) { int main(void) {
@ -338,13 +342,13 @@ int main(void) {
return 0; return 0;
} }
EOF EOF
if $XCC _strlcat.c -o _strlcat 2>/dev/null; then if $XCC _$func.c -o _$func 2>/dev/null; then
STRLCAT=yes STRLCAT=yes
else else
STRLCAT=no STRLCAT=no
fi fi
echo "$STRLCAT." echo "$STRLCAT."
rm -f _strlcat.c _strlcat rm -f _$func.c _$func
if [ "$STRLCAT" = no ]; then if [ "$STRLCAT" = no ]; then
echo "COMPAT_SRCS += compat/strlcat.o" >>$CONFIG_MK echo "COMPAT_SRCS += compat/strlcat.o" >>$CONFIG_MK
echo "#include \"strlcat.h\"" >>$CONFIG_H echo "#include \"strlcat.h\"" >>$CONFIG_H