summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b4c21d)
raw | patch | inline | side by side (parent: 0b4c21d)
author | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Mon, 14 Apr 2008 10:26:08 +0000 (12:26 +0200) | ||
committer | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Mon, 14 Apr 2008 10:26:08 +0000 (12:26 +0200) |
Resolves: #8
configure.in | patch | blob | history |
diff --git a/configure.in b/configure.in
index db344978d38a27dff2adecdc2f06f4c281176a16..d9fc92da237e9a4bfa5f4ce638452ed511e7ee18 100644 (file)
--- a/configure.in
+++ b/configure.in
@@ -371,6 +371,68 @@ AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr
AC_FUNC_STRERROR_R
+AC_CACHE_CHECK([for strtok_r],
+ [have_strtok_r_default],
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [[[[
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+ ]]]],
+ [[[[
+ char buffer[] = "foo,bar,baz";
+ char *token;
+ char *dummy;
+ char *saveptr;
+
+ dummy = buffer;
+ saveptr = NULL;
+ while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
+ {
+ dummy = NULL;
+ printf ("token = %s;\n", token);
+ }
+ ]]]]),
+ [have_strtok_r_default="yes"],
+ [have_strtok_r_default="no"]
+ )
+)
+
+if test "x$have_strtok_r_default" = "xno"
+then
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -D_REENTRANT=1"
+
+ AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
+ [have_strtok_r_reentrant],
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [[[[
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+ ]]]],
+ [[[[
+ char buffer[] = "foo,bar,baz";
+ char *token;
+ char *dummy;
+ char *saveptr;
+
+ dummy = buffer;
+ saveptr = NULL;
+ while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
+ {
+ dummy = NULL;
+ printf ("token = %s;\n", token);
+ }
+ ]]]]),
+ [have_strtok_r_reentrant="yes"],
+ [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
+ )
+ )
+fi
+
AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
socket_needs_socket="no"