]> Savannah Git Hosting - gnulib.git/commitdiff
search: Don't assume that tsearch() exists if 'VISIT' is defined.
authorBruno Haible <bruno@clisp.org>
Fri, 10 Feb 2017 21:42:36 +0000 (22:42 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 10 Feb 2017 23:10:29 +0000 (00:10 +0100)
* 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
lib/search.in.h
m4/search_h.m4
modules/search

index 95b4c23ff9694ba554063329b8dc1df8e7d5dc89..f5de3492a188c4a7784ecdcd9746d1dfcc37c36f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-02-10  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        doc: Don't mention obsolete AC_LIBTOOL_WIN32_DLL macro.
index c06f480737002808931d138771dd187a5cc4b7aa..ad4a852ca3c0d8cfb250b7161911ad371d2fdf58 100644 (file)
@@ -52,7 +52,7 @@
        <http://www.opengroup.org/susv3xsh/tsearch.html>
    for details.  */
 
-# if !@HAVE_TSEARCH@
+# if !@HAVE_TYPE_VISIT@
 #  if !GNULIB_defined_search_types
 typedef enum
 {
index 1bc50ddab4c57a614ebb6d0d8e65de770f791933..6aaaf36ed04bacab64f09863327e37ff6912627a 100644 (file)
@@ -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 <search.h>
+              #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 <search.h>
index 7adddc144d4bd336aba9c397bd373b6b2f6f7573..70536ea5a9c1e504ef7a5fefac33bd73bc68d897 100644 (file)
@@ -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' \