Changeset 12957 for trunk/configure.ac


Ignore:
Timestamp:
Oct 9, 2011, 2:05:52 AM (10 years ago)
Author:
jordan
Message:

(trunk libT) #4323 "Allow usage of system miniupnpc" -- fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r12954 r12957  
    220220        LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
    221221        LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
    222         if test "x$libutp_extra_libs" != "x" ; then
    223            LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
    224         fi
     222        if test "x$libutp_extra_libs" != "x" ; then
     223            LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
     224        fi
    225225        AC_DEFINE([WITH_UTP],[1])
    226226        build_utp="yes"
     
    233233AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
    234234AC_MSG_RESULT([$build_utp])
     235
     236
     237dnl
     238dnl  look for preinstalled miniupnpc...
     239dnl
     240
     241AC_MSG_CHECKING([supported miniupnp library])
     242upnp_version="none"
     243ac_save_LIBS="$LIBS"
     244LIBS="-lminiupnpc"
     245# See if the OS has its miniupnp 1.5 installed
     246AC_TRY_LINK([
     247    #include <stdlib.h>
     248    #include <miniupnpc/miniupnpc.h>
     249    #include <miniupnpc/upnpcommands.h>
     250],[
     251    struct UPNPDev * devlist;
     252    struct UPNPUrls    urls;
     253    struct IGDdatas    data;
     254    char lanaddr[16];
     255    char portStr[8];
     256    char intPort[8];
     257    char intClient[16];
     258    upnpDiscover( 2000, NULL, NULL, 0 );
     259    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) ); 
     260    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
     261                        portStr, "TCP", intClient, intPort );
     262],[
     263AC_DEFINE(HAVE_MINIUPNP_15, 1, [Define to 1 if you have miniupnpc version 1.5])
     264upnp_version="1.5"])
     265 
     266# See if the OS has its miniupnp 1.6 installed
     267AC_TRY_LINK([
     268    #include <stdlib.h>
     269    #include <errno.h>
     270    #include <miniupnpc/miniupnpc.h>
     271    #include <miniupnpc/upnpcommands.h>
     272],[
     273    struct UPNPDev * devlist;
     274    struct UPNPUrls    urls;
     275    struct IGDdatas    data;
     276    char lanaddr[16];
     277    char portStr[8];
     278    char intPort[8];
     279    char intClient[16];
     280    upnpDiscover( 2000, NULL, NULL, 0, 0, &errno );
     281    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) ); 
     282    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
     283                        portStr, "TCP", intClient, intPort, NULL, NULL, NULL );
     284],[
     285AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6])
     286upnp_version="1.6"])
     287
     288# ... and the results of our tests
     289LIBS="$ac_save_LIBS"
     290AC_MSG_RESULT([$upnp_version])
     291AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"])
     292if test "x$upnp_version" = "xnone" ; then
     293    LIBUPNP_CFLAGS="-I\$(top_srcdir)/third-party/"
     294    LIBUPNP_LIBS="\$(top_builddir)/third-party/miniupnp/libminiupnp.a"
     295    LIBUPNP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a"
     296    dnl because this is the version that we bundle...
     297    AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6])
     298else
     299    AC_DEFINE([SYSTEM_MINIUPNP])
     300    LIBUPNP_CFLAGS="" 
     301    LIBUPNP_LIBS="-lminiupnpc"
     302    LIBUPNP_LIBS_QT="-lminiupnpc"
     303fi
     304AC_SUBST(LIBUPNP_CFLAGS)
     305AC_SUBST(LIBUPNP_LIBS)
     306AC_SUBST(LIBUPNP_LIBS_QT)
    235307
    236308
     
    409481                 utils/Makefile
    410482                 third-party/Makefile
    411                  third-party/miniupnp/Makefile
    412483                 third-party/libnatpmp/Makefile
    413484                 third-party/dht/Makefile
     
    426497
    427498dnl Maybe build libutp...
    428 AM_CONDITIONAL([CONDITIONAL],[test "x$build_utp" = "xyes"])
    429 AM_COND_IF([CONDITIONAL],
     499AM_CONDITIONAL([LIBUTP_CONDITIONAL],[test "x$build_utp" = "xyes"])
     500AM_COND_IF([LIBUTP_CONDITIONAL],
    430501           [AC_CONFIG_FILES([third-party/libutp/Makefile])])
     502
     503dnl Maybe build miniupnpc...
     504AM_CONDITIONAL([UPNP_CONDITIONAL],[test "x$upnp_version" = "xnone"])
     505AM_COND_IF([UPNP_CONDITIONAL],
     506           [AC_CONFIG_FILES([third-party/miniupnp/Makefile])])
    431507
    432508AC_OUTPUT
Note: See TracChangeset for help on using the changeset viewer.