1AC_PREREQ(2.60)
2
3dnl please read gstreamer/docs/random/autotools before changing this file
4
5dnl initialize autoconf
6dnl releases only do -Wall, cvs and prerelease does -Werror too
7dnl use a three digit version number for releases, and four for cvs/prerelease
8AC_INIT(Farstream, 0.2.9,
9    https://bugs.freedesktop.org/enter_bug.cgi?product=Farstream,
10    farstream)
11
12AG_GST_INIT
13
14dnl initialize automake
15AM_INIT_AUTOMAKE([-Wno-portability subdir-objects])
16
17dnl define PACKAGE_VERSION_* variables
18AS_VERSION
19
20dnl check if this is a release version
21AS_NANO(FS_GIT="no", FS_GIT="yes")
22
23dnl can autoconf find the source ?
24AC_CONFIG_SRCDIR([farstream/fs-conference.c])
25
26dnl define the output header for config
27AC_CONFIG_HEADERS([config.h])
28
29dnl sets host_* variables
30AC_CANONICAL_HOST
31
32dnl use pretty build output with automake >= 1.11
33m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
34  [AM_DEFAULT_VERBOSITY=1
35   AC_SUBST(AM_DEFAULT_VERBOSITY)])
36
37dnl our libraries and install dirs use major.minor as a version
38FS_APIVERSION=0.2
39FS_API_VERSION=0_2
40AC_SUBST(FS_APIVERSION)
41AC_SUBST(FS_API_VERSION)
42AC_DEFINE_UNQUOTED(FS_APIVERSION, "$FS_APIVERSION",
43  [Farstream x.y API version])
44AC_DEFINE_UNQUOTED(FS_API_VERSION, "$FS_APIVERSION",
45  [Farstream x_y API version])
46
47GST_API_VERSION=1.0
48AC_SUBST(GST_API_VERSION)
49AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
50  [GStreamer major.minor version])
51
52
53dnl CURRENT, REVISION, AGE
54dnl - library source changed -> increment REVISION
55dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
56dnl - interfaces added -> increment AGE
57dnl - interfaces removed -> AGE = 0
58dnl sets FS_LT_LDFLAGS
59AS_LIBTOOL(FS, 6, 1, 1)
60
61dnl FIXME: this macro doesn't actually work;
62dnl the generated libtool script has no support for the listed tags.
63dnl So this needs to be fixed first if we want to use this
64dnl AS_LIBTOOL_TAGS
65
66AM_PROG_LIBTOOL
67
68dnl *** required versions of GStreamer stuff ***
69GST_REQ=1.4
70GSTPB_REQ=1.4
71
72dnl *** autotools stuff ****
73
74dnl allow for different autotools
75AS_AUTOTOOLS_ALTERNATE
76
77dnl Add parameters for aclocal
78AC_SUBST(ACLOCAL_AMFLAGS, "-I common/m4")
79
80dnl *** check for arguments to configure ***
81
82AG_GST_ARG_DEBUG
83AG_GST_ARG_PROFILING
84AG_GST_ARG_VALGRIND
85AG_GST_ARG_GCOV
86
87AG_GST_ARG_WITH_PKG_CONFIG_PATH
88AG_GST_ARG_WITH_PACKAGE_NAME
89AG_GST_ARG_WITH_PACKAGE_ORIGIN
90
91dnl let distro override plugin install helper path
92AC_ARG_WITH(install-plugins-helper,
93  AC_HELP_STRING([--with-install-plugins-helper],
94    [specify path of helper script to call to install plugins]),
95  [
96    case "${withval}" in
97      yes) AC_MSG_ERROR(bad value ${withval} for --with-install-plugins-helper) ;;
98      no)  AC_MSG_ERROR(bad value ${withval} for --with-install-plugins-helper) ;;
99      *)   GST_INSTALL_PLUGINS_HELPER="${withval}" ;;
100    esac
101  ],
102  [
103    dnl Default value
104    AS_AC_EXPAND(GST_INSTALL_PLUGINS_HELPER,${libexecdir}/gst-install-plugins-helper)
105  ]
106)
107AC_MSG_NOTICE(Using $GST_INSTALL_PLUGINS_HELPER as plugin install helper)
108AC_DEFINE_UNQUOTED(GST_INSTALL_PLUGINS_HELPER, "$GST_INSTALL_PLUGINS_HELPER",
109    [plugin install helper script])
110AC_SUBST(GST_INSTALL_PLUGINS_HELPER)
111
112dnl these are all the gst plug-ins, compilable without additional libs
113FS_PLUGINS_ALL=" \
114	fsrawconference \
115	fsrtpconference \
116 	fsvideoanyrate \
117 	fsrtpxdata \
118	"
119AC_SUBST(FS_PLUGINS_ALL)
120
121FS_PLUGINS_SELECTED=""
122
123AC_ARG_WITH(plugins,
124    AC_HELP_STRING([--with-plugins],
125      [comma-separated list of plug-ins to compile]),
126    [for i in `echo $withval | tr , ' '`; do
127        if echo $FS_PLUGINS_ALL | grep $i > /dev/null
128        then
129            FS_PLUGINS_SELECTED="$FS_PLUGINS_SELECTED $i"
130        else
131            echo "plug-in $i not recognized, ignoring..."
132        fi
133    done],
134    [FS_PLUGINS_SELECTED=$FS_PLUGINS_ALL])
135
136AC_SUBST(FS_PLUGINS_SELECTED)
137
138dnl *** path for our local plugins ***
139
140
141dnl these are all the transmitter plug-ins
142FS_TRANSMITTER_PLUGINS_ALL=" \
143	rawudp \
144	multicast \
145	nice \
146	shm
147	"
148AC_SUBST(FS_TRANSMITTER_PLUGINS_ALL)
149
150FS_TRANSMITTER_PLUGINS_SELECTED=""
151
152TRANSMITTERS_DEFAULT=yes
153
154AC_ARG_WITH(transmitter-plugins,
155    AC_HELP_STRING([--with-transmitter-plugins],
156      [comma-separated list of plug-ins to compile]),
157    [for i in `echo $withval | tr , ' '`; do
158        if echo $FS_TRANSMITTER_PLUGINS_ALL | grep $i > /dev/null
159        then
160            FS_TRANSMITTER_PLUGINS_SELECTED="$FS_TRANSMITTER_PLUGINS_SELECTED $i"
161        else
162            echo "plug-in $i not recognized, ignoring..."
163        fi
164    done
165    TRANSMITTERS_DEFAULT=no],
166    [FS_TRANSMITTER_PLUGINS_SELECTED=$FS_TRANSMITTER_PLUGINS_ALL])
167
168
169NICE_REQUIRED=0.1.8
170
171PKG_CHECK_MODULES(NICE, \
172       nice >= $NICE_REQUIRED,, AC_MSG_ERROR([Need libnice >= $NICE_REQUIRED]))
173AC_SUBST(NICE_CFLAGS)
174AC_SUBST(NICE_LIBS)
175
176AC_SUBST(FS_TRANSMITTER_PLUGINS_SELECTED)
177
178dnl set the plugindir where plugins should be installed
179AS_AC_EXPAND(FS_PLUGIN_PATH, ${libdir}/farstream-$FS_APIVERSION)
180AC_SUBST(FS_PLUGIN_PATH)
181AC_DEFINE_UNQUOTED(FS_PLUGIN_PATH, "${FS_PLUGIN_PATH}", [The path were plugins are installed and search by default])
182
183
184dnl *** checks for platform ***
185
186dnl * hardware/architecture *
187
188AG_GST_ARCH
189
190dnl *** checks for programs ***
191
192dnl find a compiler
193AC_PROG_CC
194
195AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
196AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
197
198dnl check for gobject-introspection
199GOBJECT_INTROSPECTION_CHECK([0.10.1])
200
201dnl check for documentation tools
202GTK_DOC_CHECK([1.18])
203AG_GST_PLUGIN_DOCS([1.8],[2.1])
204
205dnl Make automake happy with per-target flags
206AM_PROG_CC_C_O
207
208dnl *** checks for libraries ***
209
210dnl For interactive UNIX (a Sun thing)
211dnl FIXME: this adds -lcposix to LIBS, but I doubt we use LIBS
212AC_ISC_POSIX
213
214dnl *** checks for header files ***
215
216dnl check if we have ANSI C header files
217AC_HEADER_STDC
218
219dnl used in gst/ffmpegcolorspace/mem.c
220dnl FIXME: could be fixed by redefining av_malloc and av_free to GLib's
221AC_CHECK_HEADERS([malloc.h])
222
223dnl *** checks for types/defines ***
224
225dnl *** checks for structures ***
226
227AC_CHECK_MEMBER([struct ip_mreqn.imr_ifindex],
228	        [AC_DEFINE([HAVE_IP_MREQN], [1], [Have the struct ip_mreqn])],
229		[],
230		[
231#include <sys/socket.h>
232#include <netinet/in.h>
233])
234
235
236dnl *** checks for compiler characteristics ***
237
238dnl *** checks for library functions ***
239
240dnl *** checks for dependency libraries ***
241
242dnl GLib is required
243AG_GST_GLIB_CHECK([2.40])
244AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_40, [Ignore post 2.40 deprecations])
245AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_40, [Prevent post 2.40 APIs])
246
247
248PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0 >= 2.40, [HAVE_GIO_UNIX=true],[HAVE_GIO_UNIX=false])
249AC_SUBST(GIO_UNIX_CFLAGS)
250AC_SUBST(GIO_UNIX_LIBS)
251AM_CONDITIONAL(HAVE_GIO_UNIX, test "x$HAVE_GIO_UNIX" = "xyes")
252
253dnl checks for gstreamer
254dnl uninstalled is selected preferentially -- see pkg-config(1)
255AG_GST_CHECK_GST($GST_API_VERSION, [$GST_REQ])
256AG_GST_CHECK_GST_BASE($GST_API_VERSION, [$GST_REQ])
257AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no)
258AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GSTPB_REQ])
259AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
260
261dnl Check for documentation xrefs
262GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
263FS_PREFIX="`$PKG_CONFIG --variable=prefix farstream-$FS_APIVERSION`"
264AC_SUBST(GLIB_PREFIX)
265AC_SUBST(FS_PREFIX)
266
267dnl *** set variables based on configure arguments ***
268
269dnl set license and copyright notice
270FS_LICENSE="LGPL"
271AC_DEFINE_UNQUOTED(FS_LICENSE, "$FS_LICENSE", [Farstream license])
272AC_SUBST(FS_LICENSE)
273
274dnl set location of plugin directory
275AG_GST_SET_PLUGINDIR
276
277dnl define an ERROR_CFLAGS Makefile variable
278AG_GST_SET_ERROR_CFLAGS($FS_GIT)
279
280dnl define correct level for debugging messages
281AG_GST_SET_LEVEL_DEFAULT($FS_GIT)
282
283AC_CHECK_FUNCS(getifaddrs)
284
285dnl *** finalize CFLAGS, LDFLAGS, LIBS
286
287dnl Overview:
288dnl FS_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
289dnl GST_*:              flags shared by built objects to link against GStreamer
290dnl FS_INTERNAL_CFLAGS: to link internally against the farstream libs
291dnl                          (compare to other modules) or for i18n
292dnl FS_ALL_LDFLAGS:    linker flags shared by all
293dnl FS_LIB_LDFLAGS:    additional linker flags for all libaries
294dnl FS_LT_LDFLAGS:     library versioning of our libraries
295dnl FS_PLUGIN_LDFLAGS: flags to be used for all plugins
296
297dnl FS_OPTION_CFLAGS
298if test "x$USE_DEBUG" = xyes; then
299   PROFILE_CFLAGS="-g"
300fi
301AC_SUBST(PROFILE_CFLAGS)
302
303dnl every flag in FS_OPTION_CFLAGS can be overridden at make time
304FS_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) -Wno-error=deprecated-declarations "
305AC_SUBST(FS_OPTION_CFLAGS)
306
307dnl our libraries need to be versioned correctly
308AC_SUBST(FS_LT_LDFLAGS)
309
310dnl FS_INTERNAL_CFLAGS
311dnl prefer internal headers to already installed ones
312dnl also add builddir include for enumtypes
313FS_INTERNAL_CFLAGS="-I\$(top_srcdir) -I\$(top_builddir)"
314AC_SUBST(FS_INTERNAL_CFLAGS)
315
316dnl FIXME: do we want to rename to GST_ALL_* ?
317dnl add FS_OPTION_CFLAGS, but overridable
318FS_CFLAGS="$GST_CFLAGS \$(FS_OPTION_CFLAGS)"
319AC_SUBST(FS_CFLAGS)
320
321dnl add GCOV libs because libtool strips -fprofile-arcs -ftest-coverage
322FS_LIBS="$GST_LIBS \$(GCOV_LIBS)"
323AC_SUBST(FS_LIBS)
324
325dnl LDFLAGS really should only contain flags, not libs - they get added before
326dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
327FS_ALL_LDFLAGS="-no-undefined"
328AC_SUBST(FS_ALL_LDFLAGS)
329
330dnl FS_LIB_LDFLAGS
331dnl linker flags shared by all libraries
332dnl LDFLAGS modifier defining exported symbols from built libraries
333FS_LIB_LDFLAGS="-export-symbols-regex ^fs_.*"
334AC_SUBST(FS_LIB_LDFLAGS)
335
336dnl this really should only contain flags, not libs - they get added before
337dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
338FS_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*fs_.*plugin.*' $FS_ALL_LDFLAGS"
339AC_SUBST(FS_PLUGIN_LDFLAGS)
340
341dnl this really should only contain flags, not libs - they get added before
342dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
343GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_.*' $FS_ALL_LDFLAGS"
344AC_SUBST(GST_PLUGIN_LDFLAGS)
345
346AC_ARG_ENABLE([gupnp],
347	AC_HELP_STRING([--disable-gupnp], [Disable GUPnP IGD support]),
348	[case "${enableval}" in
349	    yes) WANT_GUPNP=yes ;;
350	    no)  WANT_GUPNP=no ;;
351	    *) AC_MSG_ERROR(bad value ${enableval} for --enable-gupnp) ;;
352        esac],
353	WANT_GUPNP=test)
354
355HAVE_GUPNP=no
356if test "x$WANT_GUPNP" != "xno"; then
357   PKG_CHECK_MODULES(GUPNP, [ gupnp-igd-1.0 >= 0.2 ],
358    [ HAVE_GUPNP=yes ],
359    [ HAVE_GUPNP=no ])
360fi
361if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then
362   AC_ERROR([Requested GUPnP IGD, but it is not available])
363fi
364
365if test "x$HAVE_GUPNP" = "xyes"; then
366   AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
367fi
368
369dnl build static plugins or not
370AC_MSG_CHECKING([whether to build static plugins or not])
371AC_ARG_ENABLE(
372  static-plugins,
373  AC_HELP_STRING(
374    [--enable-static-plugins],
375    [build static plugins @<:@default=no@:>@]),
376  [AS_CASE(
377    [$enableval], [no], [], [yes], [],
378    [AC_MSG_ERROR([bad value "$enableval" for --enable-static-plugins])])],
379  [enable_static_plugins=no])
380AC_MSG_RESULT([$enable_static_plugins])
381if test "x$enable_static_plugins" = xyes; then
382  AS_IF([test x$enable_static = xno], [AC_MSG_ERROR([--enable-static-plugins requires --enable-static to work])])
383  AC_DEFINE(GST_PLUGIN_BUILD_STATIC, 1,
384    [Define if static plugins should be built])
385  PLUGIN_LIBTOOLFLAGS=""
386else
387  PLUGIN_LIBTOOLFLAGS="--tag=disable-static"
388fi
389AC_SUBST(PLUGIN_LIBTOOLFLAGS)
390AM_CONDITIONAL(GST_PLUGIN_BUILD_STATIC, test "x$enable_static_plugins" = "xyes")
391
392dnl *** output files ***
393
394AC_CONFIG_FILES(
395Makefile
396farstream.pc
397farstream-uninstalled.pc
398common/Makefile
399common/m4/Makefile
400common-modified/Makefile
401gst/Makefile
402gst/fsrawconference/Makefile
403gst/fsrtpconference/Makefile
404gst/fsvideoanyrate/Makefile
405gst/fsrtpxdata/Makefile
406farstream/Makefile
407transmitters/Makefile
408transmitters/rawudp/Makefile
409transmitters/multicast/Makefile
410transmitters/nice/Makefile
411transmitters/shm/Makefile
412dnl pkgconfig/Makefile
413dnl pkgconfig/farstream.pc
414dnl pkgconfig/farstream-uninstalled.pc
415tests/Makefile
416tests/check/Makefile
417tests/rtp/Makefile
418examples/Makefile
419examples/gui/Makefile
420examples/commandline/Makefile
421docs/Makefile
422docs/libs/Makefile
423docs/plugins/Makefile
424docs/version.entities
425dnl docs/plugins/Makefile
426)
427AC_OUTPUT
428