]> git.saurik.com Git - wxWidgets.git/blame - aclocal.m4
Applied patch [ 694561 ] FL Release build DLL include path
[wxWidgets.git] / aclocal.m4
CommitLineData
b4eecb7e 1dnl aclocal.m4 generated automatically by aclocal 1.4-p6
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=
2b5f62a0 34for ac_dir in $1 /usr/include;
b040e242
VS
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=
2b5f62a0 50for ac_dir in $1 /usr/lib;
b040e242
VS
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[
2b5f62a0
VZ
66 dnl never add -I/usr/include to the CPPFLAGS
67 if test "x$1" = "x/usr/include"; then
b040e242
VS
68 ac_path_to_include=""
69 else
2b5f62a0
VZ
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
b040e242
VS
77 fi
78])
79
80dnl ---------------------------------------------------------------------------
81dnl Path to link, already defined
82dnl ---------------------------------------------------------------------------
83AC_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
94dnl ===========================================================================
95dnl C++ features test
96dnl ===========================================================================
97
98dnl ---------------------------------------------------------------------------
99dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
100dnl or only the old <iostream.h> one - it may be generally assumed that if
101dnl <iostream> exists, the other "new" headers (without .h) exist too.
102dnl
103dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling)
104dnl ---------------------------------------------------------------------------
105
106AC_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
126dnl ---------------------------------------------------------------------------
127dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
128dnl
129dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
130dnl ---------------------------------------------------------------------------
131
132AC_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
986ecc86
VZ
163dnl ---------------------------------------------------------------------------
164dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
165dnl keyword and defines HAVE_EXPLICIT if this is the case
166dnl ---------------------------------------------------------------------------
167
168AC_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
b040e242
VS
210dnl ---------------------------------------------------------------------------
211dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
212dnl ---------------------------------------------------------------------------
213
214AC_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.
218AC_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.
223AC_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)])
228if test $ac_cv_c_bigendian = unknown; then
229AC_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])
239fi])
240if 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])
242fi
243if test $ac_cv_c_bigendian = yes; then
244 AC_DEFINE(WORDS_BIGENDIAN)
245fi
246])
247
248dnl ---------------------------------------------------------------------------
249dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
250dnl ---------------------------------------------------------------------------
251
252AC_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
261AC_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
267dnl this macro checks for a three-valued command line --with argument:
268dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
269dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
270AC_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
317dnl this macro checks for a command line argument and caches the result
318dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
319AC_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
354dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
5005acfe 355dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
2b5f62a0
VZ
356dnl
357dnl enablestring is a hack and allows to show "checking for --disable-foo"
358dnl message when running configure instead of the default "checking for
359dnl --enable-foo" one whih is useful for the options enabled by default
b040e242
VS
360AC_DEFUN([WX_ARG_ENABLE],
361 [
5005acfe
VZ
362 enablestring=$4
363 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
b040e242
VS
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
2b5f62a0
VZ
397dnl ===========================================================================
398dnl Linker features test
399dnl ===========================================================================
400
401dnl ---------------------------------------------------------------------------
402dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
403dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
404dnl version script file named versionfile
405dnl
406dnl call WX_VERSIONED_SYMBOLS(versionfile)
407dnl ---------------------------------------------------------------------------
408AC_DEFUN([WX_VERSIONED_SYMBOLS],
409[
410 found_versioning=no
411
b4eecb7e
VS
412 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
413 dnl in the script.
414 dnl dnl Check for known non-gcc cases:
415 dnl case "${host}" in
416 dnl *-*-solaris2* )
417 dnl if test "x$GCC" != "xyes" ; then
418 dnl LDFLAGS_VERSIONING="-M $1"
419 dnl found_versioning=yes
420 dnl fi
421 dnl ;;
422 dnl esac
2b5f62a0
VZ
423
424 dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
425 if test $found_versioning = no ; then
426 AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
427 [
428 echo "VER_1 { *; };" >conftest.sym
429 echo "int main() { return 0; }" >conftest.cpp
430
431 if AC_TRY_COMMAND([
432 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
433 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
434 if test -s conftest.stderr ; then
435 wx_cv_version_script=no
436 else
437 wx_cv_version_script=yes
438 fi
439 else
440 wx_cv_version_script=no
441 fi
442 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
443 ])
444 if test $wx_cv_version_script = yes ; then
445 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
446 fi
447 fi
448])
449
b040e242
VS
450
451dnl ===========================================================================
452dnl "3rd party" macros included here because they are not widely available
453dnl ===========================================================================
454
b040e242
VS
455dnl ---------------------------------------------------------------------------
456dnl test for availability of iconv()
457dnl ---------------------------------------------------------------------------
458
b040e242
VS
459dnl From Bruno Haible.
460
461AC_DEFUN([AM_ICONV],
462[
463 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
464 dnl those with the standalone portable GNU libiconv installed).
465
466 AC_ARG_WITH([libiconv-prefix],
467[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
468 for dir in `echo "$withval" | tr : ' '`; do
469 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
470 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
471 done
472 ])
473
474 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
475 am_cv_func_iconv="no, consider installing GNU libiconv"
476 am_cv_lib_iconv=no
477 AC_TRY_LINK([#include <stdlib.h>
478#include <iconv.h>],
479 [iconv_t cd = iconv_open("","");
480 iconv(cd,NULL,NULL,NULL,NULL);
481 iconv_close(cd);],
482 am_cv_func_iconv=yes)
483 if test "$am_cv_func_iconv" != yes; then
484 am_save_LIBS="$LIBS"
485 LIBS="$LIBS -liconv"
486 AC_TRY_LINK([#include <stdlib.h>
487#include <iconv.h>],
488 [iconv_t cd = iconv_open("","");
489 iconv(cd,NULL,NULL,NULL,NULL);
490 iconv_close(cd);],
491 am_cv_lib_iconv=yes
492 am_cv_func_iconv=yes)
493 LIBS="$am_save_LIBS"
494 fi
495 ])
496 if test "$am_cv_func_iconv" = yes; then
497 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
b7043674 498 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
b040e242
VS
499 AC_TRY_COMPILE([
500#include <stdlib.h>
501#include <iconv.h>
502extern
503#ifdef __cplusplus
504"C"
505#endif
506#if defined(__STDC__) || defined(__cplusplus)
507size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
508#else
509size_t iconv();
510#endif
b7043674
VZ
511 ],
512 [],
513 wx_cv_func_iconv_const="no",
514 wx_cv_func_iconv_const="yes"
515 )
516 )
517
518 iconv_const=
1c405bb5 519 if test "x$wx_cv_func_iconv_const" = "xyes"; then
b7043674
VZ
520 iconv_const="const"
521 fi
522
523 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
b040e242
VS
524 [Define as const if the declaration of iconv() needs const.])
525 fi
526 LIBICONV=
527 if test "$am_cv_lib_iconv" = yes; then
528 LIBICONV="-liconv"
529 fi
530 AC_SUBST(LIBICONV)
531])
532
90dd450c
VZ
533dnl ---------------------------------------------------------------------------
534dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
535dnl ---------------------------------------------------------------------------
536
537dnl WX_SYS_LARGEFILE_TEST
538dnl
539dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
540dnl arithmetic properly but this failed miserably with gcc under Linux
541dnl whereas the system still supports 64 bit files, so now simply check
542dnl that off_t is big enough
543define(WX_SYS_LARGEFILE_TEST,
544[typedef struct {
545 unsigned int field: sizeof(off_t) == 8;
546} wxlf;
547])
548
549
550dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
551define(WX_SYS_LARGEFILE_MACRO_VALUE,
552[
553 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
554 [
555 AC_TRY_COMPILE([#define $1 $2
556 #include <sys/types.h>],
557 WX_SYS_LARGEFILE_TEST,
558 [$3=$2],
559 [$3=no])
560 ]
561 )
562
563 if test "$$3" != no; then
5a5d3c08 564 wx_largefile=yes
90dd450c
VZ
565 AC_DEFINE_UNQUOTED([$1], [$$3])
566 fi
567])
568
569
570dnl AC_SYS_LARGEFILE
571dnl ----------------
572dnl By default, many hosts won't let programs access large files;
573dnl one must use special compiler options to get large-file access to work.
574dnl For more details about this brain damage please see:
575dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
576AC_DEFUN([AC_SYS_LARGEFILE],
577[AC_ARG_ENABLE(largefile,
578 [ --disable-largefile omit support for large files])
579if test "$enable_largefile" != no; then
580 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
581 dnl _LARGE_FILES -- for AIX
5a5d3c08 582 wx_largefile=no
90dd450c
VZ
583 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
584 if test "x$wx_largefile" != "xyes"; then
585 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
586 fi
587
5a5d3c08 588 AC_MSG_CHECKING(if large file support is available)
90dd450c
VZ
589 if test "x$wx_largefile" = "xyes"; then
590 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
591 fi
5a5d3c08 592 AC_MSG_RESULT($wx_largefile)
90dd450c
VZ
593fi
594])
b040e242 595
521196a2
MB
596
597dnl Available from the GNU Autoconf Macro Archive at:
598dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
599dnl
600AC_DEFUN([AC_CXX_CONST_CAST],
601[AC_CACHE_CHECK(whether the compiler supports const_cast<>,
602ac_cv_cxx_const_cast,
603[AC_LANG_SAVE
604 AC_LANG_CPLUSPLUS
605 AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
606 ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
607 AC_LANG_RESTORE
608])
609if test "$ac_cv_cxx_const_cast" = yes; then
610 AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
611fi
612])
613
9e691f46
VZ
614# Configure paths for GTK+
615# Owen Taylor 1997-2001
b040e242
VS
616
617dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
9e691f46
VZ
618dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
619dnl pass to pkg-config
3f345b47 620dnl
b040e242 621AC_DEFUN(AM_PATH_GTK_2_0,
9e691f46
VZ
622[dnl
623dnl Get the cflags and libraries from pkg-config
3f345b47 624dnl
9e691f46
VZ
625AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
626 , enable_gtktest=yes)
3f345b47 627
9e691f46 628 pkg_config_args=gtk+-2.0
3f345b47
VZ
629 for module in . $4
630 do
631 case "$module" in
9e691f46
VZ
632 gthread)
633 pkg_config_args="$pkg_config_args gthread-2.0"
3f345b47
VZ
634 ;;
635 esac
636 done
637
9e691f46
VZ
638 no_gtk=""
639
640 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
641
642 if test x$PKG_CONFIG != xno ; then
643 if pkg-config --atleast-pkgconfig-version 0.7 ; then
644 :
645 else
646 echo *** pkg-config too old; version 0.7 or better required.
647 no_gtk=yes
648 PKG_CONFIG=no
649 fi
650 else
651 no_gtk=yes
8168de4c 652 fi
9e691f46
VZ
653
654 min_gtk_version=ifelse([$1], ,2.0.0,$1)
655 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
656
657 if test x$PKG_CONFIG != xno ; then
658 ## don't try to run the test against uninstalled libtool libs
659 if $PKG_CONFIG --uninstalled $pkg_config_args; then
660 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
661 enable_gtktest=no
662 fi
663
664 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
665 :
666 else
667 no_gtk=yes
668 fi
8168de4c
VZ
669 fi
670
9e691f46
VZ
671 if test x"$no_gtk" = x ; then
672 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
673 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
674 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
3f345b47 675 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
9e691f46 676 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
3f345b47 677 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
9e691f46 678 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
3f345b47
VZ
679 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
680 if test "x$enable_gtktest" = "xyes" ; then
681 ac_save_CFLAGS="$CFLAGS"
682 ac_save_LIBS="$LIBS"
683 CFLAGS="$CFLAGS $GTK_CFLAGS"
684 LIBS="$GTK_LIBS $LIBS"
8168de4c 685dnl
9e691f46
VZ
686dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
687dnl checks the results of pkg-config to some extent)
8168de4c 688dnl
3f345b47
VZ
689 rm -f conf.gtktest
690 AC_TRY_RUN([
8168de4c 691#include <gtk/gtk.h>
8168de4c
VZ
692#include <stdio.h>
693#include <stdlib.h>
694
9e691f46 695int
8168de4c
VZ
696main ()
697{
698 int major, minor, micro;
3f345b47 699 char *tmp_version;
8168de4c 700
3f345b47 701 system ("touch conf.gtktest");
8168de4c 702
3f345b47
VZ
703 /* HP/UX 9 (%@#!) writes to sscanf strings */
704 tmp_version = g_strdup("$min_gtk_version");
705 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
706 printf("%s, bad version string\n", "$min_gtk_version");
8168de4c
VZ
707 exit(1);
708 }
709
3f345b47
VZ
710 if ((gtk_major_version != $gtk_config_major_version) ||
711 (gtk_minor_version != $gtk_config_minor_version) ||
712 (gtk_micro_version != $gtk_config_micro_version))
713 {
9e691f46 714 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
3f345b47
VZ
715 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
716 gtk_major_version, gtk_minor_version, gtk_micro_version);
9e691f46 717 printf ("*** was found! If pkg-config was correct, then it is best\n");
3f345b47
VZ
718 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
719 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
720 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
721 printf("*** required on your system.\n");
9e691f46
VZ
722 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
723 printf("*** to point to the correct configuration files\n");
724 }
3f345b47 725 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
9e691f46 726 (gtk_minor_version != GTK_MINOR_VERSION) ||
3f345b47
VZ
727 (gtk_micro_version != GTK_MICRO_VERSION))
728 {
729 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
9e691f46 730 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
3f345b47 731 printf("*** library (version %d.%d.%d)\n",
9e691f46 732 gtk_major_version, gtk_minor_version, gtk_micro_version);
3f345b47 733 }
3f345b47
VZ
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",
9e691f46 747 major, minor, micro);
3f345b47
VZ
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");
9e691f46 751 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
3f345b47 752 printf("*** being found. The easiest way to fix this is to remove the old version\n");
9e691f46
VZ
753 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
754 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
3f345b47
VZ
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;
8168de4c
VZ
760}
761],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
3f345b47
VZ
762 CFLAGS="$ac_save_CFLAGS"
763 LIBS="$ac_save_LIBS"
764 fi
8168de4c
VZ
765 fi
766 if test "x$no_gtk" = x ; then
b040e242 767 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
9e691f46 768 ifelse([$2], , :, [$2])
8168de4c
VZ
769 else
770 AC_MSG_RESULT(no)
9e691f46
VZ
771 if test "$PKG_CONFIG" = "no" ; then
772 echo "*** A new enough version of pkg-config was not found."
773 echo "*** See http://pkgconfig.sourceforge.net"
3f345b47
VZ
774 else
775 if test -f conf.gtktest ; then
776 :
777 else
9e691f46 778 echo "*** Could not run GTK+ test program, checking why..."
579d8138
VS
779 ac_save_CFLAGS="$CFLAGS"
780 ac_save_LIBS="$LIBS"
3f345b47
VZ
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"
9e691f46
VZ
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"
3f345b47
VZ
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"
9e691f46 793 echo "***"
3f345b47 794 echo "*** If you have an old version installed, it is best to remove it, although"
9e691f46 795 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
3f345b47 796 [ echo "*** The test program failed to compile or link. See the file config.log for the"
579d8138 797 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
3f345b47
VZ
798 CFLAGS="$ac_save_CFLAGS"
799 LIBS="$ac_save_LIBS"
800 fi
801 fi
8168de4c
VZ
802 GTK_CFLAGS=""
803 GTK_LIBS=""
804 ifelse([$3], , :, [$3])
805 fi
806 AC_SUBST(GTK_CFLAGS)
807 AC_SUBST(GTK_LIBS)
3f345b47 808 rm -f conf.gtktest
8168de4c
VZ
809])
810
b040e242
VS
811# Configure paths for GTK+
812# Owen Taylor 97-11-3
813
814dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
ecc7ceee
OK
815dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
816dnl
b040e242
VS
817AC_DEFUN(AM_PATH_GTK,
818[dnl
819dnl Get the cflags and libraries from the gtk-config script
ecc7ceee
OK
820dnl
821AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
822 gtk_config_prefix="$withval", gtk_config_prefix="")
823AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
824 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
825AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
b040e242 826 , enable_gtktest=yes)
ecc7ceee
OK
827
828 for module in . $4
829 do
830 case "$module" in
b040e242 831 gthread)
ecc7ceee
OK
832 gtk_config_args="$gtk_config_args gthread"
833 ;;
834 esac
835 done
836
837 if test x$gtk_config_exec_prefix != x ; then
838 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
b040e242
VS
839 if test x${GTK_CONFIG+set} != xset ; then
840 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
ecc7ceee
OK
841 fi
842 fi
843 if test x$gtk_config_prefix != x ; then
844 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
b040e242
VS
845 if test x${GTK_CONFIG+set} != xset ; then
846 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
ecc7ceee
OK
847 fi
848 fi
849
b040e242
VS
850 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
851 min_gtk_version=ifelse([$1], ,0.99.7,$1)
ecc7ceee
OK
852 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
853 no_gtk=""
b040e242 854 if test "$GTK_CONFIG" = "no" ; then
ecc7ceee
OK
855 no_gtk=yes
856 else
b040e242
VS
857 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
858 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
859 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee 860 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
b040e242 861 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee 862 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
b040e242 863 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
ecc7ceee
OK
864 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
865 if test "x$enable_gtktest" = "xyes" ; then
866 ac_save_CFLAGS="$CFLAGS"
867 ac_save_LIBS="$LIBS"
868 CFLAGS="$CFLAGS $GTK_CFLAGS"
869 LIBS="$GTK_LIBS $LIBS"
870dnl
871dnl Now check if the installed GTK is sufficiently new. (Also sanity
b040e242 872dnl checks the results of gtk-config to some extent
ecc7ceee
OK
873dnl
874 rm -f conf.gtktest
875 AC_TRY_RUN([
876#include <gtk/gtk.h>
877#include <stdio.h>
878#include <stdlib.h>
879
b040e242 880int
ecc7ceee
OK
881main ()
882{
883 int major, minor, micro;
884 char *tmp_version;
885
886 system ("touch conf.gtktest");
887
888 /* HP/UX 9 (%@#!) writes to sscanf strings */
889 tmp_version = g_strdup("$min_gtk_version");
890 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
891 printf("%s, bad version string\n", "$min_gtk_version");
892 exit(1);
893 }
894
895 if ((gtk_major_version != $gtk_config_major_version) ||
896 (gtk_minor_version != $gtk_config_minor_version) ||
897 (gtk_micro_version != $gtk_config_micro_version))
898 {
b040e242 899 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
ecc7ceee
OK
900 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
901 gtk_major_version, gtk_minor_version, gtk_micro_version);
b040e242 902 printf ("*** was found! If gtk-config was correct, then it is best\n");
ecc7ceee
OK
903 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
904 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
905 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
906 printf("*** required on your system.\n");
b040e242
VS
907 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
908 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
ecc7ceee 909 printf("*** before re-running configure\n");
b040e242 910 }
ecc7ceee
OK
911#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
912 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
b040e242 913 (gtk_minor_version != GTK_MINOR_VERSION) ||
ecc7ceee
OK
914 (gtk_micro_version != GTK_MICRO_VERSION))
915 {
916 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
b040e242 917 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
ecc7ceee 918 printf("*** library (version %d.%d.%d)\n",
b040e242 919 gtk_major_version, gtk_minor_version, gtk_micro_version);
ecc7ceee
OK
920 }
921#endif /* defined (GTK_MAJOR_VERSION) ... */
922 else
923 {
924 if ((gtk_major_version > major) ||
925 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
926 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
927 {
928 return 0;
929 }
930 else
931 {
932 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
933 gtk_major_version, gtk_minor_version, gtk_micro_version);
934 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
b040e242 935 major, minor, micro);
ecc7ceee
OK
936 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
937 printf("***\n");
938 printf("*** If you have already installed a sufficiently new version, this error\n");
b040e242 939 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
ecc7ceee 940 printf("*** being found. The easiest way to fix this is to remove the old version\n");
b040e242
VS
941 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
942 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
ecc7ceee
OK
943 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
944 printf("*** so that the correct libraries are found at run-time))\n");
945 }
946 }
947 return 1;
948}
949],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
950 CFLAGS="$ac_save_CFLAGS"
951 LIBS="$ac_save_LIBS"
952 fi
953 fi
954 if test "x$no_gtk" = x ; then
b040e242
VS
955 AC_MSG_RESULT(yes)
956 ifelse([$2], , :, [$2])
ecc7ceee
OK
957 else
958 AC_MSG_RESULT(no)
b040e242
VS
959 if test "$GTK_CONFIG" = "no" ; then
960 echo "*** The gtk-config script installed by GTK could not be found"
ecc7ceee 961 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
b040e242
VS
962 echo "*** your path, or set the GTK_CONFIG environment variable to the"
963 echo "*** full path to gtk-config."
ecc7ceee
OK
964 else
965 if test -f conf.gtktest ; then
966 :
967 else
968 echo "*** Could not run GTK test program, checking why..."
969 CFLAGS="$CFLAGS $GTK_CFLAGS"
970 LIBS="$LIBS $GTK_LIBS"
971 AC_TRY_LINK([
972#include <gtk/gtk.h>
973#include <stdio.h>
974], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
975 [ echo "*** The test program compiled, but did not run. This usually means"
976 echo "*** that the run-time linker is not finding GTK or finding the wrong"
977 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
978 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
979 echo "*** to the installed location Also, make sure you have run ldconfig if that"
980 echo "*** is required on your system"
b040e242 981 echo "***"
ecc7ceee
OK
982 echo "*** If you have an old version installed, it is best to remove it, although"
983 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
984 echo "***"
985 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
986 echo "*** came with the system with the command"
987 echo "***"
988 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
989 [ echo "*** The test program failed to compile or link. See the file config.log for the"
990 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
991 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
b040e242 992 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
ecc7ceee
OK
993 CFLAGS="$ac_save_CFLAGS"
994 LIBS="$ac_save_LIBS"
995 fi
996 fi
997 GTK_CFLAGS=""
998 GTK_LIBS=""
999 ifelse([$3], , :, [$3])
1000 fi
1001 AC_SUBST(GTK_CFLAGS)
1002 AC_SUBST(GTK_LIBS)
1003 rm -f conf.gtktest
1004])
8168de4c 1005
2b5f62a0
VZ
1006
1007dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1008dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1009dnl also defines GSTUFF_PKG_ERRORS on error
1010AC_DEFUN(PKG_CHECK_MODULES, [
1011 succeeded=no
1012
1013 if test -z "$PKG_CONFIG"; then
1014 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1015 fi
1016
1017 if test "$PKG_CONFIG" = "no" ; then
1018 echo "*** The pkg-config script could not be found. Make sure it is"
1019 echo "*** in your path, or set the PKG_CONFIG environment variable"
1020 echo "*** to the full path to pkg-config."
1021 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1022 else
1023 PKG_CONFIG_MIN_VERSION=0.9.0
1024 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1025 AC_MSG_CHECKING(for $2)
1026
1027 if $PKG_CONFIG --exists "$2" ; then
1028 AC_MSG_RESULT(yes)
1029 succeeded=yes
1030
1031 AC_MSG_CHECKING($1_CFLAGS)
1032 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1033 AC_MSG_RESULT($$1_CFLAGS)
1034
1035 AC_MSG_CHECKING($1_LIBS)
1036 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1037 AC_MSG_RESULT($$1_LIBS)
1038 else
1039 $1_CFLAGS=""
1040 $1_LIBS=""
1041 ## If we have a custom action on failure, don't print errors, but
1042 ## do set a variable so people can do so.
1043 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1044 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1045 fi
1046
1047 AC_SUBST($1_CFLAGS)
1048 AC_SUBST($1_LIBS)
1049 else
1050 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1051 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1052 fi
1053 fi
1054
1055 if test $succeeded = yes; then
1056 ifelse([$3], , :, [$3])
1057 else
1058 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])
1059 fi
1060])
1061
1062
1063