aboutsummaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorSUZUKI, Shinsuke <suz@kame.net>2006-09-02 08:00:25 +0000
committerSUZUKI, Shinsuke <suz@kame.net>2006-09-02 08:00:25 +0000
commita81d6601b213f657821f80bd6f257545647574a0 (patch)
tree765faa8d45b5512188ad7cf46df6d2b33e1f658c /configure.in
parent26ff90dadfa215eaeb5008bd6d50fe1db5969a13 (diff)
added a configure check routine to automatically detect a difference(*1) in
TAILQ_FOREACH_REVERSE macros. (Suggested by Brute STEVANT) *1) Some OS (*BSD) adopts the following definition, #define TAILQ_FOREACH_REVERSE(var, head, headname, field) but others (MacOS-X, old OpenBSD) adopts the following definition #define TAILQ_FOREACH_REVERSE(var, head, field, headname)
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in40
1 files changed, 40 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 624061f..19e8d38 100644
--- a/configure.in
+++ b/configure.in
@@ -147,6 +147,46 @@ esac
dnl DHCP option type values not officially defined
dnl (no such option now)
+dnl Checks the existence of TAILQ_FOREACH_REVERSE
+AC_MSG_CHECKING(checking the existence TAILQ_FOREACH_REVERSE)
+AC_EGREP_CPP(yes,
+[#include <sys/queue.h>
+ #ifdef TAILQ_FOREACH_REVERSE
+ yes
+#endif], [result=yes], [result=no])
+AC_MSG_RESULT($result)
+case $result in
+yes) tailq_foreach=yes
+ ;;
+*) tailq_foreach=no
+ ;;
+esac
+
+dnl Checks the argument order of TAILQ_FOREACH_REVERSE if it exists
+if test $tailq_foreach = yes ; then
+ AC_MSG_CHECKING(argument order of TAILQ_FOREACH_REVERSE)
+ AC_TRY_COMPILE([],
+ [
+ #include <stdio.h>
+ #include <sys/queue.h>
+
+ TAILQ_HEAD(tailhead, entry) head = TAILQ_HEAD_INITIALIZER(head);
+ struct entry {
+ TAILQ_ENTRY(entry) entries;
+ } *p;
+
+ int i;
+ struct tailhead *headp;
+
+ TAILQ_FOREACH_REVERSE(p, headp, tailhead, entries) {
+ }
+ ],
+ [AC_MSG_RESULT(new)
+ AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE)],
+ [AC_MSG_RESULT(old)
+ AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE_OLD)]);
+fi
+
AC_CHECK_HEADERS(stdarg.h)
AC_OUTPUT(Makefile)