Fix test-dribble
[sipe-libnice.git] / configure.ac
blob71286c8ce9bd9c818e29ad7bfb58806bef81cec9
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.1.2.1)
7 LIBNICE_RELEASE="no"
9 AC_CANONICAL_SYSTEM
11 AC_CONFIG_SRCDIR([agent/agent.c])
12 AC_CONFIG_HEADER([config.h])
13 AM_INIT_AUTOMAKE([-Wall])
15 AC_CONFIG_FILES([
16         Makefile
17         agent/Makefile
18         stun/Makefile
19         stun/tests/Makefile
20         stun/tools/Makefile
21         socket/Makefile
22         nice/Makefile
23         nice/nice.pc
24         random/Makefile
25         gst/Makefile
26         docs/Makefile
27         docs/reference/Makefile
28         docs/reference/libnice/Makefile
29         tests/Makefile
30         ])
32 # Set the libtool C/A/R version info
33 #    If the source code was changed, but there were no interface changes:
34 #      Increment REVISION.
35 #    If there was a compatible interface change:
36 #      Increment CURRENT and AGE. Set REVISION to 0
37 #    If there was an incompatible interface change:
38 #      Increment CURRENT. Set AGE and REVISION to 0
39 LIBNICE_CURRENT=10
40 LIBNICE_REVISION=2
41 LIBNICE_AGE=0
42 LIBNICE_LIBVERSION=${LIBNICE_CURRENT}:${LIBNICE_REVISION}:${LIBNICE_AGE}
43 LIBNICE_LT_LDFLAGS="-version-info ${LIBNICE_LIBVERSION} -no-undefined"
44 AC_SUBST(LIBNICE_LT_LDFLAGS)
47 dnl use pretty build output with automake >= 1.11
48 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
49   [AM_DEFAULT_VERBOSITY=1
50    AC_SUBST(AM_DEFAULT_VERBOSITY)])
53 # Checks for programs.
55 AC_PROG_CC
56 AC_USE_SYSTEM_EXTENSIONS
57 AC_PROG_LIBTOOL
59 # Check Operating System
60 AC_MSG_CHECKING([operating system])
61 case "$host" in
62         *-*-*mingw*|*-*-*cygwin*)
63                 platform=win32
64                 AC_MSG_RESULT($platform)
65                 ;;
66         *)
67                 platform=linux/other
68                 AC_MSG_RESULT($platform)
69                 ;;
70 esac
72 AM_CONDITIONAL([WINDOWS], [test "$platform" = "win32"])
74 # Checks for compiler features
76 AC_C_RESTRICT
77 AC_C_VARARRAYS
78 AC_HEADER_ASSERT
79 AC_HEADER_STDBOOL
80 AC_DEFINE([_FORTIFY_SOURCE], [2], [Define to `2' to get GNU/libc warnings.])
81 AC_DEFINE([NICEAPI_EXPORT], [ ], [Public library function implementation])
82 AC_CHECK_HEADERS([arpa/inet.h net/in.h])
83 AC_CHECK_HEADERS([ifaddrs.h], \
84                       [AC_DEFINE(HAVE_GETIFADDRS, [1], \
85                        [Whether getifaddrs() is available on the system])])
87 LIBNICE_CFLAGS="-Wall"
88 dnl if asked for, add -Werror if supported
89 if test "x$LIBNICE_RELEASE" != "xyes"; then
90   LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror"
93 AC_SUBST(LIBNICE_CFLAGS)
94 AC_MSG_NOTICE([set LIBNICE_CFLAGS to $LIBNICE_CFLAGS])
96 # Checks for libraries.
97 AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
98 AC_CHECK_FUNCS([poll])
99 AC_SUBST(LIBRT)
101 PKG_CHECK_MODULES(GLIB, [dnl
102         glib-2.0 >= 2.13 dnl
103         gobject-2.0 >= 2.13 dnl
104         gthread-2.0 >= 2.13 dnl
105         gio-2.0 >= 2.13 dnl
106         ])
108 AC_ARG_WITH(gstreamer, 
109         AC_HELP_STRING([--with-gstreamer], [use GStreamer]),
110         [with_gstreamer=${withval}],
111         [with_gstreamer=auto])
113 AS_IF([test "$with_gstreamer" != no], [
114   
115         PKG_CHECK_MODULES(GST, [
116                 gstreamer-0.10 >= 0.10.0
117                 gstreamer-base-0.10 >= 0.10.0
118                 ],
119                 [
120                 with_gstreamer=yes
121                 GST_MAJORMINOR=0.10
122                 gstplugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
123                 ],
124                 [
125                 AS_IF([test "$with_gstreamer" = yes], [
126                         AC_MSG_ERROR([GStreamer support was requested but GStreamer libraries are not available])
127                 ])
129                 with_gstreamer=no
130                 ])
133 AC_SUBST(gstplugindir)
135 AM_CONDITIONAL(WITH_GSTREAMER, test "$with_gstreamer" = yes)
137 GUPNP_IGD_REQUIRED=0.1.2
139 AC_ARG_ENABLE([gupnp],
140         AC_HELP_STRING([--disable-gupnp], [Disable GUPnP IGD support]),
141         [case "${enableval}" in
142             yes) WANT_GUPNP=yes ;;
143             no)  WANT_GUPNP=no ;;
144             *) AC_MSG_ERROR(bad value ${enableval} for --enable-gupnp) ;;
145         esac],
146         WANT_GUPNP=test)
148 HAVE_GUPNP=no
149 if test "x$WANT_GUPNP" != "xno"; then
150    PKG_CHECK_MODULES(GUPNP, gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED,
151     [ HAVE_GUPNP=yes ],
152     [ HAVE_GUPNP=no ])
154 if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then
155    AC_ERROR([Requested GUPnP IGD, but it is not available])
158 if test "x$HAVE_GUPNP" = "xyes"; then
159    AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
162 AC_SUBST(HAVE_GUPNP)
164 dnl Test coverage
165 AC_ARG_ENABLE([coverage],
166         [AS_HELP_STRING([--enable-coverage],
167                 [build for test coverage (default disabled)])],,
168         [enable_coverage="no"])
169 AS_IF([test "${enable_coverage}" != "no"], [
170         CFLAGS="${CFLAGS} -g -O0 -fprofile-arcs -ftest-coverage"
171         LDFLAGS="-lgcov"
172         CCACHE_DISABLE=1
174 AC_SUBST(CCACHE_DISABLE)
176 case $host_os in
177   solaris*)
178     LDFLAGS="$LDFLAGS -lsocket -lnls"
179     ;;
180   *)
181     ;;
182 esac
184 # check for gtk-doc
185 m4_ifdef([GTK_DOC_CHECK], [
186 GTK_DOC_CHECK(1.9)
188 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
190 AC_CONFIG_MACRO_DIR(m4)
192 AC_OUTPUT