]> git.saurik.com Git - wxWidgets.git/blame - aclocal.m4
Tools
[wxWidgets.git] / aclocal.m4
CommitLineData
8168de4c
VZ
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
3f345b47
VZ
13dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
14dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
15dnl
8168de4c 16AC_DEFUN(AM_PATH_GTK,
3f345b47
VZ
17[dnl
18dnl Get the cflags and libraries from the gtk-config script
19dnl
20AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
21 gtk_config_prefix="$withval", gtk_config_prefix="")
22AC_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="")
24AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
25 , enable_gtktest=yes)
26
27 for module in . $4
28 do
29 case "$module" in
30 gthread)
31 gtk_config_args="$gtk_config_args gthread"
32 ;;
33 esac
34 done
35
8168de4c
VZ
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
40 fi
41 fi
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
46 fi
47 fi
48
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)
52 no_gtk=""
3f345b47
VZ
53 if test "$GTK_CONFIG" = "no" ; then
54 no_gtk=yes
55 else
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"
66 ac_save_LIBS="$LIBS"
67 CFLAGS="$CFLAGS $GTK_CFLAGS"
68 LIBS="$GTK_LIBS $LIBS"
8168de4c
VZ
69dnl
70dnl Now check if the installed GTK is sufficiently new. (Also sanity
3f345b47 71dnl checks the results of gtk-config to some extent
8168de4c 72dnl
3f345b47
VZ
73 rm -f conf.gtktest
74 AC_TRY_RUN([
8168de4c 75#include <gtk/gtk.h>
8168de4c
VZ
76#include <stdio.h>
77#include <stdlib.h>
78
3f345b47 79int
8168de4c
VZ
80main ()
81{
82 int major, minor, micro;
3f345b47 83 char *tmp_version;
8168de4c 84
3f345b47 85 system ("touch conf.gtktest");
8168de4c 86
3f345b47
VZ
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, &micro) != 3) {
90 printf("%s, bad version string\n", "$min_gtk_version");
8168de4c
VZ
91 exit(1);
92 }
93
3f345b47
VZ
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))
97 {
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");
109 }
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))
114 {
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);
119 }
120#endif /* defined (GTK_MAJOR_VERSION) ... */
121 else
122 {
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)))
126 {
127 return 0;
128 }
129 else
130 {
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");
136 printf("***\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");
144 }
145 }
146 return 1;
8168de4c
VZ
147}
148],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
3f345b47
VZ
149 CFLAGS="$ac_save_CFLAGS"
150 LIBS="$ac_save_LIBS"
151 fi
8168de4c
VZ
152 fi
153 if test "x$no_gtk" = x ; then
154 AC_MSG_RESULT(yes)
3f345b47 155 ifelse([$2], , :, [$2])
8168de4c
VZ
156 else
157 AC_MSG_RESULT(no)
3f345b47
VZ
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."
163 else
164 if test -f conf.gtktest ; then
165 :
166 else
167 echo "*** Could not run GTK test program, checking why..."
168 CFLAGS="$CFLAGS $GTK_CFLAGS"
169 LIBS="$LIBS $GTK_LIBS"
170 AC_TRY_LINK([
171#include <gtk/gtk.h>
172#include <stdio.h>
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"
180 echo "***"
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"
183 echo "***"
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"
186 echo "***"
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"
193 LIBS="$ac_save_LIBS"
194 fi
195 fi
8168de4c
VZ
196 GTK_CFLAGS=""
197 GTK_LIBS=""
198 ifelse([$3], , :, [$3])
199 fi
200 AC_SUBST(GTK_CFLAGS)
201 AC_SUBST(GTK_LIBS)
3f345b47 202 rm -f conf.gtktest
8168de4c
VZ
203])
204
ecc7ceee
OK
205dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
206dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
207dnl
208AC_DEFUN(AM_PATH_GTK_2_0,
8168de4c 209[dnl
ecc7ceee
OK
210dnl Get the cflags and libraries from the gtk-config-2.0 script
211dnl
212AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
213 gtk_config_prefix="$withval", gtk_config_prefix="")
214AC_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="")
216AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
8168de4c 217 , enable_gtktest=yes)
ecc7ceee
OK
218
219 for module in . $4
220 do
221 case "$module" in
8168de4c 222 gthread)
ecc7ceee
OK
223 gtk_config_args="$gtk_config_args gthread"
224 ;;
225 esac
226 done
227
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
232 fi
233 fi
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
238 fi
239 fi
240
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)
244 no_gtk=""
245 if test "$GTK_CONFIG_2_0" = "no" ; then
246 no_gtk=yes
247 else
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"
258 ac_save_LIBS="$LIBS"
259 CFLAGS="$CFLAGS $GTK_CFLAGS"
260 LIBS="$GTK_LIBS $LIBS"
261dnl
262dnl Now check if the installed GTK is sufficiently new. (Also sanity
263dnl checks the results of gtk-config-2.0 to some extent
264dnl
265 rm -f conf.gtktest
266 AC_TRY_RUN([
267#include <gtk/gtk.h>
268#include <stdio.h>
269#include <stdlib.h>
270
8168de4c 271int
ecc7ceee
OK
272main ()
273{
274 int major, minor, micro;
275 char *tmp_version;
276
277 system ("touch conf.gtktest");
278
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, &micro) != 3) {
282 printf("%s, bad version string\n", "$min_gtk_version");
283 exit(1);
284 }
285
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))
289 {
8168de4c 290 printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
ecc7ceee
OK
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");
8168de4c 301 }
ecc7ceee
OK
302#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
303 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
8168de4c 304 (gtk_minor_version != GTK_MINOR_VERSION) ||
ecc7ceee
OK
305 (gtk_micro_version != GTK_MICRO_VERSION))
306 {
307 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
8168de4c 308 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
ecc7ceee 309 printf("*** library (version %d.%d.%d)\n",
8168de4c 310 gtk_major_version, gtk_minor_version, gtk_micro_version);
ecc7ceee
OK
311 }
312#endif /* defined (GTK_MAJOR_VERSION) ... */
313 else
314 {
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)))
318 {
319 return 0;
320 }
321 else
322 {
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",
8168de4c 326 major, minor, micro);
ecc7ceee
OK
327 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
328 printf("***\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");
336 }
337 }
338 return 1;
339}
340],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
341 CFLAGS="$ac_save_CFLAGS"
342 LIBS="$ac_save_LIBS"
343 fi
344 fi
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))
8168de4c 347 ifelse([$2], , :, [$2])
ecc7ceee
OK
348 else
349 AC_MSG_RESULT(no)
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."
355 else
356 if test -f conf.gtktest ; then
357 :
358 else
359 echo "*** Could not run GTK test program, checking why..."
360 CFLAGS="$CFLAGS $GTK_CFLAGS"
361 LIBS="$LIBS $GTK_LIBS"
362 AC_TRY_LINK([
363#include <gtk/gtk.h>
364#include <stdio.h>
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"
8168de4c 372 echo "***"
ecc7ceee
OK
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"
375 echo "***"
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"
378 echo "***"
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"
385 LIBS="$ac_save_LIBS"
386 fi
387 fi
388 GTK_CFLAGS=""
389 GTK_LIBS=""
390 ifelse([$3], , :, [$3])
391 fi
392 AC_SUBST(GTK_CFLAGS)
393 AC_SUBST(GTK_LIBS)
394 rm -f conf.gtktest
395])
8168de4c
VZ
396
397