summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 48c826787289cad29c2b7766fcdb90cbd97ea6cf (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

AC_PREREQ(2.59c)

dnl releases only do -Wall, cvs and prerelease does -Werror too
dnl use a three digit version number for releases, and four for cvs/prerelease
AC_INIT(libnice, 0.1.2)
LIBNICE_RELEASE="yes"

AC_CANONICAL_SYSTEM

AC_CONFIG_SRCDIR([agent/agent.c])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([-Wall])

AC_CONFIG_FILES([
	Makefile
	agent/Makefile
	stun/Makefile
	stun/tests/Makefile
	stun/tools/Makefile
	socket/Makefile
	nice/Makefile
	nice/nice.pc
	random/Makefile
	gst/Makefile
	docs/Makefile
	docs/reference/Makefile
	docs/reference/libnice/Makefile
	tests/Makefile
	])

# Set the libtool C/A/R version info
#    If the source code was changed, but there were no interface changes:
#      Increment REVISION.
#    If there was a compatible interface change:
#      Increment CURRENT and AGE. Set REVISION to 0
#    If there was an incompatible interface change:
#      Increment CURRENT. Set AGE and REVISION to 0
LIBNICE_CURRENT=10
LIBNICE_REVISION=2
LIBNICE_AGE=0
LIBNICE_LIBVERSION=${LIBNICE_CURRENT}:${LIBNICE_REVISION}:${LIBNICE_AGE}
LIBNICE_LT_LDFLAGS="-version-info ${LIBNICE_LIBVERSION} -no-undefined"
AC_SUBST(LIBNICE_LT_LDFLAGS)


dnl use pretty build output with automake >= 1.11
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
  [AM_DEFAULT_VERBOSITY=1
   AC_SUBST(AM_DEFAULT_VERBOSITY)])


# Checks for programs.

AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_LIBTOOL

# Check Operating System
AC_MSG_CHECKING([operating system])
case "$host" in
	*-*-*mingw*|*-*-*cygwin*)
		platform=win32
		AC_MSG_RESULT($platform)
		;;
	*)
		platform=linux/other
		AC_MSG_RESULT($platform)
		;;
esac

AM_CONDITIONAL([WINDOWS], [test "$platform" = "win32"])

# Checks for compiler features

AC_C_RESTRICT
AC_C_VARARRAYS
AC_HEADER_ASSERT
AC_HEADER_STDBOOL
AC_DEFINE([_FORTIFY_SOURCE], [2], [Define to `2' to get GNU/libc warnings.])
AC_DEFINE([NICEAPI_EXPORT], [ ], [Public library function implementation])
AC_CHECK_HEADERS([arpa/inet.h net/in.h])
AC_CHECK_HEADERS([ifaddrs.h], \
		      [AC_DEFINE(HAVE_GETIFADDRS, [1], \
		       [Whether getifaddrs() is available on the system])])

LIBNICE_CFLAGS="-Wall"
dnl if asked for, add -Werror if supported
if test "x$LIBNICE_RELEASE" != "xyes"; then
  LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror"
fi

AC_SUBST(LIBNICE_CFLAGS)
AC_MSG_NOTICE([set LIBNICE_CFLAGS to $LIBNICE_CFLAGS])

# Checks for libraries.
AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
AC_CHECK_FUNCS([poll])
AC_SUBST(LIBRT)

PKG_CHECK_MODULES(GLIB, [dnl
	glib-2.0 >= 2.13 dnl
	gobject-2.0 >= 2.13 dnl
	gthread-2.0 >= 2.13 dnl
	gio-2.0 >= 2.13 dnl
	])

AC_ARG_WITH(gstreamer, 
	AC_HELP_STRING([--with-gstreamer], [use GStreamer]),
	[with_gstreamer=${withval}],
	[with_gstreamer=auto])

AS_IF([test "$with_gstreamer" != no], [
  
	PKG_CHECK_MODULES(GST, [
		gstreamer-0.10 >= 0.10.0
		gstreamer-base-0.10 >= 0.10.0
		],
		[
		with_gstreamer=yes
		GST_MAJORMINOR=0.10
		gstplugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
		],
		[
		AS_IF([test "$with_gstreamer" = yes], [
			AC_MSG_ERROR([GStreamer support was requested but GStreamer libraries are not available])
		])

		with_gstreamer=no
		])
])

AC_SUBST(gstplugindir)

AM_CONDITIONAL(WITH_GSTREAMER, test "$with_gstreamer" = yes)

GUPNP_IGD_REQUIRED=0.1.2

AC_ARG_ENABLE([gupnp],
        AC_HELP_STRING([--disable-gupnp], [Disable GUPnP IGD support]),
        [case "${enableval}" in
            yes) WANT_GUPNP=yes ;;
            no)  WANT_GUPNP=no ;;
            *) AC_MSG_ERROR(bad value ${enableval} for --enable-gupnp) ;;
        esac],
        WANT_GUPNP=test)

HAVE_GUPNP=no
if test "x$WANT_GUPNP" != "xno"; then
   PKG_CHECK_MODULES(GUPNP, gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED,
    [ HAVE_GUPNP=yes ],
    [ HAVE_GUPNP=no ])
fi
if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then
   AC_ERROR([Requested GUPnP IGD, but it is not available])
fi

if test "x$HAVE_GUPNP" = "xyes"; then
   AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
fi

AC_SUBST(HAVE_GUPNP)

dnl Test coverage
AC_ARG_ENABLE([coverage],
	[AS_HELP_STRING([--enable-coverage],
		[build for test coverage (default disabled)])],,
	[enable_coverage="no"])
AS_IF([test "${enable_coverage}" != "no"], [
	CFLAGS="${CFLAGS} -g -O0 -fprofile-arcs -ftest-coverage"
	LDFLAGS="-lgcov"
	CCACHE_DISABLE=1
])
AC_SUBST(CCACHE_DISABLE)

case $host_os in
  solaris*)
    LDFLAGS="$LDFLAGS -lsocket -lnls"
    ;;
  *)
    ;;
esac

# check for gtk-doc
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK(1.9)
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
AC_CONFIG_MACRO_DIR(m4)

AC_OUTPUT