Skip to content

Commit

Permalink
configure.ac: Fail for enable-test without enable-library
Browse files Browse the repository at this point in the history
If you `--enable-test` during configure we also need to have the
library enabled, otherwise we cannot run the unit test.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
  • Loading branch information
tasleson authored and mtkaczyk committed Aug 23, 2023
1 parent 2baebec commit e544ec4
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,29 @@ AM_CONDITIONAL([SYSTEMD_CONDITION], [test "$SYSTEMD_STR" = yes])
# target directory for ledmon service file
AC_SUBST([SYSTEMD_PATH], "$(pkg-config systemd --variable=systemdsystemunitdir)")

# Add configure option to build without library
AC_ARG_ENABLE([library],
[AS_HELP_STRING([--enable-library],
[enable building ledmon library])],
[with_library=${enableval}],
[with_library=no])

AC_ARG_ENABLE([test],
[AS_HELP_STRING([--enable-test],
[enable test cases, run using 'make check'])],
[enable test cases, run using 'make check', requires --enable-library])],
[with_test=${enableval}],
[with_test=no])

AM_CONDITIONAL([WITH_TEST], [test "x$with_test" = "xyes"])

if test "x${with_test}" = "xyes"; then
PKG_CHECK_MODULES([LIBCHECK], [check >= 0.9.8 ])
# We need the library enabled if we are going to run the tests
if test "x${with_library}" = "xno"; then
AC_MSG_ERROR([--enable-library is required when specifying --enable-test])
fi
fi

# Add configure option to build without library
AC_ARG_ENABLE([library],
[AS_HELP_STRING([--enable-library],
[enable building ledmon library])],
[with_library=${enableval}],
[with_library=no])

AM_CONDITIONAL([WITH_LIBRARY], [test "x$with_library" = "xyes"])

AC_CONFIG_FILES([Makefile
Expand Down

0 comments on commit e544ec4

Please sign in to comment.