From b1268714105dfa6ff01a55fde3ec4b93c765cb29 Mon Sep 17 00:00:00 2001 From: Max Barraclough Date: Sun, 20 Feb 2022 10:11:53 +0000 Subject: [PATCH 3/4] Fix configure script's handling of disassembler The configure script was correctly checking for the necessary dependencies for building with the disassembler enabled, but when dependencies were not found, its messages were imprecise and sometimes incorrect. The configure script now shows a good message if any of the following dependencies are not found: * libiberty * binutils BFD * libz * binutils opcodes Also deleted old FIXME comment relating to this. --- configure.ac | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 1f2c6b4..2ad0167 100644 --- a/configure.ac +++ b/configure.ac @@ -72,7 +72,7 @@ AC_ARG_ENABLE(disassembler, [Enable jit disassembler using binutils]), [DISASSEMBLER=$enableval], [DISASSEMBLER=auto]) if test "x$DISASSEMBLER" != "xno"; then - # FIXME need to check for libiberty first or will fail to link + AC_CHECK_LIB(iberty, htab_try_create, , [HAVE_IBERTY="no"]) AC_CHECK_LIB(bfd, bfd_init, , @@ -81,17 +81,43 @@ if test "x$DISASSEMBLER" != "xno"; then [HAVE_Z="no"]) AC_CHECK_LIB(opcodes, init_disassemble_info, , [HAVE_OPCODES="no"]) - if test "x$HAVE_IBERTY" = "xno" -o \ - "x$HAVE_BFD" = "xno" -o \ - "x$HAVE_Z" = "xno" -o \ - "x$HAVE_OPCODES" = "xno"; then - if test "x$DISASSEMBLER" != "xauto"; then - AC_MSG_ERROR([binutils not found, see http://www.gnu.org/software/binutils/]) - else - AC_MSG_WARN([binutils not found, see http://www.gnu.org/software/binutils/]) - DISASSEMBLER="no" - fi + + if test "x$HAVE_IBERTY" = "xno"; then + if test "x$DISASSEMBLER" = "xyes"; then + AC_MSG_ERROR([libiberty not found]) + else + AC_MSG_WARN([libiberty not found]) + DISASSEMBLER="no" + fi fi + + if test "x$HAVE_BFD" = "xno"; then + if test "x$DISASSEMBLER" = "xyes"; then + AC_MSG_ERROR([binutils BFD not found, see http://www.gnu.org/software/binutils/]) + else + AC_MSG_WARN([binutils BFD not found, see http://www.gnu.org/software/binutils/]) + DISASSEMBLER="no" + fi + fi + + if test "x$HAVE_Z" = "xno"; then + if test "x$DISASSEMBLER" = "xyes"; then + AC_MSG_ERROR([zlib not found, see https://zlib.net/]) + else + AC_MSG_WARN([zlib not found, see https://zlib.net/]) + DISASSEMBLER="no" + fi + fi + + if test "x$HAVE_OPCODES" = "xno"; then + if test "x$DISASSEMBLER" = "xyes"; then + AC_MSG_ERROR([binutils opcodes not found, see https://www.gnu.org/software/binutils/]) + else + AC_MSG_WARN([binutils opcodes not found, see https://www.gnu.org/software/binutils/]) + DISASSEMBLER="no" + fi + fi + fi AM_CONDITIONAL(with_disassembler, [test "x$DISASSEMBLER" != "xno"]) if test "x$DISASSEMBLER" != "xno"; then -- 2.32.0