1 From 3271dd69b731c0320ab0b3b0a0609e64b00f1a56 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Tue, 2 Sep 2014 22:41:32 +0200
4 Subject: [PATCH 3/4] Fix CUnit test for cross-compilation
6 The current test in configure.ac for CUnit uses AC_TRY_RUN, which
7 doesn't work in a cross-compilation context, because we can't run on
8 the build machine the binaries that are built for the target. In
9 addition, the current logic assumes CUnit is available when the
10 AC_TRY_RUN test cannot be used (e.g in a cross-compilation case).
12 Since we actually don't care about *running* but only about testing
13 whether a simple program include the CUnit header file and linking
14 against the cunit library works, simply use AC_TRY_LINK() instead of
17 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
19 configure.ac | 15 ++-------------
20 1 file changed, 2 insertions(+), 13 deletions(-)
22 diff --git a/configure.ac b/configure.ac
23 index eb9d995..0ee2d9b 100644
26 @@ -91,25 +91,14 @@ if test x"$libiscsi_cv_HAVE_SOCKADDR_IN6" = x"yes"; then
27 AC_DEFINE(HAVE_SOCKADDR_IN6,1,[Whether we have IPv6 support])
31 AC_MSG_CHECKING(whether libcunit is available)
32 ac_save_CFLAGS="$CFLAGS"
34 CFLAGS="$CFLAGS $GLIB_CFLAGS"
35 LIBS="$GLIB_LIBS $LIBS -lcunit"
38 - * Just see if we can compile/link with libcunit
41 #include <CUnit/CUnit.h>
43 -int main(int argc, const char *argv[])
47 -], ac_cv_have_cunit=yes, ac_cv_have_cunit=no,
48 - [echo $ac_n "compile with CUNIT. Assuming OK... $ac_c"
49 - ac_cv_have_cunit=yes])
50 +], [], [ac_cv_have_cunit=yes], [ac_cv_have_cunit=no])
51 CFLAGS="$ac_save_CFLAGS"
53 if test "$ac_cv_have_cunit" = yes ; then