summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure61
1 files changed, 44 insertions, 17 deletions
diff --git a/configure b/configure
index 9f11edf..8eed93c 100755
--- a/configure
+++ b/configure
@@ -445,29 +445,48 @@ if [ "$STRLCPY" = no ]; then
echo "#include \"compat/strlcpy.h\"" >>$CONFIG_H
fi
-if [ -z "$STRTOI" ]; then
- printf "Testing for strtoi ... "
- cat <<EOF >_strtoi.c
-#include <stdlib.h>
-#include <limits.h>
-#include <inttypes.h>
+if [ -z "$TAILQ_FOREACH_SAFE" ]; then
+ printf "Testing for TAILQ_FOREACH_SAFE ... "
+ cat <<EOF >_queue.c
+#include <sys/queue.h>
int main(void) {
- int e;
- strtoi("1234", NULL, 0, 0, INT32_MAX, &e);
+#ifndef TAILQ_FOREACH_SAFE
+#error TAILQ_FOREACH_SAFE
+#endif
return 0;
}
EOF
- if $XCC _strtoi.c -o _strtoi 2>&3; then
- STRTOI=yes
+ if $XCC _queue.c -o _queue 2>&3; then
+ TAILQ_FOREACH_SAFE=yes
+ TAILQ_FOREACH=yes
else
- STRTOI=no
+ TAILQ_FOREACH_SAFE=no
fi
- echo "$STRTOI"
- rm -f _strtoi.c _strtoi
+ echo "$TAILQ_FOREACH_SAFE"
+ rm -f _queue.c _queue
fi
-if [ "$STRTOI" = no ]; then
- echo "COMPAT_SRCS+= compat/strtoi.c compat/strtou.c" >>$CONFIG_MK
- echo "#include \"compat/strtoi.h\"" >>$CONFIG_H
+if [ "$TAILQ_FOREACH_SAFE" = no ] && [ -z "$TAILQ_FOREACH_MUTABLE" ]; then
+ printf "Testing for TAILQ_FOREACH_MUTABLE ... "
+ cat <<EOF >_queue.c
+#include <sys/queue.h>
+int main(void) {
+#ifndef TAILQ_FOREACH_MUTABLE
+#error TAILQ_FOREACH_MUTABLE
+#endif
+ return 0;
+}
+EOF
+ if $XCC _queue.c -o _queue 2>&3; then
+ TAILQ_FOREACH_MUTABLE=yes
+ TAILQ_FOREACH_SAFE=yes
+ TAILQ_FOREACH=yes
+ echo "#define TAILQ_FOREACH_SAFE TAILQ_FOREACH_MUTABLE" \
+ >> $CONFIG_H
+ else
+ TAILQ_FOREACH_MUTABLE=no
+ fi
+ echo "$TAILQ_FOREACH_MUTABLE"
+ rm -f _queue.c _queue
fi
if [ -z "$TAILQ_FOREACH" ]; then
@@ -489,7 +508,15 @@ EOF
echo "$TAILQ_FOREACH"
rm -f _queue.c _queue
fi
-if [ "$TAILQ_FOREACH" = no ]; then
+if [ "$TAILQ_FOREACH_SAFE" = no ]; then
+ # If we don't include sys/queue.h then clang analyser finds
+ # too many false positives.
+ # See http://llvm.org/bugs/show_bug.cgi?id=18222
+ # 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
+ fi
echo "#include \"compat/queue.h\"">>$CONFIG_H
else
echo "#define HAVE_SYS_QUEUE_H" >>$CONFIG_H