configure: Automatically disable c-ares if it is not found

With this patch configure no longer fails if either pkg-config or c-ares are
unavailable. Instead, c-ares is just disabled.

If one uses ./configure --enable-c-ares, configure will fail if c-ares is not
found.

./configure --disable-c-ares obviously won't care about c-ares. ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1644 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-10-09 17:07:22 +00:00
parent 9dd3883164
commit 528aa72df3
2 changed files with 44 additions and 213 deletions
Vendored
+23 -205
View File
@@ -565,9 +565,6 @@ LIBZNCDIR
LIBZNC
MODFLAGS
PERL
c_ares_LIBS
c_ares_CFLAGS
PKG_CONFIG
host_os
host_vendor
host_cpu
@@ -649,10 +646,7 @@ CXXFLAGS
LDFLAGS
LIBS
CPPFLAGS
CCC
PKG_CONFIG
c_ares_CFLAGS
c_ares_LIBS'
CCC'
# Initialize some variables set by options.
@@ -1298,10 +1292,6 @@ Some influential environment variables:
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
PKG_CONFIG path to pkg-config utility
c_ares_CFLAGS
C compiler flags for c_ares, overriding pkg-config
c_ares_LIBS linker flags for c_ares, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -2785,7 +2775,7 @@ fi
if test "${enable_c_ares+set}" = set; then :
enableval=$enable_c_ares; ARES="$enableval"
else
ARES="yes"
ARES="auto"
fi
@@ -2858,203 +2848,31 @@ if test "x$ac_cv_func_lstat" = x""yes; then :
fi
if test "x$ARES" = "xyes"; then
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; 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_PKG_CONFIG+set}" = set; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
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_PKG_CONFIG="$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
done
done
IFS=$as_save_IFS
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; 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_ac_pt_PKG_CONFIG+set}" = set; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
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_ac_pt_PKG_CONFIG="$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
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=0.9.0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
if test "x$ARES" != "xno"; then
old_ARES=$ARES
PKG_PROG_PKG_CONFIG()
if test -z "$PKG_CONFIG"
then
as_fn_error "pkg-config 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
ARES=no
else
PKG_CHECK_MODULES(c_ares, libcares,, ARES=no)
fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for c_ares" >&5
$as_echo_n "checking for c_ares... " >&6; }
if test -n "$PKG_CONFIG"; then
if test -n "$c_ares_CFLAGS"; then
pkg_cv_c_ares_CFLAGS="$c_ares_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares\""; } >&5
($PKG_CONFIG --exists --print-errors "libcares") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_c_ares_CFLAGS=`$PKG_CONFIG --cflags "libcares" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
if test -n "$c_ares_LIBS"; then
pkg_cv_c_ares_LIBS="$c_ares_LIBS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares\""; } >&5
($PKG_CONFIG --exists --print-errors "libcares") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_c_ares_LIBS=`$PKG_CONFIG --libs "libcares" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
c_ares_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libcares"`
else
c_ares_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libcares"`
fi
# Put the nasty error message in config.log where it belongs
echo "$c_ares_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
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
elif test $pkg_failed = untried; 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
c_ares_CFLAGS=$pkg_cv_c_ares_CFLAGS
c_ares_LIBS=$pkg_cv_c_ares_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
:
fi
appendCXX $c_ares_CFLAGS -DHAVE_ARES
appendLib $c_ares_LIBS
if test "x$ARES" = "xno" ; then
# This looks better in the summary at the end
ARES="not found"
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;}
fi
else
appendCXX $c_ares_CFLAGS -DHAVE_ARES
appendLib $c_ares_LIBS
ARES=yes
fi
fi
if test -z "$NOSSL"; then
+21 -8
View File
@@ -98,7 +98,7 @@ AC_ARG_ENABLE( [optimization],
AC_ARG_ENABLE( [c-ares],
AS_HELP_STRING([--disable-c-ares], [disable c-ares usage]),
[ARES="$enableval"],
[ARES="yes"])
[ARES="auto"])
if test "$DEBUG" != "no"; then
appendCXX -ggdb -D_DEBUG
@@ -121,17 +121,30 @@ fi
AC_CHECK_LIB( gnugetopt, getopt_long,)
AC_CHECK_FUNC([lstat], [appendCXX -DHAVE_LSTAT])
if test "x$ARES" = "xyes"; then
if test "x$ARES" != "xno"; then
old_ARES=$ARES
PKG_PROG_PKG_CONFIG()
if test -z "$PKG_CONFIG"
then
AC_MSG_ERROR([pkg-config not found. Try --disable-c-ares.
Disabling c-ares may result in a slight performance decrease but will not have any other side-effects])
ARES=no
else
PKG_CHECK_MODULES([c_ares], [libcares],, ARES=no)
fi
if test "x$ARES" = "xno" ; then
# This looks better in the summary at the end
ARES="not found"
if test "x$old_ARES" != "xauto" ; then
AC_MSG_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"])
else
AC_MSG_WARN(["c-ares was not found and thus disabled"])
fi
else
appendCXX $c_ares_CFLAGS -DHAVE_ARES
appendLib $c_ares_LIBS
ARES=yes
fi
PKG_CHECK_MODULES([c_ares], [libcares],, AC_MSG_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]))
appendCXX $c_ares_CFLAGS -DHAVE_ARES
appendLib $c_ares_LIBS
fi
if test -z "$NOSSL"; then