/xmms-scrobbler-0.4.0/configure.in
Autoconf | 276 lines | 235 code | 30 blank | 11 comment | 12 complexity | 08211365d3824a4db7176ae53b605fa8 MD5 | raw file
Possible License(s): LGPL-2.1
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(xmms_scrobbler.c)
3AC_CANONICAL_HOST
4
5AM_CONFIG_HEADER(config.h)
6
7AM_INIT_AUTOMAKE(xmms-scrobbler, 0.4.0)
8AM_MAINTAINER_MODE
9
10AM_DISABLE_STATIC
11AC_PROG_CC
12AC_PROG_CPP
13AM_PROG_CC_STDC
14AC_HEADER_STDC
15AC_PROG_INSTALL
16AC_PROG_LIBTOOL
17AC_C_BIGENDIAN
18AC_CHECK_SIZEOF(long)
19AC_CHECK_HEADERS(sys/time.h)
20AC_CHECK_HEADERS(wchar.h)
21AC_CHECK_HEADERS(pthread.h)
22
23dnl Checking for XMMS and/or BMP
24
25AC_MSG_CHECKING([if XMMS plugin is to be built])
26AC_ARG_ENABLE([xmms-plugin],
27AC_HELP_STRING([--disable-xmms-plugin],
28 [disable building the XMMS plugin (default behavior is enabled)]),
29[ case "${enableval}" in
30 yes)
31 AC_MSG_RESULT(yes)
32 make_xmms=true
33 AM_PATH_GLIB(1.2.2,,
34 [AC_MSG_WARN([*** GLIB >= 1.2.2 not installed - please install first ***])
35 make_xmms=false
36 ])
37 AM_PATH_XMMS(1.2.4,,
38 [AC_MSG_WARN([*** XMMS >= 1.2.4 not installed - please install first ***])
39 make_xmms=false
40 ])
41 ;;
42 *)
43 AC_MSG_RESULT(no)
44 make_xmms=false
45 ;;
46 esac ],
47[ AC_MSG_RESULT(yes)
48 make_xmms=true
49 AM_PATH_GLIB(1.2.2,,
50 [AC_MSG_WARN([*** GLIB >= 1.2.2 not installed - please install first ***])
51 make_xmms=false
52 ])
53 AM_PATH_XMMS(1.2.4,,
54 [AC_MSG_WARN([*** XMMS >= 1.2.4 not installed - please install first ***])
55 make_xmms=false
56 ])
57])
58AM_CONDITIONAL(MAKE_XMMS, [ test $make_xmms = true ])
59
60AC_MSG_CHECKING([if BMP plugin is to be built])
61AC_ARG_ENABLE([bmp-plugin],
62AC_HELP_STRING([--disable-bmp-plugin],
63 [disable building the BMP plugin (default behavior is enabled)]),
64[ case "${enableval}" in
65 yes)
66 AC_MSG_RESULT(yes)
67 make_bmp=true
68 PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.4.0 gtk+-2.0 >= 2.4.0],
69 [],
70 [ AC_MSG_WARN([*** GLIB >= 2.4.0 or GTK+ >= 2.4.0 not installed - please install first *** ])
71 make_bmp=false
72 ]
73 )
74 PKG_CHECK_MODULES(BMP, [bmp >= 0.9.7],
75 [],
76 [AC_MSG_WARN([*** BMP >= 0.9.7rc2 not installed - please install first ***])
77 make_bmp=false
78 ]
79 )
80 ;;
81 *)
82 AC_MSG_RESULT(no)
83 make_bmp=false
84 ;;
85 esac ],
86[ AC_MSG_RESULT(yes)
87 make_bmp=true
88 PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.4.0 gtk+-2.0 >= 2.4.0],
89 [],
90 [ AC_MSG_WARN([*** GLIB >= 2.4.0 or GTK+ >= 2.4.0 not installed - please install first *** ])
91 make_bmp=false
92 ]
93 )
94 PKG_CHECK_MODULES(BMP, [bmp >= 0.9.7],
95 [],
96 [AC_MSG_WARN([*** BMP >= 0.9.7rc2 not installed - please install first ***])
97 make_bmp=false
98 ]
99 )
100])
101AM_CONDITIONAL(MAKE_BMP, [ test $make_bmp = true ])
102
103if test $make_xmms = false -a $make_bmp = false; then
104 AC_MSG_ERROR([No media player specified, or none found. Cannot build.])
105fi
106
107dnl debug mode
108
109AC_MSG_CHECKING(if debug statements are enabled)
110AC_ARG_ENABLE(debug,
111AC_HELP_STRING([--enable-debug], [turn on debugging (default is NO)]),
112[ case "${enableval}" in
113 yes)
114 AC_MSG_RESULT(yes)
115 AC_DEFINE(DEBUG, 1, Enable debug messages)
116 debug=true
117 ;;
118 *)
119 AC_MSG_RESULT(no)
120 AC_DEFINE(DEBUG, 0, Enable debug messages)
121 debug=false
122 ;;
123 esac ],
124[ AC_MSG_RESULT(no)
125 AC_DEFINE(DEBUG, 1, Enable debug messages)
126 debug=false
127])
128
129AC_MSG_CHECKING(if metadata debug statements are enabled)
130AC_ARG_ENABLE(meta_debug,
131AC_HELP_STRING([--disable-meta-debug], [turn on metadata debug messages (only works when debugging is enabled. default is YES)]),
132[ case "${enableval}" in
133 yes)
134 if test $debug = false; then
135 AC_MSG_RESULT(no)
136 AC_DEFINE(META_DEBUG, 0, Enable metadata debug messages)
137 else
138 AC_MSG_RESULT(yes)
139 AC_DEFINE(META_DEBUG, 1, Enable metadata debug messages)
140 fi
141 ;;
142 *)
143 AC_MSG_RESULT(no)
144 AC_DEFINE(META_DEBUG, 0, Enable metadata debug messages)
145 esac ],
146[ if test $debug = false; then
147 AC_MSG_RESULT(no)
148 AC_DEFINE(META_DEBUG, 0, Enable metadata debug messages)
149 else
150 AC_MSG_RESULT(yes)
151 AC_DEFINE(META_DEBUG, 1, Enable metadata debug messages)
152 fi
153])
154
155AC_MSG_CHECKING(if submission-detection debug statements are enabled)
156AC_ARG_ENABLE(sub_debug,
157AC_HELP_STRING([--enable-sub-debug], [turn on submission-detection debug messages (only works when debugging is enabled. default is NO)]),
158[ case "${enableval}" in
159 yes)
160 if test $debug = false; then
161 AC_MSG_RESULT(no)
162 AC_DEFINE(SUB_DEBUG, 0, Enable submission-detection debug messages)
163 else
164 AC_MSG_RESULT(yes)
165 AC_DEFINE(SUB_DEBUG, 1, Enable submission-detection debug messages)
166 fi
167 ;;
168 *)
169 AC_MSG_RESULT(no)
170 AC_DEFINE(SUB_DEBUG, 0, Enable submission-detection debug messages)
171 esac ],
172[ AC_MSG_RESULT(no)
173 AC_DEFINE(SUB_DEBUG, 0, Enable submission-detection debug messages)
174])
175
176AC_DEFINE(ALLOW_MULTIPLE, 1, Allow multiple-submissions in one POST to the AudioScrobbler server)
177
178dnl APE Preference check
179
180AC_MSG_CHECKING([whether to prefer APE to ID3v2])
181AC_ARG_ENABLE([prefer-ape],
182AC_HELP_STRING([--enable-prefer-ape], [prefer APE tags to ID3v2 (default is NO)]),
183[ case "${enableval}" in
184 yes)
185 AC_MSG_RESULT(yes)
186 AC_DEFINE([PREFER_APE], 1, [Define if APE tags are preferred to ID3v2 tags])
187 ;;
188 *)
189 AC_MSG_RESULT(no)
190 ;;
191 esac ],
192AC_MSG_RESULT(no))
193
194dnl Checks for header files
195AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([*** unable to find libcurl headers]))
196
197dnl Checks for libmusicbrainz
198AC_CHECK_LIB(musicbrainz, mb_GetVersion,,
199 echo "*"
200 echo "* The MusicBrainz client library needs to be installed "
201 echo "* to build this plugin. Please download the library from "
202 echo "* http://www.musicbrainz.org/download "
203 echo "*"
204 AC_MSG_ERROR("Cannot build. Stop.")
205 ,-lstdc++)
206
207LIBS="-lmusicbrainz -lstdc++"
208AC_TRY_RUN([
209#include <musicbrainz/mb_c.h>
210
211int main ()
212{
213 int major, minor, rev;
214 musicbrainz_t o;
215
216 o = mb_New();
217 mb_GetVersion(o, &major, &minor, &rev);
218 mb_Delete(o);
219 if (major >= 2)
220 {
221 return 0;
222 }
223
224 return -1;
225}
226],have_mbver=true,have_mbver=false,have_mbver=false)
227
228dnl libcurl check
229
230AC_CACHE_VAL(my_cv_curl_vers,[
231my_cv_curl_vers=NONE
232dnl check is the plain-text version of the required version
233check="7.9.7"
234dnl check_hex must be UPPERCASE if any hex letters are present
235check_hex="070907"
236
237AC_MSG_CHECKING([for curl >= $check])
238
239if eval curl-config --version 2>/dev/null >/dev/null; then
240 ver=`curl-config --version | sed -e "s/libcurl //g"`
241 hex_ver=`curl-config --vernum | tr 'a-f' 'A-F'`
242 ok=`echo "ibase=16; if($hex_ver>=$check_hex) $hex_ver else 0" | bc`
243
244 if test x$ok != x0; then
245 my_cv_curl_vers="$ver"
246 AC_MSG_RESULT([$my_cv_curl_vers])
247 else
248 AC_MSG_RESULT(FAILED)
249 AC_MSG_WARN([$ver is too old. Need version $check or higher.])
250 fi
251else
252 AC_MSG_RESULT(FAILED)
253 AC_MSG_WARN([curl-config was not found])
254fi
255])
256
257# AC_CHECK_LIB([curl], [curl_global_init],, AC_MSG_ERROR([*** unable to link with libcurl]))
258
259LIBS="$LIBS $GTKLIBS"
260
261AC_MSG_CHECKING([for version >= 2.0.0 in -lmusicbrainz])
262if test "$have_mbver" = "false"; then
263 AC_MSG_RESULT([no])
264 echo "*"
265 echo "* Version 2.0.0 or higher of the MusicBrainz "
266 echo "* client library needs to be installed to build this application. "
267 echo "* Please download the library from: "
268 echo "* http://musicbrainz.org/products/client/download.html "
269 echo "*"
270 AC_MSG_ERROR([Cannot build. Stop.])
271else
272 AC_MSG_RESULT([yes])
273fi
274
275AC_OUTPUT(Makefile)
276