This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] autotools: search.h


From: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>

---
 config.in          |  3 +++
 configure          | 12 ++++++++++++
 configure.ac       |  2 ++
 staprun/mainloop.c |  7 ++++++-
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/config.in b/config.in
index 90c1dee..c776758 100644
--- a/config.in
+++ b/config.in
@@ -101,6 +101,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <search.h> header file. */
+#undef HAVE_SEARCH_H
+
 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
 #undef NO_MINUS_C_MINUS_O
 
diff --git a/configure b/configure
index ff5fd22..de8e7cf 100755
--- a/configure
+++ b/configure
@@ -10350,6 +10350,18 @@ _ACEOF
 DATE="$date"
 
 
+for ac_header in search.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default"
+if test "x$ac_cv_header_search_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SEARCH_H 1
+_ACEOF
+
+fi
+
+done
+
 # Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
 # being compiled on 32-bit userspace but running against 64-bit kernels.
 # This is no longer necessary.
diff --git a/configure.ac b/configure.ac
index dae2cf5..6486e6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -473,6 +473,8 @@ date=`date +%Y-%m-%d`
 AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
 AC_SUBST(DATE, "$date")
 
+AC_CHECK_HEADERS([search.h])
+
 # Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
 # being compiled on 32-bit userspace but running against 64-bit kernels.
 # This is no longer necessary.
diff --git a/staprun/mainloop.c b/staprun/mainloop.c
index e68efb3..780e182 100644
--- a/staprun/mainloop.c
+++ b/staprun/mainloop.c
@@ -14,9 +14,12 @@
 #include <sys/utsname.h>
 #include <sys/ptrace.h>
 #include <sys/select.h>
+
+#ifdef HAVE_SEARCH_H
 #include <search.h>
-#include <wordexp.h>
+#endif
 
+#include <wordexp.h>
 
 #define WORKAROUND_BZ467568 1  /* PR 6964; XXX: autoconf when able */
 
@@ -661,6 +664,7 @@ int stp_main_loop(void)
               if (verbose) { /* don't eliminate duplicates */
                       eprintf("%.*s", (int) nb, recvbuf.payload.data);
                       break;
+#ifdef HAVE_SEARCH_H
               } else { /* eliminate duplicates */
                       static void *seen = 0;
                       static unsigned seen_count = 0;
@@ -706,6 +710,7 @@ int stp_main_loop(void)
                       } else { /* old message */
                               free (dupstr);
                       }
+#endif
               } /* duplicate elimination */
       /* Note that "ERROR:" should not be translated, since it is
        * part of the module cmd protocol. */
-- 
1.8.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]