2006-05-16 James Livingston <doclivingston@gmail.com>
[rhythmbox.git] / configure.ac
blob56a6e7b0b668316b9d02cf1d0b89f447a6e35181
1 define(arch-tag)
2 # arch-tag: Toplevel Autoconf configuration script
3 AC_PREREQ(2.53)
4 AC_INIT(shell)
5 AC_CONFIG_MACRO_DIR(macros)
6 AM_CONFIG_HEADER(config.h)
7 AM_INIT_AUTOMAKE(rhythmbox, 0.9.4)
9 AM_MAINTAINER_MODE
11 AC_PROG_INTLTOOL
13 AC_ISC_POSIX
14 AC_PROG_CC
15 AC_STDC_HEADERS
16 AM_PROG_LIBTOOL
17 AC_C_BIGENDIAN
18 AC_CHECK_SIZEOF(long)
19 GTK_REQS=2.6.0
20 GNOME_VFS_REQS=2.7.4
21 NCB_MIN_REQS=2.9.0
22 OLD_DBUS_MIN_REQS=0.31
23 DBUS_MIN_REQS=0.35
24 TOTEM_PLPARSER_REQS=1.1.5
26 AC_MSG_CHECKING([for GNU extension fwrite_unlocked])
27 AC_LINK_IFELSE(
28 [AC_LANG_PROGRAM([[
29 #define _GNU_SOURCE
30 #include <stdio.h>
31 ]],
32 [[fwrite_unlocked ("foo", 1, sizeof ("foo"), stdout);]])],[have_fwrite_unlocked=yes])
33 if test x"$have_fwrite_unlocked" = xyes; then
34         AC_DEFINE(HAVE_GNU_FWRITE_UNLOCKED,1,[Define if you have GNU fwrite_unlocked])
35         AC_MSG_RESULT([yes])
36 else
37         AC_MSG_RESULT([no])
38 fi      
40 mkdtemp_missing=false
41 AC_CHECK_FUNC(mkdtemp,
42     [AC_DEFINE([HAVE_MKDTEMP], 1, [Have GlibC function to make temp dirs])],
43     mkdtemp_missing=true)
44 AM_CONDITIONAL(MKDTEMP_MISSING, test x$mkdtemp_missing = xtrue)
46 AC_CHECK_LIB(glib-2.0, g_utf8_collate_key_for_filename,
47     [AC_DEFINE([HAVE_COLLATE_KEY_FILENAME], 1, [Have glib function to collate filename sort keys])])
49 PKG_PROG_PKG_CONFIG
51 PKG_CHECK_MODULES(RHYTHMBOX,                            \
52                   gtk+-2.0 >= $GTK_REQS                 \
53                   libgnomeui-2.0                        \
54                   libglade-2.0                          \
55                   gnome-vfs-2.0 >= $GNOME_VFS_REQS      \
56                   gnome-vfs-module-2.0)
58 PKG_CHECK_MODULES(TOTEM_PLPARSER, totem-plparser >= $TOTEM_PLPARSER_REQS, have_totem_plparser=yes, have_totem_plparser=no)
59 if test x$have_totem_plparser != xyes; then
60    AC_MSG_ERROR([totem playlist parsing library not found or too old])
61 fi   
63 AC_ARG_WITH(hal,
64               AC_HELP_STRING([--without-hal],
65                              [Disable HAL support]))
66 if test "x$with_hal" != "xno"; then
67   PKG_CHECK_MODULES(HAL, hal >= 0.5 hal < 0.6, enable_hal05=yes, enable_hal05=no)
68   if test x$enable_hal05 != xyes; then
69      PKG_CHECK_MODULES(HAL, hal >= 0.2.92 hal < 0.5, enable_hal02=yes, enable_hal02=no)
70   fi
71   if test x$enable_hal05 = xyes || test x$enable_hal02 = xyes; then
72       enable_hal=yes
73       AC_DEFINE(HAVE_HAL, 1, [Define if you HAL support])
74       if test x$enable_hal05 = xyes; then
75          AC_DEFINE(HAVE_HAL_0_5, 1, [Define if you have HAL 0.5 or later])
76       else
77          AC_DEFINE(HAVE_HAL_0_2, 1, [Define if you have HAL 0.2 or later])
78       fi
79           AC_SUBST(HAL_CFLAGS)
80           AC_SUBST(HAL_LIBS)
81   else
82     if test "x$with_hal" = "xyes"; then
83           AC_MSG_ERROR([HAL support explicitly requested but HAL couldn't be found])
84     fi
85   fi
87 AM_CONDITIONAL(HAVE_HAL_0_5, test x"$enable_hal05" = xyes)
88 AM_CONDITIONAL(HAVE_HAL_0_2, test x"$enable_hal02" = xyes)
89 AM_CONDITIONAL(HAVE_HAL, test x"$enable_hal" = xyes)
91 dnl iPod support
93 AC_ARG_WITH(ipod,
94             AC_HELP_STRING([--with-ipod],
95                            [Enable iPod support]),,
96               with_ipod=auto)
97 if test "x$with_ipod" != "xno"; then
99         PKG_CHECK_MODULES(IPOD, libgpod-1.0, have_libgpod=yes, have_libgpod=no)
100         if test "x$have_libgpod" = "xno" -a "x$with_ipod" = "xyes"; then
101           AC_MSG_ERROR([iPod explicitly requested but libgpod couldn't be found])
102         fi
103         if test "x$have_libgpod" = "xyes"; then
104           if test "x$with_hal" = xyes && test "x$enable_hal" = xno; then
105              AC_MSG_ERROR([iPod explicitly requested but HAL not found or too old])        
106           fi
107           if test "x$enable_hal" = xyes; then
108              AC_DEFINE(WITH_IPOD_SUPPORT, 1, [Define if iPod support is enabled])
109              use_ipod=yes
111              PKG_CHECK_MODULES(IPOD_PHONE, libgpod-1.0 >= 0.3.3, support_phone=yes, support_phone=no)
112              if test "x$support_phone" = xyes; then
113                 AC_DEFINE(IPOD_PHONE_SUPPORT, 1, [iPod support for phone])
114              fi
115           fi
116           AC_SUBST(IPOD_CFLAGS)
117           AC_SUBST(IPOD_LIBS)
118         fi
119 fi                        
120 AM_CONDITIONAL(USE_IPOD, test x"$use_ipod" = xyes)
122 dnl Database
123 AC_ARG_WITH(database,
124               AC_HELP_STRING([--with-database=tree|libgda],
125                              [Select the database to use (default tree)]),,
126               with_database=tree)
127 AM_CONDITIONAL(USE_TREEDB, test x"$with_database" = xtree)
128 AM_CONDITIONAL(USE_GDADB, test x"$with_database" = xlibgda)
130 GDA_CFLAGS=""
131 GDA_LIBS=""
132 case "x$with_database" in
133   "xtree")
134     AC_DEFINE(WITH_RHYTHMDB_TREE, 1, [Define if you are using the RhythmDB tree database])
135     ;;
136   "xlibgda")
137     AC_DEFINE(WITH_RHYTHMDB_GDA, 1, [Define if you are using the RhythmDB sqlite/libgda database])
138     dnl FIXME: check for sqlite, too?
139     PKG_CHECK_MODULES(GDA, libgda > 1.0.3)
140     ;;
141   *)
142     AC_MSG_ERROR([Unknown database selected])
143     ;;
144 esac
145 AC_SUBST(GDA_CFLAGS)
146 AC_SUBST(GDA_LIBS)
148 dnl Database debugging
149 AC_ARG_WITH(rhythmdb-debug,
150               AC_HELP_STRING([--with-rhythmdb-debug=0|1|2],
151                              [Level of RhythmDB sanity checking]),,with_rhythmdb_debug=0)
152 if test x"${with_rhythmdb_debug}" != x0; then
153    AC_DEFINE_UNQUOTED([RHYTHMDB_ENABLE_SANITY_CHECK], "${with_rhythmdb_debug}", [Define to the level of RhythmDB sanity checking])
156 dnl Sound system
157 dnl Now we're ready to ask for gstreamer libs and cflags
158 dnl And we can also ask for the right version of gstreamer
159 HAVE_SOUNDSYSTEM=no
161 GST_0_8_MAJORMINOR=0.8
162 GST_0_8_REQUIRED_VERSION=0.8.2
163 PKG_CHECK_MODULES(GSTREAMER_0_8, \
164         gstreamer-$GST_0_8_MAJORMINOR >= $GST_0_8_REQUIRED_VERSION gstreamer-libs-$GST_0_8_MAJORMINOR >= $GST_0_8_REQUIRED_VERSION
165         gstreamer-control-$GST_0_8_MAJORMINOR >= $GST_0_8_REQUIRED_VERSION
166         gstreamer-gconf-$GST_0_8_MAJORMINOR >= $GST_0_8_REQUIRED_VERSION,
167         have_gstreamer_0_8=yes,have_gstreamer_0_8=no)
168         
169 GST_0_10_MAJORMINOR=0.10
170 GST_0_10_REQUIRED_VERSION=0.9.7
171 PKG_CHECK_MODULES(GSTREAMER_0_10, \
172         gstreamer-$GST_0_10_MAJORMINOR >= $GST_0_10_REQUIRED_VERSION
173         gstreamer-base-$GST_0_10_MAJORMINOR >= $GST_0_10_REQUIRED_VERSION
174         gstreamer-plugins-base-$GST_0_10_MAJORMINOR >= $GST_0_10_REQUIRED_VERSION,
175         have_gstreamer_0_10=yes,have_gstreamer_0_10=no)
177 AC_ARG_WITH(playback,
178    AC_HELP_STRING([--with-playback=auto|gstreamer-0-8|gstreamer-0-10],
179    [Select the playback backend to use (default auto)]),,
180    with_playback=auto)
182 if test x$with_playback = xauto -o x$with_playback = xgstreamer-0-10; then
183         if test x"$have_gstreamer_0_10" = xyes; then
184                 with_playback=gstreamer_0_10
185                 SOUNDSYSTEM_DEPS="gstreamer-$GST_0_10_MAJORMINOR"
186                 AC_DEFINE(HAVE_GSTREAMER,1,[Define if you want to use the GStreamer media framework])
187                 AC_DEFINE(HAVE_GSTREAMER_0_10,1,[Define if you want to use the GStreamer 0.10])
188                 SOUNDSYSTEM_CFLAGS="$GSTREAMER_0_10_CFLAGS"
189                 SOUNDSYSTEM_LIBS="$GSTREAMER_0_10_LIBS"
190         elif test x$with_playback = xgstreamer-0-10; then
191                 AC_MSG_ERROR([GStreamer 0.10 explicity requested, and it was not found or older than version $GST_REQUIRED_VERSION, or gst-plugins-base was missing])
192         fi
194 if test x$with_playback = xauto -o x$with_playback = xgstreamer-0-8; then
195         if test x"$have_gstreamer_0_8" = xyes; then
196                 with_playback=gstreamer_0_8
197                 SOUNDSYSTEM_DEPS="gstreamer-$GST_0_8_MAJORMINOR"
198                 AC_DEFINE(HAVE_GSTREAMER,1,[Define if you want to use the GStreamer media framework])
199                 AC_DEFINE(HAVE_GSTREAMER_0_8,1,[Define if you want to use the GStreamer 0.8])
200                 SOUNDSYSTEM_CFLAGS="$GSTREAMER_0_8_CFLAGS"
201                 SOUNDSYSTEM_LIBS="$GSTREAMER_0_8_LIBS"
202         elif test x$with_playback = xgstreamer-0-8; then
203                 AC_MSG_ERROR([GStreamer 0.8 explicity requested, and it was not found or older than version $GST_REQUIRED_VERSION])
204         fi
206 AM_CONDITIONAL(USE_GSTREAMER_0_10, test x"$with_playback" = xgstreamer_0_10)
207 AM_CONDITIONAL(USE_GSTREAMER_0_8, test x"$with_playback" = xgstreamer_0_8)
209 dnl Give error and exit if we don't have gstreamer
210 if test x$with_playback = xauto; then
211                 AC_MSG_ERROR([GStreamer not found, or older than version $GST_0_8_REQUIRED_VERSION/$GST_0_10_REQUIRED_VERSION])
214 AC_SUBST(SOUNDSYSTEM_DEPS)
215 RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $SOUNDSYSTEM_CFLAGS"
216 RHYTHMBOX_LIBS="$RHYTHMBOX_LIBS $SOUNDSYSTEM_LIBS"
219 dnl Tag writing
220 AC_ARG_ENABLE(tag-writing,
221               AC_HELP_STRING([--enable-tag-writing],
222                              [Enable tag writing support in rhythmbox **EXPERIMENTAL**]))
223 if test x"$enable_tag_writing" = xyes; then
224    AC_MSG_WARN([Tag writing support is experimental, and may corrupt files, use at your own risk])
225    AC_DEFINE(ENABLE_TAG_WRITING, 1, [Define if tag writing should be enabled])
228 dnl transfers
229 AC_ARG_ENABLE(track-transfer,
230               AC_HELP_STRING([--enable-track-transfer],
231                              [Enable track transfer support in rhythmbox **EXPERIMENTAL**]))
232 if test x"$enable_track_transfer" = xyes; then
233    AC_MSG_WARN([Track transfer support is experimental, and may corrupt files, use at your own risk])
234    PKG_CHECK_MODULES(GNOME_MEDIA_PROFILES,
235    gnome-media-profiles, 
236    have_gnome_media_profiles=yes,
237    have_gnome_media_profiles=no)
239    if test x$have_gnome_media_profiles = xno; then
240       AC_MSG_ERROR([Track transfer support explicitly requested but gnome-media-profiles not found.])
241    fi
243    AC_DEFINE(ENABLE_TRACK_TRANSFER, 1, [Define if track transfer should be enabled])
245 AM_CONDITIONAL(ENABLE_TRACK_TRANSFER, test "x$have_gnome_media_profiles" = "xyes")
248 dnl Audioscrobbler
249 AC_ARG_ENABLE(audioscrobbler,
250               AC_HELP_STRING([--disable-audioscrobbler],
251                              [Disable Audioscrobbler support in Rhythmbox]))
253 dnl DAAP (iTunes Music Shares)
254 AC_ARG_ENABLE(daap,
255               AC_HELP_STRING([--enable-daap],
256                              [Enable Digital Audio Access Protocol (music sharing) in rhythmbox **EXPERIMENTAL**]))
258 AC_ARG_WITH(mdns,
259    AC_HELP_STRING([--with-mdns=auto|howl|avahi],
260    [Select the mDNS/DNS-SD implementation to use (default auto)]),,
261    with_mdns=auto)
263 have_howl=no
264 have_avahi=no
265 have_mdns=no
266 use_howl=no
267 use_avahi=no
269 PKG_CHECK_MODULES(AVAHI,
270    avahi-client >= 0.6
271    avahi-glib >= 0.6,
272    have_avahi_06=yes,
273    have_avahi_06=no)
274 if test x$have_avahi_06 != xyes; then
275    PKG_CHECK_MODULES(AVAHI,
276       avahi-client >= 0.5
277       avahi-glib >= 0.5,
278       have_avahi_05=yes,
279       have_avahi_05=no)
281 if test x$have_avahi_06 = xyes || test x$have_avahi_05 = xyes; then
282    have_avahi=yes
283 else
284    have_avahi=no
287 PKG_CHECK_MODULES(HOWL,
288    howl,
289    have_howl=yes,
290    have_howl=no)
292 if test x"$with_mdns" = xauto; then
293    if test x"$have_avahi" = xyes; then
294       MDNS_CFLAGS=$AVAHI_CFLAGS
295       MDNS_LIBS=$AVAHI_LIBS
296       AC_DEFINE(WITH_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi])
297       use_avahi=yes
298       AC_MSG_NOTICE([Detected Avahi, using it for mDNS/DNS-SD])
299       if test x$have_avahi_06 = xyes; then
300          AC_DEFINE(HAVE_AVAHI_0_6, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.6])
301       else
302          AC_DEFINE(HAVE_AVAHI_0_5, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.5])
303       fi
305       have_mdns=yes
306    elif test x"$have_howl" = xyes; then
307       MDNS_CFLAGS=$HOWL_CFLAGS
308       MDNS_LIBS=$HOWL_LIBS
309       AC_DEFINE(WITH_HOWL, 1, [Define if mDNS/DNS-SD implementation uses Howl])
310       use_howl=yes
311       AC_MSG_NOTICE([Detected Howl, using it for mDNS/DNS-SD])
313       have_mdns=yes
314    fi
317 if test x"$with_mdns" = xhowl; then
318    if test x"$have_howl" = xno; then
319       AC_MSG_ERROR([Howl explicitly requested but not found.  Install Howl or try --with-mdns=avahi])
320    fi
322    MDNS_CFLAGS=$HOWL_CFLAGS
323    MDNS_LIBS=$HOWL_LIBS
324    AC_DEFINE(WITH_HOWL, 1, [Define if mDNS/DNS-SD implementation uses Howl])
325    use_howl=yes
326    AC_MSG_NOTICE([Using Howl for mDNS/DNS-SD])
327    have_mdns=yes
330 if test x"$with_mdns" = xavahi; then
331    if test x"$have_avahi" = xno; then
332       AC_MSG_ERROR([Avahi explicitly requested but not found.  Install Avahi or try --with-mdns=howl])
333    fi
335    MDNS_CFLAGS=$AVAHI_CFLAGS
336    MDNS_LIBS=$AVAHI_LIBS
337    AC_DEFINE(WITH_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi])
338    use_avahi=yes
339    AC_MSG_NOTICE([Using Avahi for mDNS/DNS-SD])
341    if test x$have_avahi_06 = xyes; then
342       AC_DEFINE(HAVE_AVAHI_0_6, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.6])
343    else
344       AC_DEFINE(HAVE_AVAHI_0_5, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.5])
345    fi
347    have_mdns=yes
350 AM_CONDITIONAL(USE_HOWL, test "x$use_howl" = "xyes")
351 AM_CONDITIONAL(USE_AVAHI, test "x$use_avahi" = "xyes")
353 LIBNOTIFY_REQUIRED=0.2.2
354 AC_ARG_ENABLE(libnotify,
355             AC_HELP_STRING([--disable-libnotify],
356                            [Disable libnotify support]),,
357               enable_libnotify=auto)
358 if test "x$enable_libnotify" != "xno"; then
359         PKG_CHECK_MODULES(NOTIFY,                            \
360                           libnotify >= $LIBNOTIFY_REQUIRED,
361                           have_libnotify=yes,
362                           have_libnotify=no)
363         if test "x$have_libnotify" = "xno" -a "x$enable_libnotify" = "xyes"; then
364           AC_MSG_ERROR([libnotify support explicitly requested, but libnotify couldn't be found])
365         fi
366         if test "x$have_libnotify" = "xyes"; then
367              enable_libnotify=yes
368         fi
369 fi                        
370 AM_CONDITIONAL(USE_NOTIFY, test x"$enable_libnotify" = xyes)
371 if test x$enable_libnotify = xyes ; then
372     # Find out the version of LIBNOTIFY we're using
373     libnotify_version=`pkg-config --modversion libnotify`
374     LIBNOTIFY_VERSION_MAJOR=`echo $libnotify_version | awk -F. '{print $1}'`
375     LIBNOTIFY_VERSION_MINOR=`echo $libnotify_version | awk -F. '{print $2}'`
376     LIBNOTIFY_VERSION_MICRO=`echo $libnotify_version | awk -F. '{print $3}'`
377     if test "z$LIBNOTIFY_VERSION_MAJOR" = "z"; then
378         LIBNOTIFY_VERSION_MAJOR="0"
379     fi
380     if test "z$LIBNOTIFY_VERSION_MINOR" = "z"; then
381         LIBNOTIFY_VERSION_MINOR="0"
382     fi
383     if test "z$LIBNOTIFY_VERSION_MICRO" = "z"; then
384         LIBNOTIFY_VERSION_MICRO="0"
385     fi
386     echo "Your libnotify version is $LIBNOTIFY_VERSION_MAJOR,$LIBNOTIFY_VERSION_MINOR,$LIBNOTIFY_VERSION_MICRO."
387     NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MAJOR=$LIBNOTIFY_VERSION_MAJOR"
388     NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MINOR=$LIBNOTIFY_VERSION_MINOR"
389     NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MICRO=$LIBNOTIFY_VERSION_MICRO"
391     AC_DEFINE(HAVE_NOTIFY, 1, [Define if libnotify support is enabled])
392     AC_SUBST(NOTIFY_CFLAGS)
393     AC_SUBST(NOTIFY_LIBS)
396 dnl Check for libsoup, needed for DAAP and audioscrobbler
397 if test "x$enable_daap" = "xyes" || test "x$enable_audioscrobbler" != "xno"; then
398         PKG_CHECK_MODULES(SOUP,                            \
399                 libsoup-2.2,
400                 have_libsoup=yes,
401                 have_libsoup=no)
402         if test x"$have_libsoup" = "xno"; then
403                 PKG_CHECK_MODULES(SOUP,
404                         libsoup-2.4,
405                         have_libsoup=yes,
406                         have_libsoup=no)
407         fi
408         if test x"$have_libsoup" = "xyes"; then
409                 AC_DEFINE(HAVE_LIBSOUP, 1, [Define if libsoup support is enabled])
410         fi
413 AM_CONDITIONAL(USE_LIBSOUP, test x"$have_libsoup" = "xyes")
416 dnl audioscrobbler support
417 if test "x$enable_audioscrobbler" != "xno"; then
418         if test x"$have_libsoup" = "xno"; then
419                 if test "x$enable_audioscrobbler" = "xyes"; then
420                         AC_MSG_ERROR([AudioScrobbler support explicitly requested, but no libsoup found.  Install libsoup])
421                 fi
422                 enable_audioscrobbler=no
423         else
424                 AC_DEFINE(WITH_AUDIOSCROBBLER, 1, [define if Audioscrobbler support should be enabled])
425         fi
427 AM_CONDITIONAL(WITH_AUDIOSCROBBLER, test "x$enable_audioscrobbler" != "xno")
430 dnl daap support
431 if test "x$enable_daap" != "xno"; then
432         if test x"$have_libsoup" = "xno"; then
433                 if test "x$enable_daap" = "xyes"; then
434                         AC_MSG_ERROR([DAAP support explicitly requested, but no libsoup found.  Install libsoup])
435                 fi
436                 enable_daap=no
437         elif test x"$have_mdns" = xno; then
438                 if test "x$enable_daap" = "xyes"; then
439                         AC_MSG_ERROR([DAAP support explicitly requested, but no mDNS implementation found.  Install Howl or Avahi])
440                 fi
441                 enable_daap=no
442         else
443                 AC_DEFINE(WITH_DAAP_SUPPORT, 1, [Define if DAAP should be enabled])
444                 enable_daap="yes"
445                 AC_SUBST(MDNS_CFLAGS)
446                 AC_SUBST(MDNS_LIBS)
447         fi
449 AM_CONDITIONAL(USE_DAAP, test "x$enable_daap" != "xno")
451 AC_CHECK_LIB(z, uncompress)
455 dnl check for MusicBrainz
456 AC_ARG_ENABLE(musicbrainz, AC_HELP_STRING([--disable-musicbrainz],
457                                 [don't build with MusicBrainz support]))
458 if test x"$enable_musicbrainz" != "xno"; then
459         PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz >= 2.1.0, enable_musicbrainz=yes,
460                           enable_musicbrainz=no)
462 if test x"$enable_musicbrainz" = xyes; then
463         RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $MUSICBRAINZ_CFLAGS"
464         RHYTHMBOX_LIBS="$RHYTHMBOX_LIBS $MUSICBRAINZ_LIBS"
465         AC_DEFINE(HAVE_MUSICBRAINZ, 1, [define if you have Musicbrainz])
467 AM_CONDITIONAL(HAVE_MUSICBRAINZ, test "x$enable_musicbrainz" = "xyes")
471 AC_PATH_X
473 if test x"$x_includes" != x"NONE" && test -n "$x_includes" ; then
474         CFLAGS=$CFLAGS -I`echo $x_includes | sed -e "s/:/ -I/g"`
476 if test x"$x_libraries" != x"NONE" && test -n "$x_libraries" ; then
477         LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`
480 have_xidle=no
481 AC_COMPILE_IFELSE([
482         #include <X11/extensions/xidle.h>
483 int main(int argc,char **argv) {
484   return 0;
486 ], have_xidle=yes)
487 AC_MSG_CHECKING(for XIDLE extension)
488 AC_MSG_RESULT($have_xidle)
489 if test x"$have_xidle" = "xyes" ; then
490         AC_DEFINE(HAVE_XIDLE_EXTENSION, 1, [defined if you have X11/extensions/xidle.h])
493 dnl Multimedia keys
494 have_xfree=no
495 AC_COMPILE_IFELSE([
496         #include <X11/XF86keysym.h>
497 int main(int argc,char **argv) {
498   return 0;
500 ], have_xfree=yes)
501 AC_MSG_CHECKING(for XFree86 headers)
502 AC_MSG_RESULT($have_xfree)
503 if test x"$have_xfree" = "xyes" ; then
504         AC_DEFINE(HAVE_XFREE, 1, [defined if you have X11/XF86keysym.h])
507 AC_ARG_ENABLE(mmkeys, AC_HELP_STRING([--disable-mmkeys],
508                                         [don't build with Multimedia Keys support]))
509 if test x"$have_xfree" = xyes; then
510         if test x"$enable_mmkeys" != xno; then
511                 enable_mmkeys=yes
512                 AC_DEFINE(HAVE_MMKEYS, 1, [define if Multimedia Keys are enabled])
513         fi
514 else
515         if test x"$enable_mmkeys" = xyes; then
516                 AC_MSG_ERROR([Multimedia keys explicitly requested but no support found])
517         fi
520 dnl CD Audio support              
521 AC_DEFINE(WITH_AUDIOCD_SUPPORT, 1, [Define if audio cd support is enabled])
522 AC_CHECK_HEADER(linux/cdrom.h,[enable_linux_cdrom=yes],)
523 if test "x$enable_linux_cdrom" = "xyes"; then
524   AC_MSG_CHECKING([whether linux/cdrom.h actually works])
525   AC_COMPILE_IFELSE([
526 #include <stdlib.h>    
527 #include <sys/ioctl.h>    
528 #include <linux/cdrom.h>
529 int main(int argc,char **argv) {
530   ioctl (0, CDROM_GET_CAPABILITY, 0);
531   ioctl (0, CDROM_DRIVE_STATUS, CDSL_CURRENT);  
532   ioctl (0, CDROMREADTOCHDR, NULL);
533   exit(0);
534 }], [enable_linux_cdrom=yes],[enable_linux_cdrom=no])
535   if test "x$enable_linux_cdrom" = "xyes"; then
536     AC_MSG_RESULT([yes])
537     enable_audiocd=yes
538   else
539     AC_MSG_FAILURE([linux/cdrom.h is damaged; fix your system or use --disable-audiocd])
540   fi
542 AM_CONDITIONAL(HAVE_LINUX_CDROM, test "x$enable_linux_cdrom" = "xyes")
544 NCB_DRIVE_DOOR_VERSION=2.11.3
545 dnl CD burner support
546 PKG_CHECK_MODULES(LIBNAUTILUS_BURN, [libnautilus-burn >= $NCB_MIN_REQS], have_cd_burner=yes, have_cd_burner=no)
547 if test "x$have_cd_burner" = xno; then
548    AC_MSG_ERROR([libnautilus-burn not found or too cold])          
550 AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_door_is_open,
551     [AC_DEFINE([HAVE_BURN_DRIVE_DOOR], 1, [Have nautilus-burn function to check drive door state])],
552     ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])
553 AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_unref,
554     [AC_DEFINE([HAVE_BURN_DRIVE_UNREF], 1, [Have nautilus-burn 2.13 drive unref function])],
555     ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])
556 AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_new_from_path,
557     [AC_DEFINE([HAVE_BURN_DRIVE_NEW_FROM_PATH], 1, [Have nautilus-burn 2.13 drive new_from_path function])],
558     ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])
559 AC_CHECK_LIB(nautilus-burn, nautilus_burn_drive_get_write_speeds,
560     [AC_DEFINE([HAVE_BURN_DRIVE_GET_WRITE_SPEEDS], 1, [Have nautilus-burn 2.13 drive get_write_speeds])],
561     ,[$LIBNAUTILUS_BURN_LIBS $LIBNAUTILUS_BURN_CFLAGS])
563 AC_SUBST(CFLAGS)
564 AC_SUBST(LDFLAGS)
566 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
567 AC_PATH_PROG(GCONFTOOL, gconftool-2)
569 AC_SUBST(RHYTHMBOX_CFLAGS)
570 AC_SUBST(RHYTHMBOX_LIBS)
572 GETTEXT_PACKAGE=rhythmbox
573 AC_SUBST(GETTEXT_PACKAGE)
574 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
575 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the Gettext package name])
576 ALL_LINGUAS="`cat "$srcdir/po/LINGUAS" | grep -v '^#'`"
578 AM_GLIB_GNU_GETTEXT
580 dnl Workaround for automake 1.8
581 AC_SUBST(mkdir_p) if test x"$mkdir_p" = "x"; then
582   MKINSTALLDIRS="mkinstalldirs"
584 AC_SUBST(MKINSTALLDIRS)
586 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
588 AS_AC_EXPAND(DATADIR, $datadir)
590 dnl DBUS
591 PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_MIN_REQS, enable_dbus=yes, enable_dbus=no)
592 if test "x$enable_dbus" = xno; then
593    PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $OLD_DBUS_MIN_REQS, enable_old_dbus=yes, enable_old_dbus=no)
594    if test "x$enable_old_dbus" = xno; then
595       AC_MSG_ERROR([DBUS not found or too old])
596    fi
597    AC_DEFINE(WITH_OLD_DBUS, 1, [Define if old D-BUS is enabled])           
598 else
599    AC_DEFINE(WITH_DBUS, 1, [Define if D-BUS is enabled])           
602 DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
603 DBUS_GLIB_BIN="`$PKG_CONFIG --variable=exec_prefix dbus-glib-1`/bin"
604 AC_SUBST(DBUS_GLIB_BIN)
605 AM_CONDITIONAL(WITH_DBUS, test "x$enable_dbus" = "xyes")
606 AM_CONDITIONAL(WITH_OLD_DBUS, test "x$enable_old_dbus" = "xyes")
608 dnl out-of-process metadata reader (requires dbus)
609 AC_ARG_WITH(metadata-helper,
610             AC_HELP_STRING([--with-metadata-helper],
611                            [Use a separate process for metadata reading]),,
612             with_metadata_helper=auto)
613 enable_metadata_helper=no
614 if test "x$with_metadata_helper" != xno; then
615         if test "x$enable_dbus" = xyes || test "x$enable_old_dbus" = xyes; then
616                 AC_DEFINE(WITH_METADATA_HELPER, 1, [Define if the metadata helper process is enabled])
617                 enable_metadata_helper=yes
618         elif test "x$with_metadata_helper" = xyes; then
619                 AC_MSG_ERROR([Metadata helper process explicitly requested, but D-BUS is not enabled])
620         fi
622 AM_CONDITIONAL(WITH_METADATA_HELPER, test "x$enable_metadata_helper" = "xyes")
624 AM_GCONF_SOURCE_2
626 dnl LIRC
627 AC_ARG_ENABLE(lirc,
628         AC_HELP_STRING([--enable-lirc],[enable lirc support]))
629 with_lirc=no
630 if test x"$enable_lirc" != xno; then
631         AC_CHECK_HEADER(lirc/lirc_client.h,[with_lirc=yes],[with_lirc=no])
632         if test x"$with_lirc" = xyes; then
633                 AC_CHECK_LIB(lirc_client,lirc_init,[with_lirc=yes],[with_lirc=no])
634         fi
635         if test x"$with_lirc" = xno -a x"$enable_lirc" = xyes; then
636                 AC_MSG_ERROR([lirc explicitly requested but no support found])
637         fi
639 AM_CONDITIONAL(WITH_LIRC, test x"$with_lirc" = xyes)
642 AC_ARG_ENABLE(uninstalled-build,
643               AC_HELP_STRING([--enable-uninstalled-build],
644                              [Search for files in build directory as well]),
645               enable_uninstalled=yes,)
646 if test x"$enable_uninstalled" = xyes; then
647         AC_DEFINE_UNQUOTED(SHARE_UNINSTALLED_DIR,"`pwd`/data",[path to source data dir])
648         AC_DEFINE_UNQUOTED(METADATA_UNINSTALLED_DIR,"`pwd`/metadata",[path to metadata build dir])
651 AC_ARG_WITH(internal-libsexy,
652             AC_HELP_STRING([--with-internal-libsexy],
653                            [Build using internal libsexy library]),,
654               with_internal_libsexy=no)
655 if test "x$with_internal_libsexy" = "xno"; then
656         PKG_CHECK_MODULES(LIBSEXY, libsexy >= 0.1.5, with_internal_libsexy=no,
657                           with_internal_libsexy=yes)
659 AC_SUBST(LIBSEXY_CFLAGS)
660 AC_SUBST(LIBSEXY_LIBS)
661 AM_CONDITIONAL(WITH_INTERNAL_LIBSEXY, test "x$with_internal_libsexy" = "xyes")
663 dnl warnings bits, copied from gnome-keyring configure.in
664 dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
666 AC_ARG_ENABLE(more-warnings,
667 [  --enable-more-warnings  Maximum compiler warnings],
668 set_more_warnings="$enableval",[
669 if test -d "$srcdir/{arch}" || test -d "$srcdir/CVS" || test -d "$srcdir/_darcs"; then
670         set_more_warnings=yes
671 else
672         set_more_warnings=no
675 AC_MSG_CHECKING(for more warnings, including -Werror)
676 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
677         AC_MSG_RESULT(yes)
678         WARN_CFLAGS="\
679         -Wcomment -Wformat -Wnonnull -Wimplicit-int -Wimplicit \
680         -Wmain -Wmissing-braces -Wparentheses -Wsequence-point \
681         -Wreturn-type -Wswitch -Wtrigraphs -Wunused-function \
682         -Wunused-label -Wunused-value \
683         -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
684         -Wnested-externs -Wpointer-arith \
685         -Wcast-align -Wall \
686         -Werror -std=gnu89"
688         if echo "$CFLAGS" | grep -e '-O[1-9]'; then
689            WARN_CFLAGS="-Wuninitialized $WARN_CFLAGS"
690         fi
692         for option in $WARN_CFLAGS; do
693                 SAVE_CFLAGS="$CFLAGS"
694                 CFLAGS="$CFLAGS $option"
695                 AC_MSG_CHECKING([whether gcc understands $option])
696                 AC_TRY_COMPILE([], [],
697                         has_option=yes,
698                         has_option=no,)
699                 if test x$has_option = xyes; then
700                         RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $option"
701                 fi
702                 AC_MSG_RESULT($has_option)
703                 CFLAGS="$SAVE_CFLAGS"
704                 unset has_option
705                 unset SAVE_CFLAGS
706         done
707         unset option
709         SAVE_CFLAGS="$CFLAGS"
710         CFLAGS="$CFLAGS -Wno-error"
711         AC_TRY_COMPILE([], [],
712                 WNOERROR_CFLAGS="-Wno-error",
713                 WNOERROR_CFLAGS="")
714         AC_SUBST(WNOERROR_CFLAGS)
715         CFLAGS="$SAVE_CFLAGS"
716         unset SAVE_CFLAGS
717         unset has_wnoerror
718 else
719         AC_MSG_RESULT(no)
722 dnl Enable gtk-doc
723 GTK_DOC_CHECK(1.4)
725 dnl Enable gnome-doc-utils
726 GNOME_DOC_INIT
729 dnl ================================================================
730 dnl Plugins
731 dnl ================================================================
733 PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
734 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
736 AS_AC_EXPAND(PLUGINDIR, ${libdir}/rhythmbox/plugins)
739 dnl ================================================================
740 dnl Python
741 dnl ================================================================
743 AC_MSG_CHECKING([whether Python support is requested])
744 AC_ARG_ENABLE([python],
745         AS_HELP_STRING([--enable-python],[Enable python support]),
746         [enable_python=$enableval have_python=$enableval],
747         [enable_python=autodetect have_python=yes])
748 AC_MSG_RESULT([$enable_python])
750 if test "x$have_python" != "xno"; then
751         AM_PATH_PYTHON([2.3],[],[no])
752         if test "x$PYTHON" = "x:"; then
753                 have_python=no
754         fi
757 if test "x$have_python" != "xno"; then
758         PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
759         PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
760         PYTHON_LIBS="-lpython$PYTHON_VERSION"
761         PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
762         PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
763         PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/Makefile"
764         PYTHON_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
765         PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
766         PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
767         PYTHON_EXTRA_LIBS="$PYTHON_LOCALMODLIBS $PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
768         AC_SUBST([PYTHON_LIBS])
769         AC_SUBST([PYTHON_LIB_LOC])
770         AC_SUBST([PYTHON_CFLAGS])
771         AC_SUBST([PYTHON_EXTRA_LIBS])
773         dnl FIXME: do we really need this test?
774         AC_MSG_CHECKING([whether we can build a shared library depending on libpython])
775         rm -rf testpython
776         mkdir testpython
777         cd testpython
778         cat > testpython.c <<EOF
779 #include <Python.h>
780 int testpython (void)
782 Py_Exit (0);
786         if /bin/sh ../libtool --mode=compile ${CC} $PYTHON_CFLAGS -c testpython.c >/dev/null 2>&1 && \
787                 /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 && \
788                 grep 'dlname.*testpython' testpython.la >/dev/null 2>&1; then
789                 result=yes
790         else
791                 result=no
792                 have_python=no
793         fi
794         cd ..
795         rm -rf testpython
796         AC_MSG_RESULT([$result])
799 if test "x$have_python" != "xno"; then
800         PYGTK_REQUIRED=2.6.0
802         PKG_CHECK_MODULES([PYGTK], [
803                 pygtk-2.0 >= $PYGTK_REQUIRED],
804                 [],[have_python=no])
806         AC_SUBST([PYGTK_CFLAGS])
807         AC_SUBST([PYGTK_LIBS])
810 if test "x$have_python" != "xno"; then
811         AC_MSG_CHECKING([for pygtk defs])
812         PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
813         AC_MSG_RESULT([$PYGTK_DEFSDIR])
815         AC_MSG_CHECKING([for pygtk codegen])
816         PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
817         AC_MSG_RESULT([$PYGTK_CODEGEN])
819         AC_MSG_CHECKING([for pygtk h2def])
820         PYGTK_H2DEF="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/h2def.py"
821         AC_MSG_RESULT([$PYGTK_H2DEF])
823         AC_SUBST([PYGTK_DEFSDIR])
824         AC_SUBST([PYGTK_CODEGEN])
825         AC_SUBST([PYGTK_H2DEF])
827         dnl Check for -fno-strict-aliasing
828         FLAGS="-fno-strict-aliasing"
829         save_CFLAGS="$CFLAGS"
830         CFLAGS="$CFLAGS $FLAGS"
831         AC_MSG_CHECKING([whether [$]CC understands $FLAGS])
832         AC_TRY_COMPILE([], [], [compiler_has_option=yes], [compiler_has_option=no])
833         CFLAGS="$save_CFLAGS"
834         AC_MSG_RESULT($compiler_has_option)
835         if test $compiler_has_option = yes; then
836                 NO_STRICT_ALIASING_CFLAGS="$FLAGS"
837         fi
838         AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
841 if test "x$have_python" != "xyes"; then
842         if test "x$enable_python" = "xyes"; then
843                 AC_MSG_ERROR([Python support explicity requested, but not found])
844         elif test "x$enable_python" != "xno"; then
845                 enable_python=no
846                 AC_MSG_WARN([Python not found, disabling python support])
847         fi
848 elif test "x$enable_python" != "xno"; then
849         enable_python=yes
850         AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
853 AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
857 dnl ================================================================
858 dnl end-game
859 dnl ================================================================
861 AC_OUTPUT([ 
862 Makefile
863 macros/Makefile
864 lib/Makefile
865 metadata/Makefile
866 player/Makefile
867 rhythmdb/Makefile
868 widgets/Makefile
869 widgets/libsexy/Makefile
870 iradio/Makefile
871 podcast/Makefile
872 shell/Makefile
873 data/Makefile
874 data/ui/Makefile
875 data/art/Makefile
876 data/glade/Makefile
877 sources/Makefile
878 daapsharing/Makefile
879 plugins/Makefile
880 plugins/sample/Makefile
881 plugins/audioscrobbler/Makefile
882 plugins/ipod/Makefile
883 plugins/lirc/Makefile
884 plugins/sample-python/Makefile
885 plugins/pythonconsole/Makefile
886 plugins/artdisplay/Makefile
887 plugins/artdisplay/artdisplay/Makefile
888 bindings/Makefile
889 bindings/python/Makefile
890 help/Makefile
891 po/Makefile.in
892 tests/Makefile
893 doc/Makefile
894 doc/reference/Makefile
895 backends/Makefile
896 backends/gstreamer/Makefile
899 AC_MSG_NOTICE([Rhythmbox was configured with the following options:])
900 if test x"$with_database" = xtree; then
901         AC_MSG_NOTICE([** Tree database is enabled])
902 elif test x"$with_database" = xlibgda; then
903         AC_MSG_NOTICE([** libgda/sqlite database is enabled])
904 else
905         AC_MSG_ERROR([Unknown database!])
907 if test x"${with_rhythmdb_debug}" != x0; then
908         AC_MSG_NOTICE([** RhythmDB sanity checking enabled (may be slow!)])
912 if test x"$enable_tag_writing" = xyes; then
913         AC_MSG_NOTICE([** Tag writing is enabled - USE AT YOUR OWN RISK])
914 else
915         AC_MSG_NOTICE([   Tag writing is disabled])
917 if test x"$enable_track_transfer" = xyes; then
918         AC_MSG_NOTICE([** Track transfer is enabled - USE AT YOUR OWN RISK])
919 else
920         AC_MSG_NOTICE([   Track transfer is disabled])
922 if test x"$enable_mmkeys" != "xyes"; then
923         AC_MSG_NOTICE([   Multimedia keys support is disabled])
924 else
925         AC_MSG_NOTICE([** Multimedia keys support is enabled])
927 if test x"$enable_musicbrainz" != "xyes"; then
928         AC_MSG_NOTICE([   MusicBrainz support is disabled])
929 else
930         AC_MSG_NOTICE([** MusicBrainz support is enabled])
933 if test x"$with_playback" = xgstreamer_0_8; then
934         AC_MSG_NOTICE([** GStreamer 0.8 player is enabled])
935 elif test x"$with_playback" = xgstreamer_0_10; then
936         AC_MSG_NOTICE([** GStreamer 0.10 player is enabled])
937 else
938         AC_MSG_ERROR([   Playback engine set incorrectly])
941 if test x"$use_ipod" = xyes; then
942         AC_MSG_NOTICE([** iPod integration enabled])
943 else
944         AC_MSG_NOTICE([   iPod integration disabled])
946 if test x"$enable_daap" = xyes; then
947         AC_MSG_NOTICE([** DAAP (music sharing) support is enabled])
948 else
949         AC_MSG_NOTICE([   DAAP (music sharing) support is disabled])
951 if test x"$have_libnotify" = xyes; then
952         AC_MSG_NOTICE([** libnotify support is enabled])
953 else
954         AC_MSG_NOTICE([   libnotify support is disabled])
956 if test x"$enable_hal" = xyes; then
957         AC_MSG_NOTICE([** HAL support enabled])
958 else
959         AC_MSG_NOTICE([   HAL support disabled])
961 if test x"$enable_old_dbus" = xyes; then
962         AC_MSG_NOTICE([** using D-BUS < 0.35 control/activation])
964 if test x"$enable_python" != xno; then
965         AC_MSG_NOTICE([** Python support enabled])
966 else
967         AC_MSG_NOTICE([   Python support disabled])
970 if test x"$enable_audioscrobbler" != xno; then
971         AC_MSG_NOTICE([** Audioscrobbler support enabled])
972 else
973         AC_MSG_NOTICE([   Audioscrobbler support disabled])
975 if test x"$enable_metadata_helper" = xyes; then
976         AC_MSG_NOTICE([** Separate metadata helper process enabled])
977 else
978         AC_MSG_NOTICE([   Separate metadata helper process disabled])
980 if test x"$with_internal_libsexy" = xyes; then
981         AC_MSG_NOTICE([   using internal libsexy])
982 else
983         AC_MSG_NOTICE([** using system-wide libsexy])
986 AC_MSG_NOTICE([End options])