Merge pull request #283 from yann-morin-1998/yem/no-test

buildsys: add options to disable part of the build, fix cunit detection
This commit is contained in:
Ronnie Sahlberg
2019-02-05 13:10:11 +10:00
committed by GitHub
2 changed files with 46 additions and 15 deletions
+10 -1
View File
@@ -1,5 +1,14 @@
# Generic definitions # Generic definitions
SUBDIRS = lib doc utils test-tool tests examples SUBDIRS = lib doc utils
if BUILD_TEST_TOOL
SUBDIRS += test-tool
endif
if BUILD_TESTS
SUBDIRS += tests
endif
if BUILD_EXAMPLES
SUBDIRS += examples
endif
ACLOCAL_AMFLAGS =-I m4 ACLOCAL_AMFLAGS =-I m4
AUTOMAKE_OPTIONS = foreign subdir-objects AUTOMAKE_OPTIONS = foreign subdir-objects
+36 -14
View File
@@ -47,6 +47,30 @@ AC_ARG_ENABLE([manpages],
AM_CONDITIONAL(BUILD_MANPAGES, AM_CONDITIONAL(BUILD_MANPAGES,
[expr "$ENABLE_MANPAGES" : yes > /dev/null 2>&1]) [expr "$ENABLE_MANPAGES" : yes > /dev/null 2>&1])
AC_ARG_ENABLE([test_tool],
[AC_HELP_STRING([--enable-test-tool],
[Enable building test-tool (to test a remote server)])],
[ENABLE_TEST_TOOL=$enableval],
[ENABLE_TEST_TOOL=yes])
AM_CONDITIONAL([BUILD_TEST_TOOL],
[expr "$ENABLE_TEST_TOOL" : yes > /dev/null 2>&1])
AC_ARG_ENABLE([tests],
[AC_HELP_STRING([--enable-tests],
[Enable building tests])],
[ENABLE_TESTS=$enableval],
[ENABLE_TESTS=yes])
AM_CONDITIONAL([BUILD_TESTS],
[expr "$ENABLE_TESTS" : yes > /dev/null 2>&1])
AC_ARG_ENABLE([examples],
[AC_HELP_STRING([--enable-examples],
[Enable building examples])],
[ENABLE_EXAMPLES=$enableval],
[ENABLE_EXAMPLES=yes])
AM_CONDITIONAL([BUILD_EXAMPLES],
[expr "$ENABLE_EXAMPLES" : yes > /dev/null 2>&1])
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
AC_CHECK_LIB([gcrypt], [gcry_control]) AC_CHECK_LIB([gcrypt], [gcry_control])
@@ -128,20 +152,18 @@ if test x"$libiscsi_cv_HAVE_LINUX_ISER" = x"yes"; then
fi fi
AM_CONDITIONAL([HAVE_LINUX_ISER], [test $libiscsi_cv_HAVE_LINUX_ISER = yes]) AM_CONDITIONAL([HAVE_LINUX_ISER], [test $libiscsi_cv_HAVE_LINUX_ISER = yes])
AC_MSG_CHECKING(whether libcunit is available) AC_CACHE_CHECK([whether libcunit is available],
ac_save_CFLAGS="$CFLAGS" [ac_cv_have_cunit],
ac_save_LIBS="$LIBS" [ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $GLIB_CFLAGS" ac_save_LIBS="$LIBS"
LIBS="$GLIB_LIBS $LIBS -lcunit" CFLAGS="$CFLAGS $GLIB_CFLAGS"
AC_TRY_LINK([ LIBS="$GLIB_LIBS $LIBS -lcunit"
#include <CUnit/CUnit.h> AC_TRY_LINK([
], [], [ac_cv_have_cunit=yes], [ac_cv_have_cunit=no]) #include <CUnit/CUnit.h>
CFLAGS="$ac_save_CFLAGS" ], [], [ac_cv_have_cunit=yes], [ac_cv_have_cunit=no])
LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS"
if test "$ac_cv_have_cunit" = yes ; then LIBS="$ac_save_LIBS"])
AC_MSG_RESULT(yes) if ! test "$ac_cv_have_cunit" = yes ; then
else
AC_MSG_RESULT(no)
AC_MSG_NOTICE(You need libcunit to build the test suite.) AC_MSG_NOTICE(You need libcunit to build the test suite.)
AC_MSG_NOTICE(The scsi/iscsi test suite will not be built.) AC_MSG_NOTICE(The scsi/iscsi test suite will not be built.)
fi fi