Changeset 632627e for configure


Ignore:
Timestamp:
2014-07-24T03:51:07Z (8 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
f93fd2d
Parents:
59e66ff
git-author:
jcopenha <jcopenha@…> (24-07-14 03:51:07)
git-committer:
dequis <dx@…> (24-07-14 03:51:07)
Message:

srv_lookup: Portability fixes, handle compressed responses

srv_lookup works on cygwin and openbsd now.

Provide ns_initparse, friends, and types where they aren't provided by
platform.

Use dn_expandname instead of custom parser so compressed DNS responses
are handled correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure

    r59e66ff r632627e  
    341341int main()
    342342{
     343
     344        res_query( NULL, 0, 0, NULL, 0);
     345        dn_expand( NULL, NULL, NULL, NULL, 0);
     346        dn_skipname( NULL, NULL);
     347}
     348'
     349RESOLV_NS_TESTCODE='
     350#include <sys/types.h>
     351#include <netinet/in.h>
     352#include <arpa/nameser.h>
     353#include <resolv.h>
     354
     355int main()
     356{
    343357        ns_initparse( NULL, 0, NULL );
    344358        ns_parserr( NULL, ns_s_an, 0, NULL );
    345359}
    346360'
     361RESOLV_NS_TYPES_TESTCODE='
     362#include <sys/types.h>
     363#include <netinet/in.h>
     364#include <arpa/nameser.h>
     365
     366int main()
     367{
     368        ns_msg nsh;
     369        ns_rr rr;
     370
     371        ns_initparse( NULL, 0, NULL );
     372        ns_parserr( NULL, ns_s_an, 0, NULL );
     373}
     374'
    347375
    348376detect_resolv_dynamic()
    349377{
    350378        case "$arch" in
     379        OpenBSD )
     380                # In FreeBSD res_*/dn_* routines are present in libc.so
     381                LIBRESOLV=;;
    351382        FreeBSD )
    352                 # In FreeBSD res_* routines are present in libc.so
     383                # In FreeBSD res_*/dn_* routines are present in libc.so
     384                LIBRESOLV=;;
     385        CYGWIN* )
     386                # In Cygwin res_*/dn_* routines are present in libc.so
    353387                LIBRESOLV=;;
    354388        * )
     
    385419}
    386420
     421detect_resolv_ns_dynamic()
     422{
     423        case "$arch" in
     424        FreeBSD )
     425                # In FreeBSD ns_ routines are present in libc.so
     426                LIBRESOLV=;;
     427        * )
     428                LIBRESOLV=-lresolv;;
     429        esac
     430        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
     431        ret=1
     432        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
     433        if [ "$?" = "0" ]; then
     434                ret=0
     435        fi
     436
     437        rm -f $TMPFILE
     438        return $ret
     439}
     440
     441detect_resolv_ns_static()
     442{
     443        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
     444        ret=1
     445        for i in $systemlibdirs; do
     446                if [ -f $i/libresolv.a ]; then
     447                        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
     448                        if [ "$?" = "0" ]; then
     449                                ret=0
     450                        fi
     451                fi
     452        done
     453
     454        rm -f $TMPFILE
     455        return $ret
     456}
     457
     458detect_nameser_has_ns_types()
     459{
     460        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
     461        case "$arch" in
     462        FreeBSD )
     463                # In FreeBSD ns_ routines are present in libc.so
     464                LIBRESOLV=;;
     465        * )
     466                LIBRESOLV=-lresolv;;
     467        esac
     468        ret=1
     469    if detect_resolv_ns_dynamic; then
     470            echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c $LIBRESOLV -  >/dev/null 2>/dev/null
     471        if [ "$?" = "0" ]; then
     472            ret=0
     473        fi
     474    elif detect_resolv_ns_static; then
     475            for i in $systemlibdirs; do
     476                    if [ -f $i/libresolv.a ]; then
     477                            echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c -  >/dev/null 2>/dev/null
     478                    if [ "$?" = "0" ]; then
     479                        ret=0
     480                    fi
     481                    fi
     482            done
     483    fi
     484
     485        rm -f $TMPFILE
     486        return $ret
     487}
     488
    387489if [ "$ssl" = "auto" ]; then
    388490        detect_gnutls
     
    440542echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
    441543
     544if detect_nameser_has_ns_types; then
     545        echo '#define NAMESER_HAS_NS_TYPES' >> config.h
     546fi
    442547if detect_resolv_dynamic || detect_resolv_static; then
    443548        echo '#define HAVE_RESOLV_A' >> config.h
    444 fi
     549    if detect_resolv_ns_dynamic || detect_resolv_ns_static; then
     550            echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h
     551    fi
     552else
     553    echo 'Insufficient resolv routines. Jabber server must be set explicitly'
     554fi
     555
    445556
    446557STORAGES="xml"
Note: See TracChangeset for help on using the changeset viewer.