From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 635 invoked by alias); 20 Nov 2014 10:47:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 394 invoked by uid 89); 20 Nov 2014 10:47:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_50,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Nov 2014 10:47:38 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 20 Nov 2014 02:45:18 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 20 Nov 2014 02:47:30 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sAKAlTDu008510; Thu, 20 Nov 2014 10:47:29 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id sAKAlTJC010301; Thu, 20 Nov 2014 11:47:29 +0100 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id sAKAlTsV010297; Thu, 20 Nov 2014 11:47:29 +0100 From: Markus Metzger To: palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH v2 12/13] configure: check for libipt Date: Thu, 20 Nov 2014 10:47:00 -0000 Message-Id: <1416480444-9943-13-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1416480444-9943-1-git-send-email-markus.t.metzger@intel.com> References: <1416480444-9943-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg00467.txt.bz2 2014-11-20 Markus Metzger * configure.ac: Check for libipt * configure: Regenerate. * config.in: Regenerate. * Makefile.in (LIBIPT): New. (CLIBS): Add $LIBIPT. --- gdb/Makefile.in | 5 +- gdb/config.in | 3 + gdb/configure | 498 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/configure.ac | 20 +++ 4 files changed, 525 insertions(+), 1 deletion(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index fc9c695..4bc8b9c 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -163,6 +163,9 @@ LIBLZMA = @LIBLZMA@ # available. LIBBABELTRACE = @LIBBABELTRACE@ +# Where is libipt? This will be empty if libipt was not available. +LIBIPT = @LIBIPT@ + WARN_CFLAGS = @WARN_CFLAGS@ WERROR_CFLAGS = @WERROR_CFLAGS@ GDB_WARN_CFLAGS = $(WARN_CFLAGS) @@ -557,7 +560,7 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) $(LDFLAGS) $(CONFIG_ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \ $(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) \ @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \ - $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) \ + $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \ $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \ $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) diff --git a/gdb/config.in b/gdb/config.in index f1593bd..d53d973 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -189,6 +189,9 @@ /* Define to 1 if you have the `libiconvlist' function. */ #undef HAVE_LIBICONVLIST +/* Define if you have the ipt library. */ +#undef HAVE_LIBIPT + /* Define if you have the lzma library. */ #undef HAVE_LIBLZMA diff --git a/gdb/configure b/gdb/configure index 1d6d88b..a534cb7 100755 --- a/gdb/configure +++ b/gdb/configure @@ -658,6 +658,9 @@ TARGET_SYSTEM_ROOT CONFIG_LDFLAGS RDYNAMIC ALLOCA +LTLIBIPT +LIBIPT +HAVE_LIBIPT HAVE_GUILE_FALSE HAVE_GUILE_TRUE GUILE_LIBS @@ -824,6 +827,8 @@ with_libexpat_prefix with_python with_guile enable_libmcheck +with_intel_pt +with_libipt_prefix with_included_regex with_sysroot with_system_gdbinit @@ -1542,6 +1547,9 @@ Optional Packages: (auto/yes/no/) --with-guile[=GUILE] include guile support (auto/yes/no//) + --with-intel-pt include Intel 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 don't use included regex; this is the default on systems with version 2 of the GNU C library (use @@ -9349,6 +9357,496 @@ if test "$ENABLE_LIBMCHECK" = "yes" \ $as_echo "$as_me: WARNING: --enable-libmcheck may lead to spurious crashes if threads are used in python" >&2;} fi + +# Check whether --with-intel_pt was given. +if test "${with_intel_pt+set}" = set; then : + withval=$with_intel_pt; +else + with_intel_pt=auto +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use intel pt" >&5 +$as_echo_n "checking whether to use intel pt... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_intel_pt" >&5 +$as_echo "$with_intel_pt" >&6; } + +if test "${with_intel_pt}" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Intel(R) Processor Trace support disabled; some features may be unavailable." >&5 +$as_echo "$as_me: WARNING: Intel(R) Processor Trace support disabled; some features may be unavailable." >&2;} + HAVE_LIBIPT=no +else + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libipt-prefix was given. +if test "${with_libipt_prefix+set}" = set; then : + withval=$with_libipt_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi + + LIBIPT= + LTLIBIPT= + INCIPT= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='ipt ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBIPT="${LIBIPT}${LIBIPT:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBIPT="${LTLIBIPT}${LTLIBIPT:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBIPT; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBIPT="${LTLIBIPT}${LTLIBIPT:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBIPT="${LIBIPT}${LIBIPT:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBIPT="${LIBIPT}${LIBIPT:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBIPT="${LIBIPT}${LIBIPT:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBIPT; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBIPT="${LIBIPT}${LIBIPT:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBIPT="${LIBIPT}${LIBIPT:+ }$found_so" + else + LIBIPT="${LIBIPT}${LIBIPT:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBIPT="${LIBIPT}${LIBIPT:+ }$found_a" + else + LIBIPT="${LIBIPT}${LIBIPT:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCIPT; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCIPT="${INCIPT}${INCIPT:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBIPT; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBIPT="${LIBIPT}${LIBIPT:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBIPT; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBIPT="${LTLIBIPT}${LTLIBIPT:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBIPT="${LIBIPT}${LIBIPT:+ }$dep" + LTLIBIPT="${LTLIBIPT}${LTLIBIPT:+ }$dep" + ;; + esac + done + fi + else + LIBIPT="${LIBIPT}${LIBIPT:+ }-l$name" + LTLIBIPT="${LTLIBIPT}${LTLIBIPT:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBIPT="${LIBIPT}${LIBIPT:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBIPT="${LIBIPT}${LIBIPT:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBIPT="${LTLIBIPT}${LTLIBIPT:+ }-R$found_dir" + done + fi + + + ac_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCIPT; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libipt" >&5 +$as_echo_n "checking for libipt... " >&6; } +if test "${ac_cv_libipt+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIBIPT" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include "intel-pt.h" +int +main () +{ +pt_configure (0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_libipt=yes +else + ac_cv_libipt=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libipt" >&5 +$as_echo "$ac_cv_libipt" >&6; } + if test "$ac_cv_libipt" = yes; then + HAVE_LIBIPT=yes + +$as_echo "#define HAVE_LIBIPT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libipt" >&5 +$as_echo_n "checking how to link with libipt... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBIPT" >&5 +$as_echo "$LIBIPT" >&6; } + else + HAVE_LIBIPT=no + CPPFLAGS="$ac_save_CPPFLAGS" + LIBIPT= + LTLIBIPT= + fi + + + + + + + if test "$HAVE_LIBIPT" != yes; then + if test "$with_intel_pt" = yes; then + as_fn_error "libipt is missing or unusable" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libipt is missing or unusable; some features may be unavailable." >&5 +$as_echo "$as_me: WARNING: libipt is missing or unusable; some features may be unavailable." >&2;} + fi + fi +fi + # ------------------------- # # Checks for header files. # # ------------------------- # diff --git a/gdb/configure.ac b/gdb/configure.ac index 2d73669..9ef998d 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1223,6 +1223,26 @@ if test "$ENABLE_LIBMCHECK" = "yes" \ AC_MSG_WARN(--enable-libmcheck may lead to spurious crashes if threads are used in python) fi +AC_ARG_WITH(intel_pt, + AS_HELP_STRING([--with-intel-pt], [include Intel Processor Trace support (auto/yes/no)]), + [], [with_intel_pt=auto]) +AC_MSG_CHECKING([whether to use intel pt]) +AC_MSG_RESULT([$with_intel_pt]) + +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_LIB_HAVE_LINKFLAGS([ipt], [], [#include "intel-pt.h"], [pt_configure (0);]) + if test "$HAVE_LIBIPT" != yes; then + if test "$with_intel_pt" = yes; then + AC_MSG_ERROR([libipt is missing or unusable]) + else + AC_MSG_WARN([libipt is missing or unusable; some features may be unavailable.]) + fi + fi +fi + # ------------------------- # # Checks for header files. # # ------------------------- # -- 1.8.3.1