From c3e9d39aa827d82c0234632eb815a9052ae749e9 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 30 Nov 2018 13:46:10 +0100 Subject: [PATCH] Fixed cross-compiling with the default options. The failmalloc check doesn't make sense when cross-compiling, and configure even errored out in this case. --- m4m/failmalloc.m4 | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/m4m/failmalloc.m4 b/m4m/failmalloc.m4 index dff9599..bbf3e28 100644 --- a/m4m/failmalloc.m4 +++ b/m4m/failmalloc.m4 @@ -3,11 +3,14 @@ AC_DEFUN([CHECK_FAILMALLOC],[dnl dnl Libtool sets the default library paths AM_PROG_LIBTOOL path_provided= + failmalloc_requested= dnl Either implicitly or explicitly AC_ARG_WITH(failmalloc, [ --with-failmalloc=PATH use Failmalloc for tests], [ - if test x"$withval" = "x" -o x"$withval" = "xyes"; then + failmalloc_requested=1 + if test x"$withval" = "x" -o x"$withval" = x"yes"; then failmalloc_search_path="$sys_lib_search_path_spec" - elif test x"$withval" = "xno"; then + elif test x"$withval" = x"no"; then failmalloc_search_path="" + failmalloc_requested= else failmalloc_search_path="$withval" path_provided=1 @@ -16,17 +19,22 @@ AC_DEFUN([CHECK_FAILMALLOC],[dnl ) libfailmalloc_file=libfailmalloc.so.0 FAILMALLOC_PATH= - dnl Check if the argument is a directory - for d in $failmalloc_search_path; do - AC_CHECK_FILE([$d/$libfailmalloc_file], [ - FAILMALLOC_PATH="$d/$libfailmalloc_file" - break - ], []) - done - if test -z "$FAILMALLOC_PATH" -a -n "$path_provided"; then - dnl Check if the argument is a file - AC_CHECK_FILE([$failmalloc_search_path], [FAILMALLOC_PATH="$failmalloc_search_path"], []) + + dnl Skip the check if we're cross-compiling, unless the user explicitly requested it + if test x"$cross_compiling" = x"no" -o x"$failmalloc_requested" = x"1"; then + dnl Check if the argument is a directory + for d in $failmalloc_search_path; do + AC_CHECK_FILE([$d/$libfailmalloc_file], [ + FAILMALLOC_PATH="$d/$libfailmalloc_file" + break + ], []) + done + if test -z "$FAILMALLOC_PATH" -a -n "$path_provided"; then + dnl Check if the argument is a file + AC_CHECK_FILE([$failmalloc_search_path], [FAILMALLOC_PATH="$failmalloc_search_path"], []) + fi fi + AC_MSG_CHECKING([for failmalloc]) dnl Make sure AC_CHECK_FILE didn't find a directory by mistake if test -n "$FAILMALLOC_PATH" -a -f "$FAILMALLOC_PATH"; then @@ -35,10 +43,14 @@ AC_DEFUN([CHECK_FAILMALLOC],[dnl if test -n "$path_provided"; then AC_MSG_ERROR([$libfailmalloc_file was not found at $failmalloc_search_path]) else - AC_MSG_RESULT([no]) + if test x"$cross_compiling" != x"no"; then + AC_MSG_RESULT([no (cross compiling)]) + else + AC_MSG_RESULT([no]) + fi fi fi AC_SUBST(FAILMALLOC_PATH) - AM_CONDITIONAL(USE_FAILMALLOC, [test "x$FAILMALLOC_PATH" != "x"]) + AM_CONDITIONAL(USE_FAILMALLOC, [test x"$FAILMALLOC_PATH" != x]) ]) -- 2.7.4