File: configure.ac

package info (click to toggle)
rygel 0.36.2-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,656 kB
  • sloc: ansic: 237,502; sh: 4,986; xml: 1,706; makefile: 1,203; sed: 16
file content (600 lines) | stat: -rw-r--r-- 22,693 bytes parent folder | download
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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
AC_PREREQ([2.64])
AC_INIT([Rygel],
	[m4_esyscmd(GNOME_TAG_PATTERN=rygel build-aux/git-version-gen .tarball-version)],
	[https://gitlab.gnome.org/GNOME/rygel/issues/new],
	[rygel],
	[http://www.rygel-project.org])
AC_CONFIG_AUX_DIR([build-aux])

AC_CONFIG_SRCDIR([src/librygel-core/rygel-root-device.vala])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

AC_SEARCH_LIBS([strerror],[cposix])
AC_PROG_CC
AC_HEADER_STDC
AC_FUNC_MMAP

AC_SUBST(abs_top_builddir)
AC_SUBST(VERSION)

dnl Initialize automake
AM_INIT_AUTOMAKE([1.11.1 tar-ustar no-dist-gzip dist-xz -Wno-portability foreign])
AM_MAINTAINER_MODE([enable])

dnl Initialize libtool
dnl Disable generation of static libraries
LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])

AC_SYS_LARGEFILE

GOBJECT_INTROSPECTION_CHECK([1.33.4])

dnl Required versions of library packages
dnl Not all of these are actually used, depending on the configure options.
GLIB_REQUIRED=2.40.0
LIBXML_REQUIRED=2.7
VALA_REQUIRED=0.24.0
VALADOC_REQUIRED=0.2
GSSDP_REQUIRED=0.14.15
GUPNP_REQUIRED=0.20.14
GUPNP_AV_REQUIRED=0.12.8
GUPNP_DLNA_REQUIRED=0.9.4
GSTREAMER_REQUIRED=1.0
GSTPBU_REQUIRED=1.0
GIO_REQUIRED=2.26
GEE_REQUIRED=0.8.0
LIBSOUP_REQUIRED=2.44.0
GTK_REQUIRED=3.0
MEDIAART_REQUIRED=0.7.0

dnl Additional requirements for media-export plugin
GSTREAMER_TAG_REQUIRED=1.0
GSTREAMER_APP_REQUIRED=1.0
GSTREAMER_BASE_REQUIRED=1.0
LIBSQLITE3_REQUIRED=3.5

dnl Additional requirements for playbin plugin
GSTREAMER_AUDIO_REQUIRED=1.0

dnl Additional requirements for tracker plugin
TRACKER_SPARQL_REQUIRED_MIN=0.14.0

VALAFLAGS="--enable-deprecated --target-glib=2.40 $VALAFLAGS"

########################################################
## Base
########################################################
RYGEL_BASE_MODULES="gupnp-1.0 >= $GUPNP_REQUIRED gee-0.8 >= $GEE_REQUIRED"

PKG_CHECK_MODULES([LIBRYGEL_CORE_DEPS],
                  [$RYGEL_BASE_MODULES
                   gssdp-1.0 >= $GSSDP_REQUIRED
                   gio-2.0 >= $GIO_REQUIRED
                   gmodule-2.0
                   libxml-2.0 >= $LIBXML_REQUIRED])
RYGEL_BASE_MODULES_VALAFLAGS='--pkg gupnp-1.0 --pkg gee-0.8'

########################################################
## Core
########################################################
LIBRYGEL_CORE_DEPS_VALAFLAGS="$RYGEL_BASE_MODULES_VALAFLAGS --pkg gssdp-1.0 --pkg gio-2.0 --pkg gmodule-2.0 --pkg posix"
AC_SUBST([LIBRYGEL_CORE_DEPS_VALAFLAGS])

########################################################
## Common
########################################################
RYGEL_COMMON_MODULES="$RYGEL_BASE_MODULES gupnp-av-1.0 >= $GUPNP_AV_REQUIRED"
RYGEL_COMMON_MODULES_VALAFLAGS="$RYGEL_BASE_MODULES_VALAFLAGS --pkg gupnp-av-1.0"

########################################################
## Db
########################################################
RYGEL_CHECK_PACKAGES([sqlite3])
PKG_CHECK_MODULES([LIBRYGEL_DB_DEPS],
                  [$RYGEL_COMMON_MODULES
                   gio-2.0 >= $GIO_REQUIRED
                   sqlite3 >= $LIBSQLITE3_REQUIRED])
LIBRYGEL_DB_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg sqlite3 --pkg gio-2.0"
AC_CHECK_HEADER([unistr.h],
                AC_CHECK_LIB([unistring],
                             [u8_strcoll],
                             [have_unistring=yes],[have_unistring=no]))
AS_IF([test "x$have_unistring" = "xyes"],
      [
        AC_DEFINE([HAVE_UNISTRING], [1], [Use libunistring for collation])
        LIBRYGEL_DB_DEPS_LIBS="$LIBRYGEL_DB_DEPS_LIBS -lunistring"
      ])
AC_SUBST([LIBRYGEL_DB_DEPS_VALAFLAGS])


########################################################
## Server
########################################################
PKG_CHECK_MODULES([LIBRYGEL_SERVER_DEPS],
                  [$RYGEL_COMMON_MODULES
                   gssdp-1.0 >= $GSSDP_REQUIRED
                   gio-2.0 >= $GIO_REQUIRED
                   gmodule-2.0
                   libxml-2.0 >= $LIBXML_REQUIRED
                   libsoup-2.4 >= $LIBSOUP_REQUIRED
                   libmediaart-2.0 >= $MEDIAART_REQUIRED])
LIBRYGEL_SERVER_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gssdp-1.0 --pkg gio-2.0 --pkg libsoup-2.4 --pkg gmodule-2.0 --pkg libmediaart-2.0"
AC_SUBST([LIBRYGEL_SERVER_DEPS_VALAFLAGS])

########################################################
## Renderer
########################################################
PKG_CHECK_MODULES([LIBRYGEL_RENDERER_DEPS],
                  [$RYGEL_COMMON_MODULES
                   gio-2.0 >= $GIO_REQUIRED
                   libsoup-2.4 >= $LIBSOUP_REQUIRED])
LIBRYGEL_RENDERER_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gio-2.0 --pkg libsoup-2.4"
AC_SUBST([LIBRYGEL_RENDERER_DEPS_VALAFLAGS])

PKG_CHECK_MODULES([LIBRYGEL_RUIH_DEPS],
                  [$RYGEL_COMMON_MODULES
                   gio-2.0 >= $GIO_REQUIRED
                   gee-0.8 >= $GEE_REQUIRED
                   libxml-2.0 >= $LIBXML_REQUIRED])
LIBRYGEL_RUIH_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gio-2.0 --pkg gee-0.8 --pkg libxml-2.0"
AC_SUBST([LIBRYGEL_RUIH_DEPS_VALAFLAGS])

########################################################
## Rygel
########################################################
PKG_CHECK_MODULES([RYGEL_DEPS],
                  [$RYGEL_COMMON_MODULES
                   gio-2.0 >= $GIO_REQUIRED
                   gssdp-1.0 >= $GSSDP_REQUIRED])


# Not all tests use all of these dependencies,
# but having one set of dependencies keeps things simple.

########################################################
## Tests
########################################################
PKG_CHECK_MODULES([TEST_DEPS],
                  [$RYGEL_COMMON_MODULES
                   gio-2.0 >= $GIO_REQUIRED
                   gssdp-1.0 >= $GSSDP_REQUIRED
                   libsoup-2.4 >= $LIBSOUP_REQUIRED
                   libxml-2.0 >= $LIBXML_REQUIRED])
TEST_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gio-2.0 --pkg gssdp-1.0 --pkg libsoup-2.4 --pkg libxml-2.0 --pkg gmodule-2.0"
AC_SUBST([TEST_DEPS_VALAFLAGS])

########################################################
## Examples
########################################################
PKG_CHECK_MODULES([EXAMPLE_DEPS],
                  [$RYGEL_COMMON_MODULES
                   gio-2.0 >= $GIO_REQUIRED
                   gssdp-1.0 >= $GSSDP_REQUIRED])

dnl Media engine to use
BUILT_ENGINES="librygel-media-engine-simple"

dnl Disabling the gstreamer media_engine also disables
dnl anything else that uses gstreamer.
AC_ARG_WITH([media_engine],
            AS_HELP_STRING(
                [--with-media-engine=@<:@gstreamer|simple@:>@],
                [Media Engine to use]),
            [with_media_engine="$withval"],
            [with_media_engine="gstreamer"])

AS_IF([test "x$with_media_engine" = "xgstreamer"],
      [
        enable_gstreamer="yes"
        BUILT_ENGINES="$BUILT_ENGINES;librygel-media-engine-gst"

        PKG_CHECK_MODULES([RYGEL_MEDIA_ENGINE_GSTREAMER_DEPS],
                          [$RYGEL_COMMON_MODULES
                           gstreamer-pbutils-1.0 >= $GSTPBU_REQUIRED
                           gstreamer-base-1.0 >= $GSTREAMER_BASE_REQUIRED
                           gupnp-dlna-2.0 >= $GUPNP_DLNA_REQUIRED
                           libsoup-2.4 >= $LIBSOUP_REQUIRED
                           gio-2.0 >= $GIO_REQUIRED])
        RYGEL_MEDIA_ENGINE_GSTREAMER_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gstreamer-base-1.0 --pkg gstreamer-pbutils-1.0 --pkg gupnp-dlna-2.0 --pkg libsoup-2.4"
        AC_SUBST([RYGEL_MEDIA_ENGINE_GSTREAMER_DEPS_VALAFLAGS])

        PKG_CHECK_MODULES([LIBRYGEL_RENDERER_GST_DEPS], [$RYGEL_COMMON_MODULES gstreamer-1.0 >= $GSTREAMER_REQUIRED gstreamer-audio-1.0 >= $GSTREAMER_AUDIO_REQUIRED gio-2.0 >= $GIO_REQUIRED])
        LIBRYGEL_RENDERER_GST_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gstreamer-1.0 --pkg gstreamer-audio-1.0"
        AC_SUBST([LIBRYGEL_RENDERER_GST_DEPS_VALAFLAGS])
      ],
      [enable_gstreamer="no"])
AM_CONDITIONAL([HAVE_GSTREAMER],[test "x$enable_gstreamer" = "xyes"])
AC_SUBST([BUILT_ENGINES])

dnl Add plugins
RYGEL_ADD_PLUGIN([external],[MediaServer2 DBus consumer],[yes])
AS_IF([test "x$enable_external_plugin" = "xyes"],
  [
    PKG_CHECK_MODULES([RYGEL_PLUGIN_EXTERNAL_DEPS], [$RYGEL_COMMON_MODULES gio-2.0 >= $GIO_REQUIRED])
  ])

RYGEL_ADD_PLUGIN([mpris],[MPRIS2 DBus consumer],[yes])
AS_IF([test "x$enable_mpris_plugin" = "xyes"],
  [
    PKG_CHECK_MODULES([RYGEL_PLUGIN_MPRIS_DEPS], [$RYGEL_COMMON_MODULES gio-2.0 >= $GIO_REQUIRED])
  ])

RYGEL_ADD_PLUGIN([ruih],[Ruih],[yes])
AS_IF([test "x$enable_ruih_plugin" = "xyes"],
  [
    PKG_CHECK_MODULES([RYGEL_PLUGIN_RUIH_DEPS],
                      [$RYGEL_COMMON_MODULES
                       gio-2.0 >= $GIO_REQUIRED
                       libsoup-2.4 >= $LIBSOUP_REQUIRED
                       libxml-2.0 >= $LIBXML_REQUIRED])
  ])


RYGEL_ADD_PLUGIN([lms],[LightMediaScanner],[yes])
AS_IF([test "x$enable_lms_plugin" = "xyes"],
  [
    PKG_CHECK_MODULES([RYGEL_PLUGIN_LMS_DEPS],
                      [$RYGEL_COMMON_MODULES
                       gio-2.0 >= $GIO_REQUIRED
                       sqlite3 >= $LIBSQLITE3_REQUIRED])
    RYGEL_PLUGIN_LMS_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gio-2.0 --pkg gee-0.8 --pkg sqlite3"
    AC_SUBST([RYGEL_PLUGIN_LMS_DEPS_VALAFLAGS])
  ])

AS_IF([test "x$with_media_engine" = "xgstreamer"],
      [
        RYGEL_ADD_PLUGIN([playbin],[GStreamer playbin],[yes])
        AS_IF([test "x$enable_playbin_plugin" = "xyes"],
          [
            PKG_CHECK_MODULES([RYGEL_PLUGIN_PLAYBIN_DEPS], [$RYGEL_COMMON_MODULES gstreamer-1.0 >= $GSTREAMER_TAG_REQUIRED])
          ])

        RYGEL_ADD_PLUGIN([media-export],[MediaExport],[yes])
        AS_IF([test "x$enable_media_export_plugin" = "xyes"],
          [
            PKG_CHECK_MODULES([RYGEL_PLUGIN_MEDIA_EXPORT_DEPS],
                              [$RYGEL_COMMON_MODULES gio-2.0 >= $GIO_REQUIRED
                               gio-unix-2.0 >= $GIO_REQUIRED
                               gupnp-dlna-2.0 >= $GUPNP_DLNA_REQUIRED
                               gupnp-dlna-gst-2.0 >= $GUPNP_DLNA_REQUIRED
                               gstreamer-app-1.0 >= $GSTREAMER_APP_REQUIRED
                               gstreamer-tag-1.0 >= $GSTREAMER_TAG_REQUIRED
                               gstreamer-pbutils-1.0 >= $GSTPBU_REQUIRED
                               libsoup-2.4 >= $LIBSOUP_REQUIRED
                               sqlite3 >= $LIBSQLITE3_REQUIRED
                               libxml-2.0 >= $LIBXML_REQUIRED
                               libmediaart-2.0 >= $MEDIAART_REQUIRED
                               gdk-pixbuf-2.0])
            RYGEL_PLUGIN_MEDIA_EXPORT_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gupnp-dlna-2.0 --pkg gupnp-dlna-gst-2.0 --pkg gstreamer-tag-1.0 --pkg gstreamer-app-1.0 --pkg gstreamer-pbutils-1.0 --pkg sqlite3 --pkg libmediaart-2.0"
            AC_SUBST([RYGEL_PLUGIN_MEDIA_EXPORT_DEPS_VALAFLAGS])
          ])

        RYGEL_ADD_PLUGIN([gst-launch],[GStreamer launchline],[no])
        AS_IF([test "x$enable_gst_launch_plugin" = "xyes"],
          [
            PKG_CHECK_MODULES([RYGEL_PLUGIN_GST_LAUNCH_DEPS],
                              [$RYGEL_COMMON_MODULES
                              libsoup-2.4 >= $LIBSOUP_REQUIRED])
            RYGEL_PLUGIN_GST_LAUNCH_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg libsoup-2.4"
            AC_SUBST([RYGEL_PLUGIN_GST_LAUNCH_DEPS_VALAFLAGS])
          ])

        RYGEL_ADD_STAMP([src/media-engines/gstreamer/librygel_media_engine_gst_la_vala.stamp])
        RYGEL_ADD_STAMP([src/librygel-renderer-gst/librygel_renderer_gst_2_6_la_vala.stamp])
      ],
      [
        RYGEL_DISABLE_PLUGIN([playbin])
        RYGEL_DISABLE_PLUGIN([media-export])
        RYGEL_DISABLE_PLUGIN([gst-launch])
      ])
 
dnl Example plugins:     
AC_ARG_ENABLE([example-plugins],
              AS_HELP_STRING([--enable-example-plugins],[enable example plugins]),,
              enable_example_plugins=no)
AM_CONDITIONAL([BUILD_EXAMPLE_PLUGINS], [test "x$[]enable_example_plugins" = "xyes"])

dnl Explicitly add stamp files for targets that are not plugins
RYGEL_ADD_STAMP([src/librygel-core/librygel_core_2_6_la_vala.stamp])
RYGEL_ADD_STAMP([src/librygel-server/librygel_server_2_6_la_vala.stamp])
RYGEL_ADD_STAMP([src/librygel-renderer/librygel_renderer_2_6_la_vala.stamp])
RYGEL_ADD_STAMP([src/librygel-ruih/librygel_ruih_2_0_la_vala.stamp])
RYGEL_ADD_STAMP([src/rygel/rygel_vala.stamp])
RYGEL_ADD_STAMP([src/ui/rygel_preferences_vala.stamp])
RYGEL_ADD_STAMP([src/media-engines/simple/librygel_media_engine_simple_la_vala.stamp])

AS_IF([test "x$with_media_engine" = "xgstreamer"],
      [
        RYGEL_CHECK_PACKAGES([gupnp-dlna-2.0 gstreamer-1.0
                              gstreamer-pbutils-1.0])
      ])

dnl Debugging
AC_ARG_ENABLE(debug,
	AS_HELP_STRING([--enable-debug],[enable debugging]),,
        enable_debug=no)
if test "x$enable_debug" = "xyes"; then
        CFLAGS="$CFLAGS -O0 -g"
        RYGEL_DEBUG_VALAFLAGS="-g"
fi

AC_SUBST(RYGEL_DEBUG_VALAFLAGS)

dnl Strict compiler
AC_ARG_ENABLE(strict-cc,
	AS_HELP_STRING([--enable-strict-cc],[enable strict C compiler]),,
        enable_strict_cc=no)
if test "x$enable_strict_cc" = "xyes"; then
        CFLAGS="$CFLAGS -Wall -Werror"
else
        CFLAGS="$CFLAGS -w"
fi

dnl Run uninstalled
AC_ARG_ENABLE(uninstalled,
    AS_HELP_STRING([--enable-uninstalled],[run uninstalled]),,
        enable_uninstalled=no)
if test "x$enable_uninstalled" = "xyes"; then
        AC_MSG_WARN("You want to run the tools uninstalled only? Fine!")
fi
AM_CONDITIONAL([UNINSTALLED], [test "x$enable_uninstalled" = "xyes"])

dnl Check wether user wants to build UIs
AC_ARG_WITH( ui,
  AS_HELP_STRING([--without-ui],[Do not build UI applications]),
  try_ui=$withval, try_ui=yes )

HAVE_GTK=no
if test x$try_ui = xyes ; then
    dnl check for gtk
    PKG_CHECK_MODULES([RYGEL_UI_DEPS], [$RYGEL_BASE_MODULES gtk+-3.0 >= $GTK_REQUIRED gssdp-1.0 >= $GSSDP_REQUIRED gee-0.8 >= $GEE_REQUIRED],
      [
        RYGEL_CHECK_PACKAGES([gtk+-3.0], [HAVE_GTK=yes])
        RYGEL_UI_DEPS_VALAFLAGS="$RYGEL_BASE_MODULES_VALAFLAGS --pkg gtk+-3.0 --pkg gssdp-1.0 --pkg gee-0.8"
        AC_SUBST([RYGEL_UI_DEPS_VALAFLAGS])

        PKG_CHECK_MODULES([EXAMPLE_UI_DEPS],
                          [$RYGEL_COMMON_MODULES gio-2.0 >= $GIO_REQUIRED
                           gssdp-1.0 >= $GSSDP_REQUIRED
                           gstreamer-video-1.0 >= $GSTREAMER_REQUIRED
                           gtk+-3.0 >= $GTK_REQUIRED],,
                          [
                           AC_MSG_WARN([Example UI dependencies not found.])
                           AC_MSG_WARN([Example UI applications will not be built.])
                          ])
      ],
      [
        AC_MSG_WARN([UI dependencies not found.])
        AC_MSG_WARN([UI applications will not be built.])
      ])

else
    AC_MSG_NOTICE([UI applications disabled.])
fi

AM_CONDITIONAL(BUILD_UI, test "x$HAVE_GTK" = "xyes")

dnl Tests
AC_ARG_ENABLE([tests],
              AS_HELP_STRING([--enable-tests],[always build tests]),,
              enable_tests=no)
AM_CONDITIONAL([ALWAYS_TEST], [test "x$enable_tests" = "xyes"])

dnl Generate coverage data
AC_ARG_ENABLE([coverage],
  AS_HELP_STRING([--enable-coverage],
                 [Generate converage reports for unit tests]),
  [],
  [enable_coverage=no])
AM_CONDITIONAL([ENABLE_COVERAGE],[test "x$enable_coverage" != "xno"])
AS_IF([test "x$enable_coverage" != "xno"],
  [
    AC_PATH_PROG([LCOV], [lcov])
    AC_PATH_PROG([GENHTML], [genhtml])
    AC_SUBST([COVERAGE_LIBS],["-lgcov"])
    AC_SUBST([COVERAGE_CFLAGS],["-fprofile-arcs -ftest-coverage"])
    AC_SUBST(COVERAGE_VALAFLAGS,["-g"])
  ]
)

dnl systemd user unit directory
AC_ARG_WITH([systemduserunitdir],
	    AS_HELP_STRING([--with-systemduserunitdir=DIR], [Directory for systemd user service files]),
	    [],
	    [with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)])
if test x$with_systemduserunitdir != xno; then
	AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
fi

dnl Check additional requirements for MediaExport plugins
if test "x$enable_media_export_plugin" = "xyes";
then
    RYGEL_CHECK_PACKAGES([gstreamer-tag-1.0 gstreamer-app-1.0])
fi

dnl Check additional requirements for LMS plugin
if test "x$enable_lms_plugin" = "xyes";
then
    RYGEL_CHECK_PACKAGES([sqlite3])
fi

RYGEL_ADD_PLUGIN([tracker],[Tracker],[yes])
AS_IF([test "x$enable_tracker_plugin" = "xyes"],
  [
    # Search available Tracker version
    trackerpkg=""
    m4_foreach([VERSION], [[2.0], [1.0], [0.16], [0.15], [0.14]],
                 [PKG_CHECK_EXISTS([tracker-sparql-VERSION >= $TRACKER_SPARQL_REQUIRED_MIN],
                                   [ trackerpkg="tracker-sparql-VERSION"
                                     tracker_api_version="VERSION"
                                   ])
                 ])
    AS_IF([test "x:$trackerpkg" = "x:"],
          [AC_MSG_ERROR([No supported API version of the tracker-sparql library was found])])


    PKG_CHECK_MODULES([RYGEL_PLUGIN_TRACKER_DEPS],
                      [$RYGEL_COMMON_MODULES gio-2.0 >= $GIO_REQUIRED ${trackerpkg}])

    AS_IF([test "x$enable_vala" = "xyes"],
          [VALA_CHECK_PACKAGES([${trackerpkg}])])

    RYGEL_PLUGIN_TRACKER_DEPS_VALAFLAGS="--pkg ${trackerpkg}"
    AC_SUBST([RYGEL_PLUGIN_TRACKER_DEPS_VALAFLAGS])
  ])

# This should be called only after all RYGEL_CHECK_VALA() and RYGEL_ADD_PLUGIN() calls:
RYGEL_CHECK_VALA([$VALA_REQUIRED],
                 [gupnp-1.0
                  gupnp-av-1.0
                  gio-2.0
                  gee-0.8
                  posix
                  libmediaart-2.0])

dnl Gettext
AM_GNU_GETTEXT_VERSION([0.19.7])
AM_GNU_GETTEXT([external])

GETTEXT_PACKAGE=rygel
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], 
  [Define the gettext package to be used])

dnl Shave the output
AM_SILENT_RULES([yes])

dnl documenation
AC_PATH_PROG([XSLTPROC], [xsltproc])
AS_IF([test "x$XSLTPROC" != "x"],
      [
       AC_MSG_CHECKING([whether $XSLTPROC can create manpages])
       $XSLTPROC -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl >/dev/null 2>&1
       AS_IF([test "$?" = 0], [AC_MSG_RESULT([yes])], [XSLTPROC=""; AC_MSG_RESULT([no])])
      ])
AM_CONDITIONAL([HAVE_XSLTPROC], [test x"$XSLTPROC" != x])

dnl Use valadoc and gtk-doc for API documentation:
dnl This is on by default when using autogen.sh 
dnl (so it is not on by default when building from a tarball with configure.)
AC_ARG_ENABLE(apidocs,
              AS_HELP_STRING([--enable-apidocs[=@<:@no/auto/yes@:>@]],
                             [Create API documentation using valadoc and GTK-Doc]),,
    [enable_apidocs=auto])

found_valadoc=no
AS_IF([test "x$enable_apidocs" != "xno"], [
    AC_PATH_PROG(VALADOC, valadoc, :)
    AS_IF([test -x "$VALADOC"], [
      found_valadoc=yes
      AC_SUBST(VALADOC)
      PKG_CHECK_MODULES([GTKDOC],[gtk-doc >= 1.0],,
                        AS_IF([test "x$enable_apidocs" == "xyes"],
                              [AC_MSG_ERROR([Unable to find gtk-doc])],
                              [found_valadoc=no])
                        )
    ], [
      AS_IF([test "x$enable_apidocs" == "xyes"], AC_MSG_ERROR([Unable to find valadoc]))
    ])
  ])

AM_CONDITIONAL(ENABLE_VALADOC, test x$found_valadoc = xyes)

AC_SUBST([RYGEL_PLUGIN_LINKER_FLAGS],
         ["-module -avoid-version -shared -export-dynamic -export-symbols-regex 'module_init'"])
AC_SUBST([RYGEL_ENGINE_LINKER_FLAGS],
         ["-module -avoid-version -shared -export-dynamic -export-symbols-regex 'module_get_instance'"])
AC_SUBST([RYGEL_PLUGIN_DIR],
         [${libdir}/rygel-2.6/plugins])
AC_SUBST([RYGEL_MEDIA_ENGINE_DIR],
         [${libdir}/rygel-2.6/engines])

AC_SUBST([GLIB_COMPILE_RESOURCES], [`$PKG_CONFIG --variable glib_compile_resources gio-2.0`])

AC_CONFIG_FILES([
Makefile
src/Makefile
src/librygel-core/Makefile
src/librygel-db/Makefile
src/librygel-renderer/Makefile
src/librygel-renderer-gst/Makefile
src/librygel-server/Makefile
src/librygel-ruih/Makefile
src/rygel/Makefile
src/ui/Makefile
src/media-engines/Makefile
src/media-engines/gstreamer/Makefile
src/media-engines/gstreamer/media-engine-gst.plugin
src/media-engines/simple/Makefile
src/media-engines/simple/media-engine-simple.plugin
src/plugins/Makefile
data/Makefile
data/xml/Makefile
data/xml/MediaServer3.xml.in
data/xml/RuihServer2.xml.in
data/xml/MediaRenderer2.xml.in
data/icons/Makefile
data/icons/32x32/Makefile
data/icons/48x48/Makefile
data/icons/120x120/Makefile
data/icons/128x128/Makefile
data/icons/scalable/Makefile
doc/Makefile
doc/reference/Makefile
doc/reference/librygel-core/Makefile
doc/reference/librygel-db/Makefile
doc/reference/librygel-renderer/Makefile
doc/reference/librygel-server/Makefile
doc/reference/librygel-renderer-gst/Makefile
po/Makefile.in
rygel-core-2.6.pc
rygel-renderer-2.6.pc
rygel-server-2.6.pc
rygel-renderer-gst-2.6.pc
rygel-ruih-2.0.pc
examples/Makefile
examples/renderer-plugins/Makefile
examples/renderer-plugins/vala/Makefile
examples/renderer-plugins/vala/example-renderer-vala.plugin
examples/renderer-plugins/C/Makefile
examples/renderer-plugins/C/example-renderer-c.plugin
examples/server-plugins/Makefile
examples/server-plugins/vala/Makefile
examples/server-plugins/vala/example-server-vala.plugin
examples/server-plugins/C/Makefile
examples/server-plugins/C/example-server-c.plugin
tests/Makefile
])
AC_OUTPUT

echo "

                    ${PACKAGE} ${VERSION}
                    ============


        Prefix:                 ${prefix}
        Source code location:   ${srcdir}
        Compiler:               ${CC}
        CFLAGS:                 ${CFLAGS}
        VALAFLAGS:              ${VALAFLAGS}
        uninstalled:            ${enable_uninstalled}
        preferences ui:         ${HAVE_GTK}
        Media Engine:           ${with_media_engine}
        API documentation:      ${found_valadoc}
        GObject-Introspection:  ${found_introspection}

    Plugins:
        examples:               ${enable_example_plugins}
        tracker:                ${enable_tracker_plugin}
            version:            ${tracker_api_version}
        media-export            ${enable_media_export_plugin}
        lightmediascanner       ${enable_lms_plugin}
        external:               ${enable_external_plugin}
        MPRIS2:                 ${enable_mpris_plugin}
        gst-launch:             ${enable_gst_launch_plugin}
        playbin:                ${enable_playbin_plugin}
        RUIH plugin:            ${enable_ruih_plugin}
"