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