1AC_ARG_ENABLE(flac,
2[  --disable-flac           disable flac support],
3)
4HAVE_FLAC=no
5if test "x$enable_flac" != "xno"; then
6  if test "x$PKG_CONFIG" != "x"; then
7    PKG_CHECK_MODULES([FLAC], [flac], HAVE_FLAC=yes, HAVE_FLAC=no)
8  else
9    AM_PATH_LIBFLAC(HAVE_FLAC=yes, HAVE_FLAC=no)
10  fi
11  if test "x$HAVE_FLAC" = xyes; then
12    AC_DEFINE(HAVE_FLAC, 1, [define this if you have flac libs])
13  fi
14fi
15AM_CONDITIONAL(HAVE_FLAC, test "x$HAVE_FLAC" = "xyes")
16
17AC_ARG_ENABLE(wildmidi,
18[  --disable-wildmidi         disable libWildMidi support],
19)
20HAVE_WILDMIDI=no
21WM_LIBS=
22if test "x$enable_wildmidi" != "xno"; then
23  AC_CHECK_LIB(WildMidi, WildMidi_GetString, HAVE_WILDMIDI=yes, HAVE_WILDMIDI=no)
24  if test "x$HAVE_WILDMIDI" = "xyes"; then
25    AC_CHECK_HEADER(wildmidi_lib.h, HAVE_WILDMIDI=yes, HAVE_WILDMIDI=no)
26    if test "x$HAVE_WILDMIDI" = "xyes"; then
27      WM_LIBS="-lWildMidi"
28      AC_DEFINE(HAVE_WILDMIDI, 1, [Define if you have WildMidi])
29    fi
30  fi
31fi
32AC_SUBST(WM_LIBS)
33AM_CONDITIONAL(HAVE_MIDI, test "x$HAVE_WILDMIDI" = "xyes")
34
35AC_ARG_ENABLE(vorbis,
36[  --disable-vorbis         disable ogg vorbis support],
37)
38HAVE_VORBIS=no
39if test "x$enable_vorbis" != "xno"; then
40  if test "x$PKG_CONFIG" != "x"; then
41    PKG_CHECK_MODULES([OGG], [ogg], HAVE_OGG=yes, HAVE_OGG=no)
42	if test "x$HAVE_OGG" = xyes; then
43	  PKG_CHECK_MODULES([VORBIS], [vorbis], HAVE_VORBIS=yes, HAVE_VORBIS=no)
44	  if test "x$HAVE_VORBIS" = xyes; then
45	    PKG_CHECK_MODULES([VORBISFILE], [vorbisfile], HAVE_VORBISFILE=yes, HAVE_VORBISFILE=no)
46	    AC_DEFINE(HAVE_VORBIS, 1, [define this if you have ogg/vorbis libs])
47	  fi
48	fi
49  else
50    XIPH_PATH_OGG(HAVE_OGG=yes, HAVE_OGG=no)
51	if test "x$HAVE_OGG" = xyes; then
52	  XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
53	  if test "x$HAVE_VORBIS" = xyes; then
54	    AC_DEFINE(HAVE_VORBIS, 1, [define this if you have ogg/vorbis libs])
55	  fi
56	fi
57  fi
58fi
59AM_CONDITIONAL(HAVE_VORBIS, test "x$HAVE_VORBIS" = "xyes")
60
61
62AC_ARG_ENABLE(zlib, [  --disable-zlib          disable zlib support])
63HAVE_ZLIB=no
64Z_LIBS=""
65if test "x$enable_zlib" != "xno"; then
66	if test "x$PKG_CONFIG" != "x"; then
67		PKG_CHECK_MODULES([Z], [zlib], HAVE_ZLIB=yes, HAVE_ZLIB=no)
68	else
69		dnl Check for working -lz
70		dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
71		AC_CHECK_LIB(z, gztell, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
72		if test "x$HAVE_ZLIB" = "xyes"; then
73			 AC_CHECK_LIB(z, gzgets, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
74			 if test "x$HAVE_ZLIB" = "xyes"; then
75				  AC_CHECK_HEADER(zlib.h, HAVE_ZLIB=yes Z_LIBS=-lz,
76								  HAVE_ZLIB=no)
77			 fi
78		fi
79	fi
80fi
81AC_SUBST(Z_LIBS)
82if test "x$HAVE_ZLIB" = "xyes"; then
83	 AC_DEFINE(HAVE_ZLIB, 1, [Define if you have zlib])
84fi
85
86AC_ARG_ENABLE(png,
87[  --disable-png           disable png support],
88)
89HAVE_PNG=no
90PNG_LIBS=""
91if test "x$enable_png" != "xno"; then
92	if test "x$PKG_CONFIG" != "x"; then
93		PKG_CHECK_MODULES([PNG], [libpng], HAVE_PNG=yes, HAVE_PNG=no)
94	else
95		AC_CHECK_LIB(png, png_set_read_fn, HAVE_PNG=yes, HAVE_PNG=no, [$LIBS])
96		if test "x$HAVE_PNG" = "xyes"; then
97			AC_CHECK_HEADER(png.h, HAVE_PNG=yes PNG_LIBS="-lpng", HAVE_PNG=no)
98		fi
99	fi
100fi
101AC_SUBST(PNG_LIBS)
102if test "x$HAVE_PNG" = "xyes"; then
103	AC_DEFINE(HAVE_PNG, 1, [Define if you have libpng])
104fi
105