~snaggen/rhythmbox/bpm

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
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
define(arch-tag)
# arch-tag: Toplevel Autoconf configuration script
AC_PREREQ(2.53)
AC_INIT(shell)
AC_CONFIG_MACRO_DIR(macros)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(rhythmbox, 0.11.3)

AC_SUBST(ACLOCAL_AMFLAGS, "-I macros")

AM_MAINTAINER_MODE

dnl XXXX hack to kill off all the libtool tags ...
dnl it isn't like we are using C++ or Fortran.
m4_define([_LT_AC_TAGCONFIG],[])


IT_PROG_INTLTOOL([0.35.0])

AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CXX
AC_STDC_HEADERS
AM_PROG_LIBTOOL()
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(long)

DBUS_MIN_REQS=0.35
GST_0_10_REQS=0.10.4
GST_0_10_XFADE_REQS=0.10.11
GST_0_10_BPM_REQS=0.10.12
GST_0_10_MISSING_PLUGIN_REQS=0.10.12
GTK_REQS=2.8.0
GNOME_MEDIA_PROFILES_REQS=2.8
GNOME_VFS_REQS=2.8.0
LIBNOTIFY_REQS=0.3.2
LIBGPOD_REQS=0.4
MUSICBRAINZ_REQS=2.1.0
NCB_MIN_REQS=2.9.0
TOTEM_PLPARSER_REQS=2.21.4
VALA_REQS=0.0.8

AC_MSG_CHECKING([for GNU extension fwrite_unlocked])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <stdio.h>
]],
[[fwrite_unlocked ("foo", 1, sizeof ("foo"), stdout);]])],[have_fwrite_unlocked=yes])
if test x"$have_fwrite_unlocked" = xyes; then
	AC_DEFINE(HAVE_GNU_FWRITE_UNLOCKED,1,[Define if you have GNU fwrite_unlocked])
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
fi

mkdtemp_missing=false
AC_CHECK_FUNC(mkdtemp,
    [AC_DEFINE([HAVE_MKDTEMP], 1, [Have GlibC function to make temp dirs])],
    mkdtemp_missing=true)
AM_CONDITIONAL(MKDTEMP_MISSING, test x$mkdtemp_missing = xtrue)

PKG_CHECK_MODULES(GLIB_TESTS, glib-2.0)
AC_CHECK_LIB(glib-2.0, g_utf8_collate_key_for_filename,
    [AC_DEFINE([HAVE_COLLATE_KEY_FILENAME], 1, [Have glib function to collate filename sort keys])],
    ,[$GLIB_TESTS_LIBS $GLIB_TESTS_CFLAGS])
AC_CHECK_LIB(glib-2.0, g_mapped_file_new,
    [AC_DEFINE([HAVE_G_MAPPED_FILE], 1, [Have glib mmap wrapper])],
    ,[$GLIB_TESTS_LIBS $GLIB_TESTS_CFLAGS])
AC_CHECK_LIB(glib-2.0, g_get_user_special_dir,
    [AC_DEFINE([HAVE_G_GET_USER_SPECIAL_DIR], 1, [Have glib function to find user special dirs])],
    ,[$GLIB_TESTS_LIBS $GLIB_TESTS_CFLAGS])

PKG_PROG_PKG_CONFIG

PKG_CHECK_MODULES(RB_CLIENT, gnome-vfs-2.0 >= $GNOME_VFS_REQS)

PKG_CHECK_MODULES(RHYTHMBOX,				\
		  gtk+-2.0 >= $GTK_REQS			\
		  libgnomeui-2.0			\
		  libglade-2.0				\
		  gnome-vfs-2.0 >= $GNOME_VFS_REQS	\
		  gnome-vfs-module-2.0)

PKG_CHECK_MODULES(TOTEM_PLPARSER, totem-plparser >= $TOTEM_PLPARSER_REQS, have_totem_plparser=yes, have_totem_plparser=no)
if test x$have_totem_plparser != xyes; then
   AC_MSG_ERROR([totem playlist parsing library not found or too old])
fi

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_hal=yes, enable_hal=no)
  if test "x$enable_hal" != "xyes" -a "x$with_hal" = "xyes"; then
      AC_MSG_ERROR([HAL support explicitly requested but HAL couldn't be found])
  fi

  if test "x$enable_hal" == "xyes"; then
  	AC_DEFINE(HAVE_HAL, 1, [Define if you have HAL support])
	AC_SUBST(HAL_CFLAGS)
    AC_SUBST(HAL_LIBS)
  fi	
fi
AM_CONDITIONAL(HAVE_HAL, test x"$enable_hal" = xyes)

dnl transfers
AC_ARG_ENABLE(track-transfer,
	      AC_HELP_STRING([--disable-track-transfer],
			     [Disable track transfer support in rhythmbox]))
if test x"$enable_track_transfer" != xno; then
   PKG_CHECK_MODULES(GNOME_MEDIA_PROFILES,
      gnome-media-profiles >= $GNOME_MEDIA_PROFILES_REQS,
      with_track_transfer=yes,
      with_track_transfer=no)

   if test "x$with_track_transfer" = xno -a "x$enable_track_transfer" = xyes; then
      AC_MSG_ERROR([Track transfer support explicitly requested but gnome-media-profiles not found.])
   fi

   if test "x$with_track_transfer" = xyes; then
      AC_DEFINE(ENABLE_TRACK_TRANSFER, 1, [Define if track transfer should be enabled])
   fi
fi
AM_CONDITIONAL(ENABLE_TRACK_TRANSFER, test "x$with_track_transfer" = "xyes")


dnl iPod support
AC_ARG_WITH(ipod,
            AC_HELP_STRING([--with-ipod],
			   [Enable iPod support]),,
	      with_ipod=auto)
if test "x$with_ipod" != "xno"; then
	PKG_CHECK_MODULES(IPOD, libgpod-1.0 >= $LIBGPOD_REQS,
	                  have_libgpod=yes, have_libgpod=no)
	if test "x$have_libgpod" = "xno" -a "x$with_ipod" = "xyes"; then
	  AC_MSG_ERROR([iPod explicitly requested but libgpod couldn't be found])
	fi
	if test "x$have_libgpod" = "xyes"; then
          if test "x$with_hal" = xyes && test "x$enable_hal" = xno; then
	     AC_MSG_ERROR([iPod explicitly requested but HAL not found or too old])
	  fi
          if test "x$enable_hal" = xyes; then
	     AC_DEFINE(WITH_IPOD_SUPPORT, 1, [Define if iPod support is enabled])
	     use_ipod=yes
	  fi
	  AC_CHECK_LIB(gpod, itdb_track_set_thumbnails_from_pixbuf,
		       [AC_DEFINE([HAVE_ITDB_TRACK_SET_THUMBNAILS_FROM_PIXBUF], 1, [Have libgpod function to set thumbnails from a GdkPixbuf])],
		       ,[$IPOD_LIBS $IPOD_CFLAGS])
	  AC_SUBST(IPOD_CFLAGS)
	  AC_SUBST(IPOD_LIBS)
	fi
fi
AM_CONDITIONAL(USE_IPOD, test x"$use_ipod" = xyes)

dnl mtp support

AC_ARG_WITH(mtp,
            AC_HELP_STRING([--with-mtp],
			   [Enable MTP support]),,
	      with_mtp=auto)
if test "x$with_mtp" != "xno"; then

	PKG_CHECK_MODULES(MTP, libmtp, have_libmtp=yes, have_libmtp=no)
	if test "x$have_libmtp" = "xno" -a "x$with_mtp" = "xyes"; then
	  AC_MSG_ERROR([MTP explicitly requested but libmtp couldn't be found])
	fi
	if test "x$have_libmtp" = "xyes"; then
          if test "x$with_hal" = xyes && test "x$enable_hal" = xno; then
	     AC_MSG_ERROR([MTP explicitly requested but HAL not found or too old])
	  fi
          if test "x$enable_hal" = xyes; then
	     use_mtp=yes
          fi
	  AC_SUBST(MTP_CFLAGS)
	  AC_SUBST(MTP_LIBS)
	fi
fi			  
AM_CONDITIONAL(USE_MTP, test x"$use_mtp" = xyes)


dnl ipod writing
AC_ARG_ENABLE(ipod-writing,
	      AC_HELP_STRING([--disable-ipod-writing],
			     [Disable support for writing to ipods in rhythmbox]))
if test x"$enable_ipod_writing" != xno; then
   if test "x$use_ipod" != xyes; then
      if test "x$enable_ipod_writing" = xyes; then
         AC_MSG_ERROR([iPod write support explicitly requested but iPod support is disabled.])
      fi
      enable_ipod_writing=no
   elif test "x$with_track_transfer" != xyes; then
      if test "x$enable_ipod_writing" = xyes; then
         AC_MSG_ERROR([iPod write support explicitly requested but track transfer support is disabled.])
      fi
      enable_ipod_writing=no
   else
      AC_DEFINE(ENABLE_IPOD_WRITING, 1, [Define if ipod writing should be enabled])
   fi
fi



dnl gnome-keyring support

AC_ARG_WITH(gnome-keyring,
            AC_HELP_STRING([--with-gnome-keyring],
			   [Enable gnome-keyring support]),,
	      with_gnome_keyring=auto)
if test "x$with_gnome_keyring" != "xno"; then

	PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1, have_gnome_keyring=yes, have_gnome_keyring=no)
	if test "x$have_gnome_keyring" = "xno" -a "x$with_gnome_keyring" = "xyes"; then
	  AC_MSG_ERROR([gnome-keyring support explicitly requested but gnome-keyring couldn't be found])
	fi
	if test "x$have_gnome_keyring" = "xyes"; then
	   AC_DEFINE(WITH_GNOME_KEYRING, 1, [Define if gnome-keyring support is enabled])
	   use_gnome_keyring=yes
	  AC_SUBST(GNOME_KEYRING_CFLAGS)
	  AC_SUBST(GNOME_KEYRING_LIBS)
	fi
fi
AM_CONDITIONAL(USE_GNOME_KEYRING, test x"$use_gnome_keyring" = xyes)

dnl Database
AC_ARG_WITH(database,
              AC_HELP_STRING([--with-database=tree|libgda],
			     [Select the database to use (default tree)]),,
	      with_database=tree)
AM_CONDITIONAL(USE_TREEDB, test x"$with_database" = xtree)
AM_CONDITIONAL(USE_GDADB, test x"$with_database" = xlibgda)

GDA_CFLAGS=""
GDA_LIBS=""
case "x$with_database" in
  "xtree")
    AC_DEFINE(WITH_RHYTHMDB_TREE, 1, [Define if you are using the RhythmDB tree database])
    ;;
  "xlibgda")
    AC_DEFINE(WITH_RHYTHMDB_GDA, 1, [Define if you are using the RhythmDB sqlite/libgda database])
    dnl FIXME: check for sqlite, too?
    PKG_CHECK_MODULES(GDA, libgda > 1.0.3)
    ;;
  *)
    AC_MSG_ERROR([Unknown database selected])
    ;;
esac
AC_SUBST(GDA_CFLAGS)
AC_SUBST(GDA_LIBS)

dnl Database debugging
AC_ARG_WITH(rhythmdb-debug,
              AC_HELP_STRING([--with-rhythmdb-debug=0|1|2],
			     [Level of RhythmDB sanity checking]),,with_rhythmdb_debug=0)
if test x"${with_rhythmdb_debug}" != x0; then
   AC_DEFINE_UNQUOTED([RHYTHMDB_ENABLE_SANITY_CHECK], "${with_rhythmdb_debug}", [Define to the level of RhythmDB sanity checking])
fi

dnl Sound system
dnl Now we're ready to ask for gstreamer libs and cflags
dnl And we can also ask for the right version of gstreamer
PKG_CHECK_MODULES(GSTREAMER_0_10, \
	gstreamer-0.10 >= $GST_0_10_REQS
	gstreamer-base-0.10 >= $GST_0_10_REQS
	gstreamer-plugins-base-0.10 >= $GST_0_10_REQS)

RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $GSTREAMER_0_10_CFLAGS"
RHYTHMBOX_LIBS="$RHYTHMBOX_LIBS $GSTREAMER_0_10_LIBS"

PKG_CHECK_MODULES(GSTREAMER_0_10_XFADE, \
	gstreamer-0.10 >= $GST_0_10_XFADE_REQS,
	have_gstreamer_0_10_xfade=yes,have_gstreamer_0_10_xfade=no)

if test x"$have_gstreamer_0_10_xfade" = xyes; then
	AC_DEFINE(HAVE_GSTREAMER_0_10_XFADE,1,[Define if you want to use the crossfading GStreamer 0.10 backend])
fi
AM_CONDITIONAL(USE_GSTREAMER_0_10_XFADE, test x"$have_gstreamer_0_10_xfade" = xyes)

PKG_CHECK_MODULES(GSTREAMER_0_10_MISSING_PLUGINS, \
		  gstreamer-plugins-base-0.10 >= $GST_0_10_MISSING_PLUGIN_REQS,
		  have_gstreamer_0_10_missing_plugins=yes,have_gstreamer_0_10_missing_plugins=no)
if test x"$have_gstreamer_0_10_missing_plugins" = xyes; then
	AC_DEFINE(HAVE_GSTREAMER_0_10_MISSING_PLUGINS,1,[Define if you want to enable GStreamer plugin installation])
fi
AM_CONDITIONAL(USE_GSTREAMER_0_10_MISSING_PLUGINS, test x"$have_gstreamer_0_10_missing_plugins" = xyes)

dnl Tag writing
AC_ARG_ENABLE(tag-writing,
	      AC_HELP_STRING([--disable-tag-writing],
			     [Disable tag writing support in rhythmbox]))
if test x"$enable_tag_writing" != xno; then
   AC_DEFINE(ENABLE_TAG_WRITING, 1, [Define if tag writing should be enabled])
fi

dnl Beats per Minute
PKG_CHECK_MODULES(GSTREAMER_0_10_BPM, \
	gstreamer-0.10 >= $GST_0_10_BPM_REQS,
	have_gstreamer_0_10_bpm=yes,have_gstreamer_0_10_bpm=no)

if test x"$have_gstreamer_0_10_bpm" = xyes; then
   AC_DEFINE(ENABLE_BPM, 1, [Define if beats per minute should be enabled])
fi

dnl Audioscrobbler
AC_ARG_ENABLE(audioscrobbler,
	      AC_HELP_STRING([--disable-audioscrobbler],
			     [Disable Audioscrobbler support in Rhythmbox]))

dnl DAAP (iTunes Music Shares)
AC_ARG_ENABLE(daap,
	      AC_HELP_STRING([--disable-daap],
			     [Disable Digital Audio Access Protocol (music sharing) in rhythmbox]))

AC_ARG_WITH(mdns,
   AC_HELP_STRING([--with-mdns=auto|howl|avahi],
   [Select the mDNS/DNS-SD implementation to use (default auto)]),,
   with_mdns=auto)

have_howl=no
have_avahi=no
have_mdns=no
use_howl=no
use_avahi=no

PKG_CHECK_MODULES(AVAHI,
   avahi-client >= 0.6
   avahi-glib >= 0.6,
   have_avahi_06=yes,
   have_avahi_06=no)
if test x$have_avahi_06 != xyes; then
   PKG_CHECK_MODULES(AVAHI,
      avahi-client >= 0.5
      avahi-glib >= 0.5,
      have_avahi_05=yes,
      have_avahi_05=no)
fi
if test x$have_avahi_06 = xyes || test x$have_avahi_05 = xyes; then
   have_avahi=yes
else
   have_avahi=no
fi

PKG_CHECK_MODULES(HOWL,
   howl,
   have_howl=yes,
   have_howl=no)

if test x"$with_mdns" = xauto; then
   if test x"$have_avahi" = xyes; then
      MDNS_CFLAGS=$AVAHI_CFLAGS
      MDNS_LIBS=$AVAHI_LIBS
      AC_DEFINE(WITH_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi])
      use_avahi=yes
      AC_MSG_NOTICE([Detected Avahi, using it for mDNS/DNS-SD])
      if test x$have_avahi_06 = xyes; then
         AC_DEFINE(HAVE_AVAHI_0_6, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.6])
      else
         AC_DEFINE(HAVE_AVAHI_0_5, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.5])
      fi

      have_mdns=yes
   elif test x"$have_howl" = xyes; then
      MDNS_CFLAGS=$HOWL_CFLAGS
      MDNS_LIBS=$HOWL_LIBS
      AC_DEFINE(WITH_HOWL, 1, [Define if mDNS/DNS-SD implementation uses Howl])
      use_howl=yes
      AC_MSG_NOTICE([Detected Howl, using it for mDNS/DNS-SD])

      have_mdns=yes
   fi
fi

if test x"$with_mdns" = xhowl; then
   if test x"$have_howl" = xno; then
      AC_MSG_ERROR([Howl explicitly requested but not found.  Install Howl or try --with-mdns=avahi])
   fi

   MDNS_CFLAGS=$HOWL_CFLAGS
   MDNS_LIBS=$HOWL_LIBS
   AC_DEFINE(WITH_HOWL, 1, [Define if mDNS/DNS-SD implementation uses Howl])
   use_howl=yes
   AC_MSG_NOTICE([Using Howl for mDNS/DNS-SD])
   have_mdns=yes
fi

if test x"$with_mdns" = xavahi; then
   if test x"$have_avahi" = xno; then
      AC_MSG_ERROR([Avahi explicitly requested but not found.  Install Avahi or try --with-mdns=howl])
   fi

   MDNS_CFLAGS=$AVAHI_CFLAGS
   MDNS_LIBS=$AVAHI_LIBS
   AC_DEFINE(WITH_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi])
   use_avahi=yes
   AC_MSG_NOTICE([Using Avahi for mDNS/DNS-SD])

   if test x$have_avahi_06 = xyes; then
      AC_DEFINE(HAVE_AVAHI_0_6, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.6])
   else
      AC_DEFINE(HAVE_AVAHI_0_5, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.5])
   fi

   have_mdns=yes
fi

AM_CONDITIONAL(USE_HOWL, test "x$use_howl" = "xyes")
AM_CONDITIONAL(USE_AVAHI, test "x$use_avahi" = "xyes")

AC_ARG_ENABLE(libnotify,
            AC_HELP_STRING([--disable-libnotify],
			   [Disable libnotify support]),,
	      enable_libnotify=auto)
if test "x$enable_libnotify" != "xno"; then
	PKG_CHECK_MODULES(NOTIFY,                            \
			  libnotify >= $LIBNOTIFY_REQS,
			  have_libnotify=yes,
			  have_libnotify=no)
	if test "x$have_libnotify" = "xno" -a "x$enable_libnotify" = "xyes"; then
	  AC_MSG_ERROR([libnotify support explicitly requested, but libnotify couldn't be found])
	fi
	if test "x$have_libnotify" = "xyes"; then
	     enable_libnotify=yes
	fi
fi
AM_CONDITIONAL(USE_NOTIFY, test x"$enable_libnotify" = xyes)
if test x$enable_libnotify = xyes ; then
    # Find out the version of LIBNOTIFY we're using
    libnotify_version=`pkg-config --modversion libnotify`
    LIBNOTIFY_VERSION_MAJOR=`echo $libnotify_version | awk -F. '{print $1}'`
    LIBNOTIFY_VERSION_MINOR=`echo $libnotify_version | awk -F. '{print $2}'`
    LIBNOTIFY_VERSION_MICRO=`echo $libnotify_version | awk -F. '{print $3}'`
    if test "z$LIBNOTIFY_VERSION_MAJOR" = "z"; then
        LIBNOTIFY_VERSION_MAJOR="0"
    fi
    if test "z$LIBNOTIFY_VERSION_MINOR" = "z"; then
        LIBNOTIFY_VERSION_MINOR="0"
    fi
    if test "z$LIBNOTIFY_VERSION_MICRO" = "z"; then
        LIBNOTIFY_VERSION_MICRO="0"
    fi
    echo "Your libnotify version is $LIBNOTIFY_VERSION_MAJOR,$LIBNOTIFY_VERSION_MINOR,$LIBNOTIFY_VERSION_MICRO."
    NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MAJOR=$LIBNOTIFY_VERSION_MAJOR"
    NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MINOR=$LIBNOTIFY_VERSION_MINOR"
    NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MICRO=$LIBNOTIFY_VERSION_MICRO"

    AC_DEFINE(HAVE_NOTIFY, 1, [Define if libnotify support is enabled])
    AC_SUBST(NOTIFY_CFLAGS)
    AC_SUBST(NOTIFY_LIBS)
fi

dnl Check for libsoup, needed for DAAP and audioscrobbler
if test "x$enable_daap" = "xyes" || test "x$enable_audioscrobbler" != "xno"; then
	PKG_CHECK_MODULES(SOUP,                            \
		libsoup-2.2,
		have_libsoup=yes,
		have_libsoup=no)
	if test x"$have_libsoup" = "xno"; then
		PKG_CHECK_MODULES(SOUP,
			libsoup-2.4,
			have_libsoup=yes,
			have_libsoup=no)
	fi
	if test x"$have_libsoup" = "xyes"; then
		AC_DEFINE(HAVE_LIBSOUP, 1, [Define if libsoup support is enabled])
	fi
fi

AM_CONDITIONAL(USE_LIBSOUP, test x"$have_libsoup" = "xyes")


dnl audioscrobbler support
if test "x$enable_audioscrobbler" != "xno"; then
	if test x"$have_libsoup" = "xno"; then
		if test "x$enable_audioscrobbler" = "xyes"; then
			AC_MSG_ERROR([AudioScrobbler support explicitly requested, but no libsoup found.  Install libsoup])
		fi
		enable_audioscrobbler=no
	else
		AC_DEFINE(WITH_AUDIOSCROBBLER, 1, [define if Audioscrobbler support should be enabled])
	fi
fi
AM_CONDITIONAL(WITH_AUDIOSCROBBLER, test "x$enable_audioscrobbler" != "xno")


dnl daap support
if test "x$enable_daap" != "xno"; then
	if test x"$have_libsoup" = "xno"; then
		if test "x$enable_daap" = "xyes"; then
			AC_MSG_ERROR([DAAP support explicitly requested, but no libsoup found.  Install libsoup])
		fi
		enable_daap=no
	elif test x"$have_mdns" = xno; then
		if test "x$enable_daap" = "xyes"; then
			AC_MSG_ERROR([DAAP support explicitly requested, but no mDNS implementation found.  Install Howl or Avahi])
		fi
		enable_daap=no
	else
		AC_DEFINE(WITH_DAAP_SUPPORT, 1, [Define if DAAP should be enabled])
		enable_daap="yes"
		AC_SUBST(MDNS_CFLAGS)
		AC_SUBST(MDNS_LIBS)
	fi
fi
AM_CONDITIONAL(USE_DAAP, test "x$enable_daap" != "xno")

AC_CHECK_LIB(z, uncompress)


dnl check for MusicBrainz
AC_ARG_ENABLE(musicbrainz, AC_HELP_STRING([--disable-musicbrainz],
				[don't build with MusicBrainz support]))
if test x"$enable_musicbrainz" != "xno"; then
	PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz >= $MUSICBRAINZ_REQS,
                          enable_musicbrainz=yes,
		          enable_musicbrainz=no)
fi
if test x"$enable_musicbrainz" = xyes; then
	RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $MUSICBRAINZ_CFLAGS"
	RHYTHMBOX_LIBS="$RHYTHMBOX_LIBS $MUSICBRAINZ_LIBS"
	AC_DEFINE(HAVE_MUSICBRAINZ, 1, [define if you have Musicbrainz])
fi
AM_CONDITIONAL(HAVE_MUSICBRAINZ, test "x$enable_musicbrainz" = "xyes")



AC_PATH_X

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

have_xidle=no
AC_COMPILE_IFELSE([
	#include <X11/extensions/xidle.h>
int main(int argc,char **argv) {
  return 0;
}
], have_xidle=yes)
AC_MSG_CHECKING(for XIDLE extension)
AC_MSG_RESULT($have_xidle)
if test x"$have_xidle" = "xyes" ; then
	AC_DEFINE(HAVE_XIDLE_EXTENSION, 1, [defined if you have X11/extensions/xidle.h])
fi

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 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_ARG_ENABLE(mmkeys, AC_HELP_STRING([--disable-mmkeys],
					[don't build with Multimedia Keys support]))
if test x"$have_xfree" = xyes; then
	if test x"$enable_mmkeys" != xno; then
		enable_mmkeys=yes
		AC_DEFINE(HAVE_MMKEYS, 1, [define if Multimedia Keys are enabled])
	fi
else
	if test x"$enable_mmkeys" = xyes; then
		AC_MSG_ERROR([Multimedia keys explicitly requested but no support found])
	fi
fi

dnl libnautilus-burn support
have_libnautilus_burn=no
AC_ARG_WITH(libnautilus-burn,
	    AC_HELP_STRING([--with-libnautilus-burn],
	    		   [Build with libnautilus-burn support]),,
	    with_libnautilus_burn=auto)
if test x"$with_libnautilus_burn" != "xno"; then
    PKG_CHECK_MODULES(LIBNAUTILUS_BURN, [libnautilus-burn >= $NCB_MIN_REQS], have_libnautilus_burn=yes, have_libnautilus_burn=no)
fi
if test "x$have_libnautilus_burn" = xyes; then
    AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_door_is_open,
       [AC_DEFINE([HAVE_BURN_DRIVE_DOOR], 1, [Have nautilus-burn function to check drive door state])],
       ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])
    AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_unref,
       [AC_DEFINE([HAVE_BURN_DRIVE_UNREF], 1, [Have nautilus-burn 2.13 drive unref function])],
       ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])
    AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_new_from_path,
       [AC_DEFINE([HAVE_BURN_DRIVE_NEW_FROM_PATH], 1, [Have nautilus-burn 2.13 drive new_from_path function])],
       ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])
    AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_get_write_speeds,
       [AC_DEFINE([HAVE_BURN_DRIVE_GET_WRITE_SPEEDS], 1, [Have nautilus-burn 2.13 drive get_write_speeds])],
       ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])

    AC_DEFINE([HAVE_NAUTILUS_BURN], 1, [Have nautilus-burn])
fi
AM_CONDITIONAL(HAVE_NAUTILUS_BURN, test x$have_libnautilus_burn = xyes)
AC_SUBST(HAVE_NAUTILUS_BURN)

dnl CD burning support
AC_ARG_WITH(cd-burning,
            AC_HELP_STRING([--with-cd-burning],
			   [Enable CD burning support]),,
	      with_cd_burning=auto)
enable_cd_burning=no
if test "x$have_libnautilus_burn" = "xyes" -a "x$with_cd_burning" != "xno"; then
   enable_cd_burning=yes
fi
AM_CONDITIONAL(USE_CD_BURNING, test "x$enable_cd_burning" != "xno")

AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)

AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource)
AC_PATH_PROG(GCONFTOOL, gconftool-2)

AC_SUBST(RHYTHMBOX_CFLAGS)
AC_SUBST(RHYTHMBOX_LIBS)
AC_SUBST(RB_CLIENT_CFLAGS)
AC_SUBST(RB_CLIENT_LIBS)

AC_TRY_RUN([#include <time.h>
                int main ()
                {
                  char buf[100];
                  struct tm tm = {0};
                  tm.tm_year = 99;
                  if (strftime(buf, 100, "%EY", &tm) == 4 &&
                      strcmp (buf, "1999")==0)
                    return 0;
                  return 1;
                }
            ],
            AC_DEFINE(HAVE_STRFTIME_EXTENSION, 1, [Define if strftime supports %E and %O modifiers.])
            )

GETTEXT_PACKAGE=rhythmbox
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the Gettext package name])

AM_GLIB_GNU_GETTEXT

dnl Workaround for automake 1.8
AC_SUBST(mkdir_p) if test x"$mkdir_p" = "x"; then
  MKINSTALLDIRS="mkinstalldirs"
fi
AC_SUBST(MKINSTALLDIRS)

dnl DBUS
PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_MIN_REQS)

DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
DBUS_GLIB_BIN="`$PKG_CONFIG --variable=exec_prefix dbus-glib-1`/bin"
AC_SUBST(DBUS_GLIB_BIN)

dnl out-of-process metadata reader (requires dbus)
AC_ARG_WITH(metadata-helper,
	    AC_HELP_STRING([--with-metadata-helper],
	    		   [Use a separate process for metadata reading]),,
	    with_metadata_helper=auto)
if test "x$with_metadata_helper" != xno; then
	AC_DEFINE(WITH_METADATA_HELPER, 1, [Define if the metadata helper process is enabled])
fi
AM_CONDITIONAL(WITH_METADATA_HELPER, test "x$with_metadata_helper" != "xno")

AM_GCONF_SOURCE_2

dnl LIRC
AC_ARG_ENABLE(lirc,
	AC_HELP_STRING([--enable-lirc],[enable lirc support]))
with_lirc=no
if test x"$enable_lirc" != xno; then
	AC_CHECK_HEADER(lirc/lirc_client.h,[with_lirc=yes],[with_lirc=no])
	if test x"$with_lirc" = xyes; then
		AC_CHECK_LIB(lirc_client,lirc_init,[with_lirc=yes],[with_lirc=no])
	fi
	if test x"$with_lirc" = xno -a x"$enable_lirc" = xyes; then
		AC_MSG_ERROR([lirc explicitly requested but no support found])
	fi
fi
AM_CONDITIONAL(WITH_LIRC, test x"$with_lirc" = xyes)


AC_ARG_ENABLE(uninstalled-build,
              AC_HELP_STRING([--enable-uninstalled-build],
			     [Search for files in build directory as well]),
	      enable_uninstalled=yes,)
if test x"$enable_uninstalled" = xyes; then
	ROOT_UNINSTALLED_DIR="`pwd`"
	AC_DEFINE(USE_UNINSTALLED_DIRS, 1, [Define to look for files in source tree locations])
	AC_DEFINE_UNQUOTED(SHARE_UNINSTALLED_DIR,"`pwd`/data",[path to source data dir])
	AC_DEFINE_UNQUOTED(METADATA_UNINSTALLED_DIR,"`pwd`/metadata",[path to metadata build dir])
fi
AC_SUBST(ROOT_UNINSTALLED_DIR)

AC_ARG_WITH(internal-libsexy,
            AC_HELP_STRING([--with-internal-libsexy],
			   [Build using internal libsexy library]),,
	      with_internal_libsexy=no)
if test "x$with_internal_libsexy" = "xno"; then
	PKG_CHECK_MODULES(LIBSEXY, libsexy >= 0.1.5,
		          with_internal_libsexy=no,
		          with_internal_libsexy=yes)
fi
AC_SUBST(LIBSEXY_CFLAGS)
AC_SUBST(LIBSEXY_LIBS)
AM_CONDITIONAL(WITH_INTERNAL_LIBSEXY, test "x$with_internal_libsexy" = "xyes")


dnl we've copies gsequence from glib 2.13, and should just link to that
dnl if the system version has it
AC_ARG_WITH(internal-gsequence,
            AC_HELP_STRING([--with-internal-gsequence],
			   [Build using internal cope of gsequence]),,
	      with_internal_gsequence=no)
if test "x$with_internal_gsequence" = "xno"; then
	PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.13.0, with_internal_gsequence=no,
		          with_internal_gsequence=yes)
fi
AM_CONDITIONAL(WITH_INTERNAL_GSEQUENCE, test "x$with_internal_gsequence" = "xyes")

dnl warnings bits, copied from gnome-keyring configure.in
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.

AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
if test -d "$srcdir/.svn" || test -d "$srcdir/{arch}" || test -d "$srcdir/CVS" || test -d "$srcdir/_darcs" || test -d "$srcdir/.git"; then
	set_more_warnings=yes
else
	set_more_warnings=no
fi
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
	AC_MSG_RESULT(yes)
	WARN_CFLAGS="\
	-Wcomment -Wformat -Wnonnull -Wimplicit-int -Wimplicit \
	-Wmain -Wmissing-braces -Wparentheses -Wsequence-point \
	-Wreturn-type -Wswitch -Wtrigraphs -Wunused-function \
	-Wunused-label -Wunused-value \
	-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
	-Wnested-externs -Wpointer-arith \
	-Wcast-align -Wall \
	-Werror -std=gnu89"

	if echo "$CFLAGS" | grep -e '-O[1-9]'; then
	   WARN_CFLAGS="-Wuninitialized $WARN_CFLAGS"
	fi

	for option in $WARN_CFLAGS; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		if test x$has_option = xyes; then
			RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $option"
		fi
		AC_MSG_RESULT($has_option)
		CFLAGS="$SAVE_CFLAGS"
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
	AC_SUBST(WARN_CFLAGS)

	SAVE_CFLAGS="$CFLAGS"
	CFLAGS="$CFLAGS -Wno-error"
	AC_TRY_COMPILE([], [],
		WNOERROR_CFLAGS="-Wno-error",
		WNOERROR_CFLAGS="")
	AC_SUBST(WNOERROR_CFLAGS)
	CFLAGS="$SAVE_CFLAGS"
	unset SAVE_CFLAGS
	unset has_wnoerror
else
	AC_MSG_RESULT(no)
fi

dnl Enable gtk-doc
GTK_DOC_CHECK(1.4)

dnl Enable gnome-doc-utils
GNOME_DOC_INIT


dnl ================================================================
dnl Plugins
dnl ================================================================

PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)

PLUGINDIR='${libdir}/rhythmbox/plugins'
AC_SUBST(PLUGINDIR)

dnl ================================================================
dnl Python plugins
dnl ================================================================

AC_MSG_CHECKING([whether Python plugin support is requested])
AC_ARG_ENABLE([python],
	AS_HELP_STRING([--enable-python],[Enable python support]),
	[enable_python=$enableval have_python=$enableval],
	[enable_python=autodetect have_python=yes])
AC_MSG_RESULT([$enable_python])

if test "x$have_python" != "xyes"; then
	if test "x$enable_python" = "xyes"; then
		AC_MSG_ERROR([Python not found])
	elif test "x$enable_python" = "xautodetect"; then
		enable_python=no
		AC_MSG_WARN([Python not found, disabling python support])
	fi
fi

if test "x$have_python" != "xno"; then
	AM_PATH_PYTHON([2.3],[],[no])
	if test "x$PYTHON" = "x:"; then
		have_python=no
	fi
fi

if test "x$have_python" != "xno"; then
	PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
	PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
	PYTHON_LIBS="-lpython$PYTHON_VERSION"
	PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
	PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
	PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/Makefile"
	PYTHON_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
	PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
	PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
	PYTHON_EXTRA_LIBS="$PYTHON_LOCALMODLIBS $PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
	AC_SUBST([PYTHON_LIBS])
	AC_SUBST([PYTHON_LIB_LOC])
	AC_SUBST([PYTHON_CFLAGS])
	AC_SUBST([PYTHON_EXTRA_LIBS])

	dnl FIXME: do we really need this test?
	AC_MSG_CHECKING([whether we can build a shared library depending on libpython])
	rm -rf testpython
	mkdir testpython
	cd testpython
	cat > testpython.c <<EOF
#include <Python.h>
int testpython (void)
{
Py_Exit (0);
}
EOF

	if /bin/sh ../libtool --mode=compile ${CC} $PYTHON_CFLAGS -c testpython.c >/dev/null 2>&1 && \
		/bin/sh ../libtool --mode=link ${CC} -o testpython.la -rpath `pwd` -module -avoid-version $PYTHON_LIB_LOC testpython.lo $PYTHON_LIBS $PYTHON_EXTRA_LIBS >/dev/null 2>&1 && \
		grep 'dlname.*testpython' testpython.la >/dev/null 2>&1; then
		result=yes
	else
		result=no
		have_python=no
	fi
	cd ..
	rm -rf testpython
	AC_MSG_RESULT([$result])
fi

if test "x$have_python" != "xno"; then
	PYGTK_REQUIRED=2.8.0
	GST_PYTHON_REQUIRED=0.10.1

	PKG_CHECK_MODULES([PYGTK], [
		pygtk-2.0 >= $PYGTK_REQUIRED] \
		gst-python-0.10 >= $GST_PYTHON_REQUIRED,
		[],
		[
		have_python=no
		if test "x$enable_python" = "xyes"; then
			AC_MSG_ERROR([$PYGTK_PKG_ERRORS])
		elif test "x$enable_python" = "xautodetect"; then
			enable_python=no
			AC_MSG_WARN([$PYGTK_PKG_ERRORS])
			AC_MSG_WARN([Disabling python support])
		fi
		])

	AC_SUBST([PYGTK_CFLAGS])
	AC_SUBST([PYGTK_LIBS])
fi

if test "x$have_python" != "xno"; then
	AC_MSG_CHECKING([for pygtk defs])
	PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
	AC_MSG_RESULT([$PYGTK_DEFSDIR])

	AC_MSG_CHECKING([for gst-python defs])
	GST_PYTHON_DEFSDIR=`$PKG_CONFIG --variable=defsdir gst-python-0.10`
	AC_MSG_RESULT([$GST_PYTHON_DEFSDIR])

	AC_MSG_CHECKING([for pygtk codegen])
	PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
	AC_MSG_RESULT([$PYGTK_CODEGEN])

	AC_MSG_CHECKING([for pygtk h2def])
	PYGTK_H2DEF="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/h2def.py"
	AC_MSG_RESULT([$PYGTK_H2DEF])

	AC_SUBST([PYGTK_DEFSDIR])
	AC_SUBST([GST_PYTHON_DEFSDIR])
	AC_SUBST([PYGTK_CODEGEN])
	AC_SUBST([PYGTK_H2DEF])

dnl	uncomment when http://bugzilla.gnome.org/show_bug.cgi?id=351072 fixed
dnl	PKG_CHECK_EXISTS([pygobject-2.0 >= X.XX.X],
dnl			 AC_DEFINE([PYGOBJECT_CAN_MARSHAL_GVALUE]))

	dnl Check for -fno-strict-aliasing
	FLAGS="-fno-strict-aliasing"
	save_CFLAGS="$CFLAGS"
	CFLAGS="$CFLAGS $FLAGS"
	AC_MSG_CHECKING([whether [$]CC understands $FLAGS])
	AC_TRY_COMPILE([], [], [compiler_has_option=yes], [compiler_has_option=no])
	CFLAGS="$save_CFLAGS"
	AC_MSG_RESULT($compiler_has_option)
	if test $compiler_has_option = yes; then
		NO_STRICT_ALIASING_CFLAGS="$FLAGS"
	fi
	AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
fi

if test "x$have_python" != "xno" -a "x$enable_python" != "xno"; then
	enable_python=yes
	AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python plugin support])
fi

AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])

dnl ================================================================
dnl Vala plugins
dnl ================================================================
AC_MSG_CHECKING([whether Vala plugin support is requested])
AC_ARG_ENABLE([vala],
	AS_HELP_STRING([--enable-vala],[Enable Vala plugin support]),
	[enable_vala=$enableval have_vala=$enableval],
	[enable_vala=autodetect have_vala=yes])
AC_MSG_RESULT([$enable_vala])
if test "x$enable_vala" != "xno"; then
	PKG_CHECK_MODULES(VALA, vala-1.0 >= $VALA_REQS, with_vala=yes,
		          with_vala=no)
	if test "x$with_vala" = "xyes"; then
		VALAC="`pkg-config --variable=prefix vala-1.0`/bin/valac"
		AC_SUBST([VALAC])
	elif test "x$enable_vala" = "xyes"; then
		AC_MSG_ERROR([Vala plugin support explicitly requested, but not found])
	fi
fi
AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes")

dnl ================================================================
dnl FM Radio Plugin
dnl ================================================================
AC_CHECK_HEADER
AC_MSG_CHECKING([whether FM radio support is requested])
AC_ARG_ENABLE([fm-radio],
  AC_HELP_STRING([--disable-fm-radio],[Disable FM radio support]),,
  enable_fm_radio=yes)
if test "x$enable_fm_radio" != xno; then
  AC_CHECK_HEADER([linux/videodev2.h],,[enable_fm_radio=no])
fi
AM_CONDITIONAL(ENABLE_FM_RADIO, test "x$enable_fm_radio" != xno)


dnl check, for unit tests
AM_PATH_CHECK([], have_check=yes, have_check=no)
AM_CONDITIONAL([HAVE_CHECK],[test "x$have_check" = "xyes"])

dnl ================================================================
dnl Browser plugin
dnl ================================================================

AC_ARG_ENABLE([browser-plugin],
	[AS_HELP_STRING([--enable-browser-plugin],[compile the iTunes detection browser plugin])],
	[],[enable_browser_plugin=autodetect])

if test "$enable_browser_plugin" != "no" ; then
	AC_MSG_CHECKING([which gecko to use])

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

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

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

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

	AC_MSG_RESULT([$gecko])
fi

if test "$enable_browser_plugin" = "yes" ; then
	PKG_CHECK_MODULES([BROWSER_PLUGIN],
		[glib-2.0 $gecko-plugin],
		[],[enable_browser_plugins=no])
fi

AM_CONDITIONAL([ENABLE_BROWSER_PLUGIN], test x$enable_browser_plugin = xyes)

dnl ================================================================
dnl end-game
dnl ================================================================

AC_OUTPUT([
Makefile
macros/Makefile
lib/Makefile
metadata/Makefile
rhythmdb/Makefile
widgets/Makefile
widgets/libsexy/Makefile
podcast/Makefile
shell/Makefile
data/Makefile
data/rhythmbox.desktop.in
data/ui/Makefile
data/glade/Makefile
data/icons/Makefile
data/icons/hicolor/Makefile
data/icons/hicolor/16x16/Makefile
data/icons/hicolor/16x16/actions/Makefile
data/icons/hicolor/16x16/apps/Makefile
data/icons/hicolor/16x16/places/Makefile
data/icons/hicolor/16x16/status/Makefile
data/icons/hicolor/22x22/Makefile
data/icons/hicolor/22x22/actions/Makefile
data/icons/hicolor/22x22/apps/Makefile
data/icons/hicolor/22x22/places/Makefile
data/icons/hicolor/22x22/status/Makefile
data/icons/hicolor/32x32/Makefile
data/icons/hicolor/32x32/actions/Makefile
data/icons/hicolor/32x32/apps/Makefile
data/icons/hicolor/32x32/places/Makefile
data/icons/hicolor/32x32/status/Makefile
data/icons/hicolor/48x48/Makefile
data/icons/hicolor/48x48/apps/Makefile
data/icons/hicolor/scalable/Makefile
data/icons/hicolor/scalable/actions/Makefile
data/icons/hicolor/scalable/apps/Makefile
data/icons/hicolor/scalable/places/Makefile
data/icons/hicolor/scalable/status/Makefile
sources/Makefile
corelib/Makefile
plugins/Makefile
plugins/sample/Makefile
plugins/audiocd/Makefile
plugins/coherence/Makefile
plugins/coherence/upnp_coherence/Makefile
plugins/audioscrobbler/Makefile
plugins/cd-recorder/Makefile
plugins/daap/Makefile
plugins/fmradio/Makefile
plugins/ipod/Makefile
plugins/mtpdevice/Makefile
plugins/iradio/Makefile
plugins/lirc/Makefile
plugins/lyrics/Makefile
plugins/lyrics/lyrics/Makefile
plugins/sample-python/Makefile
plugins/sample-vala/Makefile
plugins/pythonconsole/Makefile
plugins/artdisplay/Makefile
plugins/artdisplay/artdisplay/Makefile
plugins/magnatune/Makefile
plugins/magnatune/magnatune/Makefile
plugins/jamendo/Makefile
plugins/jamendo/jamendo/Makefile
plugins/generic-player/Makefile
plugins/rb/Makefile
plugins/power-manager/Makefile
plugins/visualizer/Makefile
plugins/mmkeys/Makefile
bindings/Makefile
bindings/python/Makefile
bindings/vala/Makefile
help/Makefile
po/Makefile.in
tests/Makefile
doc/Makefile
doc/reference/Makefile
backends/Makefile
backends/gstreamer/Makefile
remote/Makefile
remote/dbus/Makefile
])

AC_MSG_NOTICE([Rhythmbox was configured with the following options:])
if test x"$with_database" = xtree; then
	AC_MSG_NOTICE([** Tree database is enabled])
elif test x"$with_database" = xlibgda; then
	AC_MSG_NOTICE([** libgda/sqlite database is enabled])
else
	AC_MSG_ERROR([Unknown database!])
fi
if test x"${with_rhythmdb_debug}" != x0; then
	AC_MSG_NOTICE([** RhythmDB sanity checking enabled (may be slow!)])
fi


if test x"$enable_tag_writing" != xno; then
        AC_MSG_NOTICE([** Tag writing is enabled])
else
	AC_MSG_NOTICE([   Tag writing is disabled])
fi
if test x"$with_track_transfer" = xyes; then
        AC_MSG_NOTICE([** Track transfer is enabled])
else
	AC_MSG_NOTICE([   Track transfer is disabled])
fi
if test x"$enable_mmkeys" != "xyes"; then
	AC_MSG_NOTICE([   Multimedia keys support is disabled])
else
	AC_MSG_NOTICE([** Multimedia keys support is enabled])
fi
if test x"$enable_musicbrainz" != "xyes"; then
	AC_MSG_NOTICE([   MusicBrainz support is disabled])
else
	AC_MSG_NOTICE([** MusicBrainz support is enabled])
fi

if test x"$have_gstreamer_0_10_xfade" != xyes; then
	AC_MSG_NOTICE([   Crossfading player is disabled])
else
	AC_MSG_NOTICE([** Crossfading player is enabled])
fi

if test x"$use_ipod" = xyes; then
	if test x"$enable_ipod_writing" != xno; then
		AC_MSG_NOTICE([** iPod integration enabled])
	else
		AC_MSG_NOTICE([** iPod integration enabled (read-only)])
	fi
else
	AC_MSG_NOTICE([   iPod integration disabled])
fi
if test x"$use_mtp" = xyes; then
	AC_MSG_NOTICE([** MTP integration enabled])
else
	AC_MSG_NOTICE([   MTP integration disabled])
fi
if test x"$enable_cd_burning" != xno; then
	AC_MSG_NOTICE([** CD burning support enabled])
else
	AC_MSG_NOTICE([   CD burning support disabled])
fi
if test x"$enable_daap" = xyes; then
	AC_MSG_NOTICE([** DAAP (music sharing) support is enabled])
else
	AC_MSG_NOTICE([   DAAP (music sharing) support is disabled])
fi
if test x"$have_libnotify" = xyes; then
	AC_MSG_NOTICE([** libnotify support is enabled])
else
	AC_MSG_NOTICE([   libnotify support is disabled])
fi
if test x"$enable_hal" = xyes; then
	AC_MSG_NOTICE([** HAL support enabled])
else
	AC_MSG_NOTICE([   HAL support disabled])
fi
if test x"$enable_python" != xno; then
	AC_MSG_NOTICE([** Python plugin support enabled])
else
	AC_MSG_NOTICE([   Python plugin support disabled])
fi
if test x"$with_vala" = xyes; then
	AC_MSG_NOTICE([** Vala plugin support enabled])
else
	AC_MSG_NOTICE([   Vala plugin support disabled])
fi
if test x"$use_gnome_keyring" = xyes; then
	AC_MSG_NOTICE([** gnome-keyring support enabled])
else
	AC_MSG_NOTICE([   gnome-keyring support disabled])
fi
if test x"$enable_audioscrobbler" != xno; then
	AC_MSG_NOTICE([** Audioscrobbler support enabled])
else
	AC_MSG_NOTICE([   Audioscrobbler support disabled])
fi
if test x"$with_metadata_helper" != xno; then
	AC_MSG_NOTICE([** Separate metadata helper process enabled])
else
	AC_MSG_NOTICE([   Separate metadata helper process disabled])
fi
if test x"$with_internal_libsexy" = xyes; then
	AC_MSG_NOTICE([   using internal libsexy])
else
	AC_MSG_NOTICE([** using system-wide libsexy])
fi
if test x"$with_internal_gsequence" = xyes; then
	AC_MSG_NOTICE([   using internal copy of gsequence])
else
	AC_MSG_NOTICE([** using glib 2.13 version of gsequence])
fi
if test "x$enable_fm_radio" != xno; then
	AC_MSG_NOTICE([** FM radio support enabled])
else
	AC_MSG_NOTICE([   FM radio support disabled])
fi

if test "x$enable_browser_plugin" != xno; then
	AC_MSG_NOTICE([** iTunes detection browser plugin (for podcasts) enabled])
else
	AC_MSG_NOTICE([   iTunes detection browser plugin (for podcasts) disabled])
fi

AC_MSG_NOTICE([End options])