summaryrefslogtreecommitdiff
path: root/configure.in
blob: 9466cbd5953efb5410c01458f8a1b112fc565d07 (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
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
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
AC_PREREQ(2.52)

m4_define(totem_version_major, 1)
m4_define(totem_version_minor, 5)
m4_define(totem_version_micro, 4)

AC_INIT(totem,
        totem_version_major.totem_version_minor.totem_version_micro,
        http://bugzilla.gnome.org/enter_bug.cgi?product=totem)
AC_CONFIG_SRCDIR(src/totem.c)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)

AM_INIT_AUTOMAKE([1.8 dist-bzip2 no-dist-gzip check-news])

AC_DEFINE(PACKAGE, AC_PACKAGE_NAME, [package name])
AC_DEFINE(VERSION, AC_PACKAGE_VERSION, [package version])
AC_SUBST(VERSION)

dnl Add the languages which your application supports to po/LINGUAS
AC_DEFINE(GETTEXT_PACKAGE, "AC_PACKAGE_NAME", [Define to the Gettext package name])
GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.35.0])

AC_PROG_CXX
AC_PROG_LIBTOOL()
PKG_PROG_PKG_CONFIG

# Requirements
GLIB_REQS=2.6.3
GTK_REQS=2.5.6
GNOMEVFS_REQS=2.8.2
GNOMEUI_REQS=2.3.3
GNOMEICON_REQS=2.9.3
DBUS_REQS=0.35

# Before making a release, the PLPARSER_LT_VERSION string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
PLPARSER_LT_VERSION=3:0:2
AC_SUBST(PLPARSER_LT_VERSION)

TOTEM_VERSION_MAJOR=totem_version_major
TOTEM_VERSION_MINOR=totem_version_minor
TOTEM_VERSION_MICRO=totem_version_micro
AC_SUBST(TOTEM_VERSION_MAJOR)
AC_SUBST(TOTEM_VERSION_MINOR)
AC_SUBST(TOTEM_VERSION_MICRO)
TOTEM_PL_PARSER_VERSION_MAJOR=totem_version_major
TOTEM_PL_PARSER_VERSION_MINOR=totem_version_minor
TOTEM_PL_PARSER_VERSION_MICRO=totem_version_micro
AC_SUBST(TOTEM_PL_PARSER_VERSION_MAJOR)
AC_SUBST(TOTEM_PL_PARSER_VERSION_MINOR)
AC_SUBST(TOTEM_PL_PARSER_VERSION_MICRO)

AC_ARG_ENABLE(nvtv, AC_HELP_STRING([--enable-nvtv],[Enable support for TV-output with nvtv]), enable_nvtv="$enableval", enable_nvtv=yes)

if test x$enable_nvtv = xyes; then
PKG_CHECK_MODULES(NVTV, nvtvsimple >= 0.4.5, found_nvtv=1,found_nvtv=0)
AC_SUBST(NVTV_CFLAGS)
AC_SUBST(NVTV_LIBS)
	if test $found_nvtv -eq 1 ; then
		AC_DEFINE(HAVE_NVTV,1,[Define to 1 if nvtv is available and used.])
		AC_MSG_RESULT(yes)
	else 
		AC_MSG_RESULT(no)
	fi
fi

dnl xine or gst ?

dnl the two versions here implicate the gstreamer core and gst-plugins
dnl release versions.
XINE_REQS=1.1.2
GST_MAJORMINOR=0.10

AC_ARG_ENABLE(gstreamer,
	AC_HELP_STRING([--enable-gstreamer],[use GStreamer instead of xine for the backend]),
	[case "${enableval}" in
	yes) ENABLE_GST=yes ;;
        no)  ENABLE_GST=no ;;
	*) AC_MSG_ERROR([
             ***** Bad value ${enableval} for --enable-gstreamer
             ***** Please use one of the following:
             *****   --enable-gstreamer=yes
	     *****   --enable-gstreamer=no
           ]) ;;
	esac],
	[ENABLE_GST=auto]) dnl Default value

HAVE_XINE=no
AC_MSG_CHECKING(for backend libraries)

if test x$ENABLE_GST = xno || test x$ENABLE_GST = xauto; then
	MM="libxine >= $XINE_REQS gconf-2.0"
	PKG_CHECK_MODULES(XINE, $MM, HAVE_XINE=yes, HAVE_XINE=no)
	if test x$HAVE_XINE = xyes; then
		AC_MSG_RESULT(xine-lib)
	fi
fi

if test x$ENABLE_GST = xno && test x$HAVE_XINE = xno; then
	AC_MSG_RESULT(none)
	AC_MSG_ERROR(you need the GStreamer or the xine-lib development packages installed)
fi

if test x$HAVE_XINE = xno; then
	GST_REQS=0.10.1
	GSTPLUG_REQS=0.10.7
	MM="gstreamer-0.10 >= $GST_REQS gstreamer-plugins-base-0.10 >= $GSTPLUG_REQS gconf-2.0"
	PKG_CHECK_MODULES(GST, $MM,
			HAVE_GSTREAMER=yes, HAVE_GSTREAMER=no)
	if test x$GST_MAJORMINOR = x0.10; then
		GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR"
		AC_SUBST(GST_LIBS)
		EXTRA_BACKEND_LIBS="-lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR"
		AC_DEFINE(HAVE_GSTREAMER_010, 1, [Whether we use Gst 0.8 or 0.10])
	fi

	dnl Give error and exit if we don't have gstreamer
	if test "x$HAVE_GSTREAMER" = "xno"; then
		AC_MSG_ERROR(you need the GStreamer or the xine-lib development packages installed)
	fi

	AC_MSG_RESULT(GStreamer-$GST_MAJORMINOR)

	dnl Check for required plugins
	gst010_toolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-0.10`
	gst010_inspect="$gst010_toolsdir/gst-inspect-0.10"

	dnl Check for elements from gst-plugins-base
	for base_element in playbin ffmpegcolorspace videoscale
	do
		AC_MSG_CHECKING([GStreamer 0.10 $base_element plugin])
		if $gst010_inspect $base_element >/dev/null 2>/dev/null; then
			AC_MSG_RESULT([yes])
		else
			AC_MSG_RESULT([no])
			AC_MSG_ERROR([
				Cannot find required GStreamer-0.10 plugin '$base_element'.
				It should be part of gst-plugins-base. Please install it.
			])
		fi
	done

	dnl Check for elements from gst-plugins-good
	for good_element in gconfaudiosink gconfvideosink goom
	do
		AC_MSG_CHECKING([GStreamer 0.10 $good_element plugin])
		if $gst010_inspect $good_element >/dev/null 2>/dev/null; then
			AC_MSG_RESULT([yes])
		else
			AC_MSG_RESULT([no])
			AC_MSG_ERROR([
				Cannot find required GStreamer-0.10 plugin '$good_element'.
				It should be part of gst-plugins-good. Please install it.
			])
		fi
	done

	dnl We want at least GLib-2.8 for the GStreamer-0.10 backend
	AC_MSG_CHECKING([whether GLib has atomic refcounting for objects])
	PKG_CHECK_MODULES(GLIB_WITH_ATOMIC_REFCOUNTING, glib-2.0 >= 2.8.0, [
               	AC_MSG_RESULT([yes])
	], [
		AC_MSG_RESULT([no])
		AC_MSG_ERROR([
			The totem GStreamer-0.10 backend requires
			GLib version 2.8.0 or newer. Please upgrade
			your GLib version first.
		])
	])
fi

AM_CONDITIONAL(TOTEM_GST, test "x$HAVE_GSTREAMER" = "xyes")

AC_ARG_ENABLE(vanity,
	AC_HELP_STRING([--enable-vanity],[do not compile and install vanity]),
	[case "${enableval}" in
	yes) ENABLE_VANITY=yes ;;
	no) ENABLE_VANITY=no ;;
	*) AC_MSG_ERROR(bad value ${enableval} for --disable-vanity) ;;
	esac],
	[ENABLE_VANITY=no]) dnl Default value

AC_MSG_CHECKING(for Linux)
case `uname` in
        *Linux*)
	AC_MSG_RESULT(yes)
	IS_LINUX="yes"
	;;
	*)
	AC_MSG_RESULT(no)
        IS_LINUX="no"
	;;
esac

if test x$ENABLE_VANITY = "xyes" -a x$IS_LINUX = "xyes"; then
	COMPILE_VANITY=yes
else
	COMPILE_VANITY=no
fi

AM_CONDITIONAL(TOTEM_VANITY, test x$COMPILE_VANITY = "xyes")
AC_MSG_CHECKING(whether to compile vanity)
AC_MSG_RESULT($COMPILE_VANITY);

dnl Check for GTK+ only build
AC_ARG_ENABLE(gtk,
	AC_HELP_STRING([--enable-gtk],[compile a gtk+ only version]),
	[case "${enableval}" in
	yes) ENABLE_GTK=yes ;;
	no) ENABLE_GTK=no ;;
	*) AC_MSG_ERROR(bad value ${enableval} for --disable-gtk) ;;
	esac],
	[ENABLE_GTK=no]) dnl Default value

dnl Seems that the order matters because libtool blows
dnl Also check if we're going to be using GTK+ only
if test x$ENABLE_GTK = "xno" ; then
	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libgnomeui-2.0 >= $GNOMEUI_REQS libglade-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-desktop-2.0 >= 2.1.5 gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 iso-codes $MM)
	HAVE_GNOME=yes
else
	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libglade-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 iso-codes $MM)
	AC_DEFINE(USE_STABLE_LIBGNOMEUI, 1, [defined if we don't have GNOME])
	AC_DEFINE(HAVE_GTK_ONLY, 1, [defined if GNOME isn't used])
	HAVE_GNOME=no
fi

dnl Check for DBus
AC_MSG_CHECKING([for D-BUS])
AC_ARG_WITH(dbus,
            AC_HELP_STRING([--with-dbus],
			   [Enable D-BUS support]),,
	      with_dbus=auto)
if test "x$with_dbus" != "xno"; then
	PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_REQS, enable_dbus=yes, enable_dbus=no)
        if test "x$with_dbus" = xyes && test "x$enable_dbus" = xno; then
	   AC_MSG_ERROR([D-BUS explicitly requested but no support found])
	fi
        if test "x$enable_dbus" = xyes; then
		dbus_version=`pkg-config --modversion dbus-1`
		DBUS_VERSION_MAJOR=`echo $dbus_version | awk -F. '{print $1}'`
		DBUS_VERSION_MINOR=`echo $dbus_version | awk -F. '{print $2}'`
		DBUS_VERSION_MICRO=`echo $dbus_version | awk -F. '{print $3}'`
		if test "z$DBUS_VERSION_MAJOR" = "z"; then
			DBUS_VERSION_MAJOR="0"
		fi
		if test "z$DBUS_VERSION_MINOR" = "z"; then
			DBUS_VERSION_MINOR="0"
		fi
		if test "z$DBUS_VERSION_MICRO" = "z"; then
			DBUS_VERSION_MICRO="0"
		fi
		DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
		DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
		DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"

		AC_DEFINE(WITH_DBUS, 1, [Define if D-BUS is enabled])
		AC_MSG_RESULT([we're getting on D-BUS])
	else
		AC_MSG_RESULT([not found])
	fi

fi			  
AM_CONDITIONAL(WITH_DBUS, test "x$enable_dbus" = "xyes")

AC_MSG_CHECKING([whether iso-codes has iso-639 domain])
if $PKG_CONFIG --variable=domains iso-codes | grep -q 639 ; then
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
fi

AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])

AM_CONDITIONAL(HAVE_GNOME, test x$HAVE_GNOME = "xyes")
EXTRA_GNOME_CFLAGS="$EXTRA_GNOME_CFLAGS"
EXTRA_GNOME_LIBS="$EXTRA_GNOME_LIBS $EXTRA_BACKEND_LIBS"
AC_SUBST(EXTRA_GNOME_CFLAGS)
AC_SUBST(EXTRA_GNOME_LIBS)

PKG_CHECK_MODULES(GTK, gtk+-x11-2.0 $MM gthread-2.0)
AC_SUBST(GTK_CFLAGS)
GTK_LIBS="$GTK_LIBS $EXTRA_BACKEND_LIBS"
AC_SUBST(GTK_LIBS)

dnl *******
dnl Mozilla
dnl *******

dnl Check for Mozilla plugin build

AC_MSG_CHECKING([whether to compile the mozilla plugin])

AC_ARG_ENABLE([mozilla],
	AS_HELP_STRING([--enable-mozilla],[compile the mozilla plugin]),
	[ENABLE_MOZILLA=$enableval],
	[ENABLE_MOZILLA=autodetect])

AC_MSG_RESULT([$ENABLE_MOZILLA])

dnl Check which mozilla to use
if test "x$ENABLE_MOZILLA" != "xno" ; then
	AC_MSG_CHECKING([which gecko to use])

	AC_ARG_WITH([mozilla],
		AS_HELP_STRING([--with-mozilla],[Which gecko engine to use (default: autodetect)]))

	GECKOS="firefox mozilla-firefox seamonkey mozilla xulrunner"
	gecko=$with_mozilla

	if test "x$gecko" = "x"; then
		dnl Autodetect gecko
		for g in $GECKOS; do
			if $PKG_CONFIG --exists $g-xpcom; then
				gecko=$g
				break;
			fi
		done
	elif ! $PKG_CONFIG --exists $gecko-xpcom; then
		AC_MSG_ERROR([Gecko "$gecko" not found])
	fi

	if test "x$gecko" = "x" -a "x$ENABLE_MOZILLA" = "xautodetect"; then
		dnl No gecko found, disable plugin
		AC_MSG_WARN([No gecko found, disabling plugin])
		ENABLE_MOZILLA=no
	elif test "x$gecko" = "x"; then
		AC_MSG_ERROR([No gecko found])
	elif ! ( echo "$GECKOS" | egrep "(^| )$gecko(\$| )" > /dev/null); then
		AC_MSG_ERROR([Unknown gecko "$gecko" specified])
	else
		ENABLE_MOZILLA=yes
	fi

	AC_MSG_RESULT([$gecko])

	case "$gecko" in
		mozilla) MOZILLA_VERSION_MIN=1.7 ;;
		seamonkey) MOZILLA_VERSION_MIN=1.0 ;;
		*firefox) MOZILLA_VERSION_MIN=1.0 ;;
		xulrunner) MOZILLA_VERSION_MIN=1.8 ;;
	esac

	MOZILLA=$gecko
	AC_SUBST([MOZILLA])
fi

dnl Check for mozilla modules, but keep the CFLAGS and LIBS in
dnl separate vars
if test "x$ENABLE_MOZILLA" = "xyes" ; then
	PKG_CHECK_MODULES([MOZILLA_NOT_LINKED],
		[$MOZILLA-xpcom >= $MOZILLA_VERSION_MIN \
		 $MOZILLA-plugin],,
                [ENABLE_MOZILLA=no])
fi
dnl Check for other required modules, and merge CFLAGS, but not link
dnl flags to avoid linking against -lxpcom -lplds4 -lplc4 -lnspr4
if test "x$ENABLE_MOZILLA" = "xyes" ; then
	PKG_CHECK_MODULES([MOZILLA],
		[gtk+-x11-2.0 \
		 $MM \
		 gthread-2.0 \
		 gnome-vfs-2.0],,
		[ENABLE_MOZILLA=no])

	MOZILLA_LIBS="$MOZILLA_LIBS $EXTRA_BACKEND_LIBS"
	MOZILLA_CFLAGS="$MOZILLA_NOT_LINKED_CFLAGS $MOZILLA_CFLAGS"
	AC_SUBST([MOZILLA_CFLAGS])
	AC_SUBST([MOZILLA_LIBS])
fi
if test "x$ENABLE_MOZILLA" = "xyes" ; then
	PKG_CHECK_MODULES([DBUS], [dbus-glib-1 >= 0.35],,[ENABLE_MOZILLA=no])
	DBUSLIBDIR="`$PKG_CONFIG dbus-glib-1 --variable=libdir`"
	DBUSBINDIR="`echo $DBUSLIBDIR | sed -e s/lib/bin/`"
	AC_PATH_PROG([DBUS_BIND], [dbus-binding-tool], [no], [$DBUSBINDIR:$PATH])
	if test "x$DBUS_BIND" = "xno"; then
		AC_MSG_WARN([dbus-binding-tool not found])
		ENABLE_MOZILLA=no
	fi
fi

dnl Sets some variables, and check for xpidl
if test "x$ENABLE_MOZILLA" = "xyes" ; then
	MOZILLA_PREFIX="`$PKG_CONFIG $MOZILLA-xpcom --variable=prefix`"
	MOZILLA_LIBDIR="`$PKG_CONFIG $MOZILLA-xpcom --variable=libdir`"
	MOZILLA_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir $MOZILLA-xpcom`"
	MOZILLA_XPCOM_CFLAGS="-I`$PKG_CONFIG --variable=includedir $MOZILLA-xpcom`"
	MOZILLA_PLUGINDIR="${MOZILLA_PLUGINDIR:-$MOZILLA_LIBDIR}"

	AC_PATH_PROG([MOZILLA_XPIDL], [xpidl], [no], [$MOZILLA_LIBDIR:$PATH])
	if test "x$MOZILLA_XPIDL" = "xno"; then
		ENABLE_MOZILLA=no
		AC_MSG_WARN([xpidl compiler not found])
	fi

	AC_SUBST([MOZILLA_PREFIX])
	AC_SUBST([MOZILLA_LIBDIR])
	AC_SUBST([MOZILLA_XPCOM_CFLAGS])
	AC_ARG_VAR([MOZILLA_PLUGINDIR],[Where to install the plugin to])
fi

dnl Search for the idl include directory
if test "x$ENABLE_MOZILLA" = "xyes" ; then
	dnl This only works on gecko 1.8
	MOZILLA_IDLDIR="`$PKG_CONFIG --variable=idldir $MOZILLA-xpcom`"
	dnl Fallback for older versions
	if test "x$MOZILLA_IDLDIR" = "x"; then
		MOZILLA_IDLDIR="`echo $MOZILLA_LIBDIR | sed -e s!lib!share/idl!`"
	fi
	dnl Some distributions (Gentoo) have it in unusual places
	if test "x$MOZILLA_IDLDIR" = "x"; then
		MOZILLA_IDLDIR="$MOZILLA_INCLUDE_ROOT/idl"
	fi

	AC_SUBST([MOZILLA_IDLDIR])
fi

if test "x$ENABLE_MOZILLA" = "xyes" ; then
	AC_DEFINE([HAVE_MOZILLA],[1],[Define if you build the mozilla plugin])
fi

AM_CONDITIONAL([HAVE_MOZILLA], [test "x$ENABLE_MOZILLA" = "xyes"])

dnl ********
dnl Nautilus
dnl ********

dnl Check for Nautilus property page build
AC_ARG_ENABLE(nautilus,
	AC_HELP_STRING([--enable-nautilus],[compile the nautilus plugin]),
	[case "${enableval}" in
	yes) ENABLE_NAUTILUS=yes ;;
	no) ENABLE_NAUTILUS=no ;;
	*) AC_MSG_ERROR(bad value ${enableval} for --enable-nautilus) ;;
	esac],
	[ENABLE_NAUTILUS=yes]) dnl Default value

if test x$ENABLE_NAUTILUS = "xyes" ; then
	PKG_CHECK_MODULES(NAUTILUS, gtk+-x11-2.0 $MM gthread-2.0 libnautilus-extension,
			[HAVE_NAUTILUS=yes], [HAVE_NAUTILUS=no])
fi

NAUTILUS_LIBS="$NAUTILUS_LIBS $EXTRA_BACKEND_LIBS"
AC_SUBST(NAUTILUS_CFLAGS)
AC_SUBST(NAUTILUS_LIBS)
if test x$HAVE_NAUTILUS = "xyes"; then
	AC_DEFINE(HAVE_NAUTILUS, 1, [defined if you build the nautilus plugin])
fi
AM_CONDITIONAL(HAVE_NAUTILUS, test x$HAVE_NAUTILUS = "xyes")

dnl ****
dnl LIRC
dnl ****

AC_ARG_ENABLE(lirc,
	AC_HELP_STRING([--enable-lirc],[enable lirc support]),
	[case "${enableval}" in
	yes) ENABLE_LIRC=yes ;;
	no)  ENABLE_LIRC=no ;;
	*) AC_MSG_ERROR(bad value ${enableval} for --enable-lirc) ;;
	esac],
        [ENABLE_LIRC=yes]) dnl Default value

if test x$ENABLE_LIRC = xyes ; then
AC_CHECK_HEADER(irman.h,,)
REMOTE_LIBS=""
AC_CHECK_LIB(lirc_client, lirc_init, [
	AC_CHECK_HEADER(lirc/lirc_client.h, [
	REMOTE_LIBS="-llirc_client"
	AC_DEFINE(HAVE_REMOTE, 1, [defined if you have lirc library])
	])
])
fi

AC_SUBST(REMOTE_LIBS)

dnl ***
dnl HAL
dnl ***

AC_ARG_WITH(hal,
	      AC_HELP_STRING([--without-hal],
			     [Disable HAL support]))
if test "x$with_hal" != "xno"; then
  PKG_CHECK_MODULES(HAL, hal >= 0.5 hal < 0.6, enable_hal05=yes, enable_hal05=no)
  if test x$enable_hal05 != xyes; then
     PKG_CHECK_MODULES(HAL, hal >= 0.2.92 hal < 0.5, enable_hal02=yes, enable_hal02=no)
  fi
  if test x$enable_hal05 = xyes || test x$enable_hal02 = xyes; then
      enable_hal=yes
      AC_DEFINE(HAVE_HAL, 1, [Define if you HAL support])
      if test x$enable_hal05 = xyes; then
         AC_DEFINE(HAVE_HAL_0_5, 1, [Define if you have HAL 0.5 or later])
      else
         AC_DEFINE(HAVE_HAL_0_2, 1, [Define if you have HAL 0.2 or later])
      fi
  	  AC_SUBST(HAL_CFLAGS)
  	  AC_SUBST(HAL_LIBS)
  else
    if test "x$with_hal" = "xyes"; then
	  AC_MSG_ERROR([HAL support explicitly requested but HAL couldn't be found])
    fi
  fi
fi
AM_CONDITIONAL(HAVE_HAL_0_5, test x"$enable_hal05" = xyes)
AM_CONDITIONAL(HAVE_HAL_0_2, test x"$enable_hal02" = xyes)
AM_CONDITIONAL(HAVE_HAL, test x"$enable_hal" = xyes)


AC_PATH_X

if test x"$x_includes" != x"NONE" && test -n "$x_includes" ; then
	X_INCLUDES=-I`echo $x_includes | sed -e "s/:/ -I/g"`
fi
if test x"$x_libraries" != x"NONE" && test -n "$x_libraries" ; then
	X_LIBRARIES=-L`echo $x_libraries | sed -e "s/:/ -L/g"`
fi
CFLAGS="$X_INCLUDES $CFLAGS"
LIBS="$X_LIBRARIES $LIBS"

XTEST_LIBS=""
AC_CHECK_LIB(Xtst, XTestFakeKeyEvent,
		XTEST_LIBS="-lX11 -lXtst $X_LIBRARIES"
		AC_DEFINE(HAVE_XTEST, 1, [defined if you have XTest library]),
		,
		$X_LIBRARIES)
AC_SUBST(XTEST_LIBS)

have_xvidmode=no
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
	XVIDMODE_LIBS="-lXxf86vm"
	have_xvidmode=yes,,
	$X_LIBRARIES -lXext)

have_randr=no
AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
	[AC_CHECK_HEADER(X11/extensions/Xrandr.h,
	have_randr=yes
	RANDR_LIBS="-lX11 -lXrandr -lXrender",
	:, [#include <X11/Xlib.h>])], : ,
	$X_LIBRARIES -lXrandr -lXrender)

XVIDMODE_LIBS="$XVIDMODE_LIBS $RANDR_LIBS"
AC_SUBST(XVIDMODE_LIBS)
AM_CONDITIONAL(HAVE_XVIDMODE, [test $have_randr = yes -a $have_xvidmode = yes])
if test $have_randr = yes -a $have_xvidmode = yes; then
	AC_DEFINE(HAVE_XVIDMODE,, [Define this if you have the XVidMode and XRandR extension installed])
fi

dnl Explicitely link against libX11 to avoid problems with crappy linkers
X_LIBS="$X_LIBRARIES -lX11"
AC_SUBST(X_LIBS)

dnl Multimedia keys
have_xfree=no
AC_COMPILE_IFELSE([
	#include <X11/XF86keysym.h>
	int main(int argc,char **argv) {
	return 0;
	}
	],
	have_xfree=yes
)
AC_MSG_CHECKING(for X11 XFree86 headers)
AC_MSG_RESULT($have_xfree)
if test x"$have_xfree" = "xyes" ; then
	AC_DEFINE(HAVE_XFREE, 1, [defined if you have X11/XF86keysym.h])
fi

AC_MSG_CHECKING(for broken old architecture)
if test "`uname -m`x" = "i686x" ; then
       AC_MSG_RESULT(h0rk3d)
else
       AC_MSG_RESULT(n334)
fi
AC_MSG_CHECKING(for broken user)
if test "`whoami`x" = "hadessx" ; then
       AC_MSG_RESULT(h0rk3d)
else
       AC_MSG_RESULT(n334)
fi

AC_MSG_CHECKING(for bad taste in TV series)
if test "`whoami`x" = "mickex" ; then
       AC_MSG_RESULT(oh my god yes)
else
       AC_MSG_RESULT(pheew nope)
fi


_system_is_x86="no"
AC_CHECK_HEADER( asm/vm86.h, _system_is_x86="yes" )
if `test "x$_system_is_x86" = "xyes" && test "x$CURL_CONFIG" != "xno"` ; then
	HAVE_X86=1
	AC_DEFINE(HAVE_X86, 1, [defined on x86 machines])
else
	HAVE_X86=0
fi
AM_CONDITIONAL(HAVE_X86, `test "x$_system_is_x86" = "xyes" && test "x$CURL_CONFIG" != "xno"`)

AC_PATH_PROG(GCONFTOOL, gconftool-2)
AM_GCONF_SOURCE_2

dnl Check for packages for building libtotem-plparser.la
PKG_CHECK_MODULES(TOTEM_PLPARSER, [gtk+-2.0 libxml-2.0 gnome-vfs-2.0
                                   gnome-vfs-module-2.0])


dnl debug
AC_ARG_ENABLE(debug,
		AC_HELP_STRING([--disable-debug],[disables compilation of debugging messages]),
	[case "${enableval}" in
	yes) ENABLE_DEBUG=yes ;;
	no)  ENABLE_DEBUG=no ;;
	*) AC_MSG_ERROR(bad value ${enableval} for --disable-debug) ;;
	esac],
[ENABLE_DEBUG=no]) dnl Default value
if test x$ENABLE_DEBUG = xyes; then
	AC_DEFINE(TOTEM_DEBUG, 1, [Define if DEBUG statements should be compiled in])
fi

if test "$GCC" = "yes" ; then
	CFLAGS="\
	-Wall \
	-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
	-Wnested-externs -Wpointer-arith \
	-Wcast-align -Wsign-compare \
	-fno-strict-aliasing \
	$CFLAGS"
fi

AC_OUTPUT([
Makefile
totem.spec
totem-plparser.pc
src/Makefile
src/backend/Makefile
src/plparse/Makefile
src/plparse/totem-pl-parser-features.h
data/Makefile
data/totem.desktop.in.in
data/vanity.desktop.in
po/Makefile.in
help/Makefile
help/C/Makefile
help/bg/Makefile
help/de/Makefile
help/es/Makefile
help/fr/Makefile
help/ru/Makefile
help/uk/Makefile
])

echo
if test x$HAVE_XINE = xno ; then
	echo "Using the GStreamer-$GST_MAJORMINOR backend"
else
	echo "Using the xine backend"
fi
echo