diff --git a/configure.ac b/configure.ac index b417a3b43..ad73fb6bd 100644 --- a/configure.ac +++ b/configure.ac @@ -5072,6 +5072,15 @@ AC_ARG_ENABLE([crypttests], ) AC_SUBST([ENABLED_CRYPT_TESTS]) +# Build wolfCrypt test and benchmark as libraries. This will compile test.c and +# benchmark.c and make their functions available via libraries, libwolfcrypttest +# and libwolfcryptbench, respectively. Note that this feature is not enabled by +# default, and the API of these libraries should NOT be treated as stable. +AC_ARG_ENABLE([crypttests-libs], + [AS_HELP_STRING([--enable-crypttests-libs],[Enable wolfcrypt test and benchmark libraries (default: disabled)])], + [ ENABLED_CRYPT_TESTS_LIBS=$enableval ], + [ ENABLED_CRYPT_TESTS_LIBS=no ] + ) # LIBZ ENABLED_LIBZ="no" @@ -6889,6 +6898,7 @@ AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS],[test "x$ENABLED_EXAMPLES" = "xyes"]) AM_CONDITIONAL([BUILD_TESTS],[test "x$ENABLED_EXAMPLES" = "xyes"]) AM_CONDITIONAL([BUILD_THREADED_EXAMPLES],[test "x$ENABLED_SINGLETHREADED" = "xno" && test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"]) AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS],[test "x$ENABLED_CRYPT_TESTS" = "xyes"]) +AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS_LIBS],[test "x$ENABLED_CRYPT_TESTS_LIBS" = "xyes"]) AM_CONDITIONAL([BUILD_LIBZ],[test "x$ENABLED_LIBZ" = "xyes"]) AM_CONDITIONAL([BUILD_PKCS11],[test "x$ENABLED_PKCS11" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"]) AM_CONDITIONAL([BUILD_PKCS12],[test "x$ENABLED_PKCS12" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"]) diff --git a/wolfcrypt/benchmark/include.am b/wolfcrypt/benchmark/include.am index aabd7a654..b493bde38 100644 --- a/wolfcrypt/benchmark/include.am +++ b/wolfcrypt/benchmark/include.am @@ -13,6 +13,14 @@ noinst_HEADERS += wolfcrypt/benchmark/benchmark.h endif endif +if BUILD_WOLFCRYPT_TESTS_LIBS +lib_LTLIBRARIES += wolfcrypt/benchmark/libwolfcryptbench.la +wolfcrypt_benchmark_libwolfcryptbench_la_SOURCES = wolfcrypt/benchmark/benchmark.c +wolfcrypt_benchmark_libwolfcryptbench_la_CPPFLAGS = -DNO_MAIN_DRIVER +wolfcrypt_benchmark_libwolfcryptbench_la_LIBADD = src/libwolfssl.la +wolfcrypt_benchmark_libwolfcryptbench_la_DEPENDENCIES = src/libwolfssl.la +endif + EXTRA_DIST += wolfcrypt/benchmark/benchmark.sln EXTRA_DIST += wolfcrypt/benchmark/benchmark.vcproj EXTRA_DIST += wolfcrypt/benchmark/README.md diff --git a/wolfcrypt/test/include.am b/wolfcrypt/test/include.am index 905333ee8..667cd087d 100644 --- a/wolfcrypt/test/include.am +++ b/wolfcrypt/test/include.am @@ -16,6 +16,14 @@ noinst_HEADERS += wolfcrypt/test/test.h wolfcrypt/test/test_paths.h.in endif endif +if BUILD_WOLFCRYPT_TESTS_LIBS +lib_LTLIBRARIES += wolfcrypt/test/libwolfcrypttest.la +wolfcrypt_test_libwolfcrypttest_la_SOURCES = wolfcrypt/test/test.c +wolfcrypt_test_libwolfcrypttest_la_CPPFLAGS = -DNO_MAIN_DRIVER +wolfcrypt_test_libwolfcrypttest_la_LIBADD = src/libwolfssl.la +wolfcrypt_test_libwolfcrypttest_la_DEPENDENCIES = src/libwolfssl.la +endif + EXTRA_DIST += wolfcrypt/test/test.sln EXTRA_DIST += wolfcrypt/test/test.vcproj EXTRA_DIST += wolfcrypt/test/README.md