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