xbps-repo(8): 'search' target is now case insensitive.

Along with this change, compat code has been added (from NetBSD)
for systems that don't have it. The compat code has been reorganized
to be in a common place and its prototypes in compat.h.

The configure scripts checks if strcasestr() is available, and
uses compat code if not found.

This fixes issue #2 on github.com/vanilla/xbps.
This commit is contained in:
Juan RP
2011-07-09 10:50:44 +02:00
parent 5585b98ac6
commit 0a2abb3f3d
15 changed files with 198 additions and 70 deletions

38
configure vendored
View File

@@ -315,10 +315,42 @@ else
fi
echo "$VASPRINTF."
rm -f _$func.c _$func
if [ "$VASPRINTF" = "yes" ]; then
if [ "$VASPRINTF" = "no" ]; then
echo "COMPAT_SRCS+= compat/vasprintf.o" >>$CONFIG_MK
echo "#include \"compat.h\"" >>$CONFIG_H
else
echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK
fi
#
# Check for strcasestr().
#
func=strcasestr
printf "Checking for $func() ..."
cat <<EOF >_$func.c
#define _GNU_SOURCE
#include <string.h>
int main(void) {
const char *h = "NEEDCOFEE";
const char *n = "IneedCoffee";
strcasestr(n, h);
return 0;
}
EOF
if $XCC _$func.c -o _$func 2>/dev/null; then
STRCASESTR=yes
else
STRCASESTR=no
fi
echo "$STRCASESTR."
rm -f _$func _$func.c
if [ "$STRCASESTR" = no ]; then
echo "COMPAT_SRCS += compat/strcasestr.o" >>$CONFIG_MK
echo "#include \"compat.h\"" >>$CONFIG_H
else
echo "CPPFLAGS += -DHAVE_STRCASESTR" >>$CONFIG_MK
fi
#
# Check for strlcpy().
#
@@ -342,7 +374,7 @@ echo "$STRLCPY."
rm -f _$func.c _$func
if [ "$STRLCPY" = no ]; then
echo "COMPAT_SRCS += compat/strlcpy.o" >>$CONFIG_MK
echo "#include \"strlcpy.h\"" >>$CONFIG_H
echo "#include \"compat.h\"" >>$CONFIG_H
else
echo "CPPFLAGS += -DHAVE_STRLCPY" >> $CONFIG_MK
fi
@@ -369,7 +401,7 @@ echo "$STRLCAT."
rm -f _$func.c _$func
if [ "$STRLCAT" = no ]; then
echo "COMPAT_SRCS += compat/strlcat.o" >>$CONFIG_MK
echo "#include \"strlcat.h\"" >>$CONFIG_H
echo "#include \"compat.h\"" >>$CONFIG_H
else
echo "CPPFLAGS += -DHAVE_STRLCAT" >>$CONFIG_MK
fi