Skip to content

Commit

Permalink
Fixed cross-compiling with the default options.
Browse files Browse the repository at this point in the history
The failmalloc check doesn't make sense when cross-compiling, and
configure even errored out in this case.
  • Loading branch information
dfandrich committed Nov 30, 2018
1 parent a577715 commit 62b1f01
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions m4m/failmalloc.m4
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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])
])

0 comments on commit 62b1f01

Please sign in to comment.