From ed3c02ce8d8bc415d4db2e8d137aaea65f13e18c Mon Sep 17 00:00:00 2001 From: psychon Date: Wed, 7 Apr 2010 16:55:27 +0000 Subject: [PATCH] Fail less badly if perl isn't found After this, perl, c-ares and openssl now are handled similar if they aren't found. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1895 726aef4b-f618-498e-8847-2d620e286838 --- configure | 88 ++++++++++++++++++++++++++------------------- configure.in | 52 +++++++++++++-------------- modules/Makefile.in | 2 +- 3 files changed, 78 insertions(+), 64 deletions(-) diff --git a/configure b/configure index 31ed8dd5..b997cb98 100755 --- a/configure +++ b/configure @@ -566,7 +566,7 @@ MODLINK LIBZNCDIR LIBZNC MODFLAGS -PERL +PERL_BINARY c_ares_LIBS c_ares_CFLAGS PKG_CONFIG @@ -2782,12 +2782,14 @@ fi if test "${enable_openssl+set}" = set; then : enableval=$enable_openssl; SSL="$enableval" else - SSL="yes" + SSL="auto" fi # Check whether --enable-perl was given. if test "${enable_perl+set}" = set; then : - enableval=$enable_perl; if test "$enableval" = "no" ; then NOPERL=1; fi + enableval=$enable_perl; PERL="$enableval" +else + PERL="auto" fi # Check whether --enable-sasl was given. @@ -3078,12 +3080,12 @@ fi # This looks better in the summary at the end ARES="not found" - if "x$old_ARES" != "xauto" ; then - as_fn_error "\"c-ares not found. Try --disable-c-ares. -Disabling c-ares may result in a slight performance decrease but will not have any other side-effects\"" "$LINENO" 5 + if test "x$old_ARES" != "xauto" ; then + as_fn_error "c-ares not found. Try --disable-c-ares. +Disabling c-ares may result in a slight performance decrease but will not have any other side-effects" "$LINENO" 5 else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"c-ares was not found and thus disabled\"" >&5 -$as_echo "$as_me: WARNING: \"c-ares was not found and thus disabled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: c-ares was not found and thus disabled" >&5 +$as_echo "$as_me: WARNING: c-ares was not found and thus disabled" >&2;} fi else @@ -3201,16 +3203,17 @@ fi # This looks better in the summary at the end SSL="not found" - if "x$old_SSL" != "xauto" ; then - as_fn_error "\"OpenSSL not found. Try --disable-openssl.\"" "$LINENO" 5 + if test "x$old_SSL" != "xauto" ; then + as_fn_error "OpenSSL not found. Try --disable-openssl." "$LINENO" 5 else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"OpenSSL was not found and thus disabled\"" >&5 -$as_echo "$as_me: WARNING: \"OpenSSL was not found and thus disabled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OpenSSL was not found and thus disabled" >&5 +$as_echo "$as_me: WARNING: OpenSSL was not found and thus disabled" >&2;} fi NOSSL=1 else appendCXX -DHAVE_LIBSSL + SSL=yes fi else NOSSL=1 @@ -3326,17 +3329,18 @@ fi # (dynamic_lookup might only work on 10.4 and later) fi - if test -z "$NOPERL"; then + if test "x$PERL" != "xno"; then + old_PERL="$PERL" # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PERL+set}" = set; then : +if test "${ac_cv_path_PERL_BINARY+set}" = set; then : $as_echo_n "(cached) " >&6 else - case $PERL in + case $PERL_BINARY in [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ac_cv_path_PERL_BINARY="$PERL_BINARY" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3346,7 +3350,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_PERL_BINARY="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -3357,19 +3361,19 @@ IFS=$as_save_IFS ;; esac fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } +PERL_BINARY=$ac_cv_path_PERL_BINARY +if test -n "$PERL_BINARY"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL_BINARY" >&5 +$as_echo "$PERL_BINARY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test -n "$PERL"; then + if test -n "$PERL_BINARY"; then my_saved_LDFLAGS="$LDFLAGS" - appendLD `$PERL -MExtUtils::Embed -e ccopts -e ldopts` + appendLD `$PERL_BINARY -MExtUtils::Embed -e ccopts -e ldopts` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl_alloc in -lperl" >&5 $as_echo_n "checking for perl_alloc in -lperl... " >&6; } if test "${ac_cv_lib_perl_perl_alloc+set}" = set; then : @@ -3407,14 +3411,33 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_perl_perl_alloc" >&5 $as_echo "$ac_cv_lib_perl_perl_alloc" >&6; } if test "x$ac_cv_lib_perl_perl_alloc" = x""yes; then : - unset NOPERL + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPERL 1 +_ACEOF + + LIBS="-lperl $LIBS" + else - as_fn_error "could not find libperl. Try --disable-perl" "$LINENO" 5 + PERL="no" fi LDFLAGS="$my_saved_LDFLAGS" else - as_fn_error "could not find perl binary. Try --disable-perl" "$LINENO" 5 + PERL="no" + fi + if test "x$PERL" = "xno"; then + + # This looks better in the summary at the end + PERL="not found" + if test "x$old_PERL" != "xauto" ; then + as_fn_error "perl not found. Try --disable-perl." "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perl was not found and thus disabled" >&5 +$as_echo "$as_me: WARNING: perl was not found and thus disabled" >&2;} + fi + + else + PERL=yes fi fi @@ -3554,7 +3577,6 @@ fi - ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files znc-config" @@ -4718,17 +4740,9 @@ echo znc 0.089 configured echo echo "debug: $DEBUG" echo "ipv6: $IPV6" -if test x"$NOSSL" = "x1" ; then - echo "openssl: no" -else - echo "openssl: yes" -fi +echo "openssl: $SSL" echo "c-ares: $ARES" -if test x"$PERL" = "x" ; then - echo "perl: no" -else - echo "perl: yes" -fi +echo "perl: $PERL" if test x"$SASL" = "x" ; then echo "sasl: no" else diff --git a/configure.in b/configure.in index e753a9df..abaed1d7 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_LANG([C++]) AC_DEFUN(ZNC_AUTO_FAIL, [ # This looks better in the summary at the end $1="not found" - if "x$old_$1" != "xauto" ; then + if test "x$old_$1" != "xauto" ; then AC_MSG_ERROR([$2]) else AC_MSG_WARN([$3]) @@ -90,10 +90,11 @@ AC_ARG_ENABLE( [ipv6], AC_ARG_ENABLE( [openssl], AS_HELP_STRING([--disable-openssl], [disable openssl]), [SSL="$enableval"], - [SSL="yes"]) + [SSL="auto"]) AC_ARG_ENABLE( [perl], AS_HELP_STRING([--disable-perl], [disable perl]), - [if test "$enableval" = "no" ; then NOPERL=1; fi],) + [PERL="$enableval"], + [PERL="auto"]) AC_ARG_ENABLE( [sasl], AS_HELP_STRING([--enable-sasl], [enable sasl]), [if test "$enableval" = "yes" ; then SASL=1; fi],) @@ -140,9 +141,9 @@ if test "x$ARES" != "xno"; then if test "x$ARES" = "xno" ; then ZNC_AUTO_FAIL([ARES], - ["c-ares not found. Try --disable-c-ares. -Disabling c-ares may result in a slight performance decrease but will not have any other side-effects"], - ["c-ares was not found and thus disabled"]) + [c-ares not found. Try --disable-c-ares. +Disabling c-ares may result in a slight performance decrease but will not have any other side-effects], + [c-ares was not found and thus disabled]) else appendCXX $c_ares_CFLAGS -DHAVE_C_ARES appendLib $c_ares_LIBS @@ -164,11 +165,12 @@ if test "x$SSL" != "xno"; then if test "x$SSL" = "xno" ; then ZNC_AUTO_FAIL([SSL], - ["OpenSSL not found. Try --disable-openssl."], - ["OpenSSL was not found and thus disabled"]) + [OpenSSL not found. Try --disable-openssl.], + [OpenSSL was not found and thus disabled]) NOSSL=1 else appendCXX -DHAVE_LIBSSL + SSL=yes fi else NOSSL=1 @@ -234,16 +236,23 @@ if test "yes" = "yes"; then # (dynamic_lookup might only work on 10.4 and later) fi - if test -z "$NOPERL"; then - AC_PATH_PROG([PERL], [perl], []) - if test -n "$PERL"; then + if test "x$PERL" != "xno"; then + old_PERL="$PERL" + AC_PATH_PROG([PERL_BINARY], [perl], []) + if test -n "$PERL_BINARY"; then my_saved_LDFLAGS="$LDFLAGS" - appendLD `$PERL -MExtUtils::Embed -e ccopts -e ldopts` - AC_CHECK_LIB(perl, perl_alloc,unset NOPERL, - AC_MSG_ERROR([could not find libperl. Try --disable-perl])) + appendLD `$PERL_BINARY -MExtUtils::Embed -e ccopts -e ldopts` + AC_CHECK_LIB(perl, perl_alloc,, PERL="no") LDFLAGS="$my_saved_LDFLAGS" else - AC_MSG_ERROR([could not find perl binary. Try --disable-perl]) + PERL="no" + fi + if test "x$PERL" = "xno"; then + ZNC_AUTO_FAIL([PERL], + [perl not found. Try --disable-perl.], + [perl was not found and thus disabled]) + else + PERL=yes fi fi @@ -309,7 +318,6 @@ AC_SUBST([LIBZNCDIR]) AC_SUBST([MODLINK]) AC_SUBST([NOSSL]) AC_SUBST([EXTRA]) -AC_SUBST([PERL]) AC_SUBST([TCL_FLAGS]) AC_SUBST([SASL]) AC_SUBST([MODDIR]) @@ -328,17 +336,9 @@ echo znc AC_PACKAGE_VERSION configured echo echo "debug: $DEBUG" echo "ipv6: $IPV6" -if test x"$NOSSL" = "x1" ; then - echo "openssl: no" -else - echo "openssl: yes" -fi +echo "openssl: $SSL" echo "c-ares: $ARES" -if test x"$PERL" = "x" ; then - echo "perl: no" -else - echo "perl: yes" -fi +echo "perl: $PERL" if test x"$SASL" = "x" ; then echo "sasl: no" else diff --git a/modules/Makefile.in b/modules/Makefile.in index 060f5c54..48a56142 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -19,7 +19,7 @@ LDFLAGS := @LDFLAGS@ # LIBS are not and should not be used in here. # The znc binary links already against those. # LIBS := @LIBS@ -PERL := @PERL@ +PERL := @PERL_BINARY@ MODDIR := @MODDIR@ DATADIR := @DATADIR@ LIBZNC := @LIBZNC@