build: rewrite libdw detection without pkg-config
pkg-config expected to be more convenient way to configure libdw, but in practice it appeared to be less portable than good old AC_CHECK_HEADERS and AC_CHECK_LIB. * ci/install-dependencies.sh (common_packages): Remove pkg-config. (STACKTRACE == "libdw"): Do not install libz-dev and liblzma-dev. * debian/control (Build-Depends): Remove pkg-config. * m4/st_libdw.m4 (st_ARG_LIBDW, st_LIBDW): Rewrite without pkg-config.
This commit is contained in:
parent
ee5d88c5b6
commit
c9ace844ba
@ -1,7 +1,7 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
type sudo >/dev/null 2>&1 && sudo=sudo || sudo=
|
||||
common_packages='autoconf automake faketime file gawk gcc-multilib git gzip make pkg-config xz-utils'
|
||||
common_packages='autoconf automake faketime file gawk gcc-multilib git gzip make xz-utils'
|
||||
|
||||
updated=
|
||||
apt_get_install()
|
||||
@ -92,7 +92,7 @@ esac
|
||||
|
||||
case "${STACKTRACE-}" in
|
||||
libdw)
|
||||
apt_get_install libdw-dev libz-dev liblzma-dev
|
||||
apt_get_install libdw-dev
|
||||
;;
|
||||
libunwind)
|
||||
apt_get_install libunwind8-dev
|
||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -2,7 +2,7 @@ Source: strace
|
||||
Maintainer: Steve McIntyre <93sam@debian.org>
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 ppc64el s390 s390x sparc sparc64 x32], debhelper (>= 7.0.0), gawk, pkg-config, libdw-dev, libiberty-dev, libbluetooth-dev
|
||||
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 ppc64el s390 s390x sparc sparc64 x32], debhelper (>= 7.0.0), gawk, libdw-dev, libiberty-dev, libbluetooth-dev
|
||||
Standards-Version: 4.1.3
|
||||
Homepage: https://strace.io
|
||||
Vcs-Git: https://salsa.debian.org/debian/strace.git
|
||||
|
@ -27,6 +27,11 @@
|
||||
|
||||
AC_DEFUN([st_ARG_LIBDW], [dnl
|
||||
|
||||
: ${libdw_CPPFLAGS=}
|
||||
: ${libdw_CFLAGS=}
|
||||
: ${libdw_LDFLAGS=}
|
||||
: ${libdw_LIBS=}
|
||||
|
||||
AC_ARG_WITH([libdw],
|
||||
[AS_HELP_STRING([--with-libdw],
|
||||
[use libdw to implement stack tracing support]
|
||||
@ -34,9 +39,9 @@ AC_ARG_WITH([libdw],
|
||||
],
|
||||
[case "${withval}" in
|
||||
yes|no|check) ;;
|
||||
*)
|
||||
AC_MSG_ERROR([Use pkg-config variables instead of giving path to --with-libdw])
|
||||
;;
|
||||
*) libdw_CPPFLAGS="-I${withval}/include"
|
||||
libdw_LDFLAGS="-L${withval}/lib"
|
||||
with_libdw=yes ;;
|
||||
esac
|
||||
],
|
||||
[with_libdw=check]
|
||||
@ -46,60 +51,45 @@ AC_ARG_WITH([libdw],
|
||||
|
||||
AC_DEFUN([st_LIBDW], [dnl
|
||||
|
||||
: ${libdw_CPPFLAGS=}
|
||||
: ${libdw_CFLAGS=}
|
||||
: ${libdw_LDFLAGS=}
|
||||
: ${libdw_LIBS=}
|
||||
have_libdw=
|
||||
|
||||
AS_IF([test "x$with_libdw" != xno],
|
||||
[
|
||||
dnl If libdw.pc is not available, then libdw is not new enough
|
||||
dnl to be used for stack tracing.
|
||||
AS_IF([test "x$with_libdw" = xyes],
|
||||
[PKG_CHECK_MODULES([libdw], [libdw], [have_libdw=yes])],
|
||||
[PKG_CHECK_MODULES([libdw], [libdw], [have_libdw=yes], [:])]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test "x$have_libdw" = xyes],
|
||||
[
|
||||
dnl If libdw.pc is available, check whether libdw can be used
|
||||
dnl for stack tracing.
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
AS_IF([test "x$with_libdw" != xno && test "x$use_unwinder" = x],
|
||||
[saved_CPPFLAGS="$CPPFLAGS"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $libdw_CPPFLAGS"
|
||||
CFLAGS="$CFLAGS $libdw_CFLAGS"
|
||||
|
||||
AC_CHECK_HEADERS([elfutils/libdwfl.h],
|
||||
[
|
||||
AC_MSG_CHECKING([for dwfl_linux_proc_attach in libdw])
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
saved_LIBS="$LIBS"
|
||||
LDFLAGS="$LDFLAGS $libdw_LDFLAGS"
|
||||
LIBS="$LIBS $libdw_LIBS"
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <elfutils/libdwfl.h>]],
|
||||
[[return dwfl_linux_proc_attach(0, 0, 0)]]
|
||||
[AC_CHECK_LIB([dw], [dwfl_linux_proc_attach],
|
||||
[libdw_LIBS="-ldw $libdw_LIBS"
|
||||
AC_CACHE_CHECK([for elfutils version],
|
||||
[st_cv_ELFUTILS_VERSION],
|
||||
[[st_cv_ELFUTILS_VERSION="$(echo _ELFUTILS_VERSION |
|
||||
$CPP $CPPFLAGS -P -imacros elfutils/version.h - |
|
||||
grep '^[0-9]')"
|
||||
test -n "$st_cv_ELFUTILS_VERSION" ||
|
||||
st_cv_ELFUTILS_VERSION=0
|
||||
]]
|
||||
)
|
||||
],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AS_IF([test "x$with_libdw" = xyes],
|
||||
[AC_MSG_FAILURE([failed to find dwfl_linux_proc_attach in libdw])],
|
||||
AS_IF([test "$st_cv_ELFUTILS_VERSION" -ge 164],
|
||||
[have_libdw=yes],
|
||||
[AS_IF([test "x$with_libdw" = xyes],
|
||||
[AC_MSG_ERROR([elfutils version >= 164 is required for stack tracing support])],
|
||||
[AC_MSG_WARN([elfutils version >= 164 is required for stack tracing support])]
|
||||
)
|
||||
have_libdw=
|
||||
]
|
||||
)
|
||||
|
||||
LIBS="$saved_LIBS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
],
|
||||
[AS_IF([test "x$with_libdw" = xyes],
|
||||
[AC_MSG_FAILURE([failed to find dwfl_linux_proc_attach in libdw])],
|
||||
)
|
||||
],
|
||||
[$libdw_LDFLAGS $libdw_LIBS]
|
||||
)
|
||||
],
|
||||
[AS_IF([test "x$with_libdw" = xyes],
|
||||
[AC_MSG_FAILURE([failed to find elfutils/libdwfl.h])]
|
||||
)
|
||||
have_libdw=
|
||||
]
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user