Link manual building with GUPNP if available
[sipe-libnice.git] / configure.ac
blob952731cb0d60559fdc77974ce002e7527a6a9064
2 AC_PREREQ(2.59c)
4 dnl releases only do -Wall, cvs and prerelease does -Werror too
5 dnl use a three digit version number for releases, and four for cvs/prerelease
6 AC_INIT(libnice, 0.0.6.1)
7 LIBNICE_RELEASE="no"
9 AC_CONFIG_SRCDIR([agent/agent.c])
10 AC_CONFIG_HEADER([config.h])
11 AM_INIT_AUTOMAKE([-Wall])
12 AC_CONFIG_FILES([
13         Makefile
14         agent/Makefile
15         stun/Makefile
16         stun/tests/Makefile
17         stun/tools/Makefile
18         socket/Makefile
19         nice/Makefile
20         nice/nice.pc
21         random/Makefile
22         gst/Makefile
23         docs/Makefile
24         docs/reference/Makefile
25         docs/reference/libnice/Makefile
26         tests/Makefile
27         ])
29 # Set the libtool C/A/R version info
30 LIBNICE_CURRENT=4
31 LIBNICE_REVISION=0
32 LIBNICE_AGE=4
33 LIBNICE_LIBVERSION=${LIBNICE_CURRENT}:${LIBNICE_REVISION}:${LIBNICE_AGE}
34 LIBNICE_LT_LDFLAGS="-version-info ${LIBNICE_LIBVERSION}"
35 AC_SUBST(LIBNICE_LT_LDFLAGS)
38 # Checks for programs.
40 AC_PROG_CC
41 AC_USE_SYSTEM_EXTENSIONS
42 AC_PROG_LIBTOOL
45 # Checks for compiler features
47 AC_C_RESTRICT
48 AC_C_VARARRAYS
49 AC_HEADER_ASSERT
50 AC_HEADER_STDBOOL
51 AC_DEFINE([_FORTIFY_SOURCE], [2], [Define to `2' to get GNU/libc warnings.])
52 AC_DEFINE([NICEAPI_EXPORT], [ ], [Public library function implementation])
53 AC_CHECK_HEADERS([arpa/inet.h net/in.h ifaddrs.h])
55 LIBNICE_CFLAGS="-Wall"
56 dnl if asked for, add -Werror if supported
57 if test "x$LIBNICE_RELEASE" != "xyes"; then
58   LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror"
61 AC_SUBST(LIBNICE_CFLAGS)
62 AC_MSG_NOTICE([set LIBNICE_CFLAGS to $LIBNICE_CFLAGS])
64 # Checks for libraries.
65 AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
66 AC_CHECK_FUNCS([poll])
67 AC_SUBST(LIBRT)
69 PKG_CHECK_MODULES(GLIB, [dnl
70         glib-2.0 >= 2.10 dnl
71         gobject-2.0 >= 2.10 dnl
72         gthread-2.0 >= 2.10 dnl
73         ])
75 AC_ARG_WITH(gstreamer, 
76         AC_HELP_STRING([--with-gstreamer], [use GStreamer]),
77         [with_gstreamer=${withval}],
78         [with_gstreamer=auto])
80 AS_IF([test "$with_gstreamer" != no], [
81   
82         PKG_CHECK_MODULES(GST, [
83                 gstreamer-0.10 >= 0.10.0
84                 gstreamer-base-0.10 >= 0.10.0
85                 ],
86                 [
87                 with_gstreamer=yes
88                 GST_MAJORMINOR=0.10
89                 gstplugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
90                 ],
91                 [
92                 AS_IF([test "$with_gstreamer" = yes], [
93                         AC_MSG_ERROR([GStreamer support was requested but GStreamer libraries are not available])
94                 ])
96                 with_gstreamer=no
97                 ])
100 AC_SUBST(gstplugindir)
102 AM_CONDITIONAL(WITH_GSTREAMER, test "$with_gstreamer" = yes)
104 GUPNP_IGD_REQUIRED=0.1.2
106 AC_ARG_ENABLE([gupnp],
107         AC_HELP_STRING([--disable-gupnp], [Disable GUPnP IGD support]),
108         [case "${enableval}" in
109             yes) WANT_GUPNP=yes ;;
110             no)  WANT_GUPNP=no ;;
111             *) AC_MSG_ERROR(bad value ${enableval} for --enable-gupnp) ;;
112         esac],
113         WANT_GUPNP=test)
115 HAVE_GUPNP=no
116 if test "x$WANT_GUPNP" != "xno"; then
117    PKG_CHECK_MODULES(GUPNP, gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED,
118     [ HAVE_GUPNP=yes ],
119     [ HAVE_GUPNP=no ])
121 if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then
122    AC_ERROR([Requested GUPnP IGD, but it is not available])
125 if test "x$HAVE_GUPNP" = "xyes"; then
126    AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
129 AC_SUBST(HAVE_GUPNP)
131 dnl Test coverage
132 AC_ARG_ENABLE([coverage],
133         [AS_HELP_STRING([--enable-coverage],
134                 [build for test coverage (default disabled)])],,
135         [enable_coverage="no"])
136 AS_IF([test "${enable_coverage}" != "no"], [
137         CFLAGS="${CFLAGS} -g -O0 -fprofile-arcs -ftest-coverage"
138         LDFLAGS="-lgcov"
139         CCACHE_DISABLE=1
141 AC_SUBST(CCACHE_DISABLE)
143 # check for gtk-doc
144 GTK_DOC_CHECK(1.9)
145 AC_CONFIG_MACRO_DIR(m4)
147 AC_OUTPUT