From df37d83f8bc90521458c981d5d0fe70852cdde32 Mon Sep 17 00:00:00 2001 From: binki Date: Wed, 22 Dec 2010 16:02:39 +0000 Subject: [PATCH] - Fix invalid use of 'wc -l' when detecting the AsynchDNS feature of libcurl which breaks compilation on FreeBSD; instead use 'grep -q'. Reported by Jobe (#3981), solution proposed by satmd. --- Changes | 3 +++ Config | 16 +++++++++------- autoconf/m4/unreal.m4 | 7 +++++-- configure | 6 +++++- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index 259c9d6ca..dd6cd7979 100644 --- a/Changes +++ b/Changes @@ -2249,3 +2249,6 @@ - Fix typo 'alias::spampfilter' in German docs, reported by seraphim (#3978). - Fix missing #include . Fixes compile error on OpenBSD reported by CuleX (#3977). +- Fix invalid use of 'wc -l' when detecting the AsynchDNS feature of + libcurl which breaks compilation on FreeBSD; instead use 'grep + -q'. Reported by Jobe (#3981), solution proposed by satmd. diff --git a/Config b/Config index 5de038369..222895f41 100755 --- a/Config +++ b/Config @@ -673,9 +673,11 @@ if [ "$REMOTEINC" = "1" ] ; then GOTASYNC=0 if [ "x$CURLDIR" != "x" ]; then - # Check if it's of any use: a curl without async dns (cares) hangs the entire ircd.. - # normally this is done in ./configure but now we're forced to do it also here.. - GOTASYNC="`$CURLDIR/bin/curl-config --features|grep AsynchDNS|wc -l`" + # Check if it's of any use: a curl without async dns (cares) hangs the entire ircd.. + # normally this is done in ./configure but now we're forced to do it also here.. + if "$CURLDIR"/bin/curl-config --features | grep -q -e AsynchDNS; then + GOTASYNC="1" + fi if [ "$GOTASYNC" != "1" ]; then PREVCURLDIR="$CURLDIR" CURLDIR="" @@ -691,7 +693,7 @@ if [ "$REMOTEINC" = "1" ] ; then # on 'bc' for some reason and not all systems have that installed! echo "1+1"|bc 1>/dev/null 2>&1 if [ "$?" = 0 ]; then - $CURLDIR/bin/curl-config --checkfor 7.21.0 + "$CURLDIR"/bin/curl-config --checkfor 7.21.0 if [ "$?" != 0 ]; then echo "" echo "Your self-compiled CURL library in $CURLDIR is slightly outdated." @@ -712,8 +714,8 @@ if [ "$REMOTEINC" = "1" ] ; then fi case "$cc" in [Yy]*) - rm -rf $CURLDIR.old - mv $CURLDIR $CURLDIR.old + rm -rf "$CURLDIR".old + mv "$CURLDIR" "$CURLDIR".old CURLDIR="" GOTASYNC=1 # wow the GOTASYNC=1 is hackish, but we need to prevent the error from later on @@ -949,7 +951,7 @@ TEST="$EXTRAPARA" echo "" echo "Would you like to pass any custom parameters to configure?" echo "See \`./configure --help' and write them here:" -echo $n "[$TEST]-> $c" +echo $n "[$TEST] -> $c" read EXTRAPARA if [ -z "$EXTRAPARA" ]; then EXTRAPARA="$TEST" diff --git a/autoconf/m4/unreal.m4 b/autoconf/m4/unreal.m4 index 1cb303d4b..4967a6b1a 100644 --- a/autoconf/m4/unreal.m4 +++ b/autoconf/m4/unreal.m4 @@ -63,8 +63,11 @@ AC_DEFUN([CHECK_LIBCURL], CURLCFLAG="`$CURLCONFIG --cflags`" CURLLIBS="`$CURLCONFIG --libs`" - - CURLUSESCARES="`$CURLCONFIG --features|grep AsynchDNS|wc -l`" + + dnl This test must be this way because of #3981 + AS_IF([$CURLCONFIG --features | grep -q -e AsynchDNS], + [CURLUSESCARES="1"], + [CURLUSESCARES="0"]) AS_IF([test "$CURLUSESCARES" = "0"], [AC_MSG_WARN([cURL seems compiled without c-ares support. Your IRCd will possibly stall when REHASHing!])]) diff --git a/configure b/configure index a7cf847b4..290a7f0b2 100755 --- a/configure +++ b/configure @@ -6982,7 +6982,11 @@ fi CURLCFLAG="`$CURLCONFIG --cflags`" CURLLIBS="`$CURLCONFIG --libs`" - CURLUSESCARES="`$CURLCONFIG --features|grep AsynchDNS|wc -l`" + if $CURLCONFIG --features | grep -q -e AsynchDNS; then : + CURLUSESCARES="1" +else + CURLUSESCARES="0" +fi if test "$CURLUSESCARES" = "0"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cURL seems compiled without c-ares support. Your IRCd will possibly stall when REHASHing!" >&5 $as_echo "$as_me: WARNING: cURL seems compiled without c-ares support. Your IRCd will possibly stall when REHASHing!" >&2;}