From 4bd41ea12924161baca48add39ba5ecfab2cae30 Mon Sep 17 00:00:00 2001 From: Aleksandr Makarov Date: Mon, 13 Jul 2020 23:42:42 +0000 Subject: [PATCH] Add --{enable,disable}-examples flag to toggle examples compilation Upstream: https://github.com/cisco/libest/pull/81/. It was merged upstream in commit 4fd7e74dc556519132b9ea4c8a0f022bd1254a31, but this commit mixes multiple patches in one. Signed-off-by: Aleksandr Makarov --- Makefile.am | 11 +++++++---- configure.ac | 24 ++++++++++++++++++------ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9601de6..e2561e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,10 +4,13 @@ if ENABLE_JNI libest_jni = java/jni endif -if ENABLE_CLIENT_ONLY -SUBDIRS = safe_c_stub src $(libest_jni) example/client example/client-simple example/client-brski -else -SUBDIRS = safe_c_stub src $(libest_jni) example/client example/client-simple example/server example/proxy example/client-brski +if ENABLE_EXAMPLES +if ENABLE_CLIENT_ONLY +examples = example/client example/client-simple example/client-brski +else +examples = example/client example/client-simple example/client-brski example/server example/proxy +endif endif +SUBDIRS = safe_c_stub src $(libest_jni) $(examples) EXTRA_DIST = autogen.sh example/util LICENSE README.brski $(srcdir)/build.gradle $(srcdir)/example/build_examples.gradle diff --git a/configure.ac b/configure.ac index d648030..95b3223 100644 --- a/configure.ac +++ b/configure.ac @@ -2,11 +2,6 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT([libest],[3.2.0p],[libest-dev]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_SRCDIR(src/est/est.c) -AC_CONFIG_SRCDIR(example/client/estclient.c) -AC_CONFIG_SRCDIR(example/client-simple/estclient-simple.c) -AC_CONFIG_SRCDIR(example/client-brski/estclient-brski.c) -AC_CONFIG_SRCDIR(example/server/estserver.c) -AC_CONFIG_SRCDIR(example/proxy/estproxy.c) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE @@ -80,6 +75,15 @@ AM_COND_IF([DISABLE_PTHREAD], [], [AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_FAILURE([can't find pthread lib])])]) +AC_ARG_ENABLE([examples], + [AS_HELP_STRING([--disable-examples], + [Disable examples compilation])], + [], + [enable_examples="yes"]) +AC_MSG_CHECKING(whether to build examples) +AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$enable_examples" = "yes"]) +AM_COND_IF([ENABLE_EXAMPLES], AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) + AC_ARG_WITH([ssl-dir], [AS_HELP_STRING([--with-ssl-dir], [location of OpenSSL install folder, defaults to /usr/local/ssl])], @@ -198,7 +202,15 @@ AC_PREFIX_DEFAULT([/usr/local/est]) cp confdefs.h est_config.h -AC_CONFIG_FILES([Makefile version safe_c_stub/Makefile safe_c_stub/lib/Makefile src/Makefile src/est/Makefile example/client/Makefile example/client-simple/Makefile example/client-brski/Makefile example/server/Makefile example/proxy/Makefile]) +AC_CONFIG_FILES([Makefile version safe_c_stub/Makefile safe_c_stub/lib/Makefile src/Makefile src/est/Makefile]) AM_COND_IF([ENABLE_JNI], [AC_CONFIG_FILES([java/jni/Makefile])]) +AM_COND_IF([ENABLE_EXAMPLES], +[ + AC_CONFIG_FILES([example/client/Makefile example/client-simple/Makefile example/client-brski/Makefile]) + AM_COND_IF([ENABLE_CLIENT_ONLY], + [], + [AC_CONFIG_FILES([example/server/Makefile example/proxy/Makefile])]) +]) + AC_OUTPUT -- 2.17.1