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 <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2024-11-11 16:13:09 -05:00 committed by Stefan Berger
parent fa4f9ab561
commit 64d263aff0

View File

@ -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