g_free is NULL-safe
[sipe-libnice.git] / configure.ac
blob8b3a6e226c3c6b757ed1be6e82b2a35c7d4f139b
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.12)
7 LIBNICE_RELEASE="yes"
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 #    If the source code was changed, but there were no interface changes:
31 #      Increment REVISION.
32 #    If there was a compatible interface change:
33 #      Increment CURRENT and AGE. Set REVISION to 0
34 #    If there was an incompatible interface change:
35 #      Increment CURRENT. Set AGE and REVISION to 0
36 LIBNICE_CURRENT=8
37 LIBNICE_REVISION=0
38 LIBNICE_AGE=8
39 LIBNICE_LIBVERSION=${LIBNICE_CURRENT}:${LIBNICE_REVISION}:${LIBNICE_AGE}
40 LIBNICE_LT_LDFLAGS="-version-info ${LIBNICE_LIBVERSION}"
41 AC_SUBST(LIBNICE_LT_LDFLAGS)
44 # Checks for programs.
46 AC_PROG_CC
47 AC_USE_SYSTEM_EXTENSIONS
48 AC_PROG_LIBTOOL
51 # Checks for compiler features
53 AC_C_RESTRICT
54 AC_C_VARARRAYS
55 AC_HEADER_ASSERT
56 AC_HEADER_STDBOOL
57 AC_DEFINE([_FORTIFY_SOURCE], [2], [Define to `2' to get GNU/libc warnings.])
58 AC_DEFINE([NICEAPI_EXPORT], [ ], [Public library function implementation])
59 AC_CHECK_HEADERS([arpa/inet.h net/in.h ifaddrs.h], \
60                       [AC_DEFINE(HAVE_GETIFADDRS, [1], \
61                        [Whether getifaddrs() is available on the system])])
63 LIBNICE_CFLAGS="-Wall"
64 dnl if asked for, add -Werror if supported
65 if test "x$LIBNICE_RELEASE" != "xyes"; then
66   LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror"
69 AC_SUBST(LIBNICE_CFLAGS)
70 AC_MSG_NOTICE([set LIBNICE_CFLAGS to $LIBNICE_CFLAGS])
72 # Checks for libraries.
73 AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
74 AC_CHECK_FUNCS([poll])
75 AC_SUBST(LIBRT)
77 PKG_CHECK_MODULES(GLIB, [dnl
78         glib-2.0 >= 2.10 dnl
79         gobject-2.0 >= 2.10 dnl
80         gthread-2.0 >= 2.10 dnl
81         ])
83 AC_ARG_WITH(gstreamer, 
84         AC_HELP_STRING([--with-gstreamer], [use GStreamer]),
85         [with_gstreamer=${withval}],
86         [with_gstreamer=auto])
88 AS_IF([test "$with_gstreamer" != no], [
89   
90         PKG_CHECK_MODULES(GST, [
91                 gstreamer-0.10 >= 0.10.0
92                 gstreamer-base-0.10 >= 0.10.0
93                 ],
94                 [
95                 with_gstreamer=yes
96                 GST_MAJORMINOR=0.10
97                 gstplugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
98                 ],
99                 [
100                 AS_IF([test "$with_gstreamer" = yes], [
101                         AC_MSG_ERROR([GStreamer support was requested but GStreamer libraries are not available])
102                 ])
104                 with_gstreamer=no
105                 ])
108 AC_SUBST(gstplugindir)
110 AM_CONDITIONAL(WITH_GSTREAMER, test "$with_gstreamer" = yes)
112 GUPNP_IGD_REQUIRED=0.1.2
114 AC_ARG_ENABLE([gupnp],
115         AC_HELP_STRING([--disable-gupnp], [Disable GUPnP IGD support]),
116         [case "${enableval}" in
117             yes) WANT_GUPNP=yes ;;
118             no)  WANT_GUPNP=no ;;
119             *) AC_MSG_ERROR(bad value ${enableval} for --enable-gupnp) ;;
120         esac],
121         WANT_GUPNP=test)
123 HAVE_GUPNP=no
124 if test "x$WANT_GUPNP" != "xno"; then
125    PKG_CHECK_MODULES(GUPNP, gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED,
126     [ HAVE_GUPNP=yes ],
127     [ HAVE_GUPNP=no ])
129 if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then
130    AC_ERROR([Requested GUPnP IGD, but it is not available])
133 if test "x$HAVE_GUPNP" = "xyes"; then
134    AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
137 AC_SUBST(HAVE_GUPNP)
139 dnl Test coverage
140 AC_ARG_ENABLE([coverage],
141         [AS_HELP_STRING([--enable-coverage],
142                 [build for test coverage (default disabled)])],,
143         [enable_coverage="no"])
144 AS_IF([test "${enable_coverage}" != "no"], [
145         CFLAGS="${CFLAGS} -g -O0 -fprofile-arcs -ftest-coverage"
146         LDFLAGS="-lgcov"
147         CCACHE_DISABLE=1
149 AC_SUBST(CCACHE_DISABLE)
151 # check for gtk-doc
152 GTK_DOC_CHECK(1.9)
153 AC_CONFIG_MACRO_DIR(m4)
155 AC_OUTPUT