aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: f529cc5a8cb3aa90f6332a75249e9f65875b14a0 (plain) (blame)
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
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
AC_PREREQ(2.60)

AC_INIT(mpd, 0.18~git, musicpd-dev-team@lists.sourceforge.net)

VERSION_MAJOR=0
VERSION_MINOR=18
VERSION_REVISION=0
VERSION_EXTRA=0

AC_CONFIG_SRCDIR([src/Main.cxx])
AM_INIT_AUTOMAKE([foreign 1.11 dist-bzip2 dist-xz subdir-objects])
AM_SILENT_RULES
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])

AC_DEFINE(PROTOCOL_VERSION, "0.18.0", [The MPD protocol version])


dnl ---------------------------------------------------------------------------
dnl Programs
dnl ---------------------------------------------------------------------------
AC_PROG_CC_C99
AC_PROG_CXX
AC_PROG_RANLIB

AN_MAKEVAR([AR], [AC_PROG_AR])
AN_PROGRAM([ar], [AC_PROG_AR])
AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
AC_PROG_AR

AC_PROG_INSTALL
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemdsystemunitdir],
	    AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
	    [], [with_systemdsystemunitdir=no])
if test "x$with_systemdsystemunitdir" = xyes; then
	AC_MSG_CHECKING(for systemd)
	with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
	if test -z "$with_systemdsystemunitdir"; then
		AC_MSG_ERROR([Failed to detect systemd])
	fi
	AC_MSG_RESULT([$with_systemdsystemunitdir])
fi
if test "x$with_systemdsystemunitdir" != xno; then
	AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])

dnl ---------------------------------------------------------------------------
dnl Declare Variables
dnl ---------------------------------------------------------------------------
AC_SUBST(AM_CPPFLAGS,"")
AC_SUBST(AM_CFLAGS,"")
AC_SUBST(AM_CXXFLAGS,"")

## Used for the windows resource file
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_REVISION)
AC_SUBST(VERSION_EXTRA)

dnl ---------------------------------------------------------------------------
dnl OS Specific Defaults
dnl ---------------------------------------------------------------------------
AC_CANONICAL_HOST

case "$host_os" in
mingw32* | windows*)
	AC_CONFIG_FILES([
		src/win/mpd_win32_rc.rc
	])
	AC_CHECK_TOOL(WINDRES, windres)
	AM_CPPFLAGS="$AM_CPPFLAGS -DWIN32_LEAN_AND_MEAN"
	AM_CPPFLAGS="$AM_CPPFLAGS -DWINVER=0x0600 -D_WIN32_WINNT=0x0600"
	LIBS="$LIBS -lws2_32"
	HAVE_WINDOWS=1
	;;
esac
AM_CONDITIONAL([HAVE_WINDOWS], [test x$HAVE_WINDOWS = x1])

if test -z "$prefix" || test "x$prefix" = xNONE; then
	local_lib=
	local_include=

	# aren't autotools supposed to be smart enough to figure this out?  oh
	# well, the git-core Makefile managed to do some of the work for us :)
	case "$host_os" in
	darwin*)
		local_lib='/sw/lib /opt/local/lib'
		local_include='/sw/include /opt/local/include'
		;;
	freebsd* | openbsd*)
		local_lib=/usr/local/lib
		local_include=/usr/local/include
		;;
	netbsd*)
		local_lib=/usr/pkg/lib
		local_include=/usr/pkg/include
		LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
		;;
	esac

	for d in $local_lib; do
		if test -d "$d"; then
			LDFLAGS="$LDFLAGS -L$d"
			break
		fi
	done
	for d in $local_include; do
		if test -d "$d"; then
			CPPFLAGS="$CPPFLAGS -I$d"
			break
		fi
	done
fi

dnl ---------------------------------------------------------------------------
dnl Language Checks
dnl ---------------------------------------------------------------------------

AC_CXX_COMPILE_STDCXX_0X
if test "$ax_cv_cxx_compile_cxx0x_native" != yes; then
	if test "$ax_cv_cxx_compile_cxx0x_gxx" = yes; then
	   	AM_CXXFLAGS="$AM_CXXFLAGS -std=gnu++0x"
	elif test "$ax_cv_cxx_compile_cxx0x_cxx" = yes; then
	   	AM_CXXFLAGS="$AM_CXXFLAGS -std=c++0x"
	fi
fi

dnl ---------------------------------------------------------------------------
dnl Header/Library Checks
dnl ---------------------------------------------------------------------------
AC_CHECK_FUNCS(daemon fork)

AC_SEARCH_LIBS([syslog], [bsd socket inet],
	[AC_DEFINE(HAVE_SYSLOG, 1, [Define if syslog() is available])])

AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl])

AC_CHECK_FUNCS(pipe2 accept4)
MPD_OPTIONAL_FUNC(eventfd, eventfd, USE_EVENTFD)
MPD_OPTIONAL_FUNC(signalfd, signalfd, USE_SIGNALFD)
MPD_OPTIONAL_FUNC(epoll, epoll_create1, USE_EPOLL)

AC_SEARCH_LIBS([exp], [m],,
	[AC_MSG_ERROR([exp() not found])])

AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(valgrind/memcheck.h)

dnl ---------------------------------------------------------------------------
dnl Allow tools to be specifically built
dnl ---------------------------------------------------------------------------

AC_ARG_ENABLE(libmpdclient,
	AS_HELP_STRING([--enable-libmpdclient],
		[enable support for the MPD client]),,
	enable_libmpdclient=auto)

AC_ARG_ENABLE(adplug,
	AS_HELP_STRING([--enable-adplug],
		[enable the AdPlug decoder plugin (default: auto)]),,
	enable_adplug=auto)

AC_ARG_ENABLE(alsa,
	AS_HELP_STRING([--enable-alsa], [enable ALSA support]),,
	[enable_alsa=auto])

AC_ARG_ENABLE(roar,
	AS_HELP_STRING([--enable-roar],
		[enable support for RoarAudio]),,
	[enable_roar=auto])

AC_ARG_ENABLE(ao,
	AS_HELP_STRING([--enable-ao],
		[enable support for libao]),,
	enable_ao=auto)

AC_ARG_ENABLE(audiofile,
	AS_HELP_STRING([--enable-audiofile],
		[enable audiofile support (WAV and others)]),,
	enable_audiofile=auto)

AC_ARG_ENABLE(bzip2,
	AS_HELP_STRING([--enable-bzip2],
		[enable bzip2 archive support (default: disabled)]),,
	enable_bzip2=no)

AC_ARG_ENABLE(cdio-paranoia,
	AS_HELP_STRING([--enable-cdio-paranoia],
		[enable support for audio CD support]),,
	enable_cdio_paranoia=auto)

AC_ARG_ENABLE(curl,
	AS_HELP_STRING([--enable-curl],
		[enable support for libcurl HTTP streaming (default: auto)]),,
	[enable_curl=auto])

AC_ARG_ENABLE(debug,
	AS_HELP_STRING([--enable-debug],
		[enable debugging (default: disabled)]),,
	enable_debug=no)

AC_ARG_ENABLE(documentation,
	AS_HELP_STRING([--enable-documentation],
		[build documentation (default: disable)]),,
	[enable_documentation=no])

AC_ARG_ENABLE(ffmpeg,
	AS_HELP_STRING([--enable-ffmpeg],
		[enable FFMPEG support]),,
	enable_ffmpeg=auto)

AC_ARG_ENABLE(fifo,
	AS_HELP_STRING([--disable-fifo],
		[disable support for writing audio to a FIFO (default: enable)]),,
	enable_fifo=yes)

AC_ARG_ENABLE(flac,
	AS_HELP_STRING([--enable-flac],
		[enable FLAC decoder]),,
	enable_flac=auto)

AC_ARG_ENABLE(fluidsynth,
	AS_HELP_STRING([--enable-fluidsynth],
		[enable MIDI support via fluidsynth (default: auto)]),,
	enable_fluidsynth=auto)

AC_ARG_ENABLE(gme,
	AS_HELP_STRING([--enable-gme],
		[enable Blargg's game music emulator plugin]),,
	enable_gme=auto)

AC_ARG_ENABLE(httpd-output,
	AS_HELP_STRING([--enable-httpd-output],
		[enables the HTTP server output]),,
	[enable_httpd_output=auto])

AC_ARG_ENABLE(id3,
	AS_HELP_STRING([--enable-id3],
		[enable id3 support]),,
	enable_id3=auto)

AC_ARG_ENABLE(inotify,
	AS_HELP_STRING([--disable-inotify],
		[disable support Inotify automatic database update (default: enabled) ]),,
	[enable_inotify=yes])

AC_ARG_ENABLE(ipv6,
	AS_HELP_STRING([--disable-ipv6],
		[disable IPv6 support (default: enable)]),,
	[enable_ipv6=yes])

AC_ARG_ENABLE(iso9660,
	AS_HELP_STRING([--enable-iso9660],
		[enable iso9660 archive support (default: disabled)]),,
	enable_iso9660=no)

AC_ARG_ENABLE(jack,
	AS_HELP_STRING([--enable-jack],
		[enable jack support]),,
	enable_jack=auto)

AC_SYS_LARGEFILE

AC_ARG_ENABLE(lastfm,
	AS_HELP_STRING([--enable-lastfm],
		[enable support for last.fm radio (default: disable)]),,
	[enable_lastfm=no])

AC_ARG_ENABLE(despotify,
	AS_HELP_STRING([--enable-despotify],
		[enable support for despotify (default: disable)]),,
	[enable_despotify=no])

AC_ARG_ENABLE(soundcloud,
	AS_HELP_STRING([--enable-soundcloud],
		[enable support for soundcloud.com]),,
	[enable_soundcloud=auto])

AC_ARG_ENABLE(lame-encoder,
	AS_HELP_STRING([--enable-lame-encoder],
		[enable the LAME mp3 encoder]),,
	enable_lame_encoder=auto)

AC_ARG_ENABLE([libwrap],
	AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
	[enable_libwrap=auto])

AC_ARG_ENABLE(lsr,
	AS_HELP_STRING([--enable-lsr],
		[enable libsamplerate support]),,
	enable_lsr=auto)

AC_ARG_ENABLE(mad,
	AS_HELP_STRING([--enable-mad],
		[enable libmad mp3 decoder plugin]),,
	enable_mad=auto)

AC_ARG_ENABLE(mikmod,
	AS_HELP_STRING([--enable-mikmod],
		[enable the mikmod decoder (default: disable)]),,
	enable_mikmod=no)

AC_ARG_ENABLE(mms,
	AS_HELP_STRING([--enable-mms],
		[enable the MMS protocol with libmms]),,
	[enable_mms=auto])

AC_ARG_ENABLE(modplug,
	AS_HELP_STRING([--enable-modplug],
		[enable modplug decoder plugin]),,
	enable_modplug=auto)

AC_ARG_ENABLE(mpc,
	AS_HELP_STRING([--disable-mpc],
		[disable musepack (MPC) support (default: enable)]),,
	enable_mpc=yes)

AC_ARG_ENABLE(mpg123,
	AS_HELP_STRING([--enable-mpg123],
		[enable libmpg123 decoder plugin]),,
	enable_mpg123=auto)

AC_ARG_ENABLE(openal,
	AS_HELP_STRING([--enable-openal],
		[enable OpenAL support (default: disable)]),,
	enable_openal=no)

AC_ARG_ENABLE(opus,
	AS_HELP_STRING([--enable-opus],
		[enable Opus codec support (default: auto)]),,
	enable_opus=auto)

AC_ARG_ENABLE(oss,
	AS_HELP_STRING([--disable-oss],
		[disable OSS support (default: enable)]),,
	enable_oss=yes)

AC_ARG_ENABLE(pipe-output,
	AS_HELP_STRING([--enable-pipe-output],
		[enable support for writing audio to a pipe (default: disable)]),,
	enable_pipe_output=no)

AC_ARG_ENABLE(pulse,
	AS_HELP_STRING([--enable-pulse],
		[enable support for the PulseAudio sound server]),,
	enable_pulse=auto)

AC_ARG_ENABLE(recorder-output,
	AS_HELP_STRING([--enable-recorder-output],
		[enables the recorder file output plugin (default: disable)]),,
	[enable_recorder_output=auto])

AC_ARG_ENABLE(sidplay,
	AS_HELP_STRING([--enable-sidplay],
		[enable C64 SID support via libsidplay2]),,
	enable_sidplay=auto)


AC_ARG_ENABLE(shout,
	AS_HELP_STRING([--enable-shout],
		[enables the shoutcast streaming output]),,
	[enable_shout=auto])

AC_ARG_ENABLE(sndfile,
	AS_HELP_STRING([--enable-sndfile],
		[enable sndfile support]),,
	enable_sndfile=auto)

AC_ARG_ENABLE(solaris_output,
	AS_HELP_STRING([--enable-solaris-output],
		[enables the Solaris /dev/audio output]),,
	[enable_solaris_output=auto])

AC_ARG_ENABLE(sqlite,
	AS_HELP_STRING([--enable-sqlite],
		[enable support for the SQLite database]),,
	[enable_sqlite=auto])

AC_ARG_ENABLE(systemd-daemon,
	AS_HELP_STRING([--enable-systemd-daemon],
		[use the systemd daemon library (default=auto)]),,
	[enable_systemd_daemon=auto])

AC_ARG_ENABLE(tcp,
	AS_HELP_STRING([--disable-tcp],
		[disable support for clients connecting via TCP (default: enable)]),,
	[enable_tcp=yes])

AC_ARG_ENABLE(test,
	AS_HELP_STRING([--enable-test],
		[build the test programs (default: disabled)]),,
	enable_test=no)

AC_ARG_WITH(tremor,
	AS_HELP_STRING([--with-tremor=PFX],
		[use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
	with_tremor=no)

AC_ARG_ENABLE(twolame-encoder,
	AS_HELP_STRING([--enable-twolame-encoder],
		[enable the TwoLAME mp2 encoder]),,
	enable_twolame_encoder=auto)

AC_ARG_ENABLE(un,
	AS_HELP_STRING([--disable-un],
		[disable support for clients connecting via unix domain sockets (default: enable)]),,
	[enable_un=yes])

AC_ARG_ENABLE(vorbis,
	AS_HELP_STRING([--enable-vorbis],
		[enable Ogg Vorbis decoder]),,
	enable_vorbis=auto)

AC_ARG_ENABLE(vorbis-encoder,
	AS_HELP_STRING([--enable-vorbis-encoder],
		[enable the Ogg Vorbis encoder]),,
	[enable_vorbis_encoder=auto])

AC_ARG_ENABLE(wave-encoder,
	AS_HELP_STRING([--enable-wave-encoder],
		[enable the PCM wave encoder]),,
	enable_wave_encoder=yes)

AC_ARG_ENABLE(wavpack,
	AS_HELP_STRING([--enable-wavpack],
		[enable WavPack support]),,
	enable_wavpack=auto)

AC_ARG_ENABLE(werror,
	AS_HELP_STRING([--enable-werror],
		[treat warnings as errors (default: disabled)]),,
	enable_werror=no)

AC_ARG_ENABLE(wildmidi,
	AS_HELP_STRING([--enable-wildmidi],
		[enable MIDI support via wildmidi (default: disable)]),,
	enable_wildmidi=no)

AC_ARG_WITH(zeroconf,
	AS_HELP_STRING([--with-zeroconf=@<:@auto|avahi|bonjour|no@:>@],
		[enable zeroconf backend (default=auto)]),,
	with_zeroconf="auto")

AC_ARG_ENABLE(zzip,
	AS_HELP_STRING([--enable-zzip],
		[enable zip archive support (default: disabled)]),,
	enable_zzip=no)


AC_ARG_WITH(tremor-libraries,
	AS_HELP_STRING([--with-tremor-libraries=DIR],
		[directory where Tremor library is installed (optional)]),,
	tremor_libraries="")

AC_ARG_WITH(tremor-includes,
	AS_HELP_STRING([--with-tremor-includes=DIR],
		[directory where Tremor header files are installed (optional)]),,
	tremor_includes="")

dnl ---------------------------------------------------------------------------
dnl Mandatory Libraries
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.24 gthread-2.0],,
		[AC_MSG_ERROR([GLib 2.24 is required])])

if test x$GCC = xyes; then
	# suppress warnings in the GLib headers
	GLIB_CFLAGS=`echo $GLIB_CFLAGS |sed -e 's,-I/,-isystem /,g'`
fi

dnl ---------------------------------------------------------------------------
dnl Protocol Options
dnl ---------------------------------------------------------------------------

if test x$enable_tcp = xno; then
	# if we don't support TCP, we don't need IPv6 either
	enable_ipv6=no
fi

if test x$enable_ipv6 = xyes; then
	AC_MSG_CHECKING(for ipv6)
	AC_EGREP_CPP([AP_maGiC_VALUE],
	[
#include <sys/types.h>
#ifdef WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
#endif
#include <netdb.h>
#ifdef PF_INET6
#ifdef AF_INET6
AP_maGiC_VALUE
#endif
#endif
	],
	AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no])
)
fi

if test x$enable_tcp = xyes; then
	AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
fi

case "$host_os" in
mingw* | windows* | cygwin*)
	enable_un=no
	;;
esac

if test x$enable_un = xyes; then
	AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
	STRUCT_UCRED
	AC_CHECK_FUNCS(getpeereid)
fi

dnl --------------------------- Post Protocol Tests ---------------------------
if
	test x$enable_tcp = xno &&
	test x$enable_un = xno; then
	AC_MSG_ERROR([No client interfaces configured!])
fi

MPD_AUTO_PKG(systemd_daemon, SYSTEMD_DAEMON, libsystemd-daemon,
	[systemd activation], [libsystemd-daemon not found])
AM_CONDITIONAL(ENABLE_SYSTEMD_DAEMON, test x$enable_systemd_daemon = xyes)
if test x$enable_systemd_daemon = xyes; then
	AC_DEFINE([ENABLE_SYSTEMD_DAEMON], 1, [Define to use the systemd daemon library])
fi

dnl ---------------------------------------------------------------------------
dnl LIBC Features
dnl ---------------------------------------------------------------------------
if test x$enable_largefile != xno; then
	AC_DEFINE([ENABLE_LARGEFILE], 1, [Define if large file support is enabled])
fi

dnl ---------------------------------------------------------------------------
dnl Miscellaneous Libraries
dnl ---------------------------------------------------------------------------

dnl -------------------------------- libmpdclient --------------------------------
MPD_AUTO_PKG(libmpdclient, LIBMPDCLIENT, [libmpdclient >= 2.2],
	[MPD client library], [libmpdclient not found])
if test x$enable_libmpdclient = xyes; then
	AC_DEFINE(HAVE_LIBMPDCLIENT, 1, [Define to use libmpdclient])
fi

AM_CONDITIONAL(HAVE_LIBMPDCLIENT, test x$enable_libmpdclient = xyes)

dnl --------------------------------- inotify ---------------------------------
AC_CHECK_FUNCS(inotify_init inotify_init1)

if test x$ac_cv_func_inotify_init = xno; then
	enable_inotify=no
fi

if test x$enable_inotify = xyes; then
	AC_DEFINE([ENABLE_INOTIFY], 1, [Define to enable inotify support])
fi
AM_CONDITIONAL(ENABLE_INOTIFY, test x$enable_inotify = xyes)

dnl --------------------------------- libwrap ---------------------------------
if test x$enable_libwrap != xno; then
	AC_CHECK_LIBWRAP(found_libwrap=yes, found_libwrap=no)

	if test x$found_libwrap = xyes; then
		dnl  See if libwrap is compatible with C++; it is
		dnl  broken on many systems
		AC_MSG_CHECKING(whether libwrap is compatible with C++)
		AC_LANG_PUSH([C++])
		AC_COMPILE_IFELSE([AC_LANG_SOURCE([
			#include <tcpd.h>
			bool CheckLibWrap(int fd, const char &progname) {
				struct request_info req;
				request_init(&req, RQ_FILE, fd, RQ_DAEMON, progname, 0);
				fromhost(&req);
				return hosts_access(&req);
			}
			])],
			AC_MSG_RESULT([yes]),
			[found_libwrap=no; AC_MSG_RESULT([no]);
			AC_MSG_WARN([Your version of libwrap is broken with C++])])
		AC_LANG_POP
	fi

	MPD_AUTO_RESULT(libwrap, libwrap, [libwrap not found])
fi

if test x$enable_libwrap = xyes; then
	AC_SUBST(LIBWRAP_CFLAGS)
	AC_SUBST(LIBWRAP_LDFLAGS)
	AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])
fi

dnl ---------------------------------------------------------------------------
dnl Metadata Plugins
dnl ---------------------------------------------------------------------------

dnl -------------------------------- libid3tag --------------------------------
MPD_AUTO_PKG_LIB(id3, ID3TAG, id3tag, id3tag, id3_file_open, [-lid3tag -lz], [],
	[id3tag], [libid3tag not found])
if test x$enable_id3 = xyes; then
	AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag])
fi

AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)

dnl ---------------------------------------------------------------------------
dnl Autodiscovery
dnl ---------------------------------------------------------------------------

dnl --------------------------------- zeroconf --------------------------------

case $with_zeroconf in
no|bonjour)
	enable_avahi=no
	;;

avahi)
	enable_avahi=yes
	;;

*)
	with_zeroconf=auto
	enable_avahi=auto
	;;
esac

MPD_AUTO_PKG(avahi, AVAHI, [avahi-client avahi-glib],
	[avahi client library], [avahi client+glib not found])
if test x$enable_avahi = xyes; then
	AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])
	with_zeroconf=avahi
fi

AM_CONDITIONAL(HAVE_AVAHI, test x$enable_avahi = xyes)

enable_bounjour=no
if test x$with_zeroconf != xno; then
	if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
		AC_CHECK_HEADER(dns_sd.h,
			[enable_bonjour=yes;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])])
		AC_CHECK_LIB([dns_sd], [DNSServiceRegister])
	fi

	if test x$enable_bonjour = xyes; then
		with_zeroconf=bonjour
	elif test x$with_zeroconf = xbonjour; then
		AC_MSG_ERROR([Bonjour support requested but not found])
	fi

	if test x$with_zeroconf = xauto; then
		AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
		with_zeroconf=no
	else
		AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
	fi
fi

AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
AM_CONDITIONAL(HAVE_BONJOUR, test x$with_zeroconf = xbonjour)

dnl ---------------------------------------------------------------------------
dnl Sticker Database
dnl ---------------------------------------------------------------------------

dnl ---------------------------------- sqlite ---------------------------------

MPD_AUTO_PKG(sqlite, SQLITE, [sqlite3],
	[SQLite database support], [sqlite not found])
if test x$enable_sqlite = xyes; then
	AC_DEFINE([ENABLE_SQLITE], 1, [Define to enable sqlite database support])
fi

AM_CONDITIONAL(ENABLE_SQLITE, test x$enable_sqlite = xyes)

dnl ---------------------------------------------------------------------------
dnl Converter Plugins
dnl ---------------------------------------------------------------------------

dnl ------------------------------ libsamplerate ------------------------------
MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.0.15],
	[libsamplerate resampling], [libsamplerate not found])
if test x$enable_lsr = xyes; then
	AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
		[Define to enable libsamplerate])
fi

if test x$enable_lsr = xyes; then
	PKG_CHECK_MODULES([SAMPLERATE_013],
		[samplerate >= 0.1.3],,
		[AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1,
		[libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
fi

AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)

dnl ---------------------------------------------------------------------------
dnl Input Plugins
dnl ---------------------------------------------------------------------------

dnl ----------------------------------- CURL ----------------------------------
MPD_AUTO_PKG(curl, CURL, [libcurl >= 7.18],
	[libcurl HTTP streaming], [libcurl not found])
if test x$enable_curl = xyes; then
	AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
fi
AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)

dnl --------------------------------- Last.FM ---------------------------------
if test x$enable_lastfm = xyes; then
	if test x$enable_curl != xyes; then
		AC_MSG_ERROR([Cannot enable last.fm radio without curl])
	fi

	AC_DEFINE(ENABLE_LASTFM, 1, [Define when last.fm radio is enabled])
fi
AM_CONDITIONAL(ENABLE_LASTFM, test x$enable_lastfm = xyes)

dnl --------------------------------- Despotify ---------------------------------
MPD_AUTO_PKG(despotify, DESPOTIFY, [despotify],
	[Despotify support], [despotify not found])
if test x$enable_despotify = xyes; then
	AC_DEFINE(ENABLE_DESPOTIFY, 1, [Define when despotify is enabled])
fi
AM_CONDITIONAL(ENABLE_DESPOTIFY, test x$enable_despotify = xyes)

dnl --------------------------------- Soundcloud ------------------------------
if test x$enable_soundcloud != xno; then
	PKG_CHECK_MODULES([YAJL], [yajl >= 2.0],
		[found_soundcloud=yes],
		AC_CHECK_LIB([yajl], [yajl_alloc],
			[found_soundcloud=yes YAJL_CFLAGS=-DHAVE_YAJL1 YAJL_LIBS=-lyajl],
			[found_soundcloud=no]))
fi
MPD_AUTO_RESULT([soundcloud], [soundcloud.com support], [libyajl not found])
if test x$enable_soundcloud = xyes; then
	AC_DEFINE(ENABLE_SOUNDCLOUD, 1, [Define when soundcloud is enabled])
fi
AM_CONDITIONAL(ENABLE_SOUNDCLOUD, test x$enable_soundcloud = xyes)
AC_SUBST(YAJL_LIBS)

dnl ---------------------------------- cdio ---------------------------------
MPD_AUTO_PKG(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
	[libcdio_paranoia audio CD library], [libcdio_paranoia not found])
if test x$enable_cdio_paranoia = xyes; then
	AC_DEFINE([ENABLE_CDIO_PARANOIA], 1,
		[Define to enable libcdio_paranoia support])
fi

AM_CONDITIONAL(ENABLE_CDIO_PARANOIA, test x$enable_cdio_paranoia = xyes)

dnl ---------------------------------- libmms ---------------------------------
MPD_AUTO_PKG(mms, MMS, [libmms >= 0.4],
	[libmms mms:// protocol support], [libmms not found])
if test x$enable_mms = xyes; then
	AC_DEFINE(ENABLE_MMS, 1,
		[Define when libmms is used for the MMS protocol])
fi
AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)

dnl ---------------------------------------------------------------------------
dnl Archive Plugins
dnl ---------------------------------------------------------------------------

dnl --------------------------------- iso9660 ---------------------------------
MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
	[libiso9660 archive library], [libiso9660 not found])

AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
if test x$enable_iso9660 = xyes; then
	AC_DEFINE(HAVE_ISO9660, 1, [Define to have ISO9660 archive support])

	AC_PATH_PROG(MKISOFS, mkisofs, no)
else
	MKISOFS="no"
fi

AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)

dnl ---------------------------------- libbz2 ---------------------------------
if test x$enable_bzip2 = xyes; then
	AC_CHECK_LIB(bz2, BZ2_bzDecompressInit,
		[BZ2_LIBS="-lbz2"],
		[AC_MSG_ERROR([libbz2 not found])])
fi
AC_SUBST(BZ2_LIBS)

AM_CONDITIONAL(HAVE_BZ2, test x$enable_bzip2 = xyes)
if test x$enable_bzip2 = xyes; then
	AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])

	AC_PATH_PROG(BZIP2, bzip2, no)
else
	BZIP2="no"
fi

AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)

dnl --------------------------------- libzzip ---------------------------------
MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
	[libzzip archive library], [libzzip not found])

AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
if test x$enable_zzip = xyes; then
	AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])

	AC_PATH_PROG(ZIP, zip, no)
else
	ZIP="no"
fi

AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)

dnl ------------------------------- Archive API -------------------------------
if
	test x$enable_bzip2 = xyes ||
	test x$enable_zzip = xyes ||
	test x$enable_iso9660 = xyes; then
		enable_archive=yes
		AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
else
	enable_archive=no
fi

AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)

dnl ---------------------------------------------------------------------------
dnl Decoder Plugins
dnl ---------------------------------------------------------------------------

dnl -------------------------------- libadplug --------------------------------
MPD_AUTO_PKG(adplug, ADPLUG, [adplug],
	[AdPlug decoder plugin], [libadplug not found])
if test x$enable_adplug = xyes; then
	AC_DEFINE(HAVE_ADPLUG, 1, [Define to use libadplug])
fi
AM_CONDITIONAL(HAVE_ADPLUG, test x$enable_adplug = xyes)

dnl -------------------------------- audiofile --------------------------------
MPD_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.1.7],
	[audiofile decoder plugin], [libaudiofile not found])
AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
if test x$enable_audiofile = xyes; then
	AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
fi

dnl ----------------------------------- FAAD ----------------------------------
AM_PATH_FAAD()

AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)

dnl ---------------------------------- ffmpeg ---------------------------------
MPD_AUTO_PKG(ffmpeg, FFMPEG, [libavformat >= 53.17 libavcodec >= 53.25 libavutil >= 51.17],
	[ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])

if test x$enable_ffmpeg = xyes; then
	AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support])
fi

AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)

dnl ----------------------------------- FLAC ----------------------------------

MPD_AUTO_PKG(flac, FLAC, [flac >= 1.2],
	[FLAC decoder], [libFLAC not found])

if test x$enable_flac = xyes; then
	AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support])
fi

AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)

enable_flac_encoder=$enable_flac

dnl -------------------------------- FluidSynth -------------------------------
if test x$enable_fluidsynth = xyes; then
	PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth >= 1.1],
		AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
		enable_fluidsynth=no)
fi

AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)

dnl ---------------------------------- libgme ---------------------------------
MPD_AUTO_PKG_LIB(gme, GME, [libgme], gme, gme_open_file, [-lgme -lstdc++], [],
	[gme decoder plugin], [libgme not found])
AM_CONDITIONAL(HAVE_GME, test x$enable_gme = xyes)
if test x$enable_gme = xyes; then
	AC_DEFINE(HAVE_GME, 1, [Define for gme support])
fi

dnl ---------------------------------- libmad ---------------------------------
MPD_AUTO_PKG_LIB(mad, MAD, [mad],
	mad, mad_stream_init, [-lmad], [],
	[libmad MP3 decoder plugin], [libmad not found])
if test x$enable_mad = xyes; then
	AC_DEFINE(HAVE_MAD, 1, [Define to use libmad])
fi
AM_CONDITIONAL(HAVE_MAD, test x$enable_mad = xyes)

enable_shout2="$enable_shout"
MPD_AUTO_PKG(shout, SHOUT, [shout],
	[shout output plugin], [libshout not found])
if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
	enable_shout=auto
fi

dnl -------------------------------- libmpg123 --------------------------------
MPD_AUTO_PKG(mpg123, MPG123, [libmpg123],
	[libmpg123 decoder plugin], [libmpg123 not found])
if test x$enable_mpg123 = xyes; then
	AC_DEFINE(HAVE_MPG123, 1, [Define to use libmpg123])
fi
AM_CONDITIONAL(HAVE_MPG123, test x$enable_mpg123 = xyes)

dnl -------------------------------- libmikmod --------------------------------
if test x$enable_mikmod = xyes; then
	AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
	if test x$LIBMIKMOD_CONFIG != x ; then
		AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
		AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
		AC_DEFINE(ENABLE_MIKMOD_DECODER, 1, [Define for mikmod support])
	else
		enable_mikmod=no
	fi
fi

AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)

dnl -------------------------------- libmodplug -------------------------------
MPD_AUTO_PKG(modplug, MODPLUG, [libmodplug],
	[modplug decoder plugin], [libmodplug not found])

if test x$enable_modplug = xyes; then
	AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
fi
AM_CONDITIONAL(HAVE_MODPLUG, test x$enable_modplug = xyes)

dnl -------------------------------- libopus ----------------------------------
MPD_AUTO_PKG(opus, OPUS, [opus ogg],
	[opus decoder plugin], [libopus not found])
if test x$enable_opus = xyes; then
	AC_DEFINE(HAVE_OPUS, 1, [Define to use libopus])
fi
AM_CONDITIONAL(HAVE_OPUS, test x$enable_opus = xyes)

dnl -------------------------------- libsndfile -------------------------------
dnl See above test, which may disable this.
MPD_AUTO_PKG(sndfile, SNDFILE, [sndfile],
	[libsndfile decoder plugin], [libsndfile not found])

if test x$enable_sndfile = xyes; then
	AC_DEFINE(ENABLE_SNDFILE, 1, [Define to enable the sndfile decoder plugin])
fi
AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)

dnl --------------------------------- musepack --------------------------------
if test x$enable_mpc = xyes; then
	oldcflags=$CFLAGS
	oldlibs=$LIBS
	oldcppflags=$CPPFLAGS
	AC_CHECK_LIB(mpcdec,main,
			MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec",
			enable_mpc=no)
	CFLAGS=$oldcflags
	LIBS=$oldlibs
	CPPFLAGS=$oldcppflags

	if test x$enable_mpc != xyes; then
		AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
	fi
fi

AC_SUBST(MPCDEC_LIBS)
AC_SUBST(MPCDEC_CFLAGS)
AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)

dnl -------------------------------- Ogg Tremor -------------------------------
if test x$with_tremor = xyes || test x$with_tremor = xno; then
	enable_tremor="$with_tremor"
else
	tremor_prefix="$with_tremor"
	enable_tremor=yes
fi

if test x$enable_tremor = xyes; then
	if test "x$tremor_libraries" != "x" ; then
		TREMOR_LIBS="-L$tremor_libraries"
	elif test "x$tremor_prefix" != "x" ; then
		TREMOR_LIBS="-L$tremor_prefix/lib"
	fi
	TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
	if test "x$tremor_includes" != "x" ; then
		TREMOR_CFLAGS="-I$tremor_includes"
	elif test "x$tremor_prefix" != "x" ; then
		TREMOR_CFLAGS="-I$tremor_prefix/include"
	fi
	ac_save_CFLAGS="$CFLAGS"
	ac_save_LIBS="$LIBS"
	CFLAGS="$CFLAGS $TREMOR_CFLAGS"
	LIBS="$LIBS $TREMOR_LIBS"
	AC_CHECK_LIB(vorbisidec,ov_read,,enable_tremor=no;
		AC_MSG_WARN([vorbisidec lib needed for ogg support with tremor -- disabling ogg support]))
	CFLAGS="$ac_save_CFLAGS"
	LIBS="$ac_save_LIBS"
fi

if test x$enable_tremor = xyes; then
	AC_DEFINE(HAVE_TREMOR,1,
		[Define to use tremor (libvorbisidec) for ogg support])
	AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
else
	TREMOR_CFLAGS=
	TREMOR_LIBS=
fi

AC_SUBST(TREMOR_CFLAGS)
AC_SUBST(TREMOR_LIBS)

dnl -------------------------------- Ogg Vorbis -------------------------------

if test x$enable_tremor = xyes; then
	if test x$enable_vorbis = xyes; then
		AC_MSG_WARN(["OggTremor detected, could not enable Vorbis."])
	fi
	enable_vorbis=no

	if test x$enable_vorbis_encoder = xauto; then
		AC_MSG_WARN([OggTremor detected, disabling the Vorbis encoder plugin.])
		enable_vorbis_encoder=no
	fi
fi

MPD_AUTO_PKG(vorbis, VORBIS, [vorbis vorbisfile ogg],
	[Ogg Vorbis decoder], [libvorbis not found])
if test x$enable_vorbis = xyes; then
	AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
fi

AM_CONDITIONAL(ENABLE_VORBIS_DECODER, test x$enable_vorbis = xyes || test x$enable_tremor = xyes)

dnl --------------------------------- sidplay ---------------------------------
if test x$enable_sidplay != xno; then
	# we're not using pkg-config here
	# because libsidplay2's .pc file requires libtool
	AC_CHECK_LIB([sidplay2],[main],[found_sidplay=yes],[found_sidplay=no],[])

	MPD_AUTO_PRE(sidplay, [sidplay decoder plugin],
		[libsidplay2 not found])
fi

if test x$enable_sidplay != xno; then
	AC_CHECK_LIB([resid-builder], [main],
		[found_sidplay=yes], [found_sidplay=no])

	if test x$found_sidplay = xyes; then
		AC_CHECK_LIB([sidutils],[main],[],[found_sidplay=no],[])
	fi

	MPD_AUTO_RESULT(sidplay, [sidplay decoder plugin],
		[libresid-builder or libsidutils not found])
fi

if test x$enable_sidplay = xyes; then
	AC_SUBST(SIDPLAY_LIBS,"-lsidplay2 -lresid-builder -lsidutils")
	AC_SUBST(SIDPLAY_CFLAGS,)

	AC_DEFINE(ENABLE_SIDPLAY, 1, [Define for libsidplay2 support])
fi

AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)

dnl --------------------------------- wavpack ---------------------------------
MPD_AUTO_PKG(wavpack, WAVPACK, [wavpack],
	[WavPack decoder plugin], [libwavpack not found])
AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
if test x$enable_wavpack = xyes; then
	AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])
fi

dnl --------------------------------- WildMidi --------------------------------
if test x$enable_wildmidi = xyes; then
	oldcflags=$CFLAGS
	oldlibs=$LIBS
	oldcppflags=$CPPFLAGS

	AC_CHECK_LIB(WildMidi, WildMidi_Init,,
		AC_MSG_ERROR([libwildmidi not found]))

	AC_CHECK_LIB(WildMidi, WildMidi_SampledSeek,
		[AC_DEFINE(HAVE_WILDMIDI_SAMPLED_SEEK, 1,
			[Defined if WildMidi_SampledSeek() is available (libwildmidi <= 0.2.2)])])

	CFLAGS=$oldcflags
	LIBS=$oldlibs
	CPPFLAGS=$oldcppflags

	AC_SUBST(WILDMIDI_LIBS,-lWildMidi)
	AC_SUBST(WILDMIDI_CFLAGS,)

	AC_DEFINE(ENABLE_WILDMIDI, 1, [Define for wildmidi support])
fi

AM_CONDITIONAL(ENABLE_WILDMIDI, test x$enable_wildmidi = xyes)

dnl ------------------------ Post Decoder Plugins Tests -----------------------

if
	test x$enable_aac = xno &&
	test x$enable_audiofile = xno &&
	test x$enable_ffmpeg = xno &&
	test x$enable_flac = xno &&
	test x$enable_fluidsynth = xno &&
	test x$enable_mad = xno &&
	test x$enable_mikmod = xno; then
	test x$enable_modplug = xno &&
	test x$enable_mpc = xno &&
	test x$enable_mpg123 = xno &&
	test x$enable_opus = xno &&
	test x$enable_sidplay = xno &&
	test x$enable_tremor = xno &&
	test x$enable_vorbis = xno &&
	test x$enable_wavpack = xno &&
	test x$enable_wildmidi = xno &&

		AC_MSG_ERROR([No input plugins supported!])
fi

AM_CONDITIONAL(HAVE_XIPH,
	test x$enable_vorbis = xyes || test x$enable_tremor = xyes || test x$enable_flac = xyes || test x$enable_opus = xyes)

dnl ---------------------------------------------------------------------------
dnl Encoders for Streaming Audio Output Plugins
dnl ---------------------------------------------------------------------------

dnl ------------------------------- Encoder API -------------------------------
if test x$enable_shout = xyes || \
	test x$enable_recorder_output = xyes || \
	test x$enable_httpd_output = xyes; then
	# at least one output using encoders is explicitly enabled
	need_encoder=yes
elif test x$enable_shout = xauto || \
	test x$enable_recorder_output = xauto || \
	test x$enable_httpd_output = xauto; then
	need_encoder=auto
else
	# all outputs using encoders are disabled
	need_encoder=no

	# don't bother to check for encoder plugins
	enable_vorbis_encoder=no
	enable_lame_encoder=no
	enable_twolame_encoder=no
	enable_wave_encoder=no
	enable_flac_encoder=no
fi

dnl ------------------------------- FLAC Encoder ------------------------------
if test x$enable_flac_encoder = xyes; then
	AC_DEFINE(ENABLE_FLAC_ENCODER, 1,
		[Define to enable the FLAC encoder plugin])
fi
AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)

dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc],
	[Ogg Vorbis encoder], [libvorbisenc not found])

if test x$enable_vorbis_encoder = xyes; then
	AC_DEFINE(ENABLE_VORBIS_ENCODER, 1,
		[Define to enable the vorbis encoder plugin])
fi
AM_CONDITIONAL(ENABLE_VORBIS_ENCODER, test x$enable_vorbis_encoder = xyes)

dnl ------------------------------- LAME Encoder ------------------------------
if test x$enable_lame_encoder != xno; then
	AC_CHECK_HEADERS(lame/lame.h,,
		[AC_CHECK_HEADERS(lame.h,, using_lame=no)])
	AC_CHECK_LIB(mp3lame, lame_init,, using_lame=no)
	if test x$using_lame != xno; then
		AC_DEFINE(HAVE_LAME, 1, [Define to 1 if you have lame 3.98 or greater.])
		LAME_LIBS="-lmp3lame -lm"
		enable_lame_encoder=yes
	fi

	if test "$enable_lame_encoder" = "yes" -a "$using_lame" = "no"; then
		AC_MSG_ERROR([LAME libraries and development support files not found.])
	fi
fi

AC_SUBST(LAME_LIBS)

if test x$enable_lame_encoder = xyes; then
	AC_DEFINE(ENABLE_LAME_ENCODER, 1,
		[Define to enable the lame encoder plugin])
fi
AM_CONDITIONAL(ENABLE_LAME_ENCODER, test x$enable_lame_encoder = xyes)

dnl ----------------------------- TwoLAME Encoder -----------------------------
MPD_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
	[TwoLAME encoder], [libtwolame not found])

if test x$enable_twolame_encoder = xyes; then
	AC_DEFINE(ENABLE_TWOLAME_ENCODER, 1,
		[Define to enable the TwoLAME encoder plugin])
fi
AM_CONDITIONAL(ENABLE_TWOLAME_ENCODER, test x$enable_twolame_encoder = xyes)

dnl ------------------------------- WAVE Encoder ------------------------------
AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
if test x$enable_wave_encoder = xyes; then
	AC_DEFINE(ENABLE_WAVE_ENCODER, 1,
		[Define to enable the PCM wave encoder plugin])
fi

dnl --------------------------- encoder plugins test --------------------------
if test x$enable_vorbis_encoder != xno ||
	test x$enable_opus != xno ||
	test x$enable_lame_encoder != xno ||
	test x$enable_twolame_encoder != xno ||
	test x$enable_flac_encoder != xno ||
	test x$enable_wave_encoder != xno; then
	# at least one encoder plugin is enabled
	enable_encoder=yes
else
	# no encoder plugin is enabled: disable the whole encoder API
	enable_encoder=no

	if test x$need_encoder = xyes; then
		AC_MSG_ERROR([No encoder plugin found])
	fi
fi

if test x$enable_encoder = xyes; then
	AC_DEFINE(ENABLE_ENCODER, 1,
		[Define to enable the encoder plugins])
fi
AM_CONDITIONAL(ENABLE_ENCODER, test x$enable_encoder = xyes)

dnl ---------------------------------------------------------------------------
dnl Audio Output Plugins
dnl ---------------------------------------------------------------------------

dnl ----------------------------------- ALSA ----------------------------------
MPD_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
	[ALSA output plugin], [libasound not found])

if test x$enable_alsa = xyes; then
	AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support])
fi

AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)

dnl ----------------------------------- ROAR ----------------------------------
MPD_AUTO_PKG(roar, ROAR, [libroar >= 0.4.0],
	[ROAR output plugin], [libroar not found])

if test x$enable_roar = xyes; then
	AC_DEFINE(HAVE_ROAR, 1, [Define to enable ROAR support])
fi

AM_CONDITIONAL(HAVE_ROAR, test x$enable_roar = xyes)

dnl ----------------------------------- FIFO ----------------------------------
if test x$enable_fifo = xyes; then
	AC_CHECK_FUNC([mkfifo],
		[enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1,
			[Define to enable support for writing audio to a FIFO])],
		[enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
fi

AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)

dnl ------------------------------- HTTPD Output ------------------------------
if test x$enable_httpd_output = xauto; then
	# handle HTTPD auto-detection: disable if no encoder is
	# available
	if test x$enable_encoder = xyes; then
		enable_httpd_output=yes
	else
		AC_MSG_WARN([No encoder plugin -- disabling the HTTP output plugin])
		enable_httpd_output=no
	fi
fi

if test x$enable_httpd_output = xyes; then
	AC_DEFINE(ENABLE_HTTPD_OUTPUT, 1, [Define to enable the HTTP server output])
fi
AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)

dnl ----------------------------------- JACK ----------------------------------
MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
	[JACK output plugin], [libjack not found])
if test x$enable_jack = xyes; then
	AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
fi

if test x$enable_jack = xyes; then
	# check whether jack_set_info_function() is available
	old_LIBS=$LIBS
	LIBS="$LIBS $JACK_LIBS"

	AC_CHECK_FUNCS(jack_set_info_function)

	LIBS=$old_LIBS
fi

AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)

dnl ---------------------------------- libao ----------------------------------
MPD_AUTO_PKG(ao, AO, [ao],
	[libao output plugin], [libao not found])
if test x$enable_ao = xyes; then
	AC_DEFINE(HAVE_AO, 1, [Define to play with ao])
fi

AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)

dnl ---------------------------------- OpenAL ---------------------------------
AC_SUBST(OPENAL_CFLAGS,"")
AC_SUBST(OPENAL_LIBS,"")

if test x$enable_openal = xyes; then
	if test x$enable_osx = xyes; then
		AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h], [], [enable_openal=no])
		if test x$enable_openal = xyes; then
			OPENAL_LIBS="-framework OpenAL"
			AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support])
		else
			AC_MSG_WARN(OpenAL headers not found -- disabling OpenAL support)
		fi
	else
		PKG_CHECK_MODULES([OPENAL], [openal],
			AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support]),
			enable_openal=no)
	fi
fi

AM_CONDITIONAL(HAVE_OPENAL, test x$enable_openal = xyes)

dnl ---------------------------- Open Sound System ----------------------------
if test x$enable_oss = xyes; then
	AC_CHECK_HEADER(sys/soundcard.h,
		[enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],
		[AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
			enable_oss=no])
fi

AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)

dnl ----------------------------------- OSX -----------------------------------
enable_osx=no
case "$host_os" in
	darwin*)
		AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
		LIBS="$LIBS -framework AudioUnit -framework CoreAudio -framework CoreServices"
		enable_osx=yes ;;
esac

AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)

dnl ------------------------------- Pipe Output -------------------------------
if test x$enable_pipe_output = xyes; then
	AC_DEFINE([ENABLE_PIPE_OUTPUT], 1,
		[Define to enable support for writing audio to a pipe])
fi
AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)

dnl -------------------------------- PulseAudio -------------------------------
MPD_AUTO_PKG(pulse, PULSE, [libpulse >= 0.9.16],
	[PulseAudio output plugin], [libpulse not found])
if test x$enable_pulse = xyes; then
	AC_DEFINE([HAVE_PULSE], 1,
		[Define to enable PulseAudio support])
fi

AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)

dnl --------------------------------- Recorder --------------------------------
if test x$enable_recorder_output = xauto; then
	# handle recorder auto-detection: disable if no encoder is
	# available
	if test x$enable_encoder = xyes; then
		enable_recorder_output=yes
	else
		AC_MSG_WARN([No encoder plugin -- disabling the recorder output plugin])
		enable_recorder_output=no
	fi
fi

if test x$enable_recorder_output = xyes; then
	AC_DEFINE(ENABLE_RECORDER_OUTPUT, 1, [Define to enable the recorder output])
fi
AM_CONDITIONAL(ENABLE_RECORDER_OUTPUT, test x$enable_recorder_output = xyes)

dnl -------------------------------- SHOUTcast --------------------------------
if test x$enable_shout = xauto; then
	# handle shout auto-detection: disable if no encoder is
	# available
	if test x$enable_encoder = xyes; then
		enable_shout=yes
	else
		AC_MSG_WARN([No encoder plugin -- disabling the shout output plugin])
		enable_shout=no
	fi
fi

if test x$enable_shout = xyes; then
	AC_DEFINE(HAVE_SHOUT, 1, [Define to enable the shoutcast output])
fi
AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)

dnl --------------------------------- Solaris ---------------------------------

if test x$enable_solaris_output = xauto; then
	case "$host_os" in
	solaris*)
		enable_solaris_output=yes
		;;

	*)
		enable_solaris_output=no
		;;
	esac
fi

if test x$enable_solaris_output = xyes; then
	AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
fi

AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)

dnl --------------------------------- WinMM ---------------------------------

case "$host_os" in
	mingw32* | windows*)
		AC_DEFINE(ENABLE_WINMM_OUTPUT, 1, [Define to enable WinMM support])
		enable_winmm_output=yes
		LIBS="$LIBS -lwinmm"
		;;

	*)
		enable_winmm_output=no
		;;
esac

AM_CONDITIONAL(ENABLE_WINMM_OUTPUT, test x$enable_winmm_output = xyes)

dnl --------------------- Post Audio Output Plugins Tests ---------------------
if
	test x$enable_alsa = xno &&
	test x$enable_roar = xno &&
	test x$enable_ao = xno &&
	test x$enable_fifo = xno &&
	test x$enable_httpd_output = xno &&
	test x$enable_jack = xno &&
	test x$enable_openal = xno &&
	test x$enable_oss = xno &&
	test x$enable_osx = xno &&
	test x$enable_pipe_output = xno &&
	test x$enable_pulse = xno &&
	test x$enable_recorder_output = xno &&
	test x$enable_shout = xno &&
	test x$enable_solaris_output = xno &&
	test x$enable_winmm_output = xno; then

		AC_MSG_ERROR([No Audio Output types configured!])
fi

dnl ---------------------------------------------------------------------------
dnl Documentation
dnl ---------------------------------------------------------------------------
if test x$enable_documentation = xyes; then
	AC_PATH_PROG(XMLTO, xmlto)
	AC_SUBST(XMLTO)
	AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)

	AC_PATH_PROG(DOXYGEN, doxygen)
	if test x$DOXYGEN = x; then
		AC_MSG_ERROR([doxygen not found])
	fi

	AC_SUBST(DOXYGEN)
else
	AM_CONDITIONAL(HAVE_XMLTO, false)
fi

AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)

dnl ---------------------------------------------------------------------------
dnl test suite
dnl ---------------------------------------------------------------------------
AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)

dnl ---------------------------------------------------------------------------
dnl CFLAGS
dnl ---------------------------------------------------------------------------

dnl ---------------------------------- debug ----------------------------------
if test "x$enable_debug" = xno; then
	AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"

	AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
	AX_APPEND_COMPILE_FLAGS([-fdata-sections])
	AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])

	AC_LANG_PUSH([C++])
	AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
	AX_APPEND_COMPILE_FLAGS([-fdata-sections])
	AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
	AX_APPEND_COMPILE_FLAGS([-fno-threadsafe-statics])
	AX_APPEND_COMPILE_FLAGS([-fmerge-all-constants])
	AX_APPEND_COMPILE_FLAGS([-fno-exceptions])
	AX_APPEND_COMPILE_FLAGS([-fno-rtti])
	AC_LANG_POP

	AX_APPEND_LINK_FLAGS([-Wl,--gc-sections])
fi

dnl ----------------------------------- GCC -----------------------------------
if test x$GCC = xyes
then
	AX_APPEND_COMPILE_FLAGS([-Wall])
	AX_APPEND_COMPILE_FLAGS([-Wextra])
	AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
	AX_APPEND_COMPILE_FLAGS([-Wshadow])
	AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
	AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
	AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
	AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
	AX_APPEND_COMPILE_FLAGS([-pedantic])

	AC_LANG_PUSH([C++])
	AX_APPEND_COMPILE_FLAGS([-Wall])
	AX_APPEND_COMPILE_FLAGS([-Wextra])
	AX_APPEND_COMPILE_FLAGS([-Wmissing-declarations])
	AX_APPEND_COMPILE_FLAGS([-Wshadow])
	AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
	AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
	AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
	AX_APPEND_COMPILE_FLAGS([-Wsign-compare])
	AC_LANG_POP
fi

dnl ---------------------------- warnings as errors ---------------------------
if test "x$enable_werror" = xyes; then
	AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
	AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
fi

dnl ---------------------------------------------------------------------------
dnl Pretty-Print Results
dnl ---------------------------------------------------------------------------
echo ''
echo '########### MPD CONFIGURATION ############'

printf '\nArchive support:\n\t'
results(bzip2,[bzip2])
results(iso9660,[ISO9660])
results(zzip,[ZIP])

if test x$with_zeroconf != xno; then
	printf '\nAutodiscovery support:\n\t'
	results(avahi, [Avahi])
	results(bonjour, [Bonjour])
fi

printf '\nClient support:\n\t'
results(ipv6, "IPv6")
results(tcp, "TCP")
results(un,[UNIX Domain Sockets])

printf '\nFile format support:\n\t'
results(aac, [AAC])
results(adplug, [AdPlug])
results(sidplay, [C64 SID])
results(ffmpeg, [FFMPEG])
results(flac, [FLAC])
results(fluidsynth, [FluidSynth])
results(gme, [GME])
printf '\n\t'
results(sndfile, [libsndfile])
results(mikmod, [MikMod])
results(modplug, [MODPLUG])
results(mad, [MAD])
results(mpg123, [MPG123])
results(mpc, [Musepack])
printf '\n\t'
results(opus, [Opus])
results(tremor, [OggTremor])
results(vorbis, [OggVorbis])
results(audiofile, [WAVE])
results(wavpack, [WavPack])
results(wildmidi, [WildMidi])

printf '\nOther features:\n\t'
results(lsr, [libsamplerate])
results(libmpdclient, [libmpdclient])
results(inotify, [inotify])
results(sqlite, [SQLite])

printf '\nMetadata support:\n\t'
results(id3,[ID3])

printf '\nPlayback support:\n\t'
results(alsa,ALSA)
results(fifo,FIFO)
results(recorder_output,[File Recorder])
results(httpd_output,[HTTP Daemon])
results(jack,[JACK])
printf '\n\t'
results(ao,[libao])
results(oss,[OSS])
results(openal,[OpenAL])
results(osx, [OS X])
results(pipe_output, [Pipeline])
printf '\n\t'
results(pulse, [PulseAudio])
results(roar,[ROAR])
results(shout, [SHOUTcast])
results(solaris_output, [Solaris])
results(winmm_output, [WinMM])

if
	test x$enable_shout = xyes ||
	test x$enable_recorder = xyes ||
	test x$enable_httpd_output = xyes; then
		printf '\nStreaming encoder support:\n\t'
		results(flac_encoder, [FLAC])
		results(lame_encoder, [LAME])
		results(vorbis_encoder, [Ogg Vorbis])
		results(opus, [Opus])
		results(twolame_encoder, [TwoLAME])
		results(wave_encoder, [WAVE])
fi

printf '\nStreaming support:\n\t'
results(cdio_paranoia, [CDIO_PARANOIA])
results(curl,[CURL])
results(despotify,[Despotify])
results(lastfm,[Last.FM])
results(soundcloud,[Soundcloud])
printf '\n\t'
results(mms,[MMS])

printf '\n\n##########################################\n\n'

echo 'Generating files needed for compilation'

dnl ---------------------------------------------------------------------------
dnl Generate files
dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(doc/doxygen.conf)
AC_CONFIG_FILES(mpd.service)
AC_OUTPUT

echo 'MPD is ready for compilation, type "make" to begin.'