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

View File

@@ -128,8 +128,9 @@ 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_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS" CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS -lcunit" LIBS="$GLIB_LIBS $LIBS -lcunit"
@@ -137,11 +138,8 @@ AC_TRY_LINK([
#include <CUnit/CUnit.h> #include <CUnit/CUnit.h>
], [], [ac_cv_have_cunit=yes], [ac_cv_have_cunit=no]) ], [], [ac_cv_have_cunit=yes], [ac_cv_have_cunit=no])
CFLAGS="$ac_save_CFLAGS" CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS" LIBS="$ac_save_LIBS"])
if test "$ac_cv_have_cunit" = yes ; then 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(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