]> git.saurik.com Git - wxWidgets.git/blame - aclocal.m4
Some little additions to how wxBufferedDC is wrapped.
[wxWidgets.git] / aclocal.m4
CommitLineData
9e691f46 1# aclocal.m4 generated automatically by aclocal 1.6 -*- Autoconf -*-
8168de4c 2
9e691f46
VZ
3# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8168de4c 8
9e691f46
VZ
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
8168de4c 13
b040e242
VS
14dnl ---------------------------------------------------------------------------
15dnl
16dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker,
17dnl Vadim Zeitlin and Ron Lee
18dnl
19dnl This script is under the wxWindows licence.
20dnl
21dnl Version: $Id$
22dnl ---------------------------------------------------------------------------
23
24dnl ===========================================================================
25dnl macros to find the a file in the list of include/lib paths
26dnl ===========================================================================
27
28dnl ---------------------------------------------------------------------------
29dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
30dnl to the full name of the file that was found or leaves it empty if not found
31dnl ---------------------------------------------------------------------------
32AC_DEFUN([WX_PATH_FIND_INCLUDES],
33[
34ac_find_includes=
35for ac_dir in $1;
36 do
37 if test -f "$ac_dir/$2"; then
38 ac_find_includes=$ac_dir
39 break
40 fi
41 done
42])
43
44dnl ---------------------------------------------------------------------------
45dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
46dnl to the full name of the file that was found or leaves it empty if not found
47dnl ---------------------------------------------------------------------------
48AC_DEFUN([WX_PATH_FIND_LIBRARIES],
49[
50ac_find_libraries=
51for ac_dir in $1;
52 do
53 for ac_extension in a so sl dylib; do
54 if test -f "$ac_dir/lib$2.$ac_extension"; then
55 ac_find_libraries=$ac_dir
56 break 2
57 fi
58 done
59 done
60])
61
62dnl ---------------------------------------------------------------------------
63dnl Path to include, already defined
64dnl ---------------------------------------------------------------------------
65AC_DEFUN([WX_INCLUDE_PATH_EXIST],
66[
67 ac_path_to_include=$1
68 echo "$2" | grep "\-I$1" > /dev/null
69 result=$?
70 if test $result = 0; then
71 ac_path_to_include=""
72 else
73 ac_path_to_include=" -I$1"
74 fi
75])
76
77dnl ---------------------------------------------------------------------------
78dnl Path to link, already defined
79dnl ---------------------------------------------------------------------------
80AC_DEFUN([WX_LINK_PATH_EXIST],
81[
82 echo "$2" | grep "\-L$1" > /dev/null
83 result=$?
84 if test $result = 0; then
85 ac_path_to_link=""
86 else
87 ac_path_to_link=" -L$1"
88 fi
89])
90
91dnl ===========================================================================
92dnl C++ features test
93dnl ===========================================================================
94
95dnl ---------------------------------------------------------------------------
96dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
97dnl or only the old <iostream.h> one - it may be generally assumed that if
98dnl <iostream> exists, the other "new" headers (without .h) exist too.
99dnl
100dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling)
101dnl ---------------------------------------------------------------------------
102
103AC_DEFUN([WX_CPP_NEW_HEADERS],
104[
105 if test "$cross_compiling" = "yes"; then
106 ifelse([$2], , :, [$2])
107 else
108 AC_LANG_SAVE
109 AC_LANG_CPLUSPLUS
110
111 AC_CHECK_HEADERS(iostream)
112
113 if test "$ac_cv_header_iostream" = "yes" ; then
114 ifelse([$1], , :, [$1])
115 else
116 ifelse([$2], , :, [$2])
117 fi
118
119 AC_LANG_RESTORE
120 fi
121])
122
123dnl ---------------------------------------------------------------------------
124dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
125dnl
126dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
127dnl ---------------------------------------------------------------------------
128
129AC_DEFUN([WX_CPP_BOOL],
130[
131 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
132 [
133 AC_LANG_SAVE
134 AC_LANG_CPLUSPLUS
135
136 AC_TRY_COMPILE(
137 [
138 ],
139 [
140 bool b = true;
141
142 return 0;
143 ],
144 [
145 wx_cv_cpp_bool=yes
146 ],
147 [
148 wx_cv_cpp_bool=no
149 ]
150 )
151
152 AC_LANG_RESTORE
153 ])
154
155 if test "$wx_cv_cpp_bool" = "yes"; then
156 AC_DEFINE(HAVE_BOOL)
157 fi
158])
159
160dnl ---------------------------------------------------------------------------
161dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
162dnl ---------------------------------------------------------------------------
163
164AC_DEFUN([WX_C_BIGENDIAN],
165[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
166[ac_cv_c_bigendian=unknown
167# See if sys/param.h defines the BYTE_ORDER macro.
168AC_TRY_COMPILE([#include <sys/types.h>
169#include <sys/param.h>], [
170#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
171 bogus endian macros
172#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
173AC_TRY_COMPILE([#include <sys/types.h>
174#include <sys/param.h>], [
175#if BYTE_ORDER != BIG_ENDIAN
176 not big endian
177#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
178if test $ac_cv_c_bigendian = unknown; then
179AC_TRY_RUN([main () {
180 /* Are we little or big endian? From Harbison&Steele. */
181 union
182 {
183 long l;
184 char c[sizeof (long)];
185 } u;
186 u.l = 1;
187 exit (u.c[sizeof (long) - 1] == 1);
188}], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
189fi])
190if test $ac_cv_c_bigendian = unknown; then
191 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])
192fi
193if test $ac_cv_c_bigendian = yes; then
194 AC_DEFINE(WORDS_BIGENDIAN)
195fi
196])
197
198dnl ---------------------------------------------------------------------------
199dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
200dnl ---------------------------------------------------------------------------
201
202AC_DEFUN([WX_ARG_CACHE_INIT],
203 [
204 wx_arg_cache_file="configarg.cache"
205 echo "loading argument cache $wx_arg_cache_file"
206 rm -f ${wx_arg_cache_file}.tmp
207 touch ${wx_arg_cache_file}.tmp
208 touch ${wx_arg_cache_file}
209 ])
210
211AC_DEFUN([WX_ARG_CACHE_FLUSH],
212 [
213 echo "saving argument cache $wx_arg_cache_file"
214 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
215 ])
216
217dnl this macro checks for a three-valued command line --with argument:
218dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
219dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
220AC_DEFUN([WX_ARG_SYS_WITH],
221 [
222 AC_MSG_CHECKING([for --with-$1])
223 no_cache=0
224 AC_ARG_WITH($1, [$2],
225 [
226 if test "$withval" = yes; then
227 ac_cv_use_$1='$3=yes'
228 elif test "$withval" = no; then
229 ac_cv_use_$1='$3=no'
230 elif test "$withval" = sys; then
231 ac_cv_use_$1='$3=sys'
232 elif test "$withval" = builtin; then
233 ac_cv_use_$1='$3=builtin'
234 else
235 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
236 fi
237 ],
238 [
239 LINE=`grep "$3" ${wx_arg_cache_file}`
240 if test "x$LINE" != x ; then
241 eval "DEFAULT_$LINE"
242 else
243 no_cache=1
244 fi
245
246 ac_cv_use_$1='$3='$DEFAULT_$3
247 ])
248
249 eval "$ac_cv_use_$1"
250 if test "$no_cache" != 1; then
251 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
252 fi
253
254 if test "$$3" = yes; then
255 AC_MSG_RESULT(yes)
256 elif test "$$3" = no; then
257 AC_MSG_RESULT(no)
258 elif test "$$3" = sys; then
259 AC_MSG_RESULT([system version])
260 elif test "$$3" = builtin; then
261 AC_MSG_RESULT([builtin version])
262 else
263 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
264 fi
265 ])
266
267dnl this macro checks for a command line argument and caches the result
268dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
269AC_DEFUN([WX_ARG_WITH],
270 [
271 AC_MSG_CHECKING([for --with-$1])
272 no_cache=0
273 AC_ARG_WITH($1, [$2],
274 [
275 if test "$withval" = yes; then
276 ac_cv_use_$1='$3=yes'
277 else
278 ac_cv_use_$1='$3=no'
279 fi
280 ],
281 [
282 LINE=`grep "$3" ${wx_arg_cache_file}`
283 if test "x$LINE" != x ; then
284 eval "DEFAULT_$LINE"
285 else
286 no_cache=1
287 fi
288
289 ac_cv_use_$1='$3='$DEFAULT_$3
290 ])
291
292 eval "$ac_cv_use_$1"
293 if test "$no_cache" != 1; then
294 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
295 fi
296
297 if test "$$3" = yes; then
298 AC_MSG_RESULT(yes)
299 else
300 AC_MSG_RESULT(no)
301 fi
302 ])
303
304dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
305dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name)
306AC_DEFUN([WX_ARG_ENABLE],
307 [
308 AC_MSG_CHECKING([for --enable-$1])
309 no_cache=0
310 AC_ARG_ENABLE($1, [$2],
311 [
312 if test "$enableval" = yes; then
313 ac_cv_use_$1='$3=yes'
314 else
315 ac_cv_use_$1='$3=no'
316 fi
317 ],
318 [
319 LINE=`grep "$3" ${wx_arg_cache_file}`
320 if test "x$LINE" != x ; then
321 eval "DEFAULT_$LINE"
322 else
323 no_cache=1
324 fi
325
326 ac_cv_use_$1='$3='$DEFAULT_$3
327 ])
328
329 eval "$ac_cv_use_$1"
330 if test "$no_cache" != 1; then
331 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
332 fi
333
334 if test "$$3" = yes; then
335 AC_MSG_RESULT(yes)
336 else
337 AC_MSG_RESULT(no)
338 fi
339 ])
340
341
342
343dnl ===========================================================================
344dnl "3rd party" macros included here because they are not widely available
345dnl ===========================================================================
346
b040e242
VS
347dnl ---------------------------------------------------------------------------
348dnl test for availability of iconv()
349dnl ---------------------------------------------------------------------------
350
b040e242
VS
351dnl From Bruno Haible.
352
353AC_DEFUN([AM_ICONV],
354[
355 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
356 dnl those with the standalone portable GNU libiconv installed).
357
358 AC_ARG_WITH([libiconv-prefix],
359[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
360 for dir in `echo "$withval" | tr : ' '`; do
361 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
362 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
363 done
364 ])
365
366 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
367 am_cv_func_iconv="no, consider installing GNU libiconv"
368 am_cv_lib_iconv=no
369 AC_TRY_LINK([#include <stdlib.h>
370#include <iconv.h>],
371 [iconv_t cd = iconv_open("","");
372 iconv(cd,NULL,NULL,NULL,NULL);
373 iconv_close(cd);],
374 am_cv_func_iconv=yes)
375 if test "$am_cv_func_iconv" != yes; then
376 am_save_LIBS="$LIBS"
377 LIBS="$LIBS -liconv"
378 AC_TRY_LINK([#include <stdlib.h>
379#include <iconv.h>],
380 [iconv_t cd = iconv_open("","");
381 iconv(cd,NULL,NULL,NULL,NULL);
382 iconv_close(cd);],
383 am_cv_lib_iconv=yes
384 am_cv_func_iconv=yes)
385 LIBS="$am_save_LIBS"
386 fi
387 ])
388 if test "$am_cv_func_iconv" = yes; then
389 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
b7043674 390 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
b040e242
VS
391 AC_TRY_COMPILE([
392#include <stdlib.h>
393#include <iconv.h>
394extern
395#ifdef __cplusplus
396"C"
397#endif
398#if defined(__STDC__) || defined(__cplusplus)
399size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
400#else
401size_t iconv();
402#endif
b7043674
VZ
403 ],
404 [],
405 wx_cv_func_iconv_const="no",
406 wx_cv_func_iconv_const="yes"
407 )
408 )
409
410 iconv_const=
1c405bb5 411 if test "x$wx_cv_func_iconv_const" = "xyes"; then
b7043674
VZ
412 iconv_const="const"
413 fi
414
415 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
b040e242
VS
416 [Define as const if the declaration of iconv() needs const.])
417 fi
418 LIBICONV=
419 if test "$am_cv_lib_iconv" = yes; then
420 LIBICONV="-liconv"
421 fi
422 AC_SUBST(LIBICONV)
423])
424
425
9e691f46
VZ
426# Configure paths for GTK+
427# Owen Taylor 1997-2001
b040e242
VS
428
429dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
9e691f46
VZ
430dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
431dnl pass to pkg-config
3f345b47 432dnl
b040e242 433AC_DEFUN(AM_PATH_GTK_2_0,
9e691f46
VZ
434[dnl
435dnl Get the cflags and libraries from pkg-config
3f345b47 436dnl
9e691f46
VZ
437AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
438 , enable_gtktest=yes)
3f345b47 439
9e691f46 440 pkg_config_args=gtk+-2.0
3f345b47
VZ
441 for module in . $4
442 do
443 case "$module" in
9e691f46
VZ
444 gthread)
445 pkg_config_args="$pkg_config_args gthread-2.0"
3f345b47
VZ
446 ;;
447 esac
448 done
449
9e691f46
VZ
450 no_gtk=""
451
452 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
453
454 if test x$PKG_CONFIG != xno ; then
455 if pkg-config --atleast-pkgconfig-version 0.7 ; then
456 :
457 else
458 echo *** pkg-config too old; version 0.7 or better required.
459 no_gtk=yes
460 PKG_CONFIG=no
461 fi
462 else
463 no_gtk=yes
8168de4c 464 fi
9e691f46
VZ
465
466 min_gtk_version=ifelse([$1], ,2.0.0,$1)
467 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
468
469 if test x$PKG_CONFIG != xno ; then
470 ## don't try to run the test against uninstalled libtool libs
471 if $PKG_CONFIG --uninstalled $pkg_config_args; then
472 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
473 enable_gtktest=no
474 fi
475
476 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
477 :
478 else
479 no_gtk=yes
480 fi
8168de4c
VZ
481 fi
482
9e691f46
VZ
483 if test x"$no_gtk" = x ; then
484 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
485 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
486 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
3f345b47 487 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
9e691f46 488 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
3f345b47 489 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
9e691f46 490 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
3f345b47
VZ
491 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
492 if test "x$enable_gtktest" = "xyes" ; then
493 ac_save_CFLAGS="$CFLAGS"
494 ac_save_LIBS="$LIBS"
495 CFLAGS="$CFLAGS $GTK_CFLAGS"
496 LIBS="$GTK_LIBS $LIBS"
8168de4c 497dnl
9e691f46
VZ
498dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
499dnl checks the results of pkg-config to some extent)
8168de4c 500dnl
3f345b47
VZ
501 rm -f conf.gtktest
502 AC_TRY_RUN([
8168de4c 503#include <gtk/gtk.h>
8168de4c
VZ
504#include <stdio.h>
505#include <stdlib.h>
506
9e691f46 507int
8168de4c
VZ
508main ()
509{
510 int major, minor, micro;
3f345b47 511 char *tmp_version;
8168de4c 512
3f345b47 513 system ("touch conf.gtktest");
8168de4c 514
3f345b47
VZ
515 /* HP/UX 9 (%@#!) writes to sscanf strings */
516 tmp_version = g_strdup("$min_gtk_version");
517 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
518 printf("%s, bad version string\n", "$min_gtk_version");
8168de4c
VZ
519 exit(1);
520 }
521
3f345b47
VZ
522 if ((gtk_major_version != $gtk_config_major_version) ||
523 (gtk_minor_version != $gtk_config_minor_version) ||
524 (gtk_micro_version != $gtk_config_micro_version))
525 {
9e691f46 526 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
3f345b47
VZ
527 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
528 gtk_major_version, gtk_minor_version, gtk_micro_version);
9e691f46 529 printf ("*** was found! If pkg-config was correct, then it is best\n");
3f345b47
VZ
530 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
531 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
532 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
533 printf("*** required on your system.\n");
9e691f46
VZ
534 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
535 printf("*** to point to the correct configuration files\n");
536 }
3f345b47 537 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
9e691f46 538 (gtk_minor_version != GTK_MINOR_VERSION) ||
3f345b47
VZ
539 (gtk_micro_version != GTK_MICRO_VERSION))
540 {
541 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
9e691f46 542 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
3f345b47 543 printf("*** library (version %d.%d.%d)\n",
9e691f46 544 gtk_major_version, gtk_minor_version, gtk_micro_version);
3f345b47 545 }
3f345b47
VZ
546 else
547 {
548 if ((gtk_major_version > major) ||
549 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
550 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
551 {
552 return 0;
553 }
554 else
555 {
556 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
557 gtk_major_version, gtk_minor_version, gtk_micro_version);
558 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
9e691f46 559 major, minor, micro);
3f345b47
VZ
560 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
561 printf("***\n");
562 printf("*** If you have already installed a sufficiently new version, this error\n");
9e691f46 563 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
3f345b47 564 printf("*** being found. The easiest way to fix this is to remove the old version\n");
9e691f46
VZ
565 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
566 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
3f345b47
VZ
567 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
568 printf("*** so that the correct libraries are found at run-time))\n");
569 }
570 }
571 return 1;
8168de4c
VZ
572}
573],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
3f345b47
VZ
574 CFLAGS="$ac_save_CFLAGS"
575 LIBS="$ac_save_LIBS"
576 fi
8168de4c
VZ
577 fi
578 if test "x$no_gtk" = x ; then
b040e242 579 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
9e691f46 580 ifelse([$2], , :, [$2])
8168de4c
VZ
581 else
582 AC_MSG_RESULT(no)
9e691f46
VZ
583 if test "$PKG_CONFIG" = "no" ; then
584 echo "*** A new enough version of pkg-config was not found."
585 echo "*** See http://pkgconfig.sourceforge.net"
3f345b47
VZ
586 else
587 if test -f conf.gtktest ; then
588 :
589 else
9e691f46 590 echo "*** Could not run GTK+ test program, checking why..."
3f345b47
VZ
591 CFLAGS="$CFLAGS $GTK_CFLAGS"
592 LIBS="$LIBS $GTK_LIBS"
593 AC_TRY_LINK([
594#include <gtk/gtk.h>
595#include <stdio.h>
596], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
597 [ echo "*** The test program compiled, but did not run. This usually means"
9e691f46
VZ
598 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
599 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
3f345b47
VZ
600 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
601 echo "*** to the installed location Also, make sure you have run ldconfig if that"
602 echo "*** is required on your system"
9e691f46 603 echo "***"
3f345b47 604 echo "*** If you have an old version installed, it is best to remove it, although"
9e691f46 605 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
3f345b47 606 [ echo "*** The test program failed to compile or link. See the file config.log for the"
9e691f46
VZ
607 echo "*** exact error that occured. This usually means GTK+ was incorrectly installed"
608 echo "*** or that you have moved GTK+ since it was installed. In the latter case, you"
609 echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ])
3f345b47
VZ
610 CFLAGS="$ac_save_CFLAGS"
611 LIBS="$ac_save_LIBS"
612 fi
613 fi
8168de4c
VZ
614 GTK_CFLAGS=""
615 GTK_LIBS=""
616 ifelse([$3], , :, [$3])
617 fi
618 AC_SUBST(GTK_CFLAGS)
619 AC_SUBST(GTK_LIBS)
3f345b47 620 rm -f conf.gtktest
8168de4c
VZ
621])
622
b040e242
VS
623# Configure paths for GTK+
624# Owen Taylor 97-11-3
625
626dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
ecc7ceee
OK
627dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
628dnl
b040e242
VS
629AC_DEFUN(AM_PATH_GTK,
630[dnl
631dnl Get the cflags and libraries from the gtk-config script
ecc7ceee
OK
632dnl
633AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
634 gtk_config_prefix="$withval", gtk_config_prefix="")
635AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
636 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
637AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
b040e242 638 , enable_gtktest=yes)
ecc7ceee
OK
639
640 for module in . $4
641 do
642 case "$module" in
b040e242 643 gthread)
ecc7ceee
OK
644 gtk_config_args="$gtk_config_args gthread"
645 ;;
646 esac
647 done
648
649 if test x$gtk_config_exec_prefix != x ; then
650 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
b040e242
VS
651 if test x${GTK_CONFIG+set} != xset ; then
652 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
ecc7ceee
OK
653 fi
654 fi
655 if test x$gtk_config_prefix != x ; then
656 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
b040e242
VS
657 if test x${GTK_CONFIG+set} != xset ; then
658 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
ecc7ceee
OK
659 fi
660 fi
661
b040e242
VS
662 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
663 min_gtk_version=ifelse([$1], ,0.99.7,$1)
ecc7ceee
OK
664 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
665 no_gtk=""
b040e242 666 if test "$GTK_CONFIG" = "no" ; then
ecc7ceee
OK
667 no_gtk=yes
668 else
b040e242
VS
669 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
670 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
671 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee 672 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
b040e242 673 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee 674 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
b040e242 675 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee
OK
676 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
677 if test "x$enable_gtktest" = "xyes" ; then
678 ac_save_CFLAGS="$CFLAGS"
679 ac_save_LIBS="$LIBS"
680 CFLAGS="$CFLAGS $GTK_CFLAGS"
681 LIBS="$GTK_LIBS $LIBS"
682dnl
683dnl Now check if the installed GTK is sufficiently new. (Also sanity
b040e242 684dnl checks the results of gtk-config to some extent
ecc7ceee
OK
685dnl
686 rm -f conf.gtktest
687 AC_TRY_RUN([
688#include <gtk/gtk.h>
689#include <stdio.h>
690#include <stdlib.h>
691
b040e242 692int
ecc7ceee
OK
693main ()
694{
695 int major, minor, micro;
696 char *tmp_version;
697
698 system ("touch conf.gtktest");
699
700 /* HP/UX 9 (%@#!) writes to sscanf strings */
701 tmp_version = g_strdup("$min_gtk_version");
702 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
703 printf("%s, bad version string\n", "$min_gtk_version");
704 exit(1);
705 }
706
707 if ((gtk_major_version != $gtk_config_major_version) ||
708 (gtk_minor_version != $gtk_config_minor_version) ||
709 (gtk_micro_version != $gtk_config_micro_version))
710 {
b040e242 711 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
ecc7ceee
OK
712 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
713 gtk_major_version, gtk_minor_version, gtk_micro_version);
b040e242 714 printf ("*** was found! If gtk-config was correct, then it is best\n");
ecc7ceee
OK
715 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
716 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
717 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
718 printf("*** required on your system.\n");
b040e242
VS
719 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
720 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
ecc7ceee 721 printf("*** before re-running configure\n");
b040e242 722 }
ecc7ceee
OK
723#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
724 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
b040e242 725 (gtk_minor_version != GTK_MINOR_VERSION) ||
ecc7ceee
OK
726 (gtk_micro_version != GTK_MICRO_VERSION))
727 {
728 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
b040e242 729 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
ecc7ceee 730 printf("*** library (version %d.%d.%d)\n",
b040e242 731 gtk_major_version, gtk_minor_version, gtk_micro_version);
ecc7ceee
OK
732 }
733#endif /* defined (GTK_MAJOR_VERSION) ... */
734 else
735 {
736 if ((gtk_major_version > major) ||
737 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
738 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
739 {
740 return 0;
741 }
742 else
743 {
744 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
745 gtk_major_version, gtk_minor_version, gtk_micro_version);
746 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
b040e242 747 major, minor, micro);
ecc7ceee
OK
748 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
749 printf("***\n");
750 printf("*** If you have already installed a sufficiently new version, this error\n");
b040e242 751 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
ecc7ceee 752 printf("*** being found. The easiest way to fix this is to remove the old version\n");
b040e242
VS
753 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
754 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
ecc7ceee
OK
755 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
756 printf("*** so that the correct libraries are found at run-time))\n");
757 }
758 }
759 return 1;
760}
761],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
762 CFLAGS="$ac_save_CFLAGS"
763 LIBS="$ac_save_LIBS"
764 fi
765 fi
766 if test "x$no_gtk" = x ; then
b040e242
VS
767 AC_MSG_RESULT(yes)
768 ifelse([$2], , :, [$2])
ecc7ceee
OK
769 else
770 AC_MSG_RESULT(no)
b040e242
VS
771 if test "$GTK_CONFIG" = "no" ; then
772 echo "*** The gtk-config script installed by GTK could not be found"
ecc7ceee 773 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
b040e242
VS
774 echo "*** your path, or set the GTK_CONFIG environment variable to the"
775 echo "*** full path to gtk-config."
ecc7ceee
OK
776 else
777 if test -f conf.gtktest ; then
778 :
779 else
780 echo "*** Could not run GTK test program, checking why..."
781 CFLAGS="$CFLAGS $GTK_CFLAGS"
782 LIBS="$LIBS $GTK_LIBS"
783 AC_TRY_LINK([
784#include <gtk/gtk.h>
785#include <stdio.h>
786], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
787 [ echo "*** The test program compiled, but did not run. This usually means"
788 echo "*** that the run-time linker is not finding GTK or finding the wrong"
789 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
790 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
791 echo "*** to the installed location Also, make sure you have run ldconfig if that"
792 echo "*** is required on your system"
b040e242 793 echo "***"
ecc7ceee
OK
794 echo "*** If you have an old version installed, it is best to remove it, although"
795 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
796 echo "***"
797 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
798 echo "*** came with the system with the command"
799 echo "***"
800 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
801 [ echo "*** The test program failed to compile or link. See the file config.log for the"
802 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
803 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
b040e242 804 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
ecc7ceee
OK
805 CFLAGS="$ac_save_CFLAGS"
806 LIBS="$ac_save_LIBS"
807 fi
808 fi
809 GTK_CFLAGS=""
810 GTK_LIBS=""
811 ifelse([$3], , :, [$3])
812 fi
813 AC_SUBST(GTK_CFLAGS)
814 AC_SUBST(GTK_LIBS)
815 rm -f conf.gtktest
816])
8168de4c 817