Skip to content

Commit

Permalink
Merge pull request #4668 from HofiOne/add-option-to-turn-off-example-…
Browse files Browse the repository at this point in the history
…modules

Add option to turn on/off all example modules
  • Loading branch information
HofiOne committed Oct 18, 2023
2 parents f1274f1 + dc64f0b commit 80f7897
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ AC_ARG_ENABLE(forced_server_mode,
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debugging code.],, enable_debug="no")

AC_ARG_ENABLE(example-modules,
[ --enable-example-modules Enable example modules.],, enable_example_modules="yes")

AC_ARG_ENABLE(force_gnu99,
[ --enable-force-gnu99 Enforce C99 with gnu extensions.],, force_gnu99="no")

Expand Down Expand Up @@ -2217,6 +2220,7 @@ AM_CONDITIONAL(ENABLE_MANPAGES_INSTALL, [test "$enable_manpages_install" != "no"
AM_CONDITIONAL(ENABLE_NATIVE, [test "$enable_native" != "no"])
AM_CONDITIONAL(ENABLE_EXTRA_WARNINGS, [test "$enable_extra_warnings" = "yes"])
AM_CONDITIONAL(ENABLE_TESTING, [test "$enable_tests" != "no"])
AM_CONDITIONAL(ENABLE_EXAMPLE_MODULES, [test "$enable_example_modules" = "yes"])
AM_CONDITIONAL(ENABLE_SANITIZER, [test "$with_sanitizer" != "no"])
AM_CONDITIONAL(ENABLE_DEBUG, [test "$enable_debug" != "no"])
AM_CONDITIONAL([HAVE_INOTIFY], [test x$ac_cv_func_inotify_init = xyes])
Expand Down Expand Up @@ -2370,3 +2374,4 @@ echo " Java modules : ${enable_java_modules:=no}"
echo " afsnmp module : ${enable_afsnmp:=no}"
echo " eBPF module : ${enable_ebpf:=no}"
echo " native bindings : ${enable_native:=no}"
echo " Example modules : ${enable_example_modules:=yes}"
9 changes: 7 additions & 2 deletions modules/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
add_library(examples SHARED example-plugins.c)
module_switch(ENABLE_EXAMPLE_MODULES "Enable example modules" ON)

if(NOT ENABLE_EXAMPLE_MODULES)
return()
endif()

add_library(examples SHARED example-plugins.c)

add_subdirectory(sources/msg-generator)
add_subdirectory(sources/threaded-random-generator)
Expand All @@ -10,10 +15,10 @@ add_subdirectory(inner-destinations/http-test-slots)
add_subdirectory(inner-destinations/tls-test-validation)
add_subdirectory(destinations/example_destination)


target_link_libraries(examples PRIVATE msg-generator)
target_link_libraries(examples PRIVATE threaded-random-generator)
target_link_libraries(examples PRIVATE threaded-diskq-source)

if(ENABLE_CPP)
target_link_libraries(examples PRIVATE random-choice-generator)
endif()
Expand Down
6 changes: 5 additions & 1 deletion modules/examples/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
if ENABLE_EXAMPLE_MODULES

include modules/examples/sources/msg-generator/Makefile.am
include modules/examples/sources/threaded-diskq-source/Makefile.am
include modules/examples/sources/threaded-random-generator/Makefile.am
Expand All @@ -6,7 +8,6 @@ include modules/examples/inner-destinations/tls-test-validation/Makefile.am
include modules/examples/destinations/example_destination/Makefile.am
include modules/examples/sources/random-choice-generator/Makefile.am


EXAMPLE_PLUGINS = \
$(top_builddir)/modules/examples/sources/libmsg-generator.la \
$(top_builddir)/modules/examples/sources/libthreaded-diskq-source.la \
Expand Down Expand Up @@ -38,5 +39,8 @@ endif
EXTRA_DIST += modules/examples/CMakeLists.txt

modules/examples modules/examples/ mod-examples: modules/examples/libexamples.la
else
modules/examples modules/examples/ mod-examples:
endif

.PHONY: modules/examples/ mod-examples
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
module_switch(ENABLE_EXAMPLE_DESTINATION "Enable example_destination")
if (NOT ENABLE_EXAMPLE_DESTINATION)
return()
endif()

set(example_destination_SOURCES
"example_destination-parser.h"
"example_destination-plugin.c"
Expand Down

0 comments on commit 80f7897

Please sign in to comment.