1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 # Configure paths for GTK+
16 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
17 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS. Uses variables
18 dnl gtk_config_prefix and/or gtk_config_exec_prefix if defined.
21 if test x$gtk_config_exec_prefix != x ; then
22 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
23 if test x${GTK_CONFIG+set} != xset ; then
24 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
27 if test x$gtk_config_prefix != x ; then
28 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
29 if test x${GTK_CONFIG+set} != xset ; then
30 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
34 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
35 min_gtk_version=ifelse([$1], ,0.99.7,$1)
36 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
38 if test "$GTK_CONFIG" != "no" ; then
39 GTK_CFLAGS=`$GTK_CONFIG --cflags`
40 GTK_LIBS=`$GTK_CONFIG --libs gthread`
41 ac_save_CFLAGS="$CFLAGS"
43 CFLAGS="$CFLAGS $GTK_CFLAGS"
44 LIBS="$LIBS $GTK_LIBS"
46 dnl Now check if the installed GTK is sufficiently new. (Also sanity
47 dnl checks the results of gtk-config to some extent)
51 #include <gtk/gtkfeatures.h>
58 int major, minor, micro;
60 if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) {
61 printf("%s, bad version string\n", "$min_gtk_version");
65 if ((GTK_MAJOR_VERSION != gtk_major_version) ||
66 (GTK_MINOR_VERSION != gtk_minor_version) ||
67 (GTK_MICRO_VERSION != gtk_micro_version)) {
68 printf("Headers vs. library version mismatch!\n");
72 if (gtk_minor_version == 1) return FALSE;
74 return !((gtk_major_version > major) ||
75 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
76 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
78 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
79 CFLAGS="$ac_save_CFLAGS"
84 if test "x$no_gtk" = x ; then
86 ifelse([$2], , :, [$2])
91 ifelse([$3], , :, [$3])
97 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
98 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
100 AC_DEFUN(AM_PATH_GTK_2_0,
102 dnl Get the cflags and libraries from the gtk-config-2.0 script
104 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
105 gtk_config_prefix="$withval", gtk_config_prefix="")
106 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
107 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
108 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
109 , enable_gtktest=yes)
115 gtk_config_args="$gtk_config_args gthread"
120 if test x$gtk_config_exec_prefix != x ; then
121 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
122 if test x${GTK_CONFIG_2_0+set} != xset ; then
123 GTK_CONFIG_2_0=$gtk_config_exec_prefix/bin/gtk-config-2.0
126 if test x$gtk_config_prefix != x ; then
127 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
128 if test x${GTK_CONFIG_2_0+set} != xset ; then
129 GTK_CONFIG_2_0=$gtk_config_prefix/bin/gtk-config-2.0
133 AC_PATH_PROG(GTK_CONFIG_2_0, gtk-config-2.0, no)
134 min_gtk_version=ifelse([$1], ,1.3.1,$1)
135 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
137 if test "$GTK_CONFIG_2_0" = "no" ; then
140 GTK_CFLAGS=`$GTK_CONFIG_2_0 $gtk_config_args --cflags`
141 GTK_LIBS=`$GTK_CONFIG_2_0 $gtk_config_args --libs`
142 gtk_config_major_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
143 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
144 gtk_config_minor_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
145 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
146 gtk_config_micro_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
147 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
148 if test "x$enable_gtktest" = "xyes" ; then
149 ac_save_CFLAGS="$CFLAGS"
151 CFLAGS="$CFLAGS $GTK_CFLAGS"
152 LIBS="$GTK_LIBS $LIBS"
154 dnl Now check if the installed GTK is sufficiently new. (Also sanity
155 dnl checks the results of gtk-config-2.0 to some extent
166 int major, minor, micro;
169 system ("touch conf.gtktest");
171 /* HP/UX 9 (%@#!) writes to sscanf strings */
172 tmp_version = g_strdup("$min_gtk_version");
173 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
174 printf("%s, bad version string\n", "$min_gtk_version");
178 if ((gtk_major_version != $gtk_config_major_version) ||
179 (gtk_minor_version != $gtk_config_minor_version) ||
180 (gtk_micro_version != $gtk_config_micro_version))
182 printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
183 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
184 gtk_major_version, gtk_minor_version, gtk_micro_version);
185 printf ("*** was found! If gtk-config-2.0 was correct, then it is best\n");
186 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
187 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
188 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
189 printf("*** required on your system.\n");
190 printf("*** If gtk-config-2.0 was wrong, set the environment variable GTK_CONFIG_2_0\n");
191 printf("*** to point to the correct copy of gtk-config-2.0, and remove the file config.cache\n");
192 printf("*** before re-running configure\n");
194 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
195 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
196 (gtk_minor_version != GTK_MINOR_VERSION) ||
197 (gtk_micro_version != GTK_MICRO_VERSION))
199 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
200 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
201 printf("*** library (version %d.%d.%d)\n",
202 gtk_major_version, gtk_minor_version, gtk_micro_version);
204 #endif /* defined (GTK_MAJOR_VERSION) ... */
207 if ((gtk_major_version > major) ||
208 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
209 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
215 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
216 gtk_major_version, gtk_minor_version, gtk_micro_version);
217 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
218 major, minor, micro);
219 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
221 printf("*** If you have already installed a sufficiently new version, this error\n");
222 printf("*** probably means that the wrong copy of the gtk-config-2.0 shell script is\n");
223 printf("*** being found. The easiest way to fix this is to remove the old version\n");
224 printf("*** of GTK+, but you can also set the GTK_CONFIG_2_0 environment to point to the\n");
225 printf("*** correct copy of gtk-config-2.0. (In this case, you will have to\n");
226 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
227 printf("*** so that the correct libraries are found at run-time))\n");
232 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
233 CFLAGS="$ac_save_CFLAGS"
237 if test "x$no_gtk" = x ; then
238 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
239 ifelse([$2], , :, [$2])
242 if test "$GTK_CONFIG_2_0" = "no" ; then
243 echo "*** The gtk-config-2.0 script installed by GTK could not be found"
244 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
245 echo "*** your path, or set the GTK_CONFIG_2_0 environment variable to the"
246 echo "*** full path to gtk-config-2.0."
248 if test -f conf.gtktest ; then
251 echo "*** Could not run GTK test program, checking why..."
252 CFLAGS="$CFLAGS $GTK_CFLAGS"
253 LIBS="$LIBS $GTK_LIBS"
257 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
258 [ echo "*** The test program compiled, but did not run. This usually means"
259 echo "*** that the run-time linker is not finding GTK or finding the wrong"
260 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
261 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
262 echo "*** to the installed location Also, make sure you have run ldconfig if that"
263 echo "*** is required on your system"
265 echo "*** If you have an old version installed, it is best to remove it, although"
266 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
268 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
269 echo "*** came with the system with the command"
271 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
272 [ echo "*** The test program failed to compile or link. See the file config.log for the"
273 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
274 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
275 echo "*** may want to edit the gtk-config-2.0 script: $GTK_CONFIG_2_0" ])
276 CFLAGS="$ac_save_CFLAGS"
282 ifelse([$3], , :, [$3])