diff --git a/configure b/configure index 3744e773..70d0bacc 100755 --- a/configure +++ b/configure @@ -1687,7 +1687,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -SAVED_CXXFLAGS=$CXXFLAGS +SAVED_CXXFLAGS="$CXXFLAGS" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2410,9 +2410,8 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -CXXFLAGS="$SAVED_CXXFLAGS -D_GNU_SOURCE -D_FORTIFY_SOURCE=2" +CXXFLAGS="$SAVED_CXXFLAGS" INCLUDES="" -LIBS="" appendLib () { if test "$LIBS" != ""; then @@ -2446,10 +2445,13 @@ appendLD () { fi } +appendCXX "-D_GNU_SOURCE -D_FORTIFY_SOURCE=2" + case "${host_os}" in freebsd*) appendInc -I/usr/local/include appendLib -L/usr/local/lib -lcompat + MODFLAGS="$MODFLAGS -L/usr/local/lib" appendCXX -D__GNU_LIBRARY__ ;; solaris*) @@ -3374,93 +3376,7 @@ echo "$as_me: error: Missing Required libc feature" >&2;} fi done -if test "$MODULES" = "yes"; then - { echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_dlopen || defined __stub___dlopen -choke me -#endif - -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } -if test $ac_cv_func_dlopen = yes; then - NOCHECK_DL=1 -fi - -fi if test -z "$NOSSL"; then if test -n "$OPENSSL"; then appendLib -L${OPENSSL}/lib @@ -3647,7 +3563,6 @@ fi if test "$MODULES" = "yes"; then - if test -z "$NOCHECK_DL"; then { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } @@ -3723,34 +3638,28 @@ echo "$as_me: error: Could not find dlopen. Try --disable-modules" >&2;} { (exit 1); exit 1; }; } fi - NOCHECK_DL=1 + + appendCXX -D_MODULES + MODFLAGS="$MODFLAGS $CXXFLAGS" + if test -z "$ISSUN"; then + appendLD -Wl,--export-dynamic fi - if test "$MODULES" = "yes"; then - appendCXX -D_MODULES - if test -n "$ISSUN"; then - MODFLAGS="$CXXFLAGS" - else - MODFLAGS="$CXXFLAGS" - appendLD -Wl,--export-dynamic - fi - MODFLAGS="$MODFLAGS -I`pwd`" - MODTARGET="modules" - if test -z "$NOCHECK_DL"; then - appendLib -ldl - fi - if test -n "$ISSUN"; then - MODFLAGS="$MODFLAGS -mimpure-text" - fi + MODTARGET="modules" - appendCXX "-D_MODDIR_=\\\"${MODDIR}\\\"" - appendCXX "-D_DATADIR_=\\\"${DATADIR}\\\"" + # FIXME why don't we do this for sun? + if test -n "$ISSUN"; then + MODFLAGS="$MODFLAGS -mimpure-text" + fi - if test -z "$NOPERL"; then - echo -n "checking for perl... " - PERL=`which perl` - if test -n "$PERL"; then - echo "$PERL" - { echo "$as_me:$LINENO: checking for perl_alloc in -lperl" >&5 + appendCXX "-D_MODDIR_=\\\"${MODDIR}\\\"" + appendCXX "-D_DATADIR_=\\\"${DATADIR}\\\"" + + if test -z "$NOPERL"; then + echo -n "checking for perl... " + PERL=`which perl` + if test -n "$PERL"; then + echo "$PERL" + { echo "$as_me:$LINENO: checking for perl_alloc in -lperl" >&5 echo $ECHO_N "checking for perl_alloc in -lperl... $ECHO_C" >&6; } if test "${ac_cv_lib_perl_perl_alloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3819,16 +3728,15 @@ echo "$as_me: error: Could not find libperl. Try --disable-perl" >&2;} { (exit 1); exit 1; }; } fi - else - echo "no" - unset PERL - { { echo "$as_me:$LINENO: error: Could not find perl binary. Try --disable-perl" >&5 + else + echo "no" + { { echo "$as_me:$LINENO: error: Could not find perl binary. Try --disable-perl" >&5 echo "$as_me: error: Could not find perl binary. Try --disable-perl" >&2;} { (exit 1); exit 1; }; } - fi fi + fi - if test -n "$SASL"; then + if test -n "$SASL"; then { echo "$as_me:$LINENO: checking for sasl_server_init in -lsasl2" >&5 echo $ECHO_N "checking for sasl_server_init in -lsasl2... $ECHO_C" >&6; } @@ -3899,12 +3807,11 @@ _ACEOF LIBS="-lsasl2 $LIBS" else - { { echo "$as_me:$LINENO: error: Could not find libsasl2." >&5 -echo "$as_me: error: Could not find libsasl2." >&2;} + { { echo "$as_me:$LINENO: error: Could not find libsasl2. Try --disable-sasl." >&5 +echo "$as_me: error: Could not find libsasl2. Try --disable-sasl." >&2;} { (exit 1); exit 1; }; } fi - fi fi fi diff --git a/configure.in b/configure.in index bf0b6824..2ca61746 100644 --- a/configure.in +++ b/configure.in @@ -1,12 +1,11 @@ dnl Keep the version number in sync with main.h! AC_INIT([znc], [0.055]) -SAVED_CXXFLAGS=$CXXFLAGS +SAVED_CXXFLAGS="$CXXFLAGS" AC_PROG_CXX AC_CANONICAL_HOST -CXXFLAGS="$SAVED_CXXFLAGS -D_GNU_SOURCE -D_FORTIFY_SOURCE=2" +CXXFLAGS="$SAVED_CXXFLAGS" INCLUDES="" -LIBS="" appendLib () { if test "$LIBS" != ""; then @@ -40,10 +39,13 @@ appendLD () { fi } +appendCXX "-D_GNU_SOURCE -D_FORTIFY_SOURCE=2" + case "${host_os}" in freebsd*) appendInc -I/usr/local/include appendLib -L/usr/local/lib -lcompat + MODFLAGS="$MODFLAGS -L/usr/local/lib" appendCXX -D__GNU_LIBRARY__ ;; solaris*) @@ -103,9 +105,7 @@ fi AC_CHECK_LIB( gnugetopt, getopt_long,) AC_CHECK_FUNCS( stat lstat chmod open, , AC_ERROR([Missing Required libc feature])) -if test "$MODULES" = "yes"; then - AC_CHECK_FUNC( dlopen,NOCHECK_DL=1,) -fi + if test -z "$NOSSL"; then if test -n "$OPENSSL"; then appendLib -L${OPENSSL}/lib @@ -136,49 +136,40 @@ AC_ARG_WITH( [module-data-prefix], if test "$MODULES" = "yes"; then - if test -z "$NOCHECK_DL"; then - AC_CHECK_LIB( dl, dlopen,, AC_ERROR([Could not find dlopen. Try --disable-modules])) - NOCHECK_DL=1 + AC_CHECK_LIB( dl, dlopen,, AC_ERROR([Could not find dlopen. Try --disable-modules])) + + appendCXX -D_MODULES + MODFLAGS="$MODFLAGS $CXXFLAGS" + if test -z "$ISSUN"; then + appendLD -Wl,--export-dynamic fi - if test "$MODULES" = "yes"; then - appendCXX -D_MODULES - if test -n "$ISSUN"; then - MODFLAGS="$CXXFLAGS" + MODTARGET="modules" + + # FIXME why don't we do this for sun? + if test -n "$ISSUN"; then + MODFLAGS="$MODFLAGS -mimpure-text" + fi + + appendCXX "-D_MODDIR_=\\\"${MODDIR}\\\"" + appendCXX "-D_DATADIR_=\\\"${DATADIR}\\\"" + + if test -z "$NOPERL"; then + echo -n "checking for perl... " + PERL=`which perl` + if test -n "$PERL"; then + echo "$PERL" + AC_CHECK_LIB(perl, perl_alloc,unset NOPERL, + AC_ERROR([Could not find libperl. Try --disable-perl]), + [`$PERL -MExtUtils::Embed -e ccopts -e ldopts`]) else - MODFLAGS="$CXXFLAGS" - appendLD -Wl,--export-dynamic - fi - MODFLAGS="$MODFLAGS -I`pwd`" - MODTARGET="modules" - if test -z "$NOCHECK_DL"; then - appendLib -ldl - fi - if test -n "$ISSUN"; then - MODFLAGS="$MODFLAGS -mimpure-text" + echo "no" + AC_ERROR([Could not find perl binary. Try --disable-perl]) fi + fi - appendCXX "-D_MODDIR_=\\\"${MODDIR}\\\"" - appendCXX "-D_DATADIR_=\\\"${DATADIR}\\\"" - - if test -z "$NOPERL"; then - echo -n "checking for perl... " - PERL=`which perl` - if test -n "$PERL"; then - echo "$PERL" - AC_CHECK_LIB(perl, perl_alloc,unset NOPERL, - AC_ERROR([Could not find libperl. Try --disable-perl]), - [`$PERL -MExtUtils::Embed -e ccopts -e ldopts`]) - else - echo "no" - unset PERL - AC_ERROR([Could not find perl binary. Try --disable-perl]) - fi - fi - - if test -n "$SASL"; then - AC_CHECK_LIB( sasl2, sasl_server_init,, - AC_ERROR([Could not find libsasl2.])) - fi + if test -n "$SASL"; then + AC_CHECK_LIB( sasl2, sasl_server_init,, + AC_ERROR([Could not find libsasl2. Try --disable-sasl.])) fi fi diff --git a/modules/Makefile.in b/modules/Makefile.in index 99da7f32..26f8a638 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -8,7 +8,9 @@ libdir := @libdir@ sbindir := @sbindir@ localstatedir := @localstatedir@ CXX := @CXX@ -CXXFLAGS := @CXXFLAGS@ +# CXXFLAGS are for the main binary, so don't even think of using them here +# CXXFLAGS := @CXXFLAGS@ +MODFLAGS := @MODFLAGS@ LDFLAGS := @LDFLAGS@ INCLUDES := @INCLUDES@ -I.. LIBS := @LIBS@ @@ -81,10 +83,10 @@ clean: ifeq ($(DEPEND), yes) %.so: %.cpp - $(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) -shared -o $@ $< $($(basename $<)FLAGS) -MMD -MF .depend/$<.dep + $(CXX) $(MODFLAGS) $(INCLUDES) $(LDFLAGS) -shared -o $@ $< $($(basename $<)FLAGS) -MMD -MF .depend/$<.dep else %.so: %.cpp - $(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) -shared -o $@ $< $($(basename $<)FLAGS) + $(CXX) $(MODFLAGS) $(INCLUDES) $(LDFLAGS) -shared -o $@ $< $($(basename $<)FLAGS) endif modperl_install: create_install_dir diff --git a/znc-config.in b/znc-config.in index 0f67319e..272b5ff7 100644 --- a/znc-config.in +++ b/znc-config.in @@ -5,7 +5,7 @@ exec_prefix="@exec_prefix@" datadir="@datadir@" datarootdir="@datarootdir@" -CXXFLAGS="@CXXFLAGS@" +CXXFLAGS="@MODFLAGS@" INCLUDES="-I@prefix@/include/znc @INCLUDES@" LIBS="@LIBS@" MODDIR="@MODDIR@"