diff options
| author | Roy Marples <roy@marples.name> | 2019-03-03 22:59:13 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-03-03 22:59:13 +0000 |
| commit | f7304e82dfd0cb4d901dd8b1fcc77214713c86f1 (patch) | |
| tree | d5230c06d87c22a7a7d8792a54970ff160e9aac8 /configure | |
| parent | ffdcf68f52cd11fdc8595bbc0710776d2f6caee4 (diff) | |
| download | dhcpcd-f7304e82dfd0cb4d901dd8b1fcc77214713c86f1.tar.xz | |
Add rbtree(3) from NetBSD if not present in libc.
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -13,6 +13,7 @@ IPV4LL= INET6= ARC4RANDOM= CLOSEFROM= +RBTREE= STRLCPY= UDEV= OS= @@ -739,6 +740,7 @@ if [ "$ARC4RANDOM_UNIFORM" = no ]; then echo "#include \"compat/arc4random_uniform.h\"" >>$CONFIG_H fi + if [ -z "$STRLCPY" ]; then printf "Testing for strlcpy ... " cat <<EOF >_strlcpy.c @@ -936,13 +938,39 @@ if [ "$TAILQ_FOREACH_SAFE" = no -o "$TAILQ_CONCAT" = no ]; then # Strictly speaking this isn't needed, but I like it to help # catch any nasties. if [ "$TAILQ_FOREACH" = yes ]; then - echo "#include <sys/queue.h>">>$CONFIG_H + echo "#include <sys/queue.h>">>$CONFIG_H fi echo "#include \"compat/queue.h\"">>$CONFIG_H else echo "#define HAVE_SYS_QUEUE_H" >>$CONFIG_H fi +if [ -z "$RBTREE" ]; then + printf "Testing for rb_tree_init ... " + cat <<EOF >_rbtree.c +#include <sys/rbtree.h> +static rb_tree_ops_t ops; +int main(void) { + rb_tree_t tree; + rb_tree_init(&tree, &ops); + return 0; +} +EOF + if $XCC _rbtree.c -o _rbtree 2>&3; then + RBTREE=yes + else + RBTREE=no + fi + echo "$STRLCPY" + rm -f _rbtree.c _rbtree +fi +if [ "$RBTREE" = no ]; then + echo "COMPAT_SRCS+= compat/rb.c" >>$CONFIG_MK + echo "#include \"compat/rbtree.h\"" >>$CONFIG_H +else + echo "#define HAVE_SYS_RBTREE_H" >>$CONFIG_H +fi + if [ -z "$REALLOCARRAY" ]; then printf "Testing for reallocarray ... " cat <<EOF >_reallocarray.c |
