From 64d263aff004e29b4bcffed070341409bc09a251 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Mon, 11 Nov 2024 16:13:09 -0500 Subject: [PATCH] build-sys: Do not build statically linked tests when --disable-static used When --disable-static is used statically linked tests cannot be run. Therefore, put the evaluation of --enable-static-tests after --disable-static has been tested for and only set ENABLE_STATIC_TESTS if both are 'yes'. Signed-off-by: Stefan Berger --- configure.ac | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index e4e902fd..6fe0b217 100644 --- a/configure.ac +++ b/configure.ac @@ -282,18 +282,6 @@ AC_ARG_ENABLE([test-coverage], ] ) -AC_ARG_ENABLE([static-tests], - AS_HELP_STRING([--disable-static-tests], [Disable statically linked tests]), - [if test "$enableval" = "yes"; then - AM_CONDITIONAL(ENABLE_STATIC_TESTS, true) - else - AM_CONDITIONAL(ENABLE_STATIC_TESTS, false) - fi], [ - AM_CONDITIONAL(ENABLE_STATIC_TESTS, true) - enable_static_tests=yes - ] -) - LT_INIT AC_PROG_CC AC_PROG_CXX @@ -308,6 +296,14 @@ AC_C_INLINE AC_TYPE_SIZE_T +AC_ARG_ENABLE([static-tests], + [AS_HELP_STRING([--disable-static-tests], [Disable statically linked tests])],, + [enable_static_tests=yes]) +dnl enable_state must be 'yes' for any static tests +AS_IF([test "$enable_static_tests" = "yes" && test "$enable_static" = "yes"], + [enable_static_tests=yes],[enable_static_tests=no]) +AM_CONDITIONAL(ENABLE_STATIC_TESTS, [test "$enable_static_tests" = "yes"]) + AC_CHECK_LIB(c, clock_gettime, LIBRT_LIBS="", LIBRT_LIBS="-lrt") AC_SUBST([LIBRT_LIBS]) @@ -394,6 +390,7 @@ echo "With TPM2 support : $with_tpm2" echo "HAVE_VERSION_SCRIPT : $have_version_script" echo "Use openssl crypto for : $use_openssl_functions_for" echo "Test coverage : $enable_test_coverage" +echo "Static build : $enable_static" echo "Statically linked tests : $enable_static_tests" echo echo