From b1a2db943040402b0fcbdeb8929ceaddfc1b27c7 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 19 Feb 2019 01:39:32 +0000 Subject: [PATCH] build: fix --with-libiberty * m4/st_demangle.m4 (st_DEMANGLE): Move the check for cplus_demangle out of AC_CHECK_HEADERS because the latter checks for demangle.h in two different places and an absence of demangle.h in one of these places would cause a build error in --with-libiberty=yes mode. * NEWS: Mention this fix. Resolves: https://github.com/strace/strace/issues/92 --- NEWS | 1 + m4/st_demangle.m4 | 39 +++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index ae1a94e4..9ae75312 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ Noteworthy changes in release ?.?? (????-??-??) * Fixed strace-k test on alpha. * Fixed build on mips o32. * Fixed build on NOMMU architectures. + * Fixed build in --with-libiberty=yes mode. Noteworthy changes in release 4.26 (2018-12-26) =============================================== diff --git a/m4/st_demangle.m4 b/m4/st_demangle.m4 index ba019eb8..8f617fba 100644 --- a/m4/st_demangle.m4 +++ b/m4/st_demangle.m4 @@ -27,26 +27,29 @@ use_libiberty=no AS_IF([test "x$with_libiberty" != xno], [saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $libiberty_CPPFLAGS" + found_demangle_h=no AC_CHECK_HEADERS([demangle.h libiberty/demangle.h], - [saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $libiberty_LDFLAGS" - AC_CHECK_LIB([iberty],[cplus_demangle], - [libiberty_LIBS="-liberty" - use_libiberty=yes - ], - [if test "x$with_libiberty" != xcheck; then - AC_MSG_FAILURE([failed to find cplus_demangle in libiberty]) - fi - ] - ) - LDFLAGS="$saved_LDFLAGS" - ], - [if test "x$with_libiberty" != xcheck; then - AC_MSG_FAILURE([failed to find demangle.h]) - fi - ] - ) + [found_demangle_h=yes]) CPPFLAGS="$saved_CPPFLAGS" + AS_IF([test "x$found_demangle_h" = xyes], + [saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $libiberty_LDFLAGS" + AC_CHECK_LIB([iberty],[cplus_demangle], + [libiberty_LIBS="-liberty" + use_libiberty=yes + ], + [if test "x$with_libiberty" != xcheck; then + AC_MSG_FAILURE([failed to find cplus_demangle in libiberty]) + fi + ] + ) + LDFLAGS="$saved_LDFLAGS" + ], + [if test "x$with_libiberty" != xcheck; then + AC_MSG_FAILURE([failed to find demangle.h]) + fi + ] + ) ] ) -- 2.40.0