Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] configure: check for perf_event.h version
@ 2015-08-06 13:06 Markus Metzger
  2015-08-06 14:03 ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Metzger @ 2015-08-06 13:06 UTC (permalink / raw)
  To: palves; +Cc: gdb-patches

Intel(R) Processor Trace support requires a recent linux/perf_event.h header.

When GDB is built on an older system, Intel(R) Processor Trace will not be
available and there is no indication in the configure and build log as to
what went wrong.

Check for a compatible linux/perf_event.h at configure-time.

2015-08-06  Markus Metzger <markus.t.metzger@intel.com>

gdb/
	* configure.ac: Check for PERF_ATTR_SIZE_VER5 in linux/perf_event.h
	* configure: Regenerate.
---
 gdb/configure    | 27 ++++++++++++++++++++++++++-
 gdb/configure.ac | 14 ++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/gdb/configure b/gdb/configure
index e1b778b..ddff555 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -1558,7 +1558,8 @@ Optional Packages:
                           (auto/yes/no/<python-program>)
   --with-guile[=GUILE]    include guile support
                           (auto/yes/no/<guile-version>/<pkg-config-program>)
-  --with-intel-pt         include Intel(R) Processor Trace support (auto/yes/no)
+  --with-intel-pt         include Intel(R) Processor Trace support
+                          (auto/yes/no)
   --with-libipt-prefix[=DIR]  search for libipt in DIR/include and DIR/lib
   --without-libipt-prefix     don't search for libipt in includedir and libdir
   --without-included-regex
@@ -9732,6 +9733,30 @@ if test "${with_intel_pt}" = no; then
 $as_echo "$as_me: WARNING: Intel(R) Processor Trace support disabled; some features may be unavailable." >&2;}
   HAVE_LIBIPT=no
 else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <linux/perf_event.h>
+#ifdef PERF_ATTR_SIZE_VER5
+# error
+#endif
+
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  perf_event=no
+else
+  perf_event=yes
+fi
+rm -f conftest.err conftest.$ac_ext
+  if test "$perf_event" != yes; then
+    if test "$with_intel_pt" = yes; then
+      as_fn_error "linux/perf_event.h missing or too old" "$LINENO" 5
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/perf_event.h missing or too old; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: linux/perf_event.h missing or too old; some features may be unavailable." >&2;}
+    fi
+  fi
+
 
 
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 905c27b..d867e85 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1252,6 +1252,20 @@ if test "${with_intel_pt}" = no; then
   AC_MSG_WARN([Intel(R) Processor Trace support disabled; some features may be unavailable.])
   HAVE_LIBIPT=no
 else
+  AC_PREPROC_IFELSE(AC_LANG_SOURCE([[
+#include <linux/perf_event.h>
+#ifdef PERF_ATTR_SIZE_VER5
+# error
+#endif
+  ]]), [perf_event=no], [perf_event=yes])
+  if test "$perf_event" != yes; then
+    if test "$with_intel_pt" = yes; then
+      AC_MSG_ERROR([linux/perf_event.h missing or too old])
+    else
+      AC_MSG_WARN([linux/perf_event.h missing or too old; some features may be unavailable.])
+    fi
+  fi
+
   AC_LIB_HAVE_LINKFLAGS([ipt], [], [#include "intel-pt.h"], [pt_insn_alloc_decoder (0);])
   if test "$HAVE_LIBIPT" != yes; then
     if test "$with_intel_pt" = yes; then
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-06 15:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06 13:06 [PATCH] configure: check for perf_event.h version Markus Metzger
2015-08-06 14:03 ` Pedro Alves
2015-08-06 14:14   ` Metzger, Markus T
2015-08-06 14:54     ` Pedro Alves
2015-08-06 15:00       ` Metzger, Markus T
2015-08-06 15:17         ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox