diff --git a/examples/benchmark/dtls_bench.c b/examples/benchmark/dtls_bench.c index f55e1857f7..f523a5a9b9 100644 --- a/examples/benchmark/dtls_bench.c +++ b/examples/benchmark/dtls_bench.c @@ -52,12 +52,23 @@ #include #include + +#include + +/* Needs DTLS and POSIX BSD sockets; build a stub main() elsewhere + * (e.g. Windows/mingw, which lacks et al.). */ +#if defined(WOLFSSL_DTLS) && !defined(USE_WINDOWS_API) && \ + !defined(WOLFSSL_NO_SOCK) + #define DTLS_BENCH_ENABLED +#endif + +#ifdef DTLS_BENCH_ENABLED + #include #define USE_CERT_BUFFERS_2048 #include -#include #include #include #include @@ -764,3 +775,14 @@ int main(int argc, char** argv) } return c.isServer ? dtls_server(&c) : dtls_client(&c); } + +#else /* DTLS_BENCH_ENABLED */ + +int main(void) +{ + printf("dtls_bench not supported in this build " + "(requires DTLS and POSIX BSD sockets)\n"); + return 0; +} + +#endif /* DTLS_BENCH_ENABLED */