diff --git a/configure b/configure index c0483c4c..954c65cf 100755 --- a/configure +++ b/configure @@ -271,7 +271,7 @@ PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS ac_ct_CC MODFLAGS INCLUDES MODULES MODTARGET VERSION NOSSL PERL LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS ac_ct_CC MODFLAGS INCLUDES MODULES MODTARGET VERSION NOSSL PERL MODDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -681,13 +681,13 @@ echo X"$0" | /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then +if test ! -r "$srcdir/$ac_unique_file"; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } @@ -696,7 +696,7 @@ if test ! -r $srcdir/$ac_unique_file; then { (exit 1); exit 1; }; } fi fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || +(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` @@ -820,6 +820,7 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-openssl=/path/to/openssl + --with-module-prefix=/path/to/moduledir Some influential environment variables: CXX C++ compiler command @@ -3233,6 +3234,14 @@ if test -z "$prefix" || test $prefix = "NONE"; then prefix="/usr/local" fi + +# Check whether --with-module-prefix or --without-module-prefix was given. +if test "${with_module_prefix+set}" = set; then + withval="$with_module_prefix" + MODDIR=$withval +else + MODDIR="${prefix}/libexec" +fi; if test "$MODULES" = "yes"; then if test -z "$NOCHECK_DL"; then @@ -3329,7 +3338,7 @@ fi MODFLAGS="$MODFLAGS -mimpure-text" fi - appendCXX "-D_MODDIR_=\\\"${prefix}/share/znc\\\"" + appendCXX "-D_MODDIR_=\\\"${MODDIR}/znc\\\"" if test -z "$NOPERL"; then echo -n "checking for perl... " @@ -3427,6 +3436,7 @@ VERSION=`grep '#define VERSION' main.h | awk '{print $3}'` + ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files znc-config" @@ -4096,6 +4106,7 @@ s,@MODTARGET@,$MODTARGET,;t t s,@VERSION@,$VERSION,;t t s,@NOSSL@,$NOSSL,;t t s,@PERL@,$PERL,;t t +s,@MODDIR@,$MODDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/configure.in b/configure.in index 3c0912c2..4925dfbf 100644 --- a/configure.in +++ b/configure.in @@ -74,6 +74,7 @@ if test -z "$prefix" || test $prefix = "NONE"; then prefix="/usr/local" fi +AC_ARG_WITH( module-prefix, [ --with-module-prefix=/path/to/moduledir], MODDIR=$withval, MODDIR="${prefix}/libexec") if test "$MODULES" = "yes"; then if test -z "$NOCHECK_DL"; then AC_CHECK_LIB( dl, dlopen,,MODULES="no",) @@ -95,7 +96,7 @@ if test "$MODULES" = "yes"; then MODFLAGS="$MODFLAGS -mimpure-text" fi - appendCXX "-D_MODDIR_=\\\"${prefix}/share/znc\\\"" + appendCXX "-D_MODDIR_=\\\"${MODDIR}/znc\\\"" if test -z "$NOPERL"; then echo -n "checking for perl... " @@ -124,6 +125,7 @@ AC_SUBST([MODTARGET]) AC_SUBST([VERSION]) AC_SUBST([NOSSL]) AC_SUBST([PERL]) +AC_SUBST([MODDIR]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([znc-config]) if test "$MODULES" = "yes"; then diff --git a/main.h b/main.h index 2aa1d48e..eb7ff4b9 100644 --- a/main.h +++ b/main.h @@ -4,7 +4,7 @@ #define VERSION 0.046 #ifndef _MODDIR_ -#define _MODDIR_ "/usr/share/znc" +#define _MODDIR_ "/usr/libexec/znc" #endif #ifdef _MODULES diff --git a/modules/Makefile.in b/modules/Makefile.in index 62ec3e0f..0d683b9c 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -9,6 +9,7 @@ PERLCC=-DHAVE_PERL `$(PERL) -MExtUtils::Embed -e perl_inc` PERLLD=`$(PERL) -MExtUtils::Embed -e perl_inc -e ldopts` endif VPATH=.:.. +MODDIR=@MODDIR@ ifeq "@NOSSL@" "1" TARGETS=$(foreach file, $(wildcard *.cpp), $(if $(shell grep REQUIRESSL $(file)),, $(addsuffix .so, $(basename $(file))))) @@ -31,18 +32,18 @@ install: all create_install_dir install_metadirs $(INSTALL_TARGS) @echo -n "" create_install_dir: - mkdir -p $(DESTDIR)$(prefix)/share/znc - rm -rf $(DESTDIR)$(prefix)/share/znc/*.so + mkdir -p $(DESTDIR)$(MODDIR)/znc + rm -rf $(DESTDIR)$(MODDIR)/znc/*.so install_metadirs: for a in *; do \ if [ -d $$a ] && [ -f $${a}.so ]; then \ - cp -Rp $$a $(DESTDIR)$(prefix)/share/znc; \ + cp -Rp $$a $(DESTDIR)$(MODDIR)/znc; \ fi \ done install_%: - install -m 0755 $(subst install_,,$@) $(DESTDIR)$(prefix)/share/znc + install -m 0755 $(subst install_,,$@) $(DESTDIR)$(MODDIR)/znc clean: rm -rf *.so *.o core core.* @@ -62,9 +63,9 @@ modperl.so: modperl.o modperl.o: modperl.cpp $(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ modperl.cpp $(PERLCC) install_modperl.so: - install -m 0755 modperl.so $(DESTDIR)$(prefix)/share/znc + install -m 0755 modperl.so $(DESTDIR)$(MODDIR)/znc for i in *.pm; do \ - install -m 0755 $$i $(DESTDIR)$(prefix)/share/znc; \ + install -m 0755 $$i $(DESTDIR)$(MODDIR)/znc; \ done else modperl.so: