1 # Configure paths for gdk-pixbuf
2 # Elliot Lee 2000-01-10
3 # stolen from Raph Levien 98-11-18
4 # stolen from Manish Singh 98-9-30
5 # stolen back from Frank Belew
6 # stolen from Manish Singh
7 # Shamelessly stolen from Owen Taylor
9 dnl AM_PATH_GDK_PIXBUF([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
10 dnl Test for GDK_PIXBUF, and define GDK_PIXBUF_CFLAGS and GDK_PIXBUF_LIBS
12 AC_DEFUN(AM_PATH_GDK_PIXBUF,
14 dnl Get the cflags and libraries from the gdk-pixbuf-config script
16 AC_ARG_WITH(gdk-pixbuf-prefix,[ --with-gdk-pixbuf-prefix=PFX Prefix where GDK_PIXBUF is installed (optional)],
17 gdk_pixbuf_prefix="$withval", gdk_pixbuf_prefix="")
18 AC_ARG_WITH(gdk-pixbuf-exec-prefix,[ --with-gdk-pixbuf-exec-prefix=PFX Exec prefix where GDK_PIXBUF is installed (optional)],
19 gdk_pixbuf_exec_prefix="$withval", gdk_pixbuf_exec_prefix="")
20 AC_ARG_ENABLE(gdk_pixbuftest, [ --disable-gdk_pixbuftest Do not try to compile and run a test GDK_PIXBUF program],
21 , enable_gdk_pixbuftest=yes)
23 if test x$gdk_pixbuf_exec_prefix != x ; then
24 gdk_pixbuf_args="$gdk_pixbuf_args --exec-prefix=$gdk_pixbuf_exec_prefix"
25 if test x${GDK_PIXBUF_CONFIG+set} = xset ; then
26 GDK_PIXBUF_CONFIG=$gdk_pixbuf_exec_prefix/gdk-pixbuf-config
29 if test x$gdk_pixbuf_prefix != x ; then
30 gdk_pixbuf_args="$gdk_pixbuf_args --prefix=$gdk_pixbuf_prefix"
31 if test x${GDK_PIXBUF_CONFIG+set} = xset ; then
32 GDK_PIXBUF_CONFIG=$gdk_pixbuf_prefix/bin/gdk-pixbuf-config
36 AC_PATH_PROG(GDK_PIXBUF_CONFIG, gdk-pixbuf-config, no)
37 min_gdk_pixbuf_version=ifelse([$1], ,0.2.5,$1)
38 AC_MSG_CHECKING(for GDK_PIXBUF - version >= $min_gdk_pixbuf_version)
40 if test "$GDK_PIXBUF_CONFIG" = "no" ; then
43 GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --cflags`
44 GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --libs`
46 gdk_pixbuf_major_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
47 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
48 gdk_pixbuf_minor_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
49 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
50 gdk_pixbuf_micro_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_config_args --version | \
51 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
52 if test "x$enable_gdk_pixbuftest" = "xyes" ; then
53 ac_save_CFLAGS="$CFLAGS"
55 CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
56 LIBS="$LIBS $GDK_PIXBUF_LIBS"
58 dnl Now check if the installed GDK_PIXBUF is sufficiently new. (Also sanity
59 dnl checks the results of gdk-pixbuf-config to some extent
61 rm -f conf.gdk_pixbuftest
66 #include <gdk-pixbuf/gdk-pixbuf.h>
75 new_str = malloc ((strlen (str) + 1) * sizeof(char));
76 strcpy (new_str, str);
86 int major, minor, micro;
89 system ("touch conf.gdk_pixbuftest");
91 /* HP/UX 9 (%@#!) writes to sscanf strings */
92 tmp_version = my_strdup("$min_gdk_pixbuf_version");
93 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
94 printf("%s, bad version string\n", "$min_gdk_pixbuf_version");
98 if (($gdk_pixbuf_major_version > major) ||
99 (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version > minor)) ||
100 (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version == minor) && ($gdk_pixbuf_micro_version >= micro)))
106 printf("\n*** 'gdk-pixbuf-config --version' returned %d.%d.%d, but the minimum version\n", $gdk_pixbuf_major_version, $gdk_pixbuf_minor_version, $gdk_pixbuf_micro_version);
107 printf("*** of GDK_PIXBUF required is %d.%d.%d. If gdk-pixbuf-config is correct, then it is\n", major, minor, micro);
108 printf("*** best to upgrade to the required version.\n");
109 printf("*** If gdk-pixbuf-config was wrong, set the environment variable GDK_PIXBUF_CONFIG\n");
110 printf("*** to point to the correct copy of gdk-pixbuf-config, and remove the file\n");
111 printf("*** config.cache before re-running configure\n");
116 ],, no_gdk_pixbuf=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
117 CFLAGS="$ac_save_CFLAGS"
121 if test "x$no_gdk_pixbuf" = x ; then
123 ifelse([$2], , :, [$2])
126 if test "$GDK_PIXBUF_CONFIG" = "no" ; then
127 echo "*** The gdk-pixbuf-config script installed by GDK_PIXBUF could not be found"
128 echo "*** If GDK_PIXBUF was installed in PREFIX, make sure PREFIX/bin is in"
129 echo "*** your path, or set the GDK_PIXBUF_CONFIG environment variable to the"
130 echo "*** full path to gdk-pixbuf-config."
132 if test -f conf.gdk_pixbuftest ; then
135 echo "*** Could not run GDK_PIXBUF test program, checking why..."
136 CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
137 LIBS="$LIBS $GDK_PIXBUF_LIBS"
140 #include <gdk-pixbuf/gdk-pixbuf.h>
142 [ echo "*** The test program compiled, but did not run. This usually means"
143 echo "*** that the run-time linker is not finding GDK_PIXBUF or finding the wrong"
144 echo "*** version of GDK_PIXBUF. If it is not finding GDK_PIXBUF, you'll need to set your"
145 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
146 echo "*** to the installed location Also, make sure you have run ldconfig if that"
147 echo "*** is required on your system"
149 echo "*** If you have an old version installed, it is best to remove it, although"
150 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
151 [ echo "*** The test program failed to compile or link. See the file config.log for the"
152 echo "*** exact error that occured. This usually means GDK_PIXBUF was incorrectly installed"
153 echo "*** or that you have moved GDK_PIXBUF since it was installed. In the latter case, you"
154 echo "*** may want to edit the gdk-pixbuf-config script: $GDK_PIXBUF_CONFIG" ])
155 CFLAGS="$ac_save_CFLAGS"
161 ifelse([$3], , :, [$3])
163 AC_SUBST(GDK_PIXBUF_CFLAGS)
164 AC_SUBST(GDK_PIXBUF_LIBS)
165 rm -f conf.gdk_pixbuftest