cleanup specfile for packaging
[profile/ivi/gdk-pixbuf.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_PREREQ([2.63])
3
4 # Making point releases:
5 #   gdk_pixbuf_micro_version += 1;
6 #   gdk_pixbuf_interface_age += 1;
7 #   gdk_pixbuf_binary_age += 1;
8 #
9 # if any functions have been added, set gdk_pixbuf_interface_age to 0.
10 #
11 # if backwards compatibility has been broken:
12 #   gdk_pixbuf_major_version += 1;
13 #   gdk_pixbuf_interface_age = 0;
14 #   gdk_pixbuf_binary_age = 0;
15
16 m4_define([gdk_pixbuf_major_version], [2])
17 m4_define([gdk_pixbuf_minor_version], [26])
18 m4_define([gdk_pixbuf_micro_version], [1])
19 m4_define([gdk_pixbuf_interface_age], [1])
20 m4_define([gdk_pixbuf_binary_age],
21           [m4_eval(100 * gdk_pixbuf_minor_version + gdk_pixbuf_micro_version)])
22 m4_define([gdk_pixbuf_version],
23           [gdk_pixbuf_major_version.gdk_pixbuf_minor_version.gdk_pixbuf_micro_version])
24 m4_define([gdk_pixbuf_api_version], [2.0])
25 m4_define([gdk_pixbuf_binary_version], [2.10.0])
26
27
28 # required versions of other packages
29 m4_define([glib_required_version], [2.31.0])
30
31 AC_INIT([gdk-pixbuf], [gdk_pixbuf_version],
32         [http://bugzilla.gnome.org/enter_bug.cgi?product=gdk-pixbuf],
33         [gdk-pixbuf])
34
35 AC_CONFIG_HEADER([config.h])
36 AC_CONFIG_SRCDIR([gdk-pixbuf/gdk-pixbuf.h])
37 AC_CONFIG_MACRO_DIR([m4])
38
39 # Save this value here, since automake will set cflags later
40 cflags_set=${CFLAGS+set}
41
42 AM_INIT_AUTOMAKE([1.11 foreign no-define -Wno-portability dist-xz no-dist-gzip tar-ustar])
43 AM_MAINTAINER_MODE([enable])
44
45 # Support silent build rules. Disable
46 # by either passing --disable-silent-rules to configure or passing V=0
47 # to make
48 AM_SILENT_RULES([yes])
49
50 #
51 # For each of the libraries we build, we define the following
52 # substituted variables:
53 #
54 # foo_PACKAGES:     pkg-config packages this library requires
55 # foo_EXTRA_LIBS:   Libraries this module requires not pulled in by pkg-config
56 # foo_EXTRA_CFLAGS: cflags this module requires not pulled in by pkg-config
57 # foo_DEP_LIBS:     All libraries this module requires
58 # foo_DEP_CFLAGS:   All cflags this module requires
59
60 GDK_PIXBUF_MAJOR=gdk_pixbuf_major_version
61 GDK_PIXBUF_MINOR=gdk_pixbuf_minor_version
62 GDK_PIXBUF_MICRO=gdk_pixbuf_micro_version
63 GDK_PIXBUF_VERSION=gdk_pixbuf_version
64 GDK_PIXBUF_API_VERSION=gdk_pixbuf_api_version
65 GDK_PIXBUF_BINARY_VERSION=gdk_pixbuf_binary_version
66 AC_SUBST(GDK_PIXBUF_MAJOR)
67 AC_SUBST(GDK_PIXBUF_MINOR)
68 AC_SUBST(GDK_PIXBUF_MICRO)
69 AC_SUBST(GDK_PIXBUF_VERSION)
70 AC_SUBST(GDK_PIXBUF_API_VERSION)
71 AC_SUBST(GDK_PIXBUF_BINARY_VERSION)
72
73 # libtool versioning
74 #LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
75 #LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
76 #LT_REVISION=$GTK_INTERFACE_AGE
77 #LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
78 #LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
79
80 m4_define([lt_current], [m4_eval(100 * gdk_pixbuf_minor_version + gdk_pixbuf_micro_version - gdk_pixbuf_interface_age)])
81 m4_define([lt_revision], [gdk_pixbuf_interface_age])
82 m4_define([lt_age], [m4_eval(gdk_pixbuf_binary_age - gdk_pixbuf_interface_age)])
83 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
84 LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
85 AC_SUBST(LT_VERSION_INFO)
86 AC_SUBST(LT_CURRENT_MINUS_AGE)
87
88 # Checks for programs.
89 AC_PROG_CC
90 AC_PROG_CC_C_O
91 AC_PROG_CC_STDC
92 AC_PROG_INSTALL
93 AC_PROG_MAKE_SET
94 PKG_PROG_PKG_CONFIG
95
96 AC_CANONICAL_HOST
97
98 MATH_LIB=-lm
99 AC_MSG_CHECKING([for native Win32])
100 LIB_EXE_MACHINE_FLAG=X86
101 EXE_MANIFEST_ARCHITECTURE=X86
102 case "$host" in
103   *-*-mingw*)
104     os_win32=yes
105     gio_can_sniff=no
106     MATH_LIB=
107     case "$host" in
108     x86_64-*-*)
109       LIB_EXE_MACHINE_FLAG=X64
110       EXE_MANIFEST_ARCHITECTURE=AMD64
111       ;;
112     esac
113     ;;
114   *)
115     os_win32=no
116     ;;
117 esac
118 AC_MSG_RESULT([$os_win32])
119
120 AC_SUBST(LIB_EXE_MACHINE_FLAG)
121 AC_SUBST(EXE_MANIFEST_ARCHITECTURE)
122
123 case $host in
124   *-*-linux*)
125     os_linux=yes
126     ;;
127 esac
128
129 if test "$os_win32" = "yes"; then
130   if test x$enable_static = xyes -o x$enable_static = x; then
131     AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
132     enable_static=no
133   fi
134   if test x$enable_shared = xno; then
135     AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
136   fi
137   enable_shared=yes
138 fi
139
140 dnl Initialize libtool
141 LT_PREREQ([2.2.6])
142 LT_INIT([disable-static win32-dll])
143 # Create libtool early, because it's used in configure
144 LT_OUTPUT
145
146 # Make sure we use 64-bit versions of various file stuff.
147 AC_SYS_LARGEFILE
148
149 AM_PROG_AS
150 AC_PATH_PROG(NM, nm, nm)
151
152 AC_MSG_CHECKING([for some Win32 platform])
153 AS_CASE(["$host"],
154         [*-*-mingw*|*-*-cygwin*], [platform_win32=yes],
155         [platform_win32=no]
156 )
157 AC_MSG_RESULT([$platform_win32])
158 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
159
160 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
161 AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
162 AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
163
164 if test "$os_win32" = "yes"; then
165   AC_CHECK_TOOL(WINDRES, windres, no)
166   if test "$WINDRES" = no; then
167     AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
168   fi
169   AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
170 fi
171 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
172
173 m4_define([debug_default],
174           m4_if(m4_eval(gdk_pixbuf_minor_version % 2), [1], [yes], [minimum]))
175
176 dnl declare --enable-* args and collect ac_help strings
177 AC_ARG_ENABLE(debug,
178               AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
179                              [turn on debugging @<:@default=debug_default@:>@]),,
180               enable_debug=debug_default)
181 AC_ARG_ENABLE(rebuilds,
182               [AC_HELP_STRING([--disable-rebuilds],
183                               [disable all source autogeneration rules])],,
184               [enable_rebuilds=yes])
185
186 AS_CASE([$enable_debug],
187         [yes],
188         [
189           test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
190           GDK_PIXBUF_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_ERRORCHECK_MUTEXES"
191         ],
192
193         [no], [GDK_PIXBUF_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
194
195         [minimum], [GDK_PIXBUF_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"]
196 )
197
198 # Build time sanity check...
199 AM_SANITY_CHECK
200
201 changequote(,)dnl
202 if test "x$GCC" = "xyes"; then
203   case " $CFLAGS " in
204   *[\ \ ]-Wall[\ \      ]*) ;;
205   *) CFLAGS="$CFLAGS -Wall" ;;
206   esac
207
208   if test "x$enable_ansi" = "xyes"; then
209     case " $CFLAGS " in
210     *[\ \       ]-ansi[\ \      ]*) ;;
211     *) CFLAGS="$CFLAGS -ansi" ;;
212     esac
213
214     case " $CFLAGS " in
215     *[\ \       ]-pedantic[\ \  ]*) ;;
216     *) CFLAGS="$CFLAGS -pedantic" ;;
217     esac
218   fi
219 fi
220 changequote([,])dnl
221
222 CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES"
223
224 # Ensure MSVC-compatible struct packing convention is used when
225 # compiling for Win32 with gcc.
226 # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
227 # gcc2 uses "-fnative-struct".
228 if test x"$os_win32" = xyes; then
229   if test x"$GCC" = xyes; then
230     msnative_struct=''
231     AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
232     if test -z "$ac_cv_prog_CC"; then
233       our_gcc="$CC"
234     else
235       our_gcc="$ac_cv_prog_CC"
236     fi
237     case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
238       2.)
239         if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
240           msnative_struct='-fnative-struct'
241         fi
242         ;;
243       *)
244         if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
245           msnative_struct='-mms-bitfields'
246         fi
247         ;;
248     esac
249     if test x"$msnative_struct" = x ; then
250       AC_MSG_RESULT([no way])
251       AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
252     else
253       CFLAGS="$CFLAGS $msnative_struct"
254       AC_MSG_RESULT([${msnative_struct}])
255     fi
256   fi
257 fi
258
259 ## Initial sanity check, done here so that users get told they
260 ## have the wrong dependencies as early in the process as possible.
261 ## Later on we actually use the cflags/libs from separate pkg-config
262 ## calls. Oh, also the later pkg-config calls don't include
263 ## the version requirements since those make the module lists
264 ## annoying to construct
265 PKG_CHECK_MODULES(BASE_DEPENDENCIES, [glib-2.0 >= glib_required_version])
266
267 if test "$os_win32" != yes; then
268     # libtool option to control which symbols are exported
269     # right now, symbols starting with _ are not exported
270     LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
271 else
272     # We currently use .def files on Windows (for gdk-pixbuf, gdk and gtk)
273     LIBTOOL_EXPORT_OPTIONS=
274 fi
275 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
276
277 dnl ******************************************************
278 dnl * See whether to include shared library dependencies *
279 dnl ******************************************************
280
281 AC_ARG_ENABLE(explicit-deps,
282               [AC_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@],
283                               [use explicit dependencies in .pc files [default=auto]])],,
284               [enable_explicit_deps=auto])
285
286 AC_MSG_CHECKING([Whether to write dependencies into .pc files])
287 case $enable_explicit_deps in
288   auto)
289     export SED
290     deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh`
291     if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then
292       enable_explicit_deps=yes
293     else
294       enable_explicit_deps=no
295     fi
296   ;;
297   yes|no)
298   ;;
299   *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
300   ;;
301 esac
302 AC_MSG_RESULT($enable_explicit_deps)
303
304 AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)
305
306 # define a MAINT-like variable REBUILD which is set if Perl
307 # and awk are found, so autogenerated sources can be rebuilt
308
309 AC_PATH_PROGS(PERL, perl5 perl)
310
311 REBUILD=\#
312 if test "x$enable_rebuilds" = "xyes" && \
313      test -n "$PERL" && \
314      $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
315   REBUILD=
316 fi
317 AC_SUBST(REBUILD)
318
319 # sigsetjmp is a macro on some platforms, so AC_CHECK_FUNCS is not reliable
320 AC_MSG_CHECKING(for sigsetjmp)
321 AC_TRY_LINK([#include <setjmp.h>], [
322 sigjmp_buf env;
323 sigsetjmp(env, 0);
324 ], gtk_ok=yes, gtk_ok=no)
325 AC_MSG_RESULT($gtk_ok)
326 if test "$gtk_ok" = "yes"; then
327   AC_DEFINE(HAVE_SIGSETJMP, 1,
328             [Define to 1 if sigsetjmp is available])
329 fi
330
331 # i18n stuff
332 AM_GNU_GETTEXT_VERSION([0.17])
333 AM_GNU_GETTEXT([external])
334
335 GETTEXT_PACKAGE="$PACKAGE"
336 AC_SUBST(GETTEXT_PACKAGE)
337 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
338                    [The prefix for our gettext translation domains.])
339
340 dnl The DU4 header files don't provide library prototypes unless
341 dnl -std1 is given to the native cc.
342 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
343
344 gtk_save_LIBS=$LIBS
345 LIBS="$LIBS -lm"
346 AC_TRY_RUN([#include <math.h>
347              int main (void) { return (log(1) != log(1.)); }],
348      AC_MSG_RESULT(none needed),
349      gtk_save_CFLAGS="$CFLAGS"
350      CFLAGS="$CFLAGS -std1"
351      AC_TRY_RUN([#include <math.h>
352                  int main (void) { return (log(1) != log(1.)); }],
353          AC_MSG_RESULT(-std1),
354          AC_MSG_RESULT()
355          CFLAGS="$gtk_save_CFLAGS"
356          AC_MSG_WARN(
357                 [No ANSI prototypes found in library. (-std1 didn't work.)]),
358          true
359      ),
360      AC_MSG_RESULT(none needed)
361 )
362 LIBS=$gtk_save_LIBS
363
364 AC_MSG_CHECKING(for the BeOS)
365 case $host in
366   *-*-beos*)
367     AC_MSG_RESULT(yes)
368     MATH_LIB=
369   ;;
370   *)
371     AC_MSG_RESULT(no)
372   ;;
373 esac
374
375 AC_SUBST(MATH_LIB)
376 #
377 # see bug 162979
378 #
379 AC_MSG_CHECKING(for HP-UX)
380 case $host_os in
381   hpux9* | hpux10* | hpux11*)
382     AC_MSG_RESULT(yes)
383     CFLAGS="$CFLAGS -DHPPEX -DSHMLINK"
384   ;;
385   *)
386     AC_MSG_RESULT(no)
387   ;;
388 esac
389
390 dnl NeXTStep cc seems to need this
391 AC_MSG_CHECKING([for extra flags for POSIX compliance])
392 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
393   AC_MSG_RESULT(none needed),
394   gtk_save_CFLAGS="$CFLAGS"
395   CFLAGS="$CFLAGS -posix"
396   AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
397     AC_MSG_RESULT(-posix),
398     AC_MSG_RESULT()
399     CFLAGS="$gtk_save_CFLAGS"
400     AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
401
402 #
403 # Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
404 #
405
406 GLIB_PACKAGES="gobject-2.0 gio-2.0 gmodule-no-export-2.0"
407
408 AM_PATH_GLIB_2_0(glib_required_version, :,
409   AC_MSG_ERROR([
410 *** GLIB glib_required_version or better is required. The latest version of
411 *** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
412   gobject gmodule-no-export gthread)
413
414 dnl
415 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
416 dnl
417 gtk_save_LIBS=$LIBS
418 LIBS="$LIBS $GLIB_LIBS"
419 AC_CHECK_FUNCS(bind_textdomain_codeset)
420 LIBS=$gtk_save_LIBS
421
422 AC_CHECK_HEADERS(unistd.h,
423                  AC_DEFINE(HAVE_UNISTD_H, 1,
424                            [Define to 1 if unistd.h is available]))
425
426 saved_cflags="$CFLAGS"
427 saved_ldflags="$LDFLAGS"
428
429
430 # Checks for header files.
431 AC_HEADER_STDC
432
433 # Checks for typedefs, structures, and compiler characteristics.
434 AC_C_CONST
435
436 ##################################################
437 # Checks for gdk-pixbuf
438 ##################################################
439
440 dnl ********************************************************
441 dnl * See whether we need to load our modules as .la files *
442 dnl ********************************************************
443
444 use_la_modules=false
445 case $host in
446   *-aix*) use_la_modules=true
447 esac
448
449 if $use_la_modules ; then
450    AC_DEFINE(USE_LA_MODULES, 1,
451              [Whether to load modules via .la files rather than directly])
452 fi
453
454
455 AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
456
457 AC_ARG_ENABLE(modules,
458               [AC_HELP_STRING([--disable-modules],
459                               [disable dynamic module loading])])
460
461 dynworks=false
462 deps=
463 if test x$enable_modules = xno; then
464     AC_MSG_RESULT(no)
465 else
466     AC_MSG_RESULT(yes)
467     AC_MSG_CHECKING(whether dynamic modules work)
468     ## for loop is to strip newline
469     tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-no-export-2.0`
470     for I in $tmp; do
471         dynworks=$I
472     done
473
474     dnl Now we check to see if our libtool supports shared lib deps
475     dnl (in a rather ugly way even)
476     if $dynworks; then
477         pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
478         pixbuf_deplibs_check=`$pixbuf_libtool_config | \
479             grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
480             sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
481         if test "x$pixbuf_deplibs_check" = "xnone" || \
482            test "x$pixbuf_deplibs_check" = "xunknown" || \
483            test "x$pixbuf_deplibs_check" = "x"; then
484             dynworks=false
485         fi
486     fi
487
488     if $dynworks; then
489         AC_DEFINE(USE_GMODULE, 1,
490                   [Define to 1 if gmodule works and should be used])
491         AC_MSG_RESULT(yes)
492     else
493         AC_MSG_RESULT(no)
494     fi
495 fi
496
497 dnl We allow people to disable image loaders explicitely, but if they don't we error
498 dnl out so that people don't accidentally build without them.
499
500 AC_ARG_WITH(libpng,
501             [AC_HELP_STRING([--without-libpng],
502                             [disable PNG loader for gdk-pixbuf])])
503 AC_ARG_WITH(libjpeg,
504             [AC_HELP_STRING([--without-libjpeg],
505                             [disable JPEG loader for gdk-pixbuf])])
506 AC_ARG_WITH(libtiff,
507             [AC_HELP_STRING([--without-libtiff],
508                             [disable TIFF loader for gdk-pixbuf])])
509 AC_ARG_WITH(libjasper,
510             [AC_HELP_STRING([--with-libjasper],
511                             [enable JPEG2000 loader for gdk-pixbuf])])
512 AC_ARG_WITH(gdiplus,
513             [AC_HELP_STRING([--without-gdiplus],
514                             [disable GDI+ loaders for gdk-pixbuf on Windows])])
515
516 AM_CONDITIONAL(BUILD_GDIPLUS_LOADERS, [ test x$os_win32 = xyes && test x$with_gdiplus != xno ])
517
518 dnl Test for libtiff
519 if test x$os_win32 = xno || test x$with_gdiplus = xno; then
520   if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
521     AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented,
522       [AC_CHECK_HEADER(tiffio.h,
523         TIFF='tiff'; LIBTIFF='-ltiff',
524         AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
525       [AC_CHECK_LIB(tiff, TIFFWriteScanline,
526         [AC_CHECK_HEADER(tiffio.h,
527           TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
528           AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
529         [AC_CHECK_LIB(tiff34, TIFFFlushData,
530           [AC_CHECK_HEADER(tiffio.h,
531             TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
532             AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
533         AC_MSG_WARN(*** TIFF loader will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
534   fi
535
536   if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
537      AC_MSG_ERROR([
538 *** Checks for TIFF loader failed. You can build without it by passing
539 *** --without-libtiff to configure but some programs using GTK+ may
540 *** not work properly])
541   fi
542 fi
543
544 dnl Test for libjpeg
545 if test x$os_win32 = xno || test x$with_gdiplus = xno; then
546   if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
547     AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
548       jpeg_ok=yes,
549       jpeg_ok=no
550       AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
551     if test "$jpeg_ok" = yes; then
552       AC_MSG_CHECKING([for jpeglib.h])
553       AC_TRY_CPP(
554 [#include <stdio.h>
555 #undef PACKAGE
556 #undef VERSION
557 #undef HAVE_STDLIB_H
558 #include <jpeglib.h>],
559         jpeg_ok=yes,
560         jpeg_ok=no)
561       AC_MSG_RESULT($jpeg_ok)
562       if test "$jpeg_ok" = yes; then
563         LIBJPEG='-ljpeg'
564         AC_CHECK_LIB(jpeg, jpeg_simple_progression,
565           AC_DEFINE(HAVE_PROGRESSIVE_JPEG, 1,
566                     [Define to 1 is libjpeg supports progressive JPEG]),
567           AC_MSG_WARN(JPEG library does not support progressive saving.))
568       else
569           AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
570       fi
571     fi
572   fi
573
574   if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
575      AC_MSG_ERROR([
576 *** Checks for JPEG loader failed. You can build without it by passing
577 *** --without-libjpeg to configure but some programs using GTK+ may
578 *** not work properly])
579   fi
580 fi
581
582 dnl Test for libpng
583   if test x$with_libpng != xno && test -z "$LIBPNG"; then
584     for l in libpng15 libpng14 libpng12 libpng13 libpng10 libpng ; do
585       AC_MSG_CHECKING(for $l)
586       if $PKG_CONFIG --exists $l ; then
587         AC_MSG_RESULT(yes)
588         PNG='png'
589         PNG_DEP_CFLAGS_PACKAGES=$l
590         LIBPNG=`$PKG_CONFIG --libs $l`
591         break
592       else
593         AC_MSG_RESULT(no)
594       fi
595     done
596     if test x$PNG != xpng; then
597       AC_MSG_RESULT(no)
598       AC_CHECK_LIB(png, png_read_info,
599         [AC_CHECK_HEADER(png.h,
600           png_ok=yes,
601           png_ok=no)],
602         AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
603       if test "$png_ok" = yes; then
604         AC_MSG_CHECKING([for png_structp in png.h])
605         AC_TRY_COMPILE([#include <png.h>],
606           [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
607           png_ok=yes,
608           png_ok=no)
609         AC_MSG_RESULT($png_ok)
610         if test "$png_ok" = yes; then
611           PNG='png'; LIBPNG='-lpng -lz'
612         else
613           AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
614         fi
615       else
616        AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
617       fi
618     fi
619   fi
620
621   if test x$with_libpng != xno && test -z "$LIBPNG"; then
622      AC_MSG_ERROR([
623 *** Checks for PNG loader failed. You can build without it by passing
624 *** --without-libpng to configure but many programs using GTK+ will
625 *** not work properly. The PNG loader is also needed if you are compiling
626 *** from Git.])
627   fi
628
629 dnl Test for libjasper
630   if test x$with_libjasper = xyes && test -z "$LIBJASPER"; then
631     AC_CHECK_LIB(jasper, jas_init, LIBJASPER=-ljasper, [], -ljpeg -lm)
632   fi
633
634   if test x$with_libjasper = xyes && test -z "$LIBJASPER"; then
635      AC_MSG_ERROR([
636 *** Checks for JPEG2000 loader failed. You can build without it by passing
637 *** --without-libjasper to configure])
638   fi
639
640 AC_SUBST(LIBTIFF)
641 AC_SUBST(LIBJPEG)
642 AC_SUBST(LIBPNG)
643 AC_SUBST(LIBJASPER)
644
645 AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
646
647 #
648 # Allow building some or all gdk-pixbuf loaders included
649 #
650 AC_MSG_CHECKING(pixbuf loaders to build)
651
652 dnl due to an autoconf bug, commas in the first arg to
653 dnl AC_HELP_STRING cause problems.
654 dnl AC_HELP_STRING([--with-included-loaders=LOADER1 LOADER2 ...],
655 dnl                [build the specified loaders into gdk-pixbuf])
656 AC_ARG_WITH(included_loaders,
657 [  --with-included-loaders=LOADER1,LOADER2,...
658                           build the specified loaders into gdk-pixbuf])
659
660 if $dynworks; then
661    :
662 else
663    ## if the option was specified, leave it; otherwise disable included loaders
664    if test x$with_included_loaders = xno; then
665            with_included_loaders=yes
666    fi
667 fi
668
669 # Use the traditional png loader instead of the GDI+ one on Windows,
670 # because some important apps like GIMP need to read and write
671 # arbitrary tEXt chunks which doesn't seem to be possible through GDI+
672
673 all_loaders="ani,icns,pcx,ras,tga,png,pnm,wbmp,xbm,xpm,qtif"
674 if test x$with_libjasper = xyes; then
675   all_loaders="$all_loaders,jasper"
676 fi
677 if test x$os_win32 = xyes && test x$with_gdiplus != xno; then
678   # Skip PNG, see comment above
679   gdip_formats="bmp emf gif ico jpeg tiff wmf"
680   for f in $gdip_formats; do
681     all_loaders="$all_loaders,gdip-$f"
682   done
683 else
684   all_loaders="$all_loaders,bmp,gif,ico,jpeg,tiff"
685 fi
686 included_loaders=""
687 # If no loaders specified, include all
688 if test "x$with_included_loaders" = xyes ; then
689   included_loaders="$all_loaders"
690 else
691   included_loaders="$with_included_loaders"
692 fi
693
694 AC_MSG_RESULT($included_loaders)
695
696 INCLUDED_LOADER_OBJ=
697 INCLUDED_LOADER_DEFINE=
698
699 IFS="${IFS=     }"; gtk_save_ifs="$IFS"; IFS=","
700 for loader in $included_loaders; do
701  if echo "$all_loaders" | egrep "(^|,)$loader(\$|,)" > /dev/null; then
702    :
703  else
704    AC_MSG_ERROR([the specified loader $loader does not exist])
705  fi
706
707  loader_underscores=`echo $loader | sed -e 's/-/_/g'`
708  INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libstatic-pixbufloader-$loader.la"
709
710  # Don't bother defining separate -DINCLUDE_gdip_foo for each gdip-foo loader
711  case $loader in
712    gdip-*) ;;
713    *) INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader_underscores";;
714  esac
715  eval INCLUDE_$loader_underscores=yes
716 done
717
718 # Just define one -DINCLUDE_gdiplus for all the gdip-foo loaders
719 # (except gdip-png, which isn't built at all)
720 if test x"$INCLUDE_gdip_ico" = xyes; then
721   INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_gdiplus"
722 fi
723
724 IFS="$gtk_save_ifs"
725 AC_SUBST(INCLUDED_LOADER_OBJ)
726 AC_SUBST(INCLUDED_LOADER_DEFINE)
727
728 AM_CONDITIONAL(INCLUDE_PNG, [test x"$INCLUDE_png" = xyes])
729 AM_CONDITIONAL(INCLUDE_BMP, [test x"$INCLUDE_bmp" = xyes])
730 AM_CONDITIONAL(INCLUDE_WBMP, [test x"$INCLUDE_wbmp" = xyes])
731 AM_CONDITIONAL(INCLUDE_GIF, [test x"$INCLUDE_gif" = xyes])
732 AM_CONDITIONAL(INCLUDE_ICO, [test x"$INCLUDE_ico" = xyes])
733 AM_CONDITIONAL(INCLUDE_ANI, [test x"$INCLUDE_ani" = xyes])
734 AM_CONDITIONAL(INCLUDE_JPEG, [test x"$INCLUDE_jpeg" = xyes])
735 AM_CONDITIONAL(INCLUDE_PNM, [test x"$INCLUDE_pnm" = xyes])
736 AM_CONDITIONAL(INCLUDE_RAS, [test x"$INCLUDE_ras" = xyes])
737 AM_CONDITIONAL(INCLUDE_TIFF, [test x"$INCLUDE_tiff" = xyes])
738 AM_CONDITIONAL(INCLUDE_XPM, [test x"$INCLUDE_xpm" = xyes])
739 AM_CONDITIONAL(INCLUDE_XBM, [test x"$INCLUDE_xbm" = xyes])
740 AM_CONDITIONAL(INCLUDE_TGA, [test x"$INCLUDE_tga" = xyes])
741 AM_CONDITIONAL(INCLUDE_PCX, [test x"$INCLUDE_pcx" = xyes])
742 AM_CONDITIONAL(INCLUDE_ICNS, [test x"$INCLUDE_icns" = xyes])
743 AM_CONDITIONAL(INCLUDE_JASPER, [test x"$INCLUDE_jasper" = xyes])
744 AM_CONDITIONAL(INCLUDE_QTIF, [test x"$INCLUDE_qtif" = xyes])
745 # As all GDI+ loaders are either built-in or not, arbitrarily just
746 # check one of the variables here
747 AM_CONDITIONAL(INCLUDE_GDIPLUS, [test x"$INCLUDE_gdip_ico" = xyes])
748
749 if test x$gio_can_sniff = x; then
750   AC_MSG_CHECKING([if gio can sniff png])
751   gtk_save_LIBS="$LIBS"
752   gtk_save_CFLAGS="$CFLAGS"
753   LIBS="`$PKG_CONFIG --libs gio-2.0`"
754   CFLAGS="`$PKG_CONFIG --cflags gio-2.0`"
755   AC_RUN_IFELSE([AC_LANG_SOURCE([[
756   #include <gio/gio.h>
757   static const gsize data_size = 159;
758   static const guint8 data[] =
759   {
760     0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
761     0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
762     0x08, 0x02, 0x00, 0x00, 0x00, 0x90, 0x77, 0x53, 0xde, 0x00, 0x00, 0x00,
763     0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
764     0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00,
765     0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74,
766     0x49, 0x4d, 0x45, 0x07, 0xd8, 0x07, 0x0f, 0x10, 0x08, 0x15, 0x61, 0xd8,
767     0x35, 0x37, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x43, 0x6f,
768     0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
769     0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0x57,
770     0x81, 0x0e, 0x17, 0x00, 0x00, 0x00, 0x0c, 0x49, 0x44, 0x41, 0x54, 0x08,
771     0xd7, 0x63, 0xf8, 0xff, 0xff, 0x3f, 0x00, 0x05, 0xfe, 0x02, 0xfe, 0xdc,
772     0xcc, 0x59, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
773     0x42, 0x60, 0x82
774   };
775   int
776   main (int argc, char **argv)
777   {
778     char *content_type;
779     char *image_png;
780     g_type_init ();
781     content_type = g_content_type_guess (NULL, data, data_size, NULL);
782     image_png = g_content_type_from_mime_type ("image/png");
783     return !!g_strcmp0 (content_type, image_png);
784   }]])],
785     [gio_can_sniff=yes
786      AC_DEFINE(GDK_PIXBUF_USE_GIO_MIME, 1, [Define if gio can sniff image data])],
787     [gio_can_sniff=no])
788   AC_MSG_RESULT($gio_can_sniff)
789   LIBS="$gtk_save_LIBS"
790   CFLAGS="$gtk_save_CFLAGS"
791 fi
792
793 AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
794 AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
795 AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
796 AM_CONDITIONAL(HAVE_JASPER, test "x$LIBJASPER" != x)
797
798 if $dynworks ; then
799   STATIC_LIB_DEPS=
800   if echo "$included_loaders" | egrep '(^|,)tiff($|,)' > /dev/null; then
801     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBTIFF"
802   fi
803   if echo "$included_loaders" | egrep '(^|,)jpeg($|,)' > /dev/null; then
804     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJPEG"
805   fi
806   if echo "$included_loaders" | egrep '(^|,)png($|,)' > /dev/null; then
807     if test -z $PNG_DEP_CFLAGS_PACKAGES; then
808       STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBPNG"
809     fi
810   fi
811   if echo "$included_loaders" | egrep '(^|,)jasper($|,)' > /dev/null; then
812     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJASPER"
813   fi
814 else
815   STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG $LIBJASPER"
816 fi
817
818 # Checks to see whether we should include mediaLib
819 # support.
820 #
821 AC_CHECK_HEADER(sys/systeminfo.h,
822                 AC_DEFINE(HAVE_SYS_SYSTEMINFO_H, 1,
823                           [Define to 1 if sys/systeminfo.h is available]))
824 AC_CHECK_HEADER(sys/sysinfo.h,
825                 AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
826                           [Define to 1 if sys/sysinfo.h is available]))
827
828 AC_MSG_CHECKING(for mediaLib 2.3)
829 use_mlib25=no
830 # Check for a mediaLib 2.3 function since that is what the GTK+ mediaLib
831 # patch requires.
832 AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no)
833 if test $use_mlib = yes; then
834     AC_DEFINE(USE_MEDIALIB, 1,
835               [Define to 1 if medialib is available and should be used])
836     MEDIA_LIB=-lmlib
837
838     AC_MSG_CHECKING(for mediaLib 2.5)
839     # Check for a mediaLib 2.5 function since that is what is needed for
840     # gdk_rgb_convert integration.
841     AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib25=yes, use_mlib25=no)
842     if test $use_mlib25 = yes; then
843         AC_DEFINE(USE_MEDIALIB25, 1,
844                   [Define to 1 if medialib 2.5 is available])
845     fi
846 fi
847 AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
848 AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
849
850 # Checks to see if we should compile in MMX support (there will be
851 # a runtime test when the code is actually run to see if it should
852 # be used - this just checks if we can compile it.)
853 #
854 # This code is partially taken from Mesa
855 #
856 AC_MSG_CHECKING(for x86 platform)
857 case $host_cpu in
858   i386|i486|i586|i686|i786|k6|k7)
859         use_x86_asm=yes
860         ;;
861    *)
862         use_x86_asm=no
863 esac
864 AC_MSG_RESULT($use_x86_asm)
865
866 use_mmx_asm=no
867 if test $use_x86_asm = yes; then
868     save_ac_ext=$ac_ext
869     ac_ext=S
870
871     AC_MSG_CHECKING(compiler support for MMX)
872     cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
873     if AC_TRY_EVAL(ac_compile); then
874         use_mmx_asm=yes
875     fi
876
877     rm -rf conftest*
878
879     ac_ext=$save_ac_ext
880     if test $use_mmx_asm = yes; then
881       AC_DEFINE(USE_MMX, 1,
882                 [Define to 1 if XXM is available and should be used])
883       AC_MSG_RESULT(yes)
884     else
885       AC_MSG_RESULT(no)
886     fi
887 fi
888
889 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
890
891 REBUILD_PNGS=
892 if test -z "$LIBPNG" && test x"$os_win32" = xno -o x$with_gdiplus = xno; then
893   REBUILD_PNGS=#
894 fi
895
896 dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
897
898 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
899
900 if test $cross_compiling = yes; then
901   AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
902   AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
903   if test x$GTK_UPDATE_ICON_CACHE = xno; then
904     REBUILD_PNGS=#
905   fi
906 fi
907
908 GDK_PIXBUF_PACKAGES="gmodule-no-export-2.0 gobject-2.0 gio-2.0"
909 GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB $MEDIA_LIB"
910 GDK_PIXBUF_EXTRA_CFLAGS=
911 GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
912 GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
913
914 AC_SUBST(PNG_DEP_CFLAGS_PACKAGES)
915 AC_SUBST(GDK_PIXBUF_PACKAGES)
916 AC_SUBST(GDK_PIXBUF_EXTRA_LIBS)
917 AC_SUBST(GDK_PIXBUF_EXTRA_CFLAGS)
918 AC_SUBST(GDK_PIXBUF_DEP_LIBS)
919 AC_SUBST(GDK_PIXBUF_DEP_CFLAGS)
920
921 ###############
922 # Check for X11
923 ###############
924
925 GDK_PIXBUF_XLIB_PACKAGES=
926 GDK_PIXBUF_XLIB_EXTRA_CFLAGS=
927 GDK_PIXBUF_XLIB_EXTRA_LIBS=
928
929 AC_ARG_WITH(x11,
930             [AC_HELP_STRING([--with-x11],
931                             [build X11 support])])
932
933 if test x$with_x11 = xyes; then
934   AM_CONDITIONAL(USE_X11, true)
935   PKG_CHECK_MODULES(GDK_PIXBUF_XLIB_DEP, x11 gobject-2.0)
936 else
937   AM_CONDITIONAL(USE_X11, false)
938 fi
939
940 ################################################################
941 # Strip -export-dynamic from the link lines of various libraries
942 ################################################################
943
944 #
945 # pkg-config --libs gmodule includes the "export_dynamic" flag,
946 #  but this flag is only meaningful for executables. For libraries
947 #  the effect is undefined; what it causes on Linux is that the
948 #  export list from -export-symbols-regex is ignored and everything
949 #  is exported
950 #
951 # We are using gmodule-no-export now, but I'm leaving the stripping
952 # code in place for now, since pango and atk still require gmodule.
953 export SED
954 export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
955 if test -n "$export_dynamic"; then
956   GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"`
957 fi
958
959 ##################################################
960 # GObject introspection
961 ##################################################
962
963 GOBJECT_INTROSPECTION_CHECK([0.9.3])
964
965 ##################################################
966 # Checks for gtk-doc and docbook-tools
967 ##################################################
968
969 GTK_DOC_CHECK([1.11], [--flavour=no-tmpl])
970
971 AC_CHECK_PROG(DB2HTML, db2html, true, false)
972 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
973
974 AC_ARG_ENABLE(man,
975               [AC_HELP_STRING([--enable-man],
976                               [regenerate man pages from Docbook [default=no]])],enable_man=yes,
977               enable_man=no)
978
979 if test "${enable_man}" != no; then
980   dnl
981   dnl Check for xsltproc
982   dnl
983   AC_PATH_PROG([XSLTPROC], [xsltproc])
984   if test -z "$XSLTPROC"; then
985     enable_man=no
986   fi
987 fi
988
989 AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
990
991
992 ##################################################
993 # Check for -Bsymbolic-functions linker flag used
994 # to avoid intra-library PLT jumps, if available.
995 ##################################################
996
997 AC_ARG_ENABLE(Bsymbolic,
998               [AC_HELP_STRING([--disable-Bsymbolic],
999                               [avoid linking with -Bsymbolic])],,
1000               [SAVED_LDFLAGS="${LDFLAGS}"
1001                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
1002                LDFLAGS=-Wl,-Bsymbolic-functions
1003                AC_TRY_LINK([], [int main (void) { return 0; }],
1004                            AC_MSG_RESULT(yes)
1005                            enable_Bsymbolic=yes,
1006                            AC_MSG_RESULT(no)
1007                            enable_Bsymbolic=no)
1008                LDFLAGS="${SAVED_LDFLAGS}"])
1009
1010 if test "x${enable_Bsymbolic}" = "xyes"; then
1011   GDK_PIXBUF_LINK_FLAGS=-Wl,-Bsymbolic-functions
1012 fi
1013
1014 AC_SUBST(GDK_PIXBUF_LINK_FLAGS)
1015
1016
1017 ##################################################
1018 # Output commands
1019 ##################################################
1020
1021 AC_CONFIG_FILES([
1022 Makefile
1023 gdk-pixbuf-2.0.pc
1024 gdk-pixbuf-2.0-uninstalled.pc
1025 gdk-pixbuf/Makefile
1026 gdk-pixbuf/gdk_pixbuf.rc
1027 gdk-pixbuf/gdk-pixbuf-features.h
1028 gdk-pixbuf/pixops/Makefile
1029 build/Makefile
1030 build/win32/Makefile
1031 build/win32/vs9/Makefile
1032 build/win32/vs10/Makefile
1033 docs/Makefile
1034 docs/reference/Makefile
1035 docs/reference/gdk-pixbuf/Makefile
1036 docs/reference/gdk-pixbuf/version.xml
1037 po/Makefile.in
1038 tests/Makefile
1039 contrib/Makefile
1040 contrib/gdk-pixbuf-xlib/Makefile
1041 contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-2.0.pc
1042 config.h.win32
1043 ])
1044
1045 AC_OUTPUT