>From e3f94e9de67e74a8e1ff56e476f72d47b174dd7c Mon Sep 17 00:00:00 2001
From: Bruno Haible
Date: Fri, 10 Feb 2017 22:42:36 +0100
Subject: [PATCH 1/2] search: Don't assume that tsearch() exists if 'VISIT' is
defined.
* m4/search_h.m4 (gl_SEARCH_H): Determine HAVE_TYPE_VISIT.
* modules/search (Makefile.am): Substitute HAVE_TYPE_VISIT.
* lib/search.in.h (VISIT): Define if HAVE_TYPE_VISIT is 0.
---
ChangeLog | 7 +++++++
lib/search.in.h | 2 +-
m4/search_h.m4 | 23 ++++++++++++++++++++++-
modules/search | 1 +
4 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 95b4c23..f5de349 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-02-10 Bruno Haible
+
+ search: Don't assume that tsearch() exists if 'VISIT' is defined.
+ * m4/search_h.m4 (gl_SEARCH_H): Determine HAVE_TYPE_VISIT.
+ * modules/search (Makefile.am): Substitute HAVE_TYPE_VISIT.
+ * lib/search.in.h (VISIT): Define if HAVE_TYPE_VISIT is 0.
+
2017-02-09 Bruno Haible
doc: Don't mention obsolete AC_LIBTOOL_WIN32_DLL macro.
diff --git a/lib/search.in.h b/lib/search.in.h
index c06f480..ad4a852 100644
--- a/lib/search.in.h
+++ b/lib/search.in.h
@@ -52,7 +52,7 @@
for details. */
-# if address@hidden@
+# if address@hidden@
# if !GNULIB_defined_search_types
typedef enum
{
diff --git a/m4/search_h.m4 b/m4/search_h.m4
index 1bc50dd..6aaaf36 100644
--- a/m4/search_h.m4
+++ b/m4/search_h.m4
@@ -1,4 +1,4 @@
-# search_h.m4 serial 8
+# search_h.m4 serial 9
dnl Copyright (C) 2007-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,27 @@ AC_DEFUN([gl_SEARCH_H],
fi
AC_SUBST([HAVE_SEARCH_H])
+ if test $HAVE_SEARCH_H = 1; then
+ AC_CACHE_CHECK([for type VISIT], [gl_cv_type_VISIT],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#if HAVE_SEARCH_H
+ #include
+ #endif
+ ]],
+ [[static VISIT x; x = postorder;]])],
+ [gl_cv_type_VISIT=yes],
+ [gl_cv_type_VISIT=no])])
+ else
+ gl_cv_type_VISIT=no
+ fi
+ if test $gl_cv_type_VISIT = yes; then
+ HAVE_TYPE_VISIT=1
+ else
+ HAVE_TYPE_VISIT=0
+ fi
+ AC_SUBST([HAVE_TYPE_VISIT])
+
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include
diff --git a/modules/search b/modules/search
index 7adddc1..70536ea 100644
--- a/modules/search
+++ b/modules/search
@@ -28,6 +28,7 @@ search.h: search.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SEARCH_H''@|$(NEXT_SEARCH_H)|g' \
+ -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|@''REPLACE_TSEARCH''@|$(REPLACE_TSEARCH)|g' \
--
2.7.4