dd4eb4a61122476f8076e4c5f2c15d934c781a5c
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / libiscsi / 0003-Fix-CUnit-test-for-cross-compilation.patch
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
5
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).
11
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
15 AC_TRY_RUN().
16
17 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
18 ---
19  configure.ac | 15 ++-------------
20  1 file changed, 2 insertions(+), 13 deletions(-)
21
22 diff --git a/configure.ac b/configure.ac
23 index eb9d995..0ee2d9b 100644
24 --- a/configure.ac
25 +++ b/configure.ac
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])
28  fi
29  
30 -
31  AC_MSG_CHECKING(whether libcunit is available)
32  ac_save_CFLAGS="$CFLAGS"
33  ac_save_LIBS="$LIBS"
34  CFLAGS="$CFLAGS $GLIB_CFLAGS"
35  LIBS="$GLIB_LIBS $LIBS -lcunit"
36 -AC_TRY_RUN([
37 -/*
38 - * Just see if we can compile/link with libcunit
39 - */
40 +AC_TRY_LINK([
41  #include <CUnit/CUnit.h>
42 -
43 -int main(int argc, const char *argv[])
44 -{
45 -       return 0;
46 -}
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"
52  LIBS="$ac_save_LIBS"
53  if test "$ac_cv_have_cunit" = yes ; then
54 -- 
55 2.0.0
56