summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 1efed1321a3822d7561aabd51a14b44b0050c01c (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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
AC_PREREQ(2.60)

dnl please read gstreamer/docs/random/autotools before changing this file

dnl initialize autoconf
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(Farstream, 0.2.9.1,
    https://bugs.freedesktop.org/enter_bug.cgi?product=Farstream,
    farstream)

AG_GST_INIT

dnl initialize automake
AM_INIT_AUTOMAKE([-Wno-portability subdir-objects])

dnl define PACKAGE_VERSION_* variables
AS_VERSION

dnl check if this is a release version
AS_NANO(FS_GIT="no", FS_GIT="yes")

dnl can autoconf find the source ?
AC_CONFIG_SRCDIR([farstream/fs-conference.c])

dnl define the output header for config
AC_CONFIG_HEADERS([config.h])

dnl sets host_* variables
AC_CANONICAL_HOST

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)])

dnl our libraries and install dirs use major.minor as a version
FS_APIVERSION=0.2
FS_API_VERSION=0_2
AC_SUBST(FS_APIVERSION)
AC_SUBST(FS_API_VERSION)
AC_DEFINE_UNQUOTED(FS_APIVERSION, "$FS_APIVERSION",
  [Farstream x.y API version])
AC_DEFINE_UNQUOTED(FS_API_VERSION, "$FS_APIVERSION",
  [Farstream x_y API version])

GST_API_VERSION=1.0
AC_SUBST(GST_API_VERSION)
AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
  [GStreamer major.minor version])


dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0
dnl sets FS_LT_LDFLAGS
AS_LIBTOOL(FS, 6, 1, 1)

dnl FIXME: this macro doesn't actually work;
dnl the generated libtool script has no support for the listed tags.
dnl So this needs to be fixed first if we want to use this
dnl AS_LIBTOOL_TAGS

AM_PROG_LIBTOOL

dnl *** required versions of GStreamer stuff ***
GST_REQ=1.4
GSTPB_REQ=1.4

dnl *** autotools stuff ****

dnl allow for different autotools
AS_AUTOTOOLS_ALTERNATE

dnl Add parameters for aclocal
AC_SUBST(ACLOCAL_AMFLAGS, "-I common/m4")

dnl *** check for arguments to configure ***

AG_GST_ARG_DEBUG
AG_GST_ARG_PROFILING
AG_GST_ARG_VALGRIND
AG_GST_ARG_GCOV

AG_GST_ARG_WITH_PKG_CONFIG_PATH
AG_GST_ARG_WITH_PACKAGE_NAME
AG_GST_ARG_WITH_PACKAGE_ORIGIN

dnl let distro override plugin install helper path
AC_ARG_WITH(install-plugins-helper,
  AC_HELP_STRING([--with-install-plugins-helper],
    [specify path of helper script to call to install plugins]),
  [
    case "${withval}" in
      yes) AC_MSG_ERROR(bad value ${withval} for --with-install-plugins-helper) ;;
      no)  AC_MSG_ERROR(bad value ${withval} for --with-install-plugins-helper) ;;
      *)   GST_INSTALL_PLUGINS_HELPER="${withval}" ;;
    esac
  ],
  [
    dnl Default value
    AS_AC_EXPAND(GST_INSTALL_PLUGINS_HELPER,${libexecdir}/gst-install-plugins-helper)
  ]
)
AC_MSG_NOTICE(Using $GST_INSTALL_PLUGINS_HELPER as plugin install helper)
AC_DEFINE_UNQUOTED(GST_INSTALL_PLUGINS_HELPER, "$GST_INSTALL_PLUGINS_HELPER",
    [plugin install helper script])
AC_SUBST(GST_INSTALL_PLUGINS_HELPER)

dnl these are all the gst plug-ins, compilable without additional libs
FS_PLUGINS_ALL=" \
	fsrawconference \
	fsrtpconference \
 	fsvideoanyrate \
 	fsrtpxdata \
	"
AC_SUBST(FS_PLUGINS_ALL)

FS_PLUGINS_SELECTED=""

AC_ARG_WITH(plugins,
    AC_HELP_STRING([--with-plugins],
      [comma-separated list of plug-ins to compile]),
    [for i in `echo $withval | tr , ' '`; do
        if echo $FS_PLUGINS_ALL | grep $i > /dev/null
        then
            FS_PLUGINS_SELECTED="$FS_PLUGINS_SELECTED $i"
        else
            echo "plug-in $i not recognized, ignoring..."
        fi
    done],
    [FS_PLUGINS_SELECTED=$FS_PLUGINS_ALL])

AC_SUBST(FS_PLUGINS_SELECTED)

dnl *** path for our local plugins ***


dnl these are all the transmitter plug-ins
FS_TRANSMITTER_PLUGINS_ALL=" \
	rawudp \
	multicast \
	nice \
	shm
	"
AC_SUBST(FS_TRANSMITTER_PLUGINS_ALL)

FS_TRANSMITTER_PLUGINS_SELECTED=""

TRANSMITTERS_DEFAULT=yes

AC_ARG_WITH(transmitter-plugins,
    AC_HELP_STRING([--with-transmitter-plugins],
      [comma-separated list of plug-ins to compile]),
    [for i in `echo $withval | tr , ' '`; do
        if echo $FS_TRANSMITTER_PLUGINS_ALL | grep $i > /dev/null
        then
            FS_TRANSMITTER_PLUGINS_SELECTED="$FS_TRANSMITTER_PLUGINS_SELECTED $i"
        else
            echo "plug-in $i not recognized, ignoring..."
        fi
    done
    TRANSMITTERS_DEFAULT=no],
    [FS_TRANSMITTER_PLUGINS_SELECTED=$FS_TRANSMITTER_PLUGINS_ALL])


NICE_REQUIRED=0.1.8

PKG_CHECK_MODULES(NICE, \
       nice >= $NICE_REQUIRED,, AC_MSG_ERROR([Need libnice >= $NICE_REQUIRED]))
AC_SUBST(NICE_CFLAGS)
AC_SUBST(NICE_LIBS)

AC_SUBST(FS_TRANSMITTER_PLUGINS_SELECTED)

dnl set the plugindir where plugins should be installed
AS_AC_EXPAND(FS_PLUGIN_PATH, ${libdir}/farstream-$FS_APIVERSION)
AC_SUBST(FS_PLUGIN_PATH)
AC_DEFINE_UNQUOTED(FS_PLUGIN_PATH, "${FS_PLUGIN_PATH}", [The path were plugins are installed and search by default])


dnl *** checks for platform ***

dnl * hardware/architecture *

AG_GST_ARCH

dnl *** checks for programs ***

dnl find a compiler
AC_PROG_CC

AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")

dnl check for gobject-introspection
GOBJECT_INTROSPECTION_CHECK([0.10.1])

dnl check for documentation tools
GTK_DOC_CHECK([1.18])
AG_GST_PLUGIN_DOCS([1.8],[2.1])

dnl Make automake happy with per-target flags
AM_PROG_CC_C_O

dnl *** checks for libraries ***

dnl For interactive UNIX (a Sun thing)
dnl FIXME: this adds -lcposix to LIBS, but I doubt we use LIBS
AC_ISC_POSIX

dnl *** checks for header files ***

dnl check if we have ANSI C header files
AC_HEADER_STDC

dnl used in gst/ffmpegcolorspace/mem.c
dnl FIXME: could be fixed by redefining av_malloc and av_free to GLib's
AC_CHECK_HEADERS([malloc.h])

dnl *** checks for types/defines ***

dnl *** checks for structures ***

AC_CHECK_MEMBER([struct ip_mreqn.imr_ifindex],
	        [AC_DEFINE([HAVE_IP_MREQN], [1], [Have the struct ip_mreqn])],
		[],
		[
#include <sys/socket.h>
#include <netinet/in.h>
])


dnl *** checks for compiler characteristics ***

dnl *** checks for library functions ***

dnl *** checks for dependency libraries ***

dnl GLib is required
AG_GST_GLIB_CHECK([2.40])
AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_40, [Ignore post 2.40 deprecations])
AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_40, [Prevent post 2.40 APIs])


PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0 >= 2.40, [HAVE_GIO_UNIX=true],[HAVE_GIO_UNIX=false])
AC_SUBST(GIO_UNIX_CFLAGS)
AC_SUBST(GIO_UNIX_LIBS)
AM_CONDITIONAL(HAVE_GIO_UNIX, test "x$HAVE_GIO_UNIX" = "xyes")

dnl checks for gstreamer
dnl uninstalled is selected preferentially -- see pkg-config(1)
AG_GST_CHECK_GST($GST_API_VERSION, [$GST_REQ])
AG_GST_CHECK_GST_BASE($GST_API_VERSION, [$GST_REQ])
AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no)
AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GSTPB_REQ])
AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")

dnl Check for documentation xrefs
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
FS_PREFIX="`$PKG_CONFIG --variable=prefix farstream-$FS_APIVERSION`"
AC_SUBST(GLIB_PREFIX)
AC_SUBST(FS_PREFIX)

dnl Check for glib-2.0 tools
AC_MSG_CHECKING([for glib-mkenums])
GLIB_MKENUMS="`$PKG_CONFIG --variable=glib_mkenums glib-2.0`"
AC_SUBST(GLIB_MKENUMS)
AC_MSG_RESULT($GLIB_MKENUMS)

dnl *** set variables based on configure arguments ***

dnl set license and copyright notice
FS_LICENSE="LGPL"
AC_DEFINE_UNQUOTED(FS_LICENSE, "$FS_LICENSE", [Farstream license])
AC_SUBST(FS_LICENSE)

dnl set location of plugin directory
AG_GST_SET_PLUGINDIR

dnl define an ERROR_CFLAGS Makefile variable
AG_GST_SET_ERROR_CFLAGS($FS_GIT)

dnl define correct level for debugging messages
AG_GST_SET_LEVEL_DEFAULT($FS_GIT)

AC_CHECK_FUNCS(getifaddrs)

dnl *** finalize CFLAGS, LDFLAGS, LIBS

dnl Overview:
dnl FS_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
dnl GST_*:              flags shared by built objects to link against GStreamer
dnl FS_INTERNAL_CFLAGS: to link internally against the farstream libs
dnl                          (compare to other modules) or for i18n
dnl FS_ALL_LDFLAGS:    linker flags shared by all
dnl FS_LIB_LDFLAGS:    additional linker flags for all libaries
dnl FS_LT_LDFLAGS:     library versioning of our libraries
dnl FS_PLUGIN_LDFLAGS: flags to be used for all plugins

dnl FS_OPTION_CFLAGS
if test "x$USE_DEBUG" = xyes; then
   PROFILE_CFLAGS="-g"
fi
AC_SUBST(PROFILE_CFLAGS)

dnl every flag in FS_OPTION_CFLAGS can be overridden at make time
FS_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) -Wno-error=deprecated-declarations "
AC_SUBST(FS_OPTION_CFLAGS)

dnl our libraries need to be versioned correctly
AC_SUBST(FS_LT_LDFLAGS)

dnl FS_INTERNAL_CFLAGS
dnl prefer internal headers to already installed ones
dnl also add builddir include for enumtypes
FS_INTERNAL_CFLAGS="-I\$(top_srcdir) -I\$(top_builddir)"
AC_SUBST(FS_INTERNAL_CFLAGS)

dnl FIXME: do we want to rename to GST_ALL_* ?
dnl add FS_OPTION_CFLAGS, but overridable
FS_CFLAGS="$GST_CFLAGS \$(FS_OPTION_CFLAGS)"
AC_SUBST(FS_CFLAGS)

dnl add GCOV libs because libtool strips -fprofile-arcs -ftest-coverage
FS_LIBS="$GST_LIBS \$(GCOV_LIBS)"
AC_SUBST(FS_LIBS)

dnl LDFLAGS really should only contain flags, not libs - they get added before
dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
FS_ALL_LDFLAGS="-no-undefined"
AC_SUBST(FS_ALL_LDFLAGS)

dnl FS_LIB_LDFLAGS
dnl linker flags shared by all libraries
dnl LDFLAGS modifier defining exported symbols from built libraries
FS_LIB_LDFLAGS="-export-symbols-regex ^fs_.*"
AC_SUBST(FS_LIB_LDFLAGS)

dnl this really should only contain flags, not libs - they get added before
dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
FS_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*fs_.*plugin.*' $FS_ALL_LDFLAGS"
AC_SUBST(FS_PLUGIN_LDFLAGS)

dnl this really should only contain flags, not libs - they get added before
dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_.*' $FS_ALL_LDFLAGS"
AC_SUBST(GST_PLUGIN_LDFLAGS)

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 >= 0.2 ],
    [ 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])

    PKG_CHECK_MODULES(GUPNP_CORE, [ gupnp-1.2 ],
	[ HAVE_GUPNP_CORE_12=yes ],
	[ HAVE_GUPNP_CORE_12=no
	  PKG_CHECK_MODULES(GUPNP_CORE, [ gupnp-1.0 ],
	     [ HAVE_GUPNP_CORE_10=yes ],
	     [ HAVE_GUPNP_CORE_10=no ])
    ])

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

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


dnl build static plugins or not
AC_MSG_CHECKING([whether to build static plugins or not])
AC_ARG_ENABLE(
  static-plugins,
  AC_HELP_STRING(
    [--enable-static-plugins],
    [build static plugins @<:@default=no@:>@]),
  [AS_CASE(
    [$enableval], [no], [], [yes], [],
    [AC_MSG_ERROR([bad value "$enableval" for --enable-static-plugins])])],
  [enable_static_plugins=no])
AC_MSG_RESULT([$enable_static_plugins])
if test "x$enable_static_plugins" = xyes; then
  AS_IF([test x$enable_static = xno], [AC_MSG_ERROR([--enable-static-plugins requires --enable-static to work])])
  AC_DEFINE(GST_PLUGIN_BUILD_STATIC, 1,
    [Define if static plugins should be built])
  PLUGIN_LIBTOOLFLAGS=""
else
  PLUGIN_LIBTOOLFLAGS="--tag=disable-static"
fi
AC_SUBST(PLUGIN_LIBTOOLFLAGS)
AM_CONDITIONAL(GST_PLUGIN_BUILD_STATIC, test "x$enable_static_plugins" = "xyes")

dnl *** output files ***

AC_CONFIG_FILES(
Makefile
farstream.pc
farstream-uninstalled.pc
common/Makefile
common/m4/Makefile
common-modified/Makefile
gst/Makefile
gst/fsrawconference/Makefile
gst/fsrtpconference/Makefile
gst/fsvideoanyrate/Makefile
gst/fsrtpxdata/Makefile
farstream/Makefile
transmitters/Makefile
transmitters/rawudp/Makefile
transmitters/multicast/Makefile
transmitters/nice/Makefile
transmitters/shm/Makefile
dnl pkgconfig/Makefile
dnl pkgconfig/farstream.pc
dnl pkgconfig/farstream-uninstalled.pc
tests/Makefile
tests/check/Makefile
tests/rtp/Makefile
examples/Makefile
examples/gui/Makefile
examples/commandline/Makefile
docs/Makefile
docs/libs/Makefile
docs/plugins/Makefile
docs/version.entities
dnl docs/plugins/Makefile
)
AC_OUTPUT