buildsys: handle ac_cv_cunit as a true cache-val

The ac_cv_-prefix variables are supposed to be settable from the command
line, à-la: ./configure ac_cv_foo=no

The canonical way of doing so is to use AC_CACHE_VAL() or AC_CACHE_CHECK().
The latter is to be preferred in our case, as it handles printing the
message for us.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
This commit is contained in:
Yann E. MORIN
2018-12-04 09:21:18 +01:00
parent ac9a8e5aed
commit b8a28fad54
+12 -14
View File
@@ -128,20 +128,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