summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 576d72b55443a3e742615c47d17ea9ffb7726529 (plain)
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
AC_PREREQ(2.52)
AC_INIT(src)
AC_CONFIG_SRCDIR(configure.ac)
AC_CONFIG_MACRO_DIR(m4)

AM_CONFIG_HEADER(config.h)

# Making releases:
#   LIBGPOD_MICRO_VERSION += 1;
#   LIBGPOD_SO_VERSION - see comments
#
LIBGPOD_MAJOR_VERSION=0
LIBGPOD_MINOR_VERSION=7
LIBGPOD_MICRO_VERSION=0
# If you need a modifier for the version number. 
# Normally empty, but can be used to make "fixup" releases.
LIBGPOD_EXTRAVERSION=rc2

LIBGPOD_VERSION=$LIBGPOD_MAJOR_VERSION.$LIBGPOD_MINOR_VERSION.$LIBGPOD_MICRO_VERSION$LIBGPOD_EXTRAVERSION

dnl libtool versioning
# +1 : 0 : +1  == adds new functions to the interface
# +1 : 0 : 0   == changes or removes functions (changes include both
#                 changes to the signature and the semantic)
#  ? :+1 : ?   == just internal changes
# CURRENT : REVISION : AGE
LIBGPOD_SO_VERSION=4:0:0

AC_SUBST(LIBGPOD_SO_VERSION)
AC_SUBST(LIBGPOD_MAJOR_VERSION)
AC_SUBST(LIBGPOD_MINOR_VERSION)
AC_SUBST(LIBGPOD_MICRO_VERSION)
AC_SUBST(LIBGPOD_VERSION)

AM_INIT_AUTOMAKE(libgpod, $LIBGPOD_VERSION)

dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")

AM_MAINTAINER_MODE

AC_GNU_SOURCE
AC_PROG_CC
AM_PROG_CC_C_O

# AC_PROG_CXX is only needed for the test program tests/test-rebuild-db.cc.
# You can safely remove AC_PROG_CXX and the test program (edit tests/Makefile.am)
# if you should run into problems.
AC_PROG_CXX

AC_PROG_LD
AC_STDC_HEADERS
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INTLTOOL([0.21])

PKG_CHECK_MODULES(LIBGPOD, glib-2.0 >= 2.8.0 gobject-2.0)

dnl **************************************************
dnl * expand $libdir 
dnl * by default, it looks like ${prefix}/lib
dnl * we want to expand prefix
dnl **************************************************
expanded_libdir=`(
    case $prefix in 
        NONE) prefix=$ac_default_prefix ;; 
        *) ;; 
    esac
    case $exec_prefix in 
        NONE) exec_prefix=$prefix ;; 
        *) ;; 
    esac
    eval echo $libdir
)`


dnl **************************************************
dnl we've copied gchecksum from glib 2.16. Only use the
dnl copy if the version of glib on the system does not
dnl provide it.
dnl **************************************************

AC_ARG_WITH(internal-gchecksum,
            AC_HELP_STRING([--with-internal-gchecksum],
                           [Build using internal copy of gchecksum]),,
                           with_internal_gchecksum=no)

if test "x$with_internal_gchecksum" = "xno"; then
        PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16.0, with_internal_gchecksum=no,
                          with_internal_gchecksum=yes)
fi

AM_CONDITIONAL(WITH_INTERNAL_GCHECKSUM, test "x$with_internal_gchecksum" = "xyes")

dnl **************************************************
dnl * sgutils is necessary to get the xml device file from the ipod
dnl **************************************************
AC_CHECK_LIB(sgutils2, sg_ll_inquiry,
             [SGUTILS_LIBS="-lsgutils2"; have_sgutils=yes],
             have_sgutils=no)
if test "x$have_sgutils" != xyes; then
    AC_CHECK_LIB(sgutils, sg_ll_inquiry,
                 [SGUTILS_LIBS="-lsgutils"; have_sgutils=yes],
                 have_sgutils=no)
fi
AC_SUBST(SGUTILS_LIBS)
AM_CONDITIONAL(HAVE_SGUTILS, test x"$have_sgutils" = xyes)

dnl ***********************************************************************
dnl * HAL is optional, but is required if you want things to "just work"
dnl * when a recent iPod is plugged in
dnl * libgpod by itself doesn't use HAL at all, HAL is just used to build a 
dnl * helper program which is then installed as a HAL callout
dnl ***********************************************************************
AC_ARG_WITH(hal, AC_HELP_STRING([--without-hal],
        [Disable HAL support]))

AC_ARG_WITH(hal_callouts_dir, AC_HELP_STRING([--with-hal-callouts-dir=DIR],
	[Directory where HAL expects its callout scripts to be located]), , 
	with_hal_callouts_dir="${expanded_libdir}/hal")
HALCALLOUTSDIR="$with_hal_callouts_dir"
AC_SUBST(HALCALLOUTSDIR)

if test "x$with_hal" != "xno"; then
  PKG_CHECK_MODULES(HAL, hal >= 0.5 hal < 0.6, enable_hal=yes, enable_hal=no)
  if test "x$enable_hal" != "xyes" -a "x$with_hal" = "xyes"; then
      AC_MSG_ERROR([HAL support explicitly requested but HAL couldn't be found])
  fi

  if test "x$enable_hal" = "xyes"; then
        AC_DEFINE(HAVE_HAL, 1, [Define if you have HAL support])
        AC_SUBST(HAL_CFLAGS)
	AC_SUBST(HAL_LIBS)
  fi
fi
AM_CONDITIONAL(HAVE_HAL, test x"$enable_hal" = xyes)



dnl **************************************************
dnl * TagLib is only used by test-rebuild-db 
dnl **************************************************
PKG_CHECK_MODULES(TAGLIB, taglib, have_taglib=yes, have_taglib=no)
if test x"$have_taglib" = xyes; then
   AH_TEMPLATE([HAVE_TAGLIB], [Whether TagLib is installed, it's only used in a test program])
   AC_DEFINE_UNQUOTED(HAVE_TAGLIB, 1)
fi
AC_SUBST(TAGLIB_CFLAGS)
AC_SUBST(TAGLIB_LIBS)
AM_CONDITIONAL(HAVE_TAGLIB, test x"$have_taglib" = xyes)

dnl **************************************************
dnl * libxml is used to parse the plist files (aka SysInfoExtended)
dnl **************************************************
AC_ARG_ENABLE(libxml, [AC_HELP_STRING([--disable-libxml],[SysInfoExtended won't be parsed])], 
[case "${enableval}" in
  no) enable_libxml=no ;;
  *) enable_libxml=yes;;
esac])
AH_TEMPLATE([HAVE_LIBXML], [Whether libxml is installed, it's used to parse SysInfoExtended])
if test x$enable_libxml != xno; then
   PKG_CHECK_MODULES(LIBXML, libxml-2.0)
   AC_DEFINE_UNQUOTED(HAVE_LIBXML, 1)
   LIBGPOD_CFLAGS="$LIBGPOD_CFLAGS $LIBXML_CFLAGS"
   LIBGPOD_LIBS="$LIBGPOD_LIBS $LIBXML_LIBS"
fi

dnl **************************************************
dnl * GDKPIXBUF is optional
dnl **************************************************
AC_ARG_ENABLE(gdk-pixbuf, [AC_HELP_STRING([--disable-gdk-pixbuf],[ArtworkDB will be disabled without gdk-pixbuf])], 
[case "${enableval}" in
  no) enable_gdkpixbuf=no ;;
  *) enable_gdkpixbuf=yes;;
esac])
AH_TEMPLATE([HAVE_GDKPIXBUF], [Whether gdk-pixbuf is installed, ArtworkDB writing support will be disabled if it can't be found])
if test x$enable_gdkpixbuf != xno; then
   GDKPIXBUF_REQ="gdk-pixbuf-2.0"
   PKG_CHECK_MODULES(GDKPIXBUF, $GDKPIXBUF_REQ >= 2.6.0, have_gdkpixbuf=yes, have_gdkpixbuf=no)
   if test x"$enable_gdkpixbuf" = xyes -a x"$have_gdkpixbuf" = xno; then
      AC_MSG_ERROR([gdk-pixbuf support explicitly requested but gdk-pixbuf couldn't be found])
   fi
fi
if test x"$have_gdkpixbuf" = xyes; then
   AC_DEFINE_UNQUOTED(HAVE_GDKPIXBUF, 1)
   LIBGPOD_CFLAGS="$LIBGPOD_CFLAGS $GDKPIXBUF_CFLAGS"
   LIBGPOD_LIBS="$LIBGPOD_LIBS $GDKPIXBUF_LIBS"
else
   have_gdkpixbuf=no
   GDKPIXBUF_REQ=""
fi
AM_CONDITIONAL(HAVE_GDKPIXBUF, test x"$have_gdkpixbuf" = xyes)
AC_SUBST(GDKPIXBUF_REQ)

dnl **************************************************
dnl * PYGOBJECT is optional
dnl **************************************************

AC_ARG_ENABLE(pygobject, [AC_HELP_STRING([--disable-pygobject],[Python API will lack GdkPixbuf support without PyGOBJECT])], 
[case "${enableval}" in
  no) enable_pygobject=no ;;
  *) enable_pygobject=yes;;
esac])
AH_TEMPLATE([HAVE_PYGOBJECT], [Whether pygobject is installed, Python API will lack GdkPixbuf support without PyGOBJECT])
if test x$enable_pygobject != xno; then
   PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= 2.8.0, have_pygobject=yes, have_pygobject=no)
   if test x"$enable_pygobject" = xyes -a x"$have_pygobject" = xno; then
      AC_MSG_ERROR([pygobject support explicitly requested but pygobject couldn't be found])
   fi
fi
if test x"$have_pygobject" = xyes; then
   AC_DEFINE_UNQUOTED(HAVE_PYGOBJECT, 1)
   LIBGPOD_CFLAGS="$LIBGPOD_CFLAGS $PYGOBJECT_CFLAGS"
   LIBGPOD_LIBS="$LIBGPOD_LIBS $PYGOBJECT_LIBS"
else
   have_pygobject=no
fi
AM_CONDITIONAL(HAVE_PYGOBJECT, test x"$have_pygobject" = xyes)

dnl **************************************************
dnl * internationalization support
dnl **************************************************
ALL_LINGUAS="de es fr he it ja ro sv zh_CN"

GETTEXT_PACKAGE=libgpod
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])

AM_GLIB_GNU_GETTEXT


dnl **************************************************
dnl * gtk-doc
dnl **************************************************
GTK_DOC_CHECK(1.0)

dnl **************************************************
dnl * optional python bindings
dnl **************************************************

PYTHON_MIN_VERSION=2.1.1
PYTHON_MUTAGEN_MIN_VERSION=1.8
SWIG_MIN_VERSION=1.3.24
LIBGPOD_CHECK_PYTHON($PYTHON_MIN_VERSION)


dnl warnings bits, copied from gnome-keyring configure.in
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.

AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
if test -e "$srcdir/autogen.sh"; then
	set_more_warnings=yes
else
	set_more_warnings=no
fi
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
	AC_MSG_RESULT(yes)
	CFLAGS="\
	-Wall \
	-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
	-Wnested-externs -Wpointer-arith \
	-Wcast-align -Wsign-compare \
	-Werror -std=c89 \
	$CFLAGS"

	for option in -Wno-strict-aliasing -Wno-sign-compare -Wdeclaration-after-statement; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		if test $has_option = no; then
			CFLAGS="$SAVE_CFLAGS"
		fi
		AC_MSG_RESULT($has_option)
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
else
	AC_MSG_RESULT(no)
fi

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBGPOD_CFLAGS)
AC_SUBST(LIBGPOD_LIBS)

AC_OUTPUT([
Makefile
bindings/Makefile
bindings/python/gpod.i
bindings/python/Makefile
bindings/python/examples/Makefile
bindings/python/tests/Makefile
docs/Makefile
docs/reference/Makefile
docs/reference/version.xml
m4/Makefile
po/Makefile.in
src/Makefile
tools/Makefile
tests/Makefile
libgpod-1.0.pc
])

echo "
Configuration for $PACKAGE $VERSION :
--------------------------------

 Host System Type .....: $host
 Install path .........: $prefix
 Preprocessor .........: $CC $CPPFLAGS
 Compiler .............: $CC $CFLAGS $LIBGPOD_CFLAGS
 Linker ...............: $CC $LDFLAGS $LIBS $LIBGPOD_LIBS
 Artwork support ......: $have_gdkpixbuf
 Python bindings ......: $with_python
 PyGObject support ....: $have_pygobject

 Now type 'make' to build $PACKAGE $VERSION,
 and then 'make install' for installation.
"

if test x"$enable_libxml" = xno; then
        echo "
**WARNING** libxml support is disabled, libgpod won't be able to 
parse SysInfoExtended. This means it can't take advantage of the 
extensive iPod description (image formats, features, ...) 
available from that file
"
fi

if test x"$have_gdkpixbuf" = xno; then
        echo "
**WARNING** gdkpixbuf support is disabled. libgpod won't be able
to read or write artwork (covers, photos, ...) from/to the iPod
"
fi