Add check for libcunit and only build the test suite if libcunit is available
This commit is contained in:
@@ -163,6 +163,10 @@ bin_iscsi_test_SOURCES = test-tool/iscsi-test.c \
|
||||
test-tool/1144_persistent_reserve_access_check_eaar.c \
|
||||
test-tool/1145_persistent_reserve_access_check_wear.c
|
||||
|
||||
endif
|
||||
|
||||
|
||||
if ISCSITEST
|
||||
# libiscsi test tool using cunit
|
||||
|
||||
noinst_PROGRAMS += bin/iscsi-test-cu
|
||||
|
||||
30
configure.ac
30
configure.ac
@@ -81,5 +81,35 @@ else
|
||||
fi
|
||||
AM_CONDITIONAL(PROGRAMS, [test "$ac_cv_have_popt" = yes])
|
||||
|
||||
AC_MSG_CHECKING(whether libcunit is available)
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$GLIB_LIBS $LIBS -lcunit"
|
||||
AC_TRY_RUN([
|
||||
/*
|
||||
* Just see if we can compile/link with libcunit
|
||||
*/
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_have_cunit=yes, ac_cv_have_cunit=no,
|
||||
[echo $ac_n "compile with CUNIT. Assuming OK... $ac_c"
|
||||
ac_cv_have_cunit=yes])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
if test "$ac_cv_have_cunit" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_NOTICE(You need libcunit to build the test suite.)
|
||||
AC_MSG_NOTICE(The scsi/iscsi test suite will not be built.)
|
||||
fi
|
||||
AM_CONDITIONAL(ISCSITEST, [test "$ac_cv_have_cunit" = yes])
|
||||
|
||||
|
||||
AC_CONFIG_FILES(Makefile)
|
||||
AC_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user