forked from dajhorn/dante
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminiupnpc.m4
101 lines (90 loc) · 3.54 KB
/
miniupnpc.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#miniupnpc
AC_ARG_WITH(upnp,
[ --without-upnp disable upnp support @<:@default=detect@:>@],
[UPNP=$withval])
no_upnp=t
if test x"${UPNP}" != xno; then
AC_MSG_CHECKING([for miniupnpc headers])
AC_TRY_COMPILE([#include <miniupnpc/miniupnpc.h>],
[struct UPNPDev upnpdev;],
[AC_MSG_RESULT(yes)
upnphdr=t],
[AC_MSG_RESULT(no)
unset upnphdr])
if test "x$upnphdr" = "xt"; then
oLIBS=$LIBS
AC_SEARCH_LIBS(UPNP_GetValidIGD, miniupnpc, [have_libminiupnp=t])
UPNPLIB=$LIBS
LIBS=$oLIBS
fi
if test x"${have_libminiupnp}" = xt; then
AC_MSG_CHECKING([for miniupnpc version >= 1.7])
AC_TRY_COMPILE([
#include <stdio.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>], [
#ifndef MINIUPNPC_API_VERSION
#error "no api version define"
#else
# if MINIUPNPC_API_VERSION < 8
#error "api version too low"
# endif
#endif],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBMINIUPNP, 1, [UPNP support library])
AC_DEFINE(HAVE_LIBMINIUPNP17, 1, [UPNP support library 1.7])
unset no_upnp
SOCKDDEPS="${SOCKDDEPS}${SOCKDDEPS:+ }$UPNPLIB"
DLIBDEPS="${DLIBDEPS}${DLIBDEPS:+ }$UPNPLIB"],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING([for miniupnpc version >= 1.4])
AC_TRY_COMPILE([
#include <stdio.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>], [
char *str = NULL;
struct UPNPDev *UPNPDev;
struct UPNPUrls *UPNPUrls = NULL;
struct IGDdatas *IGDdatas = NULL;
(void)sizeof(IGDdatas->CIF.servicetype);
(void)UPNP_GetIGDFromUrl(str, UPNPUrls, IGDdatas, str, 0);
(void)UPNP_GetValidIGD(UPNPDev, UPNPUrls, IGDdatas, str, 0);
(void)UPNP_GetExternalIPAddress(str, str, str);
(void)UPNP_AddPortMapping(str, str, str, str, str, str, str, str);
(void)UPNP_DeletePortMapping(str, str, str, str, str);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBMINIUPNP, 1, [UPNP support library])
AC_DEFINE(HAVE_LIBMINIUPNP14, 1, [UPNP support library 1.4])
unset no_upnp
SOCKDDEPS="${SOCKDDEPS}${SOCKDDEPS:+ }$UPNPLIB"
DLIBDEPS="${DLIBDEPS}${DLIBDEPS:+ }$UPNPLIB"],
[AC_MSG_RESULT(no)])
if test x"${no_upnp}" != x; then
AC_MSG_CHECKING([for miniupnpc version 1.3])
AC_TRY_COMPILE([
#include <stdio.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>], [
char *str = NULL;
struct UPNPDev *UPNPDev;
struct UPNPUrls *UPNPUrls = NULL;
struct IGDdatas *IGDdatas = NULL;
(void)strlen(IGDdatas->servicetype);
(void)UPNP_GetIGDFromUrl(str, UPNPUrls, IGDdatas, str, 0);
(void)UPNP_GetValidIGD(UPNPDev, UPNPUrls, IGDdatas, str, 0);
(void)UPNP_GetExternalIPAddress(str, str, str);
(void)UPNP_AddPortMapping(str, str, str, str, str, str, str, str);
(void)UPNP_DeletePortMapping(str, str, str, str, str);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBMINIUPNP, 1, [UPNP support library])
AC_DEFINE(HAVE_LIBMINIUPNP13, 1, [UPNP support library 1.3])
unset no_upnp
SOCKDDEPS="${SOCKDDEPS}${SOCKDDEPS:+ }$UPNPLIB"
DLIBDEPS="${DLIBDEPS}${DLIBDEPS:+ }$UPNPLIB"],
[AC_MSG_RESULT(no)])
fi
fi
fi