1dnl Process this file with autoconf to produce a configure script.
2
3# Require autoconf 2.55 or higher
4AC_PREREQ(2.55)
5
6AC_INIT(configure.in)
7AM_INIT_AUTOMAKE(gtkpod, 1.0.0)
8AM_CONFIG_HEADER(config.h)
9AM_MAINTAINER_MODE
10AC_CANONICAL_HOST
11AC_ISC_POSIX
12AC_PROG_CC
13AM_PROG_CC_STDC
14
15IT_PROG_INTLTOOL([0.33])
16
17dnl Only use -Wall if we have gcc
18if test "x$GCC" = "xyes"; then
19    if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
20        CFLAGS="$CFLAGS -Wall"
21    fi
22    # gcc < 4.0 does not know '-Wno-pointer-sign'. Try to find out
23    # whether we can set this option or not.
24    CFLAGS_orig=$CFLAGS
25    CFLAGS="$CFLAGS -Wno-pointer-sign"
26    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]])],
27                      [], [CFLAGS=$CFLAGS_orig])
28fi
29
30GETTEXT_PACKAGE=gtkpod
31AC_SUBST(GETTEXT_PACKAGE)
32AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",["Gettext package name"])
33
34dnl check if pkg-config exists -- if not print a meaningful error message
35AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
36if test -z "$PKG_CONFIG"; then
37    AC_MSG_FAILURE([*** pkg-config required (http://www.freedesktop.org/software/pkgconfig)])
38else
39    ac_cv_env_PKG_CONFIG_set=set
40fi
41
42dnl check for required libs that are managed with pkg-config
43PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8.0,, [AC_MSG_FAILURE([*** $GTK_PKG_ERRORS])])
44PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.15.0,, [AC_MSG_FAILURE([*** $GLIB_PKG_ERRORS])])
45PKG_CHECK_MODULES(GMODULE, gmodule-2.0,, [AC_MSG_FAILURE([*** $GMODULE_PKG_ERRORS])])
46PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 0.14.0,, [AC_MSG_FAILURE([*** $GTHREAD_PKG_ERRORS])])
47PKG_CHECK_MODULES(LIBGLADE, libglade-2.0 >= 2.4.0,, [AC_MSG_FAILURE([*** $LIBGLADE_PKG_ERRORS])])
48PKG_CHECK_MODULES(LIBGPOD, libgpod-1.0 >= 0.7.0,, [AC_MSG_FAILURE([*** $LIBGPOD_PKG_ERRORS])])
49
50CFLAGS="$CFLAGS $GTK_CFLAGS $GLIB_CFLAGS $GMODULE_CFLAGS $GTHREAD_CFLAGS $LIBGLADE_CFLAGS $LIBGPOD_CFLAGS"
51LIBS="$LIBS $GTK_LIBS $GLIB_LIBS $GMODULE_LIBS $GTHREAD_LIBS $LIBGLADE_LIBS $LIBGPOD_LIBS"
52
53dnl we need 'flex'
54AM_PROG_LEX
55case "$LEX" in
56flex|*/flex|lex|*/lex)
57	;;
58*)
59        AC_MSG_FAILURE([*** flex or lex required])
60	;;
61esac
62
63dnl Retrieve the path of mount and umount binaries
64AC_PATH_PROG(MOUNT, mount)
65AC_SUBST(MOUNT)
66AC_PATH_PROG(UMOUNT, umount)
67AC_SUBST(UMOUNT)
68
69dnl Add the languages which your application supports here.
70ALL_LINGUAS="ca de es fr he it ja ru ro sv zh_CN"
71AM_GLIB_GNU_GETTEXT
72
73dnl Check if we have to supply getopt_long
74dnl If getopt_long_only is not available, getopt.c and getopt1.c
75dnl (providing getopt_long*) will be included into the binary.
76AC_CHECK_FUNCS(getopt_long_only, , [AC_LIBOBJ(getopt)])
77AC_CHECK_FUNCS(getopt_long_only, , [AC_LIBOBJ(getopt1)])
78
79dnl Check if flock() is available (seems to be missing on some solaris versions)
80AC_CHECK_FUNCS(flock)
81
82dnl Check if statvfs() is available (otherwise we fall back on 'df' to determine
83dnl free space on the iPod
84AC_CHECK_FUNCS(statvfs)
85
86dnl Check for libid3tag
87AC_SEARCH_LIBS([id3_frame_field], ["id3tag" "id3tag -lz"],,
88    AC_MSG_ERROR([*** id3tag >= 0.15 lib not found (0.14 will not work!)]))
89
90dnl Check for libcurl
91AC_ARG_WITH(curl, AC_HELP_STRING([--without-curl], [Disable coverart download support]))
92if test "x$with_curl" != "xno"; then
93    PKG_CHECK_MODULES(CURL, [libcurl >= 7.10.0], have_curl=yes, have_curl=no)
94    if test "x$with_curl" = "xyes" -a "x$have_curl" = "xno"; then
95        AC_MSG_ERROR([curl support explicitly requested but curl couldn't be found])
96    fi
97fi
98AM_CONDITIONAL(HAVE_CURL, test "x$have_curl" = "xyes")
99if test "x$have_curl" = "xyes"; then
100    AC_DEFINE(HAVE_CURL, 1, [Define if you have curl support])
101    have_curl="yes -- will build with coverart download support"
102    CPPFLAGS="$CPPFLAGS $CURL_CFLAGS"
103    CFLAGS="$CFLAGS $CURL_CFLAGS"
104    LIBS="$LIBS $CURL_LIBS"
105else
106    have_curl="*no -- will build without coverart download support"
107fi
108
109dnl Check for gio
110AC_ARG_WITH(gio, AC_HELP_STRING([--without-gio],[Disable autodetection support]))
111if test "x$with_gio" != "xno"; then
112    PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.15.0], have_gio=yes, have_gio=no)
113    if test "x$with_gio" = "xyes" -a "x$have_gio" = "xno"; then
114        AC_MSG_ERROR([gio support explicitly requested but gio could not be found])
115    fi
116fi
117AM_CONDITIONAL(HAVE_GIO, test "x$have_gio" = "xyes")
118if test "x$have_gio" = "xyes"; then
119    have_gio="yes -- will build with automount support"
120    AC_DEFINE(HAVE_GIO, 1, [Define if you have gio support])
121    CPPFLAGS="$CPPFLAGS $GIO_CFLAGS"
122    CFLAGS="$CFLAGS $GIO_CFLAGS"
123    LIBS="$LIBS $GIO_LIBS"
124else
125    have_gio="*no -- will build without iPod autodetection support"
126fi
127
128dnl Check for libvorbisfile and libvorbis
129AC_ARG_WITH(ogg, AC_HELP_STRING([--without-ogg], [Disable Ogg/Vorbis support]))
130if test "x$with_ogg" != "xno"; then
131    AC_SEARCH_LIBS(ov_open, ["vorbisfile"],
132        [AC_CHECK_HEADER(vorbis/vorbisfile.h, have_ogg=yes, have_ogg_header=no)], have_ogg=no)
133    if test "x$have_ogg_header" = "xno"; then
134        have_ogg="no"
135        AC_MSG_WARN([vorbis/vorbisfile.h cannot be found or is unusable. Check your ogg/vorbis installation.])
136    fi
137    if test "x$have_ogg" = "xyes"; then
138        AC_SEARCH_LIBS(vorbis_comment_query, ["vorbis"],
139            [AC_CHECK_HEADER(vorbis/codec.h, have_ogg=yes, have_ogg_header=no)], have_ogg=no)
140        if test "x$have_ogg_header" = "xno"; then
141            have_ogg="no"
142            AC_MSG_WARN([vorbis/codec.h cannot be found or is unusable. Check your ogg/vorbis installation.])
143        fi
144    fi
145    if test "x$with_ogg" = "xyes" -a "x$have_ogg" = "xno"; then
146        AC_MSG_ERROR([Ogg/Vorbis support explicitly requested but ogg/vorbis libs couldn't be found])
147    fi
148fi
149AM_CONDITIONAL(HAVE_LIBVORBISFILE, test "x$have_ogg" = "xyes")
150if test "x$have_ogg" = "xyes"; then
151    have_ogg="yes -- will build with ogg support"
152    AC_DEFINE(HAVE_LIBVORBISFILE, 1, [Define if you have the ogg/vorbis library])
153else
154    have_ogg="*no -- will build without ogg support"
155fi
156
157dnl Check for FLAC
158AC_ARG_WITH(flac, AC_HELP_STRING([--without-flac], [Disable FLAC support]))
159if test "x$with_flac" != "xno"; then
160    AC_SEARCH_LIBS(FLAC__metadata_get_streaminfo, ["FLAC"],
161        [AC_CHECK_HEADER(FLAC/metadata.h, have_flac=yes, have_flac_header=no)], have_flac=no)
162    if test "x$have_flac_header" = "xno"; then
163        have_flac="no"
164        AC_MSG_WARN([FLAC/metadata.h cannot be found or is unusable. Check your FLACinstallation.])
165    fi
166    if test "xwith_flac" = "xyes" -a "x$have_flac" = "xno"; then
167        AC_MSG_ERROR([FLAC support explicitly requested but flac libs couldn't be found])
168    fi
169fi
170AM_CONDITIONAL(HAVE_FLAC, test "x$have_flac" = "xyes")
171if test "x$have_flac" = "xyes"; then
172    have_flac="yes -- will build with FLAC support"
173    AC_DEFINE(HAVE_FLAC, 1, [Define if you have the flac library])
174else
175    have_flac="*no -- will build without FLAC support"
176fi
177
178dnl Additional libs maybe needed when compiling under solaris
179AC_SEARCH_LIBS(bind, ["socket" "nsl" "socket -lnsl"])
180
181dnl Check for Linux-specific headers (so we can compile Linux-specific
182dnl stuff only when compiling under Linux)
183AC_CHECK_HEADERS(linux/cdrom.h scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h)
184
185libgpod_version=`$PKG_CONFIG libgpod-1.0 --modversion`
186AC_DEFINE_UNQUOTED(LIBGPOD_VERSION, "${libgpod_version}", [Set this to the libgpod version])
187
188AC_CHECK_HEADERS([mp4v2/platform.h])
189AC_CHECK_HEADERS([mp4v2/itmf_tags.h], [], [],
190		 [#ifdef HAVE_MP4V2_PLATFORM_H
191		  # include <mp4v2/platform.h>
192		  #endif
193		  typedef void* MP4FileHandle;
194		 ])
195
196AC_CHECK_HEADERS([endian.h])
197
198AC_OUTPUT([
199Makefile
200src/Makefile
201po/Makefile.in
202scripts/Makefile
203data/Makefile
204data/icons/Makefile
205data/icons/16x16/Makefile
206data/icons/22x22/Makefile
207data/icons/24x24/Makefile
208data/icons/32x32/Makefile
209data/icons/48x48/Makefile
210data/icons/64x64/Makefile
211data/icons/scalable/Makefile
212data/icons/hicolor/Makefile
213data/icons/hicolor/16x16/Makefile
214data/icons/hicolor/16x16/places/Makefile
215data/icons/hicolor/16x16/status/Makefile
216data/icons/hicolor/22x22/Makefile
217data/icons/hicolor/22x22/places/Makefile
218data/icons/hicolor/24x24/Makefile
219data/icons/hicolor/24x24/places/Makefile
220data/icons/hicolor/32x32/Makefile
221data/icons/hicolor/32x32/places/Makefile
222data/icons/hicolor/48x48/Makefile
223data/icons/hicolor/48x48/places/Makefile
224data/icons/hicolor/scalable/Makefile
225data/icons/hicolor/scalable/places/Makefile
226data/man/Makefile
227data/man/gtkpod.1
228doc/Makefile
229doc/figures/Makefile
230])
231
232echo "
233Configuration for $PACKAGE $VERSION :
234--------------------------------
235
236 Host System Type .....: $host
237 Install path .........: $prefix
238 GTK2 version .........: `$PKG_CONFIG gtk+-2.0 --modversion`
239 GLib2/GThread version : `$PKG_CONFIG gthread-2.0 --modversion`
240 gio ..................: $have_gio
241 libgpod version ......: $libgpod_version
242 libcurl ..............: $have_curl
243 vorbisfile ...........: $have_ogg
244 FLAC .................: $have_flac
245 Preprocessor .........: $CC $CPPFLAGS
246 Compiler .............: $CC $CFLAGS
247 Linker ...............: $CC $LDFLAGS $LIBS
248
249 Now type 'make' to build $PACKAGE $VERSION,
250 and then 'make install' for installation.
251"
252