1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
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.
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.
13 dnl ---------------------------------------------------------------------------
15 dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker,
16 dnl Vadim Zeitlin and Ron Lee
18 dnl This script is under the wxWindows licence.
21 dnl ---------------------------------------------------------------------------
23 dnl ===========================================================================
24 dnl macros to find the a file in the list of include/lib paths
25 dnl ===========================================================================
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],
34 for ac_dir in $1 /usr/include;
36 if test -f "$ac_dir/$2"; then
37 ac_find_includes=$ac_dir
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],
50 for ac_dir in $1 /usr/lib;
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
61 dnl ---------------------------------------------------------------------------
62 dnl Path to include, already defined
63 dnl ---------------------------------------------------------------------------
64 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
66 dnl never add -I/usr/include to the CPPFLAGS
67 if test "x$1" = "x/usr/include"; then
70 echo "$2" | grep "\-I$1" > /dev/null
72 if test $result = 0; then
75 ac_path_to_include=" -I$1"
80 dnl ---------------------------------------------------------------------------
81 dnl Path to link, already defined
82 dnl ---------------------------------------------------------------------------
83 AC_DEFUN([WX_LINK_PATH_EXIST],
85 echo "$2" | grep "\-L$1" > /dev/null
87 if test $result = 0; then
90 ac_path_to_link=" -L$1"
94 dnl ===========================================================================
96 dnl ===========================================================================
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.
103 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling)
104 dnl ---------------------------------------------------------------------------
106 AC_DEFUN([WX_CPP_NEW_HEADERS],
108 if test "$cross_compiling" = "yes"; then
109 ifelse([$2], , :, [$2])
114 AC_CHECK_HEADERS(iostream)
116 if test "$ac_cv_header_iostream" = "yes" ; then
117 ifelse([$1], , :, [$1])
119 ifelse([$2], , :, [$2])
126 dnl ---------------------------------------------------------------------------
127 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
129 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
130 dnl ---------------------------------------------------------------------------
132 AC_DEFUN([WX_CPP_BOOL],
134 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
158 if test "$wx_cv_cpp_bool" = "yes"; then
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 ---------------------------------------------------------------------------
168 AC_DEFUN([WX_CPP_EXPLICIT],
170 AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
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
180 class Foo { public: explicit Foo(int) {} };
188 class Foo { public: explicit Foo(int) {} };
189 static void TakeFoo(const Foo& foo) { }
205 if test "$wx_cv_explicit" = "yes"; then
206 AC_DEFINE(HAVE_EXPLICIT)
210 dnl ---------------------------------------------------------------------------
211 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
212 dnl ---------------------------------------------------------------------------
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
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
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. */
234 char c[sizeof (long)];
237 exit (u.c[sizeof (long) - 1] == 1);
238 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
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])
243 if test $ac_cv_c_bigendian = yes; then
244 AC_DEFINE(WORDS_BIGENDIAN)
248 dnl ---------------------------------------------------------------------------
249 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
250 dnl ---------------------------------------------------------------------------
252 AC_DEFUN([WX_ARG_CACHE_INIT],
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}
261 AC_DEFUN([WX_ARG_CACHE_FLUSH],
263 echo "saving argument cache $wx_arg_cache_file"
264 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
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],
272 AC_MSG_CHECKING([for --with-$1])
274 AC_ARG_WITH($1, [$2],
276 if test "$withval" = yes; then
277 ac_cv_use_$1='$3=yes'
278 elif test "$withval" = no; then
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'
285 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
289 LINE=`grep "$3" ${wx_arg_cache_file}`
290 if test "x$LINE" != x ; then
296 ac_cv_use_$1='$3='$DEFAULT_$3
300 if test "$no_cache" != 1; then
301 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
304 if test "$$3" = yes; then
306 elif test "$$3" = no; then
308 elif test "$$3" = sys; then
309 AC_MSG_RESULT([system version])
310 elif test "$$3" = builtin; then
311 AC_MSG_RESULT([builtin version])
313 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
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],
321 AC_MSG_CHECKING([for --with-$1])
323 AC_ARG_WITH($1, [$2],
325 if test "$withval" = yes; then
326 ac_cv_use_$1='$3=yes'
332 LINE=`grep "$3" ${wx_arg_cache_file}`
333 if test "x$LINE" != x ; then
339 ac_cv_use_$1='$3='$DEFAULT_$3
343 if test "$no_cache" != 1; then
344 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
347 if test "$$3" = yes; then
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)
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],
363 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
365 AC_ARG_ENABLE($1, [$2],
367 if test "$enableval" = yes; then
368 ac_cv_use_$1='$3=yes'
374 LINE=`grep "$3" ${wx_arg_cache_file}`
375 if test "x$LINE" != x ; then
381 ac_cv_use_$1='$3='$DEFAULT_$3
385 if test "$no_cache" != 1; then
386 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
389 if test "$$3" = yes; then
397 dnl ===========================================================================
398 dnl Linker features test
399 dnl ===========================================================================
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
406 dnl call WX_VERSIONED_SYMBOLS(versionfile)
407 dnl ---------------------------------------------------------------------------
408 AC_DEFUN([WX_VERSIONED_SYMBOLS],
412 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
414 dnl dnl Check for known non-gcc cases:
415 dnl case "${host}" in
417 dnl if test "x$GCC" != "xyes" ; then
418 dnl LDFLAGS_VERSIONING="-M $1"
419 dnl found_versioning=yes
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,
428 echo "VER_1 { *; };" >conftest.sym
429 echo "int main() { return 0; }" >conftest.cpp
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
437 wx_cv_version_script=yes
440 wx_cv_version_script=no
442 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
444 if test $wx_cv_version_script = yes ; then
445 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
451 dnl ===========================================================================
452 dnl "3rd party" macros included here because they are not widely available
453 dnl ===========================================================================
455 dnl ---------------------------------------------------------------------------
456 dnl test for availability of iconv()
457 dnl ---------------------------------------------------------------------------
459 dnl From Bruno Haible.
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).
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
474 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
475 am_cv_func_iconv="no, consider installing GNU libiconv"
477 AC_TRY_LINK([#include <stdlib.h>
479 [iconv_t cd = iconv_open("","");
480 iconv(cd,NULL,NULL,NULL,NULL);
482 am_cv_func_iconv=yes)
483 if test "$am_cv_func_iconv" != yes; then
486 AC_TRY_LINK([#include <stdlib.h>
488 [iconv_t cd = iconv_open("","");
489 iconv(cd,NULL,NULL,NULL,NULL);
492 am_cv_func_iconv=yes)
496 if test "$am_cv_func_iconv" = yes; then
497 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
498 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
506 #if defined(__STDC__) || defined(__cplusplus)
507 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
513 wx_cv_func_iconv_const="no",
514 wx_cv_func_iconv_const="yes"
519 if test "x$wx_cv_func_iconv_const" = "xyes"; then
523 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
524 [Define as const if the declaration of iconv() needs const.])
527 if test "$am_cv_lib_iconv" = yes; then
533 dnl ---------------------------------------------------------------------------
534 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
535 dnl ---------------------------------------------------------------------------
537 dnl WX_SYS_LARGEFILE_TEST
539 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
540 dnl arithmetic properly but this failed miserably with gcc under Linux
541 dnl whereas the system still supports 64 bit files, so now simply check
542 dnl that off_t is big enough
543 define(WX_SYS_LARGEFILE_TEST,
545 unsigned int field: sizeof(off_t) == 8;
550 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
551 define(WX_SYS_LARGEFILE_MACRO_VALUE,
553 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
555 AC_TRY_COMPILE([#define $1 $2
556 #include <sys/types.h>],
557 WX_SYS_LARGEFILE_TEST,
563 if test "$$3" != no; then
565 AC_DEFINE_UNQUOTED([$1], [$$3])
572 dnl By default, many hosts won't let programs access large files;
573 dnl one must use special compiler options to get large-file access to work.
574 dnl For more details about this brain damage please see:
575 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
576 AC_DEFUN([AC_SYS_LARGEFILE],
577 [AC_ARG_ENABLE(largefile,
578 [ --disable-largefile omit support for large files])
579 if test "$enable_largefile" != no; then
580 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
581 dnl _LARGE_FILES -- for AIX
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)
588 AC_MSG_CHECKING(if large file support is available)
589 if test "x$wx_largefile" = "xyes"; then
590 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
592 AC_MSG_RESULT($wx_largefile)
596 # Configure paths for GTK+
597 # Owen Taylor 1997-2001
599 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
600 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
601 dnl pass to pkg-config
603 AC_DEFUN(AM_PATH_GTK_2_0,
605 dnl Get the cflags and libraries from pkg-config
607 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
608 , enable_gtktest=yes)
610 pkg_config_args=gtk+-2.0
615 pkg_config_args="$pkg_config_args gthread-2.0"
622 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
624 if test x$PKG_CONFIG != xno ; then
625 if pkg-config --atleast-pkgconfig-version 0.7 ; then
628 echo *** pkg-config too old; version 0.7 or better required.
636 min_gtk_version=ifelse([$1], ,2.0.0,$1)
637 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
639 if test x$PKG_CONFIG != xno ; then
640 ## don't try to run the test against uninstalled libtool libs
641 if $PKG_CONFIG --uninstalled $pkg_config_args; then
642 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
646 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
653 if test x"$no_gtk" = x ; then
654 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
655 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
656 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
657 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
658 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
659 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
660 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
661 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
662 if test "x$enable_gtktest" = "xyes" ; then
663 ac_save_CFLAGS="$CFLAGS"
665 CFLAGS="$CFLAGS $GTK_CFLAGS"
666 LIBS="$GTK_LIBS $LIBS"
668 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
669 dnl checks the results of pkg-config to some extent)
680 int major, minor, micro;
683 system ("touch conf.gtktest");
685 /* HP/UX 9 (%@#!) writes to sscanf strings */
686 tmp_version = g_strdup("$min_gtk_version");
687 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
688 printf("%s, bad version string\n", "$min_gtk_version");
692 if ((gtk_major_version != $gtk_config_major_version) ||
693 (gtk_minor_version != $gtk_config_minor_version) ||
694 (gtk_micro_version != $gtk_config_micro_version))
696 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
697 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
698 gtk_major_version, gtk_minor_version, gtk_micro_version);
699 printf ("*** was found! If pkg-config was correct, then it is best\n");
700 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
701 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
702 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
703 printf("*** required on your system.\n");
704 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
705 printf("*** to point to the correct configuration files\n");
707 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
708 (gtk_minor_version != GTK_MINOR_VERSION) ||
709 (gtk_micro_version != GTK_MICRO_VERSION))
711 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
712 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
713 printf("*** library (version %d.%d.%d)\n",
714 gtk_major_version, gtk_minor_version, gtk_micro_version);
718 if ((gtk_major_version > major) ||
719 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
720 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
726 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
727 gtk_major_version, gtk_minor_version, gtk_micro_version);
728 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
729 major, minor, micro);
730 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
732 printf("*** If you have already installed a sufficiently new version, this error\n");
733 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
734 printf("*** being found. The easiest way to fix this is to remove the old version\n");
735 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
736 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
737 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
738 printf("*** so that the correct libraries are found at run-time))\n");
743 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
744 CFLAGS="$ac_save_CFLAGS"
748 if test "x$no_gtk" = x ; then
749 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
750 ifelse([$2], , :, [$2])
753 if test "$PKG_CONFIG" = "no" ; then
754 echo "*** A new enough version of pkg-config was not found."
755 echo "*** See http://pkgconfig.sourceforge.net"
757 if test -f conf.gtktest ; then
760 echo "*** Could not run GTK+ test program, checking why..."
761 ac_save_CFLAGS="$CFLAGS"
763 CFLAGS="$CFLAGS $GTK_CFLAGS"
764 LIBS="$LIBS $GTK_LIBS"
768 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
769 [ echo "*** The test program compiled, but did not run. This usually means"
770 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
771 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
772 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
773 echo "*** to the installed location Also, make sure you have run ldconfig if that"
774 echo "*** is required on your system"
776 echo "*** If you have an old version installed, it is best to remove it, although"
777 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
778 [ echo "*** The test program failed to compile or link. See the file config.log for the"
779 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
780 CFLAGS="$ac_save_CFLAGS"
786 ifelse([$3], , :, [$3])
793 # Configure paths for GTK+
794 # Owen Taylor 97-11-3
796 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
797 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
799 AC_DEFUN(AM_PATH_GTK,
801 dnl Get the cflags and libraries from the gtk-config script
803 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
804 gtk_config_prefix="$withval", gtk_config_prefix="")
805 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
806 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
807 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
808 , enable_gtktest=yes)
814 gtk_config_args="$gtk_config_args gthread"
819 if test x$gtk_config_exec_prefix != x ; then
820 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
821 if test x${GTK_CONFIG+set} != xset ; then
822 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
825 if test x$gtk_config_prefix != x ; then
826 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
827 if test x${GTK_CONFIG+set} != xset ; then
828 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
832 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
833 min_gtk_version=ifelse([$1], ,0.99.7,$1)
834 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
836 if test "$GTK_CONFIG" = "no" ; then
839 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
840 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
841 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
842 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
843 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
844 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
845 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
846 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
847 if test "x$enable_gtktest" = "xyes" ; then
848 ac_save_CFLAGS="$CFLAGS"
850 CFLAGS="$CFLAGS $GTK_CFLAGS"
851 LIBS="$GTK_LIBS $LIBS"
853 dnl Now check if the installed GTK is sufficiently new. (Also sanity
854 dnl checks the results of gtk-config to some extent
865 int major, minor, micro;
868 system ("touch conf.gtktest");
870 /* HP/UX 9 (%@#!) writes to sscanf strings */
871 tmp_version = g_strdup("$min_gtk_version");
872 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
873 printf("%s, bad version string\n", "$min_gtk_version");
877 if ((gtk_major_version != $gtk_config_major_version) ||
878 (gtk_minor_version != $gtk_config_minor_version) ||
879 (gtk_micro_version != $gtk_config_micro_version))
881 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
882 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
883 gtk_major_version, gtk_minor_version, gtk_micro_version);
884 printf ("*** was found! If gtk-config was correct, then it is best\n");
885 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
886 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
887 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
888 printf("*** required on your system.\n");
889 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
890 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
891 printf("*** before re-running configure\n");
893 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
894 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
895 (gtk_minor_version != GTK_MINOR_VERSION) ||
896 (gtk_micro_version != GTK_MICRO_VERSION))
898 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
899 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
900 printf("*** library (version %d.%d.%d)\n",
901 gtk_major_version, gtk_minor_version, gtk_micro_version);
903 #endif /* defined (GTK_MAJOR_VERSION) ... */
906 if ((gtk_major_version > major) ||
907 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
908 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
914 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
915 gtk_major_version, gtk_minor_version, gtk_micro_version);
916 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
917 major, minor, micro);
918 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
920 printf("*** If you have already installed a sufficiently new version, this error\n");
921 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
922 printf("*** being found. The easiest way to fix this is to remove the old version\n");
923 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
924 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
925 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
926 printf("*** so that the correct libraries are found at run-time))\n");
931 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
932 CFLAGS="$ac_save_CFLAGS"
936 if test "x$no_gtk" = x ; then
938 ifelse([$2], , :, [$2])
941 if test "$GTK_CONFIG" = "no" ; then
942 echo "*** The gtk-config script installed by GTK could not be found"
943 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
944 echo "*** your path, or set the GTK_CONFIG environment variable to the"
945 echo "*** full path to gtk-config."
947 if test -f conf.gtktest ; then
950 echo "*** Could not run GTK test program, checking why..."
951 CFLAGS="$CFLAGS $GTK_CFLAGS"
952 LIBS="$LIBS $GTK_LIBS"
956 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
957 [ echo "*** The test program compiled, but did not run. This usually means"
958 echo "*** that the run-time linker is not finding GTK or finding the wrong"
959 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
960 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
961 echo "*** to the installed location Also, make sure you have run ldconfig if that"
962 echo "*** is required on your system"
964 echo "*** If you have an old version installed, it is best to remove it, although"
965 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
967 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
968 echo "*** came with the system with the command"
970 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
971 [ echo "*** The test program failed to compile or link. See the file config.log for the"
972 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
973 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
974 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
975 CFLAGS="$ac_save_CFLAGS"
981 ifelse([$3], , :, [$3])
989 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
990 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
991 dnl also defines GSTUFF_PKG_ERRORS on error
992 AC_DEFUN(PKG_CHECK_MODULES, [
995 if test -z "$PKG_CONFIG"; then
996 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
999 if test "$PKG_CONFIG" = "no" ; then
1000 echo "*** The pkg-config script could not be found. Make sure it is"
1001 echo "*** in your path, or set the PKG_CONFIG environment variable"
1002 echo "*** to the full path to pkg-config."
1003 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1005 PKG_CONFIG_MIN_VERSION=0.9.0
1006 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1007 AC_MSG_CHECKING(for $2)
1009 if $PKG_CONFIG --exists "$2" ; then
1013 AC_MSG_CHECKING($1_CFLAGS)
1014 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1015 AC_MSG_RESULT($$1_CFLAGS)
1017 AC_MSG_CHECKING($1_LIBS)
1018 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1019 AC_MSG_RESULT($$1_LIBS)
1023 ## If we have a custom action on failure, don't print errors, but
1024 ## do set a variable so people can do so.
1025 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1026 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1032 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1033 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1037 if test $succeeded = yes; then
1038 ifelse([$3], , :, [$3])
1040 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])