]>
Commit | Line | Data |
---|---|---|
1 | dnl --------------------------------------------------------------------------- | |
2 | dnl | |
3 | dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker, | |
4 | dnl Vadim Zeitlin and Ron Lee | |
5 | dnl | |
6 | dnl This script is under the wxWindows licence. | |
7 | dnl | |
8 | dnl Version: $Id$ | |
9 | dnl --------------------------------------------------------------------------- | |
10 | ||
11 | dnl =========================================================================== | |
12 | dnl macros to find the a file in the list of include/lib paths | |
13 | dnl =========================================================================== | |
14 | ||
15 | dnl --------------------------------------------------------------------------- | |
16 | dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes | |
17 | dnl to the full name of the file that was found or leaves it empty if not found | |
18 | dnl --------------------------------------------------------------------------- | |
19 | AC_DEFUN([WX_PATH_FIND_INCLUDES], | |
20 | [ | |
21 | ac_find_includes= | |
22 | for ac_dir in $1; | |
23 | do | |
24 | if test -f "$ac_dir/$2"; then | |
25 | ac_find_includes=$ac_dir | |
26 | break | |
27 | fi | |
28 | done | |
29 | ]) | |
30 | ||
31 | dnl --------------------------------------------------------------------------- | |
32 | dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries | |
33 | dnl to the full name of the file that was found or leaves it empty if not found | |
34 | dnl --------------------------------------------------------------------------- | |
35 | AC_DEFUN([WX_PATH_FIND_LIBRARIES], | |
36 | [ | |
37 | ac_find_libraries= | |
38 | for ac_dir in $1; | |
39 | do | |
40 | for ac_extension in a so sl dylib; do | |
41 | if test -f "$ac_dir/lib$2.$ac_extension"; then | |
42 | ac_find_libraries=$ac_dir | |
43 | break 2 | |
44 | fi | |
45 | done | |
46 | done | |
47 | ]) | |
48 | ||
49 | dnl --------------------------------------------------------------------------- | |
50 | dnl Path to include, already defined | |
51 | dnl --------------------------------------------------------------------------- | |
52 | AC_DEFUN([WX_INCLUDE_PATH_EXIST], | |
53 | [ | |
54 | ac_path_to_include=$1 | |
55 | echo "$2" | grep "\-I$1" > /dev/null | |
56 | result=$? | |
57 | if test $result = 0; then | |
58 | ac_path_to_include="" | |
59 | else | |
60 | ac_path_to_include=" -I$1" | |
61 | fi | |
62 | ]) | |
63 | ||
64 | dnl --------------------------------------------------------------------------- | |
65 | dnl Path to link, already defined | |
66 | dnl --------------------------------------------------------------------------- | |
67 | AC_DEFUN([WX_LINK_PATH_EXIST], | |
68 | [ | |
69 | echo "$2" | grep "\-L$1" > /dev/null | |
70 | result=$? | |
71 | if test $result = 0; then | |
72 | ac_path_to_link="" | |
73 | else | |
74 | ac_path_to_link=" -L$1" | |
75 | fi | |
76 | ]) | |
77 | ||
78 | dnl =========================================================================== | |
79 | dnl C++ features test | |
80 | dnl =========================================================================== | |
81 | ||
82 | dnl --------------------------------------------------------------------------- | |
83 | dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header | |
84 | dnl or only the old <iostream.h> one - it may be generally assumed that if | |
85 | dnl <iostream> exists, the other "new" headers (without .h) exist too. | |
86 | dnl | |
87 | dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling) | |
88 | dnl --------------------------------------------------------------------------- | |
89 | ||
90 | AC_DEFUN([WX_CPP_NEW_HEADERS], | |
91 | [ | |
92 | if test "$cross_compiling" = "yes"; then | |
93 | ifelse([$2], , :, [$2]) | |
94 | else | |
95 | AC_LANG_SAVE | |
96 | AC_LANG_CPLUSPLUS | |
97 | ||
98 | AC_CHECK_HEADERS(iostream) | |
99 | ||
100 | if test "$ac_cv_header_iostream" = "yes" ; then | |
101 | ifelse([$1], , :, [$1]) | |
102 | else | |
103 | ifelse([$2], , :, [$2]) | |
104 | fi | |
105 | ||
106 | AC_LANG_RESTORE | |
107 | fi | |
108 | ]) | |
109 | ||
110 | dnl --------------------------------------------------------------------------- | |
111 | dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type | |
112 | dnl | |
113 | dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool | |
114 | dnl --------------------------------------------------------------------------- | |
115 | ||
116 | AC_DEFUN([WX_CPP_BOOL], | |
117 | [ | |
118 | AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool, | |
119 | [ | |
120 | AC_LANG_SAVE | |
121 | AC_LANG_CPLUSPLUS | |
122 | ||
123 | AC_TRY_COMPILE( | |
124 | [ | |
125 | ], | |
126 | [ | |
127 | bool b = true; | |
128 | ||
129 | return 0; | |
130 | ], | |
131 | [ | |
132 | wx_cv_cpp_bool=yes | |
133 | ], | |
134 | [ | |
135 | wx_cv_cpp_bool=no | |
136 | ] | |
137 | ) | |
138 | ||
139 | AC_LANG_RESTORE | |
140 | ]) | |
141 | ||
142 | if test "$wx_cv_cpp_bool" = "yes"; then | |
143 | AC_DEFINE(HAVE_BOOL) | |
144 | fi | |
145 | ]) | |
146 | ||
147 | dnl --------------------------------------------------------------------------- | |
148 | dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling | |
149 | dnl --------------------------------------------------------------------------- | |
150 | ||
151 | AC_DEFUN([WX_C_BIGENDIAN], | |
152 | [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian, | |
153 | [ac_cv_c_bigendian=unknown | |
154 | # See if sys/param.h defines the BYTE_ORDER macro. | |
155 | AC_TRY_COMPILE([#include <sys/types.h> | |
156 | #include <sys/param.h>], [ | |
157 | #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN | |
158 | bogus endian macros | |
159 | #endif], [# It does; now see whether it defined to BIG_ENDIAN or not. | |
160 | AC_TRY_COMPILE([#include <sys/types.h> | |
161 | #include <sys/param.h>], [ | |
162 | #if BYTE_ORDER != BIG_ENDIAN | |
163 | not big endian | |
164 | #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) | |
165 | if test $ac_cv_c_bigendian = unknown; then | |
166 | AC_TRY_RUN([main () { | |
167 | /* Are we little or big endian? From Harbison&Steele. */ | |
168 | union | |
169 | { | |
170 | long l; | |
171 | char c[sizeof (long)]; | |
172 | } u; | |
173 | u.l = 1; | |
174 | exit (u.c[sizeof (long) - 1] == 1); | |
175 | }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown]) | |
176 | fi]) | |
177 | if test $ac_cv_c_bigendian = unknown; then | |
178 | AC_MSG_WARN([Assuming little-endian target machine - this may be overriden by adding the line "ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}" to config.cache file]) | |
179 | fi | |
180 | if test $ac_cv_c_bigendian = yes; then | |
181 | AC_DEFINE(WORDS_BIGENDIAN) | |
182 | fi | |
183 | ]) | |
184 | ||
185 | dnl --------------------------------------------------------------------------- | |
186 | dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file | |
187 | dnl --------------------------------------------------------------------------- | |
188 | ||
189 | AC_DEFUN([WX_ARG_CACHE_INIT], | |
190 | [ | |
191 | wx_arg_cache_file="configarg.cache" | |
192 | echo "loading argument cache $wx_arg_cache_file" | |
193 | rm -f ${wx_arg_cache_file}.tmp | |
194 | touch ${wx_arg_cache_file}.tmp | |
195 | touch ${wx_arg_cache_file} | |
196 | ]) | |
197 | ||
198 | AC_DEFUN([WX_ARG_CACHE_FLUSH], | |
199 | [ | |
200 | echo "saving argument cache $wx_arg_cache_file" | |
201 | mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file} | |
202 | ]) | |
203 | ||
204 | dnl this macro checks for a three-valued command line --with argument: | |
205 | dnl possible arguments are 'yes', 'no', 'sys', or 'builtin' | |
206 | dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name) | |
207 | AC_DEFUN([WX_ARG_SYS_WITH], | |
208 | [ | |
209 | AC_MSG_CHECKING([for --with-$1]) | |
210 | no_cache=0 | |
211 | AC_ARG_WITH($1, [$2], | |
212 | [ | |
213 | if test "$withval" = yes; then | |
214 | ac_cv_use_$1='$3=yes' | |
215 | elif test "$withval" = no; then | |
216 | ac_cv_use_$1='$3=no' | |
217 | elif test "$withval" = sys; then | |
218 | ac_cv_use_$1='$3=sys' | |
219 | elif test "$withval" = builtin; then | |
220 | ac_cv_use_$1='$3=builtin' | |
221 | else | |
222 | AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) | |
223 | fi | |
224 | ], | |
225 | [ | |
226 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
227 | if test "x$LINE" != x ; then | |
228 | eval "DEFAULT_$LINE" | |
229 | else | |
230 | no_cache=1 | |
231 | fi | |
232 | ||
233 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
234 | ]) | |
235 | ||
236 | eval "$ac_cv_use_$1" | |
237 | if test "$no_cache" != 1; then | |
238 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
239 | fi | |
240 | ||
241 | if test "$$3" = yes; then | |
242 | AC_MSG_RESULT(yes) | |
243 | elif test "$$3" = no; then | |
244 | AC_MSG_RESULT(no) | |
245 | elif test "$$3" = sys; then | |
246 | AC_MSG_RESULT([system version]) | |
247 | elif test "$$3" = builtin; then | |
248 | AC_MSG_RESULT([builtin version]) | |
249 | else | |
250 | AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) | |
251 | fi | |
252 | ]) | |
253 | ||
254 | dnl this macro checks for a command line argument and caches the result | |
255 | dnl usage: WX_ARG_WITH(option, helpmessage, variable-name) | |
256 | AC_DEFUN([WX_ARG_WITH], | |
257 | [ | |
258 | AC_MSG_CHECKING([for --with-$1]) | |
259 | no_cache=0 | |
260 | AC_ARG_WITH($1, [$2], | |
261 | [ | |
262 | if test "$withval" = yes; then | |
263 | ac_cv_use_$1='$3=yes' | |
264 | else | |
265 | ac_cv_use_$1='$3=no' | |
266 | fi | |
267 | ], | |
268 | [ | |
269 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
270 | if test "x$LINE" != x ; then | |
271 | eval "DEFAULT_$LINE" | |
272 | else | |
273 | no_cache=1 | |
274 | fi | |
275 | ||
276 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
277 | ]) | |
278 | ||
279 | eval "$ac_cv_use_$1" | |
280 | if test "$no_cache" != 1; then | |
281 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
282 | fi | |
283 | ||
284 | if test "$$3" = yes; then | |
285 | AC_MSG_RESULT(yes) | |
286 | else | |
287 | AC_MSG_RESULT(no) | |
288 | fi | |
289 | ]) | |
290 | ||
291 | dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH | |
292 | dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name) | |
293 | AC_DEFUN([WX_ARG_ENABLE], | |
294 | [ | |
295 | AC_MSG_CHECKING([for --enable-$1]) | |
296 | no_cache=0 | |
297 | AC_ARG_ENABLE($1, [$2], | |
298 | [ | |
299 | if test "$enableval" = yes; then | |
300 | ac_cv_use_$1='$3=yes' | |
301 | else | |
302 | ac_cv_use_$1='$3=no' | |
303 | fi | |
304 | ], | |
305 | [ | |
306 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
307 | if test "x$LINE" != x ; then | |
308 | eval "DEFAULT_$LINE" | |
309 | else | |
310 | no_cache=1 | |
311 | fi | |
312 | ||
313 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
314 | ]) | |
315 | ||
316 | eval "$ac_cv_use_$1" | |
317 | if test "$no_cache" != 1; then | |
318 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
319 | fi | |
320 | ||
321 | if test "$$3" = yes; then | |
322 | AC_MSG_RESULT(yes) | |
323 | else | |
324 | AC_MSG_RESULT(no) | |
325 | fi | |
326 | ]) | |
327 | ||
328 | ||
329 | ||
330 | dnl =========================================================================== | |
331 | dnl "3rd party" macros included here because they are not widely available | |
332 | dnl =========================================================================== | |
333 | ||
334 | ||
335 | dnl --------------------------------------------------------------------------- | |
336 | dnl test for availability of iconv() | |
337 | dnl --------------------------------------------------------------------------- | |
338 | ||
339 | dnl From Bruno Haible. | |
340 | ||
341 | AC_DEFUN([AM_ICONV], | |
342 | [ | |
343 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and | |
344 | dnl those with the standalone portable GNU libiconv installed). | |
345 | ||
346 | AC_ARG_WITH([libiconv-prefix], | |
347 | [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ | |
348 | for dir in `echo "$withval" | tr : ' '`; do | |
349 | if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi | |
350 | if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi | |
351 | done | |
352 | ]) | |
353 | ||
354 | AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ | |
355 | am_cv_func_iconv="no, consider installing GNU libiconv" | |
356 | am_cv_lib_iconv=no | |
357 | AC_TRY_LINK([#include <stdlib.h> | |
358 | #include <iconv.h>], | |
359 | [iconv_t cd = iconv_open("",""); | |
360 | iconv(cd,NULL,NULL,NULL,NULL); | |
361 | iconv_close(cd);], | |
362 | am_cv_func_iconv=yes) | |
363 | if test "$am_cv_func_iconv" != yes; then | |
364 | am_save_LIBS="$LIBS" | |
365 | LIBS="$LIBS -liconv" | |
366 | AC_TRY_LINK([#include <stdlib.h> | |
367 | #include <iconv.h>], | |
368 | [iconv_t cd = iconv_open("",""); | |
369 | iconv(cd,NULL,NULL,NULL,NULL); | |
370 | iconv_close(cd);], | |
371 | am_cv_lib_iconv=yes | |
372 | am_cv_func_iconv=yes) | |
373 | LIBS="$am_save_LIBS" | |
374 | fi | |
375 | ]) | |
376 | if test "$am_cv_func_iconv" = yes; then | |
377 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | |
378 | AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const, | |
379 | AC_TRY_COMPILE([ | |
380 | #include <stdlib.h> | |
381 | #include <iconv.h> | |
382 | extern | |
383 | #ifdef __cplusplus | |
384 | "C" | |
385 | #endif | |
386 | #if defined(__STDC__) || defined(__cplusplus) | |
387 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | |
388 | #else | |
389 | size_t iconv(); | |
390 | #endif | |
391 | ], | |
392 | [], | |
393 | wx_cv_func_iconv_const="no", | |
394 | wx_cv_func_iconv_const="yes" | |
395 | ) | |
396 | ) | |
397 | ||
398 | iconv_const= | |
399 | if test "x$wx_cv_func_iconv_const" = "xyes"; then | |
400 | iconv_const="const" | |
401 | fi | |
402 | ||
403 | AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const, | |
404 | [Define as const if the declaration of iconv() needs const.]) | |
405 | fi | |
406 | LIBICONV= | |
407 | if test "$am_cv_lib_iconv" = yes; then | |
408 | LIBICONV="-liconv" | |
409 | fi | |
410 | AC_SUBST(LIBICONV) | |
411 | ]) | |
412 | ||
413 | ||
414 | dnl --------------------------------------------------------------------------- | |
415 | dnl test for GTK+ 2.0 | |
416 | dnl --------------------------------------------------------------------------- | |
417 | ||
418 | dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | |
419 | dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS | |
420 | dnl | |
421 | AC_DEFUN(AM_PATH_GTK_2_0, | |
422 | [dnl | |
423 | dnl Get the cflags and libraries from the gtk-config-2.0 script | |
424 | dnl | |
425 | AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], | |
426 | gtk_config_prefix="$withval", gtk_config_prefix="") | |
427 | AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], | |
428 | gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") | |
429 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], | |
430 | , enable_gtktest=yes) | |
431 | ||
432 | for module in . $4 | |
433 | do | |
434 | case "$module" in | |
435 | gthread) | |
436 | gtk_config_args="$gtk_config_args gthread" | |
437 | ;; | |
438 | esac | |
439 | done | |
440 | ||
441 | if test x$gtk_config_exec_prefix != x ; then | |
442 | gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" | |
443 | if test x${GTK_CONFIG_2_0+set} != xset ; then | |
444 | GTK_CONFIG_2_0=$gtk_config_exec_prefix/bin/gtk-config-2.0 | |
445 | fi | |
446 | fi | |
447 | if test x$gtk_config_prefix != x ; then | |
448 | gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" | |
449 | if test x${GTK_CONFIG_2_0+set} != xset ; then | |
450 | GTK_CONFIG_2_0=$gtk_config_prefix/bin/gtk-config-2.0 | |
451 | fi | |
452 | fi | |
453 | ||
454 | AC_PATH_PROG(GTK_CONFIG_2_0, gtk-config-2.0, no) | |
455 | min_gtk_version=ifelse([$1], ,1.3.1,$1) | |
456 | AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) | |
457 | no_gtk="" | |
458 | if test "$GTK_CONFIG_2_0" = "no" ; then | |
459 | no_gtk=yes | |
460 | else | |
461 | GTK_CFLAGS=`$GTK_CONFIG_2_0 $gtk_config_args --cflags` | |
462 | GTK_LIBS=`$GTK_CONFIG_2_0 $gtk_config_args --libs` | |
463 | gtk_config_major_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \ | |
464 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
465 | gtk_config_minor_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \ | |
466 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
467 | gtk_config_micro_version=`$GTK_CONFIG_2_0 $gtk_config_args --version | \ | |
468 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
469 | if test "x$enable_gtktest" = "xyes" ; then | |
470 | ac_save_CFLAGS="$CFLAGS" | |
471 | ac_save_LIBS="$LIBS" | |
472 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
473 | LIBS="$GTK_LIBS $LIBS" | |
474 | dnl | |
475 | dnl Now check if the installed GTK is sufficiently new. (Also sanity | |
476 | dnl checks the results of gtk-config-2.0 to some extent | |
477 | dnl | |
478 | rm -f conf.gtktest | |
479 | AC_TRY_RUN([ | |
480 | #include <gtk/gtk.h> | |
481 | #include <stdio.h> | |
482 | #include <stdlib.h> | |
483 | ||
484 | int | |
485 | main () | |
486 | { | |
487 | int major, minor, micro; | |
488 | char *tmp_version; | |
489 | ||
490 | system ("touch conf.gtktest"); | |
491 | ||
492 | /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
493 | tmp_version = g_strdup("$min_gtk_version"); | |
494 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
495 | printf("%s, bad version string\n", "$min_gtk_version"); | |
496 | exit(1); | |
497 | } | |
498 | ||
499 | if ((gtk_major_version != $gtk_config_major_version) || | |
500 | (gtk_minor_version != $gtk_config_minor_version) || | |
501 | (gtk_micro_version != $gtk_config_micro_version)) | |
502 | { | |
503 | printf("\n*** 'gtk-config-2.0 --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
504 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
505 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
506 | printf ("*** was found! If gtk-config-2.0 was correct, then it is best\n"); | |
507 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
508 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
509 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
510 | printf("*** required on your system.\n"); | |
511 | printf("*** If gtk-config-2.0 was wrong, set the environment variable GTK_CONFIG_2_0\n"); | |
512 | printf("*** to point to the correct copy of gtk-config-2.0, and remove the file config.cache\n"); | |
513 | printf("*** before re-running configure\n"); | |
514 | } | |
515 | #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) | |
516 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
517 | (gtk_minor_version != GTK_MINOR_VERSION) || | |
518 | (gtk_micro_version != GTK_MICRO_VERSION)) | |
519 | { | |
520 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
521 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
522 | printf("*** library (version %d.%d.%d)\n", | |
523 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
524 | } | |
525 | #endif /* defined (GTK_MAJOR_VERSION) ... */ | |
526 | else | |
527 | { | |
528 | if ((gtk_major_version > major) || | |
529 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
530 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
531 | { | |
532 | return 0; | |
533 | } | |
534 | else | |
535 | { | |
536 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
537 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
538 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
539 | major, minor, micro); | |
540 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
541 | printf("***\n"); | |
542 | printf("*** If you have already installed a sufficiently new version, this error\n"); | |
543 | printf("*** probably means that the wrong copy of the gtk-config-2.0 shell script is\n"); | |
544 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
545 | printf("*** of GTK+, but you can also set the GTK_CONFIG_2_0 environment to point to the\n"); | |
546 | printf("*** correct copy of gtk-config-2.0. (In this case, you will have to\n"); | |
547 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
548 | printf("*** so that the correct libraries are found at run-time))\n"); | |
549 | } | |
550 | } | |
551 | return 1; | |
552 | } | |
553 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
554 | CFLAGS="$ac_save_CFLAGS" | |
555 | LIBS="$ac_save_LIBS" | |
556 | fi | |
557 | fi | |
558 | if test "x$no_gtk" = x ; then | |
559 | AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) | |
560 | ifelse([$2], , :, [$2]) | |
561 | else | |
562 | AC_MSG_RESULT(no) | |
563 | if test "$GTK_CONFIG_2_0" = "no" ; then | |
564 | echo "*** The gtk-config-2.0 script installed by GTK could not be found" | |
565 | echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" | |
566 | echo "*** your path, or set the GTK_CONFIG_2_0 environment variable to the" | |
567 | echo "*** full path to gtk-config-2.0." | |
568 | else | |
569 | if test -f conf.gtktest ; then | |
570 | : | |
571 | else | |
572 | echo "*** Could not run GTK test program, checking why..." | |
573 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
574 | LIBS="$LIBS $GTK_LIBS" | |
575 | AC_TRY_LINK([ | |
576 | #include <gtk/gtk.h> | |
577 | #include <stdio.h> | |
578 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
579 | [ echo "*** The test program compiled, but did not run. This usually means" | |
580 | echo "*** that the run-time linker is not finding GTK or finding the wrong" | |
581 | echo "*** version of GTK. If it is not finding GTK, you'll need to set your" | |
582 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
583 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
584 | echo "*** is required on your system" | |
585 | echo "***" | |
586 | echo "*** If you have an old version installed, it is best to remove it, although" | |
587 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" | |
588 | echo "***" | |
589 | echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" | |
590 | echo "*** came with the system with the command" | |
591 | echo "***" | |
592 | echo "*** rpm --erase --nodeps gtk gtk-devel" ], | |
593 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
594 | echo "*** exact error that occured. This usually means GTK was incorrectly installed" | |
595 | echo "*** or that you have moved GTK since it was installed. In the latter case, you" | |
596 | echo "*** may want to edit the gtk-config-2.0 script: $GTK_CONFIG_2_0" ]) | |
597 | CFLAGS="$ac_save_CFLAGS" | |
598 | LIBS="$ac_save_LIBS" | |
599 | fi | |
600 | fi | |
601 | GTK_CFLAGS="" | |
602 | GTK_LIBS="" | |
603 | ifelse([$3], , :, [$3]) | |
604 | fi | |
605 | AC_SUBST(GTK_CFLAGS) | |
606 | AC_SUBST(GTK_LIBS) | |
607 | rm -f conf.gtktest | |
608 | ]) |