From a593f584c0d54ba2e36cdf043099266e09a9edf8 Mon Sep 17 00:00:00 2001 From: psychon Date: Thu, 20 Aug 2009 19:49:21 +0000 Subject: [PATCH] Add support for extra modules This commits adds the necessary build system fun for extra modules in modules/extra which can be enabled with --enable-extra. This is a preparation for the import of znc-extra. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1605 726aef4b-f618-498e-8847-2d620e286838 --- configure | 12 ++++++++++++ configure.in | 6 ++++++ modules/Makefile.in | 14 +++++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 382843e2..813cc36c 100755 --- a/configure +++ b/configure @@ -556,6 +556,7 @@ LIBOBJS DATADIR MODDIR SASL +EXTRA NOSSL MODTARGET MODLINK @@ -623,6 +624,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_largefile +enable_extra with_openssl enable_debug enable_ipv6 @@ -1262,6 +1264,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files + --enable-extra enable some extra modules --enable-debug enable debuging --disable-ipv6 disable ipv6 support --disable-modules disable modules @@ -2715,6 +2718,13 @@ case "${host_os}" in ;; esac +# Check whether --enable-extra was given. +if test "${enable_extra+set}" = set; then : + enableval=$enable_extra; EXTRA="$enableval" +else + EXTRA="no" +fi + # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then : @@ -3416,6 +3426,7 @@ fi + ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files znc-config" @@ -4594,3 +4605,4 @@ if test x"$SASL" = "x" ; then else echo "sasl: yes" fi +echo "extra: $EXTRA" diff --git a/configure.in b/configure.in index 75240460..59be24fd 100644 --- a/configure.in +++ b/configure.in @@ -62,6 +62,10 @@ case "${host_os}" in ;; esac +AC_ARG_ENABLE( [extra], + AS_HELP_STRING([--enable-extra], [enable some extra modules]), + [EXTRA="$enableval"], + [EXTRA="no"]) AC_ARG_WITH( [openssl], AS_HELP_STRING([--with-openssl=DIR], [openssl installation prefix]), [OPENSSL=$withval],) @@ -244,6 +248,7 @@ AC_SUBST([LIBZNCDIR]) AC_SUBST([MODLINK]) AC_SUBST([MODTARGET]) AC_SUBST([NOSSL]) +AC_SUBST([EXTRA]) AC_SUBST([PERL]) AC_SUBST([SASL]) AC_SUBST([MODDIR]) @@ -281,3 +286,4 @@ if test x"$SASL" = "x" ; then else echo "sasl: yes" fi +echo "extra: $EXTRA" diff --git a/modules/Makefile.in b/modules/Makefile.in index 2ddbb506..613b8c19 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -29,9 +29,15 @@ ifneq "$(LIBZNC)" "" LDFLAGS += -L.. -lznc -Wl,-rpath,$(LIBZNCDIR) endif -FILES := $(basename $(wildcard $(srcdir)/*.cpp)) +FILES := $(wildcard $(srcdir)/*.cpp) +# If extra is enabled +ifeq "@EXTRA@" "yes" +FILES += $(wildcard $(srcdir)/extra/*.cpp) +endif + +FILES := $(basename $(FILES)) # Strip away the srcdir, we want them to be created in the current dir -FILES := $(shell echo $(FILES) | sed -e "s:$(srcdir)/::g") +FILES := $(shell echo $(FILES) | sed -e "s: $(srcdir)/: :g") ifeq "@NOSSL@" "1" FILES := $(foreach file, $(FILES), \ @@ -58,7 +64,7 @@ saslauthFLAGS := -lsasl2 TARGETS := $(addsuffix .so, $(FILES)) -CLEAN := *.so +CLEAN := *.so extra/*.so .PHONY: all clean install modperl_install @@ -85,6 +91,8 @@ clean: %.so: %.cpp Makefile @mkdir -p .depend + @mkdir -p .depend/extra + @mkdir -p extra $(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $($(basename $@)FLAGS) -MMD -MF .depend/$@.dep modperl_install: create_install_dir