0002-Add-enable-disable-examples-flag-to-toggle-examples-.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. From 4bd41ea12924161baca48add39ba5ecfab2cae30 Mon Sep 17 00:00:00 2001
  2. From: Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
  3. Date: Mon, 13 Jul 2020 23:42:42 +0000
  4. Subject: [PATCH] Add --{enable,disable}-examples flag to toggle examples
  5. compilation
  6. Upstream: https://github.com/cisco/libest/pull/81/. It was merged
  7. upstream in commit 4fd7e74dc556519132b9ea4c8a0f022bd1254a31, but this
  8. commit mixes multiple patches in one.
  9. Signed-off-by: Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
  10. ---
  11. Makefile.am | 11 +++++++----
  12. configure.ac | 24 ++++++++++++++++++------
  13. 2 files changed, 25 insertions(+), 10 deletions(-)
  14. diff --git a/Makefile.am b/Makefile.am
  15. index 9601de6..e2561e7 100644
  16. --- a/Makefile.am
  17. +++ b/Makefile.am
  18. @@ -4,10 +4,13 @@ if ENABLE_JNI
  19. libest_jni = java/jni
  20. endif
  21. -if ENABLE_CLIENT_ONLY
  22. -SUBDIRS = safe_c_stub src $(libest_jni) example/client example/client-simple example/client-brski
  23. -else
  24. -SUBDIRS = safe_c_stub src $(libest_jni) example/client example/client-simple example/server example/proxy example/client-brski
  25. +if ENABLE_EXAMPLES
  26. +if ENABLE_CLIENT_ONLY
  27. +examples = example/client example/client-simple example/client-brski
  28. +else
  29. +examples = example/client example/client-simple example/client-brski example/server example/proxy
  30. +endif
  31. endif
  32. +SUBDIRS = safe_c_stub src $(libest_jni) $(examples)
  33. EXTRA_DIST = autogen.sh example/util LICENSE README.brski $(srcdir)/build.gradle $(srcdir)/example/build_examples.gradle
  34. diff --git a/configure.ac b/configure.ac
  35. index d648030..95b3223 100644
  36. --- a/configure.ac
  37. +++ b/configure.ac
  38. @@ -2,11 +2,6 @@ dnl Process this file with autoconf to produce a configure script.
  39. AC_INIT([libest],[3.2.0p],[libest-dev])
  40. AC_CONFIG_AUX_DIR(config)
  41. AC_CONFIG_SRCDIR(src/est/est.c)
  42. -AC_CONFIG_SRCDIR(example/client/estclient.c)
  43. -AC_CONFIG_SRCDIR(example/client-simple/estclient-simple.c)
  44. -AC_CONFIG_SRCDIR(example/client-brski/estclient-brski.c)
  45. -AC_CONFIG_SRCDIR(example/server/estserver.c)
  46. -AC_CONFIG_SRCDIR(example/proxy/estproxy.c)
  47. AC_CONFIG_MACRO_DIR([m4])
  48. AM_INIT_AUTOMAKE
  49. @@ -80,6 +75,15 @@ AM_COND_IF([DISABLE_PTHREAD], [],
  50. [AC_CHECK_LIB([pthread], [pthread_create], [],
  51. [AC_MSG_FAILURE([can't find pthread lib])])])
  52. +AC_ARG_ENABLE([examples],
  53. + [AS_HELP_STRING([--disable-examples],
  54. + [Disable examples compilation])],
  55. + [],
  56. + [enable_examples="yes"])
  57. +AC_MSG_CHECKING(whether to build examples)
  58. +AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
  59. +AM_COND_IF([ENABLE_EXAMPLES], AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]))
  60. +
  61. AC_ARG_WITH([ssl-dir],
  62. [AS_HELP_STRING([--with-ssl-dir],
  63. [location of OpenSSL install folder, defaults to /usr/local/ssl])],
  64. @@ -198,7 +202,15 @@ AC_PREFIX_DEFAULT([/usr/local/est])
  65. cp confdefs.h est_config.h
  66. -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])
  67. +AC_CONFIG_FILES([Makefile version safe_c_stub/Makefile safe_c_stub/lib/Makefile src/Makefile src/est/Makefile])
  68. AM_COND_IF([ENABLE_JNI],
  69. [AC_CONFIG_FILES([java/jni/Makefile])])
  70. +AM_COND_IF([ENABLE_EXAMPLES],
  71. +[
  72. + AC_CONFIG_FILES([example/client/Makefile example/client-simple/Makefile example/client-brski/Makefile])
  73. + AM_COND_IF([ENABLE_CLIENT_ONLY],
  74. + [],
  75. + [AC_CONFIG_FILES([example/server/Makefile example/proxy/Makefile])])
  76. +])
  77. +
  78. AC_OUTPUT
  79. --
  80. 2.17.1