+2018-05-13 Bruno Haible <bruno@clisp.org>
+
+ tsearch: Fix compilation error on Android.
+ * lib/search.in.h (twalk): Declare when HAVE_TWALK, not HAVE_TSEARCH,
+ is 0.
+ (GNULIB_defined_tsearch, GNULIB_defined_twalk): New macros.
+ * lib/tsearch.c (tsearch, tfind, tdelete): Define only if
+ GNULIB_defined_tsearch is true.
+ (twalk): Define only if GNULIB_defined_twalk is true.
+ * modules/tsearch (configure.ac): Compile tsearch.c also if HAVE_TWALK
+ is 0.
+ * m4/tsearch.m4 (gl_FUNC_TSEARCH): Set HAVE_TWALK.
+ * m4/search_h.m4 (gl_SEARCH_H_DEFAULTS): Initialize HAVE_TWALK.
+ * modules/search (Makefile.am): Substitute HAVE_TWALK.
+
2018-05-13 Bruno Haible <bruno@clisp.org>
imaxdiv: Fix compilation error on Android.
_GL_CXXALIAS_RPL (twalk, void,
(const void *vroot, _gl_search_action_fn action));
# else
-# if !@HAVE_TSEARCH@
+# if !@HAVE_TWALK@
_GL_FUNCDECL_SYS (twalk, void,
(const void *vroot, _gl_search_action_fn action)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIASWARN (twalk);
+/* Flags used by tsearch.c. */
+# define GNULIB_defined_tsearch (@REPLACE_TSEARCH@ || !@HAVE_TSEARCH@)
+# define GNULIB_defined_twalk (@REPLACE_TSEARCH@ || !@HAVE_TWALK@)
+
#elif defined GNULIB_POSIXCHECK
# undef tsearch
# if HAVE_RAW_DECL_TSEARCH
#endif
+#if GNULIB_defined_tsearch
+
/* Possibly "split" a node with two red successors, and/or fix up two red
edges in a row. ROOTP is a pointer to the lowest node we visited, PARENTP
and GPARENTP pointers to its parent/grandparent. P_R and GP_R contain the
weak_alias (__tdelete, tdelete)
#endif
+#endif /* GNULIB_defined_tsearch */
+
+
+#if GNULIB_defined_twalk
/* Walk the nodes of a tree.
ROOT is the root of the tree to be walked, ACTION the function to be
weak_alias (__twalk, twalk)
#endif
+#endif /* GNULIB_defined_twalk */
+
#ifdef _LIBC
-# search_h.m4 serial 9
+# search_h.m4 serial 10
dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
GNULIB_TSEARCH=0; AC_SUBST([GNULIB_TSEARCH])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH])
+ HAVE_TWALK=1; AC_SUBST([HAVE_TWALK])
REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH])
])
-# tsearch.m4 serial 7
+# tsearch.m4 serial 8
dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_FUNC_TSEARCH],
[
AC_REQUIRE([gl_SEARCH_H_DEFAULTS])
- AC_CHECK_FUNCS([tsearch])
+ AC_CHECK_FUNCS([tsearch twalk])
if test $ac_cv_func_tsearch = yes; then
dnl On OpenBSD 4.0, the return value of tdelete() is incorrect.
AC_REQUIRE([AC_PROG_CC])
else
HAVE_TSEARCH=0
fi
+ if test $ac_cv_func_twalk != yes; then
+ HAVE_TWALK=0
+ fi
])
# Prerequisites of lib/tsearch.c.
-e 's|@''HAVE_TYPE_VISIT''@|$(HAVE_TYPE_VISIT)|g' \
-e 's/@''GNULIB_TSEARCH''@/$(GNULIB_TSEARCH)/g' \
-e 's|@''HAVE_TSEARCH''@|$(HAVE_TSEARCH)|g' \
+ -e 's|@''HAVE_TWALK''@|$(HAVE_TWALK)|g' \
-e 's|@''REPLACE_TSEARCH''@|$(REPLACE_TSEARCH)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
configure.ac:
gl_FUNC_TSEARCH
-if test $HAVE_TSEARCH = 0 || test $REPLACE_TSEARCH = 1; then
+if test $HAVE_TSEARCH = 0 || test $HAVE_TWALK = 0 || test $REPLACE_TSEARCH = 1; then
AC_LIBOBJ([tsearch])
gl_PREREQ_TSEARCH
fi