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 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
14 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
18 dnl Get the cflags and libraries from the gtk-config script
20 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
21 gtk_config_prefix="$withval", gtk_config_prefix="")
22 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
23 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
24 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
31 gtk_config_args="$gtk_config_args gthread"
36 if test x$gtk_config_exec_prefix != x ; then
37 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
38 if test x${GTK_CONFIG+set} != xset ; then
39 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
42 if test x$gtk_config_prefix != x ; then
43 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
44 if test x${GTK_CONFIG+set} != xset ; then
45 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
49 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
50 min_gtk_version=ifelse([$1], ,0.99.7,$1)
51 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
53 if test "$GTK_CONFIG" = "no" ; then
56 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
57 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
58 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
59 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
60 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
61 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
62 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
63 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
64 if test "x$enable_gtktest" = "xyes" ; then
65 ac_save_CFLAGS="$CFLAGS"
67 CFLAGS="$CFLAGS $GTK_CFLAGS"
68 LIBS="$GTK_LIBS $LIBS"
70 dnl Now check if the installed GTK is sufficiently new. (Also sanity
71 dnl checks the results of gtk-config to some extent
82 int major, minor, micro;
85 system ("touch conf.gtktest");
87 /* HP/UX 9 (%@#!) writes to sscanf strings */
88 tmp_version = g_strdup("$min_gtk_version");
89 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
90 printf("%s, bad version string\n", "$min_gtk_version");
94 if ((gtk_major_version != $gtk_config_major_version) ||
95 (gtk_minor_version != $gtk_config_minor_version) ||
96 (gtk_micro_version != $gtk_config_micro_version))
98 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
99 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
100 gtk_major_version, gtk_minor_version, gtk_micro_version);
101 printf ("*** was found! If gtk-config was correct, then it is best\n");
102 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
103 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
104 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
105 printf("*** required on your system.\n");
106 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
107 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
108 printf("*** before re-running configure\n");
110 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
111 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
112 (gtk_minor_version != GTK_MINOR_VERSION) ||
113 (gtk_micro_version != GTK_MICRO_VERSION))
115 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
116 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
117 printf("*** library (version %d.%d.%d)\n",
118 gtk_major_version, gtk_minor_version, gtk_micro_version);
120 #endif /* defined (GTK_MAJOR_VERSION) ... */
123 if ((gtk_major_version > major) ||
124 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
125 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
131 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
132 gtk_major_version, gtk_minor_version, gtk_micro_version);
133 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
134 major, minor, micro);
135 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
137 printf("*** If you have already installed a sufficiently new version, this error\n");
138 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
139 printf("*** being found. The easiest way to fix this is to remove the old version\n");
140 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
141 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
142 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
143 printf("*** so that the correct libraries are found at run-time))\n");
148 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
149 CFLAGS="$ac_save_CFLAGS"
153 if test "x$no_gtk" = x ; then
155 ifelse([$2], , :, [$2])
158 if test "$GTK_CONFIG" = "no" ; then
159 echo "*** The gtk-config script installed by GTK could not be found"
160 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
161 echo "*** your path, or set the GTK_CONFIG environment variable to the"
162 echo "*** full path to gtk-config."
164 if test -f conf.gtktest ; then
167 echo "*** Could not run GTK test program, checking why..."
168 CFLAGS="$CFLAGS $GTK_CFLAGS"
169 LIBS="$LIBS $GTK_LIBS"
173 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
174 [ echo "*** The test program compiled, but did not run. This usually means"
175 echo "*** that the run-time linker is not finding GTK or finding the wrong"
176 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
177 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
178 echo "*** to the installed location Also, make sure you have run ldconfig if that"
179 echo "*** is required on your system"
181 echo "*** If you have an old version installed, it is best to remove it, although"
182 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
184 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
185 echo "*** came with the system with the command"
187 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
188 [ echo "*** The test program failed to compile or link. See the file config.log for the"
189 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
190 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
191 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
192 CFLAGS="$ac_save_CFLAGS"
198 ifelse([$3], , :, [$3])
205 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
206 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
208 AC_DEFUN(AM_PATH_GTK_2_0,
210 dnl Get the cflags and libraries from the gtk-config-2.0 script
212 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
213 gtk_config_prefix="$withval", gtk_config_prefix="")
214 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
215 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
216 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
217 , enable_gtktest=yes)
223 gtk_config_args="$gtk_config_args gthread"
228 if test x$gtk_config_exec_prefix != x ; then
229 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
230 if test x${GTK_CONFIG_2_0+set} != xset ; then
231 GTK_CONFIG_2_0=$gtk_config_exec_prefix/bin/gtk-config-2.0
234 if test x$gtk_config_prefix != x ; then
235 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
236 if test x${GTK_CONFIG_2_0+set} != xset ; then
237 GTK_CONFIG_2_0=$gtk_config_prefix/bin/gtk-config-2.0
241 AC_PATH_PROG(GTK_CONFIG_2_0, gtk-config-2.0, no)
242 min_gtk_version=ifelse([$1], ,1.3.1,$1)
243 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
245 if test "$GTK_CONFIG_2_0" = "no" ; then
248 GTK_CFLAGS=`$GTK_CONFIG_2_0 $gtk_config_args --cflags`
249 GTK_LIBS=`$GTK_CONFIG_2_0 $gtk_config_args --libs`
250 gtk_config_major_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
251 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
252 gtk_config_minor_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
253 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
254 gtk_config_micro_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \
255 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
256 if test "x$enable_gtktest" = "xyes" ; then
257 ac_save_CFLAGS="$CFLAGS"
259 CFLAGS="$CFLAGS $GTK_CFLAGS"
260 LIBS="$GTK_LIBS $LIBS"
262 dnl Now check if the installed GTK is sufficiently new. (Also sanity
263 dnl checks the results of gtk-config-2.0 to some extent
274 int major, minor, micro;
277 system ("touch conf.gtktest");
279 /* HP/UX 9 (%@#!) writes to sscanf strings */
280 tmp_version = g_strdup("$min_gtk_version");
281 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
282 printf("%s, bad version string\n", "$min_gtk_version");
286 if ((gtk_major_version != $gtk_config_major_version) ||
287 (gtk_minor_version != $gtk_config_minor_version) ||
288 (gtk_micro_version != $gtk_config_micro_version))
290 printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
291 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
292 gtk_major_version, gtk_minor_version, gtk_micro_version);
293 printf ("*** was found! If gtk-config-2.0 was correct, then it is best\n");
294 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
295 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
296 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
297 printf("*** required on your system.\n");
298 printf("*** If gtk-config-2.0 was wrong, set the environment variable GTK_CONFIG_2_0\n");
299 printf("*** to point to the correct copy of gtk-config-2.0, and remove the file config.cache\n");
300 printf("*** before re-running configure\n");
302 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
303 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
304 (gtk_minor_version != GTK_MINOR_VERSION) ||
305 (gtk_micro_version != GTK_MICRO_VERSION))
307 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
308 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
309 printf("*** library (version %d.%d.%d)\n",
310 gtk_major_version, gtk_minor_version, gtk_micro_version);
312 #endif /* defined (GTK_MAJOR_VERSION) ... */
315 if ((gtk_major_version > major) ||
316 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
317 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
323 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
324 gtk_major_version, gtk_minor_version, gtk_micro_version);
325 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
326 major, minor, micro);
327 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
329 printf("*** If you have already installed a sufficiently new version, this error\n");
330 printf("*** probably means that the wrong copy of the gtk-config-2.0 shell script is\n");
331 printf("*** being found. The easiest way to fix this is to remove the old version\n");
332 printf("*** of GTK+, but you can also set the GTK_CONFIG_2_0 environment to point to the\n");
333 printf("*** correct copy of gtk-config-2.0. (In this case, you will have to\n");
334 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
335 printf("*** so that the correct libraries are found at run-time))\n");
340 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
341 CFLAGS="$ac_save_CFLAGS"
345 if test "x$no_gtk" = x ; then
346 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
347 ifelse([$2], , :, [$2])
350 if test "$GTK_CONFIG_2_0" = "no" ; then
351 echo "*** The gtk-config-2.0 script installed by GTK could not be found"
352 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
353 echo "*** your path, or set the GTK_CONFIG_2_0 environment variable to the"
354 echo "*** full path to gtk-config-2.0."
356 if test -f conf.gtktest ; then
359 echo "*** Could not run GTK test program, checking why..."
360 CFLAGS="$CFLAGS $GTK_CFLAGS"
361 LIBS="$LIBS $GTK_LIBS"
365 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
366 [ echo "*** The test program compiled, but did not run. This usually means"
367 echo "*** that the run-time linker is not finding GTK or finding the wrong"
368 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
369 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
370 echo "*** to the installed location Also, make sure you have run ldconfig if that"
371 echo "*** is required on your system"
373 echo "*** If you have an old version installed, it is best to remove it, although"
374 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
376 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
377 echo "*** came with the system with the command"
379 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
380 [ echo "*** The test program failed to compile or link. See the file config.log for the"
381 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
382 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
383 echo "*** may want to edit the gtk-config-2.0 script: $GTK_CONFIG_2_0" ])
384 CFLAGS="$ac_save_CFLAGS"
390 ifelse([$3], , :, [$3])