1 # aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
3 # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 dnl ---------------------------------------------------------------------------
16 dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker,
17 dnl Vadim Zeitlin and Ron Lee
19 dnl This script is under the wxWindows licence.
22 dnl ---------------------------------------------------------------------------
24 dnl ===========================================================================
25 dnl macros to find the a file in the list of include/lib paths
26 dnl ===========================================================================
28 dnl ---------------------------------------------------------------------------
29 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
30 dnl to the full name of the file that was found or leaves it empty if not found
31 dnl ---------------------------------------------------------------------------
32 AC_DEFUN([WX_PATH_FIND_INCLUDES],
35 for ac_dir in $1 /usr/include;
37 if test -f "$ac_dir/$2"; then
38 ac_find_includes=$ac_dir
44 dnl ---------------------------------------------------------------------------
45 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
46 dnl to the full name of the file that was found or leaves it empty if not found
47 dnl ---------------------------------------------------------------------------
48 AC_DEFUN([WX_PATH_FIND_LIBRARIES],
51 for ac_dir in $1 /usr/lib;
53 for ac_extension in a so sl dylib; do
54 if test -f "$ac_dir/lib$2.$ac_extension"; then
55 ac_find_libraries=$ac_dir
62 dnl ---------------------------------------------------------------------------
63 dnl Path to include, already defined
64 dnl ---------------------------------------------------------------------------
65 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
67 dnl never add -I/usr/include to the CPPFLAGS
68 if test "x$1" = "x/usr/include"; then
71 echo "$2" | grep "\-I$1" > /dev/null
73 if test $result = 0; then
76 ac_path_to_include=" -I$1"
81 dnl ---------------------------------------------------------------------------
82 dnl Path to link, already defined
83 dnl ---------------------------------------------------------------------------
84 AC_DEFUN([WX_LINK_PATH_EXIST],
86 echo "$2" | grep "\-L$1" > /dev/null
88 if test $result = 0; then
91 ac_path_to_link=" -L$1"
95 dnl ===========================================================================
97 dnl ===========================================================================
99 dnl ---------------------------------------------------------------------------
100 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
101 dnl or only the old <iostream.h> one - it may be generally assumed that if
102 dnl <iostream> exists, the other "new" headers (without .h) exist too.
104 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling)
105 dnl ---------------------------------------------------------------------------
107 AC_DEFUN([WX_CPP_NEW_HEADERS],
109 if test "$cross_compiling" = "yes"; then
110 ifelse([$2], , :, [$2])
115 AC_CHECK_HEADERS(iostream)
117 if test "$ac_cv_header_iostream" = "yes" ; then
118 ifelse([$1], , :, [$1])
120 ifelse([$2], , :, [$2])
127 dnl ---------------------------------------------------------------------------
128 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
130 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
131 dnl ---------------------------------------------------------------------------
133 AC_DEFUN([WX_CPP_BOOL],
135 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
159 if test "$wx_cv_cpp_bool" = "yes"; then
164 dnl ---------------------------------------------------------------------------
165 dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
166 dnl keyword and defines HAVE_EXPLICIT if this is the case
167 dnl ---------------------------------------------------------------------------
169 AC_DEFUN([WX_CPP_EXPLICIT],
171 AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
177 dnl do the test in 2 steps: first check that the compiler knows about the
178 dnl explicit keyword at all and then verify that it really honours it
181 class Foo { public: explicit Foo(int) {} };
189 class Foo { public: explicit Foo(int) {} };
190 static void TakeFoo(const Foo& foo) { }
206 if test "$wx_cv_explicit" = "yes"; then
207 AC_DEFINE(HAVE_EXPLICIT)
211 dnl ---------------------------------------------------------------------------
212 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
213 dnl ---------------------------------------------------------------------------
215 AC_DEFUN([WX_C_BIGENDIAN],
216 [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
217 [ac_cv_c_bigendian=unknown
218 # See if sys/param.h defines the BYTE_ORDER macro.
219 AC_TRY_COMPILE([#include <sys/types.h>
220 #include <sys/param.h>], [
221 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
223 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
224 AC_TRY_COMPILE([#include <sys/types.h>
225 #include <sys/param.h>], [
226 #if BYTE_ORDER != BIG_ENDIAN
228 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
229 if test $ac_cv_c_bigendian = unknown; then
230 AC_TRY_RUN([main () {
231 /* Are we little or big endian? From Harbison&Steele. */
235 char c[sizeof (long)];
238 exit (u.c[sizeof (long) - 1] == 1);
239 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
241 if test $ac_cv_c_bigendian = unknown; then
242 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])
244 if test $ac_cv_c_bigendian = yes; then
245 AC_DEFINE(WORDS_BIGENDIAN)
249 dnl ---------------------------------------------------------------------------
250 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
251 dnl ---------------------------------------------------------------------------
253 AC_DEFUN([WX_ARG_CACHE_INIT],
255 wx_arg_cache_file="configarg.cache"
256 echo "loading argument cache $wx_arg_cache_file"
257 rm -f ${wx_arg_cache_file}.tmp
258 touch ${wx_arg_cache_file}.tmp
259 touch ${wx_arg_cache_file}
262 AC_DEFUN([WX_ARG_CACHE_FLUSH],
264 echo "saving argument cache $wx_arg_cache_file"
265 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
268 dnl this macro checks for a three-valued command line --with argument:
269 dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
270 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
271 AC_DEFUN([WX_ARG_SYS_WITH],
273 AC_MSG_CHECKING([for --with-$1])
275 AC_ARG_WITH($1, [$2],
277 if test "$withval" = yes; then
278 ac_cv_use_$1='$3=yes'
279 elif test "$withval" = no; then
281 elif test "$withval" = sys; then
282 ac_cv_use_$1='$3=sys'
283 elif test "$withval" = builtin; then
284 ac_cv_use_$1='$3=builtin'
286 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
290 LINE=`grep "$3" ${wx_arg_cache_file}`
291 if test "x$LINE" != x ; then
297 ac_cv_use_$1='$3='$DEFAULT_$3
301 if test "$no_cache" != 1; then
302 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
305 if test "$$3" = yes; then
307 elif test "$$3" = no; then
309 elif test "$$3" = sys; then
310 AC_MSG_RESULT([system version])
311 elif test "$$3" = builtin; then
312 AC_MSG_RESULT([builtin version])
314 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
318 dnl this macro checks for a command line argument and caches the result
319 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
320 AC_DEFUN([WX_ARG_WITH],
322 AC_MSG_CHECKING([for --with-$1])
324 AC_ARG_WITH($1, [$2],
326 if test "$withval" = yes; then
327 ac_cv_use_$1='$3=yes'
333 LINE=`grep "$3" ${wx_arg_cache_file}`
334 if test "x$LINE" != x ; then
340 ac_cv_use_$1='$3='$DEFAULT_$3
344 if test "$no_cache" != 1; then
345 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
348 if test "$$3" = yes; then
355 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
356 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
358 dnl enablestring is a hack and allows to show "checking for --disable-foo"
359 dnl message when running configure instead of the default "checking for
360 dnl --enable-foo" one whih is useful for the options enabled by default
361 AC_DEFUN([WX_ARG_ENABLE],
364 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
366 AC_ARG_ENABLE($1, [$2],
368 if test "$enableval" = yes; then
369 ac_cv_use_$1='$3=yes'
375 LINE=`grep "$3" ${wx_arg_cache_file}`
376 if test "x$LINE" != x ; then
382 ac_cv_use_$1='$3='$DEFAULT_$3
386 if test "$no_cache" != 1; then
387 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
390 if test "$$3" = yes; then
398 dnl ===========================================================================
399 dnl Linker features test
400 dnl ===========================================================================
402 dnl ---------------------------------------------------------------------------
403 dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
404 dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
405 dnl version script file named versionfile
407 dnl call WX_VERSIONED_SYMBOLS(versionfile)
408 dnl ---------------------------------------------------------------------------
409 AC_DEFUN([WX_VERSIONED_SYMBOLS],
413 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
415 dnl dnl Check for known non-gcc cases:
416 dnl case "${host}" in
418 dnl if test "x$GCC" != "xyes" ; then
419 dnl LDFLAGS_VERSIONING="-M $1"
420 dnl found_versioning=yes
425 dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
426 if test $found_versioning = no ; then
427 AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
429 echo "VER_1 { *; };" >conftest.sym
430 echo "int main() { return 0; }" >conftest.cpp
433 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
434 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
435 if test -s conftest.stderr ; then
436 wx_cv_version_script=no
438 wx_cv_version_script=yes
441 wx_cv_version_script=no
443 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
445 if test $wx_cv_version_script = yes ; then
446 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
452 dnl ===========================================================================
453 dnl "3rd party" macros included here because they are not widely available
454 dnl ===========================================================================
456 dnl ---------------------------------------------------------------------------
457 dnl test for availability of iconv()
458 dnl ---------------------------------------------------------------------------
460 dnl From Bruno Haible.
464 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
465 dnl those with the standalone portable GNU libiconv installed).
467 AC_ARG_WITH([libiconv-prefix],
468 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
469 for dir in `echo "$withval" | tr : ' '`; do
470 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
471 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
475 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
476 am_cv_func_iconv="no, consider installing GNU libiconv"
478 AC_TRY_LINK([#include <stdlib.h>
480 [iconv_t cd = iconv_open("","");
481 iconv(cd,NULL,NULL,NULL,NULL);
483 am_cv_func_iconv=yes)
484 if test "$am_cv_func_iconv" != yes; then
487 AC_TRY_LINK([#include <stdlib.h>
489 [iconv_t cd = iconv_open("","");
490 iconv(cd,NULL,NULL,NULL,NULL);
493 am_cv_func_iconv=yes)
497 if test "$am_cv_func_iconv" = yes; then
498 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
499 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
507 #if defined(__STDC__) || defined(__cplusplus)
508 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
514 wx_cv_func_iconv_const="no",
515 wx_cv_func_iconv_const="yes"
520 if test "x$wx_cv_func_iconv_const" = "xyes"; then
524 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
525 [Define as const if the declaration of iconv() needs const.])
528 if test "$am_cv_lib_iconv" = yes; then
534 dnl ---------------------------------------------------------------------------
535 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
536 dnl ---------------------------------------------------------------------------
538 dnl WX_SYS_LARGEFILE_TEST
540 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
541 dnl arithmetic properly but this failed miserably with gcc under Linux
542 dnl whereas the system still supports 64 bit files, so now simply check
543 dnl that off_t is big enough
544 define(WX_SYS_LARGEFILE_TEST,
546 unsigned int field: sizeof(off_t) == 8;
551 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
552 define(WX_SYS_LARGEFILE_MACRO_VALUE,
554 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
556 AC_TRY_COMPILE([#define $1 $2
557 #include <sys/types.h>],
558 WX_SYS_LARGEFILE_TEST,
564 if test "$$3" != no; then
566 AC_DEFINE_UNQUOTED([$1], [$$3])
573 dnl By default, many hosts won't let programs access large files;
574 dnl one must use special compiler options to get large-file access to work.
575 dnl For more details about this brain damage please see:
576 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
577 AC_DEFUN([AC_SYS_LARGEFILE],
578 [AC_ARG_ENABLE(largefile,
579 [ --disable-largefile omit support for large files])
580 if test "$enable_largefile" != no; then
581 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
582 dnl _LARGE_FILES -- for AIX
584 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
585 if test "x$wx_largefile" != "xyes"; then
586 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
589 AC_MSG_CHECKING(if large file support is available)
590 if test "x$wx_largefile" = "xyes"; then
591 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
593 AC_MSG_RESULT($wx_largefile)
598 dnl Available from the GNU Autoconf Macro Archive at:
599 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
601 AC_DEFUN([AC_CXX_CONST_CAST],
602 [AC_CACHE_CHECK(whether the compiler supports const_cast<>,
603 ac_cv_cxx_const_cast,
606 AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
607 ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
610 if test "$ac_cv_cxx_const_cast" = yes; then
611 AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
615 # Configure paths for GTK+
616 # Owen Taylor 1997-2001
618 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
619 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
620 dnl pass to pkg-config
622 AC_DEFUN(AM_PATH_GTK_2_0,
624 dnl Get the cflags and libraries from pkg-config
626 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
627 , enable_gtktest=yes)
629 pkg_config_args=gtk+-2.0
634 pkg_config_args="$pkg_config_args gthread-2.0"
641 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
643 if test x$PKG_CONFIG != xno ; then
644 if pkg-config --atleast-pkgconfig-version 0.7 ; then
647 echo *** pkg-config too old; version 0.7 or better required.
655 min_gtk_version=ifelse([$1], ,2.0.0,$1)
656 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
658 if test x$PKG_CONFIG != xno ; then
659 ## don't try to run the test against uninstalled libtool libs
660 if $PKG_CONFIG --uninstalled $pkg_config_args; then
661 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
665 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
672 if test x"$no_gtk" = x ; then
673 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
674 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
675 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
676 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
677 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
678 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
679 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
680 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
681 if test "x$enable_gtktest" = "xyes" ; then
682 ac_save_CFLAGS="$CFLAGS"
684 CFLAGS="$CFLAGS $GTK_CFLAGS"
685 LIBS="$GTK_LIBS $LIBS"
687 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
688 dnl checks the results of pkg-config to some extent)
699 int major, minor, micro;
702 system ("touch conf.gtktest");
704 /* HP/UX 9 (%@#!) writes to sscanf strings */
705 tmp_version = g_strdup("$min_gtk_version");
706 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
707 printf("%s, bad version string\n", "$min_gtk_version");
711 if ((gtk_major_version != $gtk_config_major_version) ||
712 (gtk_minor_version != $gtk_config_minor_version) ||
713 (gtk_micro_version != $gtk_config_micro_version))
715 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
716 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
717 gtk_major_version, gtk_minor_version, gtk_micro_version);
718 printf ("*** was found! If pkg-config was correct, then it is best\n");
719 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
720 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
721 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
722 printf("*** required on your system.\n");
723 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
724 printf("*** to point to the correct configuration files\n");
726 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
727 (gtk_minor_version != GTK_MINOR_VERSION) ||
728 (gtk_micro_version != GTK_MICRO_VERSION))
730 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
731 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
732 printf("*** library (version %d.%d.%d)\n",
733 gtk_major_version, gtk_minor_version, gtk_micro_version);
737 if ((gtk_major_version > major) ||
738 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
739 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
745 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
746 gtk_major_version, gtk_minor_version, gtk_micro_version);
747 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
748 major, minor, micro);
749 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
751 printf("*** If you have already installed a sufficiently new version, this error\n");
752 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
753 printf("*** being found. The easiest way to fix this is to remove the old version\n");
754 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
755 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
756 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
757 printf("*** so that the correct libraries are found at run-time))\n");
762 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
763 CFLAGS="$ac_save_CFLAGS"
767 if test "x$no_gtk" = x ; then
768 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
769 ifelse([$2], , :, [$2])
772 if test "$PKG_CONFIG" = "no" ; then
773 echo "*** A new enough version of pkg-config was not found."
774 echo "*** See http://pkgconfig.sourceforge.net"
776 if test -f conf.gtktest ; then
779 echo "*** Could not run GTK+ test program, checking why..."
780 ac_save_CFLAGS="$CFLAGS"
782 CFLAGS="$CFLAGS $GTK_CFLAGS"
783 LIBS="$LIBS $GTK_LIBS"
787 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
788 [ echo "*** The test program compiled, but did not run. This usually means"
789 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
790 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
791 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
792 echo "*** to the installed location Also, make sure you have run ldconfig if that"
793 echo "*** is required on your system"
795 echo "*** If you have an old version installed, it is best to remove it, although"
796 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
797 [ echo "*** The test program failed to compile or link. See the file config.log for the"
798 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
799 CFLAGS="$ac_save_CFLAGS"
805 ifelse([$3], , :, [$3])
812 # Configure paths for GTK+
813 # Owen Taylor 97-11-3
815 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
816 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
818 AC_DEFUN(AM_PATH_GTK,
820 dnl Get the cflags and libraries from the gtk-config script
822 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
823 gtk_config_prefix="$withval", gtk_config_prefix="")
824 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
825 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
826 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
827 , enable_gtktest=yes)
833 gtk_config_args="$gtk_config_args gthread"
838 if test x$gtk_config_exec_prefix != x ; then
839 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
840 if test x${GTK_CONFIG+set} != xset ; then
841 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
844 if test x$gtk_config_prefix != x ; then
845 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
846 if test x${GTK_CONFIG+set} != xset ; then
847 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
851 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
852 min_gtk_version=ifelse([$1], ,0.99.7,$1)
853 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
855 if test "$GTK_CONFIG" = "no" ; then
858 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
859 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
860 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
861 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
862 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
863 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
864 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
865 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
866 if test "x$enable_gtktest" = "xyes" ; then
867 ac_save_CFLAGS="$CFLAGS"
869 CFLAGS="$CFLAGS $GTK_CFLAGS"
870 LIBS="$GTK_LIBS $LIBS"
872 dnl Now check if the installed GTK is sufficiently new. (Also sanity
873 dnl checks the results of gtk-config to some extent
884 int major, minor, micro;
887 system ("touch conf.gtktest");
889 /* HP/UX 9 (%@#!) writes to sscanf strings */
890 tmp_version = g_strdup("$min_gtk_version");
891 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
892 printf("%s, bad version string\n", "$min_gtk_version");
896 if ((gtk_major_version != $gtk_config_major_version) ||
897 (gtk_minor_version != $gtk_config_minor_version) ||
898 (gtk_micro_version != $gtk_config_micro_version))
900 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
901 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
902 gtk_major_version, gtk_minor_version, gtk_micro_version);
903 printf ("*** was found! If gtk-config was correct, then it is best\n");
904 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
905 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
906 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
907 printf("*** required on your system.\n");
908 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
909 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
910 printf("*** before re-running configure\n");
912 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
913 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
914 (gtk_minor_version != GTK_MINOR_VERSION) ||
915 (gtk_micro_version != GTK_MICRO_VERSION))
917 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
918 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
919 printf("*** library (version %d.%d.%d)\n",
920 gtk_major_version, gtk_minor_version, gtk_micro_version);
922 #endif /* defined (GTK_MAJOR_VERSION) ... */
925 if ((gtk_major_version > major) ||
926 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
927 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
933 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
934 gtk_major_version, gtk_minor_version, gtk_micro_version);
935 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
936 major, minor, micro);
937 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
939 printf("*** If you have already installed a sufficiently new version, this error\n");
940 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
941 printf("*** being found. The easiest way to fix this is to remove the old version\n");
942 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
943 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
944 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
945 printf("*** so that the correct libraries are found at run-time))\n");
950 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
951 CFLAGS="$ac_save_CFLAGS"
955 if test "x$no_gtk" = x ; then
957 ifelse([$2], , :, [$2])
960 if test "$GTK_CONFIG" = "no" ; then
961 echo "*** The gtk-config script installed by GTK could not be found"
962 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
963 echo "*** your path, or set the GTK_CONFIG environment variable to the"
964 echo "*** full path to gtk-config."
966 if test -f conf.gtktest ; then
969 echo "*** Could not run GTK test program, checking why..."
970 CFLAGS="$CFLAGS $GTK_CFLAGS"
971 LIBS="$LIBS $GTK_LIBS"
975 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
976 [ echo "*** The test program compiled, but did not run. This usually means"
977 echo "*** that the run-time linker is not finding GTK or finding the wrong"
978 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
979 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
980 echo "*** to the installed location Also, make sure you have run ldconfig if that"
981 echo "*** is required on your system"
983 echo "*** If you have an old version installed, it is best to remove it, although"
984 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
986 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
987 echo "*** came with the system with the command"
989 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
990 [ echo "*** The test program failed to compile or link. See the file config.log for the"
991 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
992 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
993 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
994 CFLAGS="$ac_save_CFLAGS"
1000 ifelse([$3], , :, [$3])
1002 AC_SUBST(GTK_CFLAGS)
1008 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1009 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1010 dnl also defines GSTUFF_PKG_ERRORS on error
1011 AC_DEFUN(PKG_CHECK_MODULES, [
1014 if test -z "$PKG_CONFIG"; then
1015 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1018 if test "$PKG_CONFIG" = "no" ; then
1019 echo "*** The pkg-config script could not be found. Make sure it is"
1020 echo "*** in your path, or set the PKG_CONFIG environment variable"
1021 echo "*** to the full path to pkg-config."
1022 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1024 PKG_CONFIG_MIN_VERSION=0.9.0
1025 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1026 AC_MSG_CHECKING(for $2)
1028 if $PKG_CONFIG --exists "$2" ; then
1032 AC_MSG_CHECKING($1_CFLAGS)
1033 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1034 AC_MSG_RESULT($$1_CFLAGS)
1036 AC_MSG_CHECKING($1_LIBS)
1037 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1038 AC_MSG_RESULT($$1_LIBS)
1042 ## If we have a custom action on failure, don't print errors, but
1043 ## do set a variable so people can do so.
1044 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1045 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1051 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1052 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1056 if test $succeeded = yes; then
1057 ifelse([$3], , :, [$3])
1059 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])
1065 dnl ---------------------------------------------------------------------------
1066 dnl Support macros for makefiles generated by BAKEFILE.
1067 dnl ---------------------------------------------------------------------------
1069 dnl Lots of compiler & linker detection code contained here was taken from
1070 dnl wxWindows configure.in script (see http://www.wxwindows.org)
1074 dnl ---------------------------------------------------------------------------
1075 dnl AC_BAKEFILE_GNUMAKE
1077 dnl Detects GNU make
1078 dnl ---------------------------------------------------------------------------
1080 AC_DEFUN(AC_BAKEFILE_GNUMAKE,
1082 dnl does make support "-include" (only GNU make does AFAIK)?
1083 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
1085 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
1086 egrep -s GNU > /dev/null); then
1087 bakefile_cv_prog_makeisgnu="yes"
1089 bakefile_cv_prog_makeisgnu="no"
1093 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
1098 AC_SUBST(IF_GNU_MAKE)
1101 dnl ---------------------------------------------------------------------------
1102 dnl AC_BAKEFILE_PLATFORM
1104 dnl Detects platform and sets PLATFORM_XXX variables accordingly
1105 dnl ---------------------------------------------------------------------------
1107 AC_DEFUN(AC_BAKEFILE_PLATFORM,
1117 *-*-cygwin* | *-*-mingw32* )
1123 *-pc-os2_emx | *-pc-os2-emx )
1135 AC_SUBST(PLATFORM_UNIX)
1136 AC_SUBST(PLATFORM_WIN32)
1137 AC_SUBST(PLATFORM_MSDOS)
1138 AC_SUBST(PLATFORM_MAC)
1139 AC_SUBST(PLATFORM_MACOSX)
1140 AC_SUBST(PLATFORM_OS2)
1145 dnl ---------------------------------------------------------------------------
1146 dnl AC_BAKEFILE_SUFFIXES
1148 dnl Detects shared various suffixes for shared libraries, libraries, programs,
1150 dnl ---------------------------------------------------------------------------
1152 AC_DEFUN(AC_BAKEFILE_SUFFIXES,
1155 SO_SUFFIX_MODULE="so"
1164 SO_SUFFIX_MODULE="sl"
1168 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
1169 dnl Both archive libraries and shared libraries on AIX have an
1170 dnl .a extension. This will explain why you can't link with an
1171 dnl .so and why it works with the name changed to .a.
1173 SO_SUFFIX_MODULE="a"
1175 *-*-cygwin* | *-*-mingw32* )
1177 SO_SUFFIX_MODULE="dll"
1185 *-pc-os2_emx | *-pc-os2-emx )
1192 SO_SUFFIX_MODULE="bundle"
1197 AC_SUBST(SO_SUFFIX_MODULE)
1201 AC_SUBST(DLLPREFIX_MODULE)
1205 dnl ---------------------------------------------------------------------------
1206 dnl AC_BAKEFILE_SHARED_LD
1208 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
1209 dnl and SHARED_LD_CXX.
1210 dnl ---------------------------------------------------------------------------
1212 AC_DEFUN(AC_BAKEFILE_SHARED_LD,
1214 dnl Defaults for GCC and ELF .so shared libs:
1215 SHARED_LD_CC="\$(CC) -shared -o"
1216 SHARED_LD_CXX="\$(CXX) -shared -o"
1218 dnl the extra compiler flags needed for compilation of shared library
1219 if test "x$GCC" = "xyes"; then
1220 dnl the switch for gcc is the same under all platforms
1226 dnl default settings are good for gcc but not for the native HP-UX
1227 if test "x$GCC" = "xyes"; then
1228 dnl -o flag must be after PIC flag
1229 SHARED_LD_CC="${CC} -shared ${PIC_FLAG} -o"
1230 SHARED_LD_CXX="${CXX} -shared ${PIC_FLAG} -o"
1232 dnl no idea why it wants it, but it does
1233 LDFLAGS="$LDFLAGS -L/usr/lib"
1235 SHARED_LD_CC="${CC} -b -o"
1236 SHARED_LD_CXX="${CXX} -b -o"
1242 if test "x$GCC" != "xyes"; then
1243 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
1247 #ifndef __INTEL_COMPILER
1251 bakefile_cv_prog_icc=yes,
1252 bakefile_cv_prog_icc=no
1255 if test "$bakefile_cv_prog_icc" = "yes"; then
1262 if test "x$GCC" != xyes ; then
1263 SHARED_LD_CC="${CC} -G -o"
1264 SHARED_LD_CXX="${CXX} -G -o"
1270 dnl For Unix to MacOS X porting instructions, see:
1271 dnl http://fink.sourceforge.net/doc/porting/porting.html
1272 CFLAGS="$CFLAGS -fno-common"
1273 CXXFLAGS="$CXXFLAGS -fno-common"
1275 dnl Most apps benefit from being fully binded (its faster and static
1276 dnl variables initialized at startup work).
1277 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
1278 dnl or with a double stage link in order to create a single module
1279 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
1281 dnl If using newer dev tools then there is a -single_module flag that
1282 dnl we can use to do this, otherwise we'll need to use a helper
1283 dnl script. Check the version of gcc to see which way we can go:
1284 AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [
1287 #if (__GNUC__ < 3) || \
1288 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
1300 if test "$wx_cv_gcc31" = "no"; then
1301 cat <<EOF >shared-ld-sh
1303 #-----------------------------------------------------------------------------
1304 #-- Name: distrib/mac/shared-ld-sh
1305 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
1306 #-- Author: Gilles Depeyrot
1307 #-- Copyright: (c) 2002 Gilles Depeyrot
1308 #-- Licence: any use permitted
1309 #-----------------------------------------------------------------------------
1314 linking_flag="-dynamiclib"
1316 while test \${#} -gt 0; do
1323 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
1324 # collect these options and values
1325 args="\${args} \${1} \${2}"
1329 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
1330 # collect these options
1331 args="\${args} \${1}"
1334 -dynamiclib|-bundle)
1335 linking_flag="\${1}"
1339 echo "shared-ld: unhandled option '\${1}'"
1343 *.o | *.a | *.dylib)
1344 # collect object files
1345 objects="\${objects} \${1}"
1349 echo "shared-ld: unhandled argument '\${1}'"
1358 # Link one module containing all the others
1360 if test \${verbose} = 1; then
1361 echo "c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o"
1363 c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o
1365 if test \${status} != 0; then
1370 # Link the shared library from the single module created
1372 if test \${verbose} = 1; then
1373 echo "cc \${linking_flag} master.\$\$.o \${args}"
1375 c++ \${linking_flag} master.\$\$.o \${args}
1377 if test \${status} != 0; then
1382 # Remove intermediate module
1388 chmod +x shared-ld-sh
1390 dnl Use the shared-ld-sh helper script
1391 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
1392 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
1393 SHARED_LD_CXX="$SHARED_LD_CC"
1394 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
1396 dnl Use the -single_module flag and let the linker do it for us
1397 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
1398 SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
1399 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
1400 SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
1403 PIC_FLAG="-dynamic -fPIC"
1407 dnl default settings are ok for gcc
1408 if test "x$GCC" != "xyes"; then
1409 dnl the abs path below used to be hardcoded here so I guess it must
1410 dnl be some sort of standard location under AIX?
1411 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
1412 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
1413 dnl FIXME - what about makeCSharedLib?
1414 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
1415 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
1420 dnl can't use gcc under BeOS for shared library creation because it
1421 dnl complains about missing 'main'
1422 SHARED_LD_CC="${LD} -shared -o"
1423 SHARED_LD_CXX="${LD} -shared -o"
1427 dnl default settings are ok for gcc
1428 if test "x$GCC" != "xyes"; then
1433 *-*-cygwin* | *-*-mingw32* )
1437 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
1441 *-pc-os2_emx | *-pc-os2-emx | \
1447 AC_MSG_ERROR(unknown system type $host.)
1450 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
1451 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
1453 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
1454 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
1457 AC_SUBST(SHARED_LD_CC)
1458 AC_SUBST(SHARED_LD_CXX)
1459 AC_SUBST(SHARED_LD_MODULE_CC)
1460 AC_SUBST(SHARED_LD_MODULE_CXX)
1465 dnl ---------------------------------------------------------------------------
1466 dnl AC_BAKEFILE_SHARED_VERSIONS
1468 dnl Detects linker options for attaching versions (sonames) to shared libs.
1469 dnl ---------------------------------------------------------------------------
1471 AC_DEFUN(AC_BAKEFILE_SHARED_VERSIONS,
1482 SONAME_FLAG="-Wl,-soname,"
1502 AC_SUBST(USE_SOVERSION)
1503 AC_SUBST(USE_SOVERLINUX)
1504 AC_SUBST(USE_SOVERSOLARIS)
1505 AC_SUBST(USE_MACVERSION)
1506 AC_SUBST(USE_SOSYMLINKS)
1507 AC_SUBST(SONAME_FLAG)
1511 dnl ---------------------------------------------------------------------------
1512 dnl AC_BAKEFILE_DEPS
1514 dnl Detects available C/C++ dependency tracking options
1515 dnl ---------------------------------------------------------------------------
1517 AC_DEFUN(AC_BAKEFILE_DEPS,
1519 AC_MSG_CHECKING([for dependency tracking method])
1522 if test "x$GCC" = "xyes"; then
1527 dnl -cpp-precomp (the default) conflicts with -MMD option
1528 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
1529 DEPSFLAG_GCC="-no-cpp-precomp -MMD"
1535 AC_MSG_RESULT([gcc])
1537 AC_MSG_RESULT([none])
1540 if test $DEPS_TRACKING = 1 ; then
1544 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1545 # script. It is used to track C/C++ files dependencies in portable way.
1547 # Permission is given to use this file in any way.
1551 DEPSFLAG_GCC="$DEPSFLAG_GCC"
1555 if test \$DEPSMODE = gcc ; then
1556 \${*} \${DEPSFLAG_GCC}
1558 if test \${status} != 0 ; then
1561 # move created file to the location we want it in:
1562 while test \${#} -gt 0; do
1576 depfile=\`basename \$srcfile | sed -e 's/\..*$/.d/g'\`
1577 depobjname=\`echo \$depfile |sed -e 's/\.d/.o/g'\`
1578 if test -f \$depfile ; then
1579 sed -e "s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d
1582 depfile=\`basename \$objfile | sed -e 's/\..*$/.d/g'\`
1583 if test -f \$depfile ; then
1584 sed -e "/^\$objfile/!s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d
1597 AC_SUBST(DEPS_TRACKING)
1600 dnl ---------------------------------------------------------------------------
1601 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
1603 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
1605 dnl ---------------------------------------------------------------------------
1607 AC_DEFUN(AC_BAKEFILE_CHECK_BASIC_STUFF,
1616 AC_CHECK_TOOL(AR, ar, ar)
1617 AC_CHECK_TOOL(STRIP, strip, :)
1618 AC_CHECK_TOOL(NM, nm, :)
1624 *) INSTALL_DIR="$INSTALL -d"
1627 AC_SUBST(INSTALL_DIR)
1631 *-*-cygwin* | *-*-mingw32* )
1632 LDFLAGS_GUI="-Wl,--subsystem,windows -mwindows"
1634 AC_SUBST(LDFLAGS_GUI)
1638 dnl ---------------------------------------------------------------------------
1639 dnl AC_BAKEFILE_RES_COMPILERS
1641 dnl Checks for presence of resource compilers for win32 or mac
1642 dnl ---------------------------------------------------------------------------
1644 AC_DEFUN(AC_BAKEFILE_RES_COMPILERS,
1650 *-*-cygwin* | *-*-mingw32* )
1651 dnl Check for win32 resources compiler:
1652 if test "$build" != "$host" ; then
1653 RESCOMP=$host_alias-windres
1655 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
1660 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
1661 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
1669 dnl ---------------------------------------------------------------------------
1670 dnl AC_BAKEFILE_PRECOMP_HEADERS
1672 dnl Check for precompiled headers support (GCC >= 3.4)
1673 dnl ---------------------------------------------------------------------------
1675 AC_DEFUN(AC_BAKEFILE_PRECOMP_HEADERS,
1678 AC_ARG_ENABLE([precomp-headers],
1679 [ --disable-precomp-headers don't use precompiled headers even if compiler can],
1680 [bk_use_pch="$enableval"])
1684 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
1685 if test "x$GCC" = "xyes"; then
1686 dnl test if we have gcc-3.4:
1687 AC_MSG_CHECKING([if the compiler supports precompiled headers])
1690 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
1691 #error "no pch support"
1694 #error "no pch support"
1696 #if (__GNUC__ == 3) && \
1697 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
1698 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
1699 #error "no pch support"
1703 AC_MSG_RESULT([yes])
1704 dnl FIXME - this is temporary, till .gch dependencies
1705 dnl are fixed in generated Makefiles
1706 CPPFLAGS="-fpch-deps $CPPFLAGS"
1712 if test $GCC_PCH = 1 ; then
1713 cat <<EOF >bk-make-pch
1716 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1717 # script. It is used to generated precompiled headers.
1719 # Permission is given to use this file in any way.
1728 while test \${#} -gt 0; do
1731 incdir=\`echo \${1} | sed -e 's/-I\(.*\)/\1/g'\`
1732 if test "x\${headerfile}" = "x" -a -f "\${incdir}/\${header}" ; then
1733 headerfile="\${incdir}/\${header}"
1737 compiler="\${compiler} \${1}"
1741 if test "x\${headerfile}" = "x" ; then
1742 echo "error: can't find header \${header} in include paths" >2
1744 if test -f \${outfile} ; then
1747 mkdir -p \`dirname \${outfile}\`
1749 depsfile=".deps/\`basename \${outfile}\`.d"
1751 # can do this because gcc is >= 3.4:
1752 \${compiler} -o \${outfile} -MMD -MF "\${depsfile}" "\${headerfile}"
1756 chmod +x bk-make-pch
1766 dnl ---------------------------------------------------------------------------
1769 dnl To be used in configure.in of any project using Bakefile-generated mks
1770 dnl ---------------------------------------------------------------------------
1772 AC_DEFUN(AC_BAKEFILE,
1774 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
1775 AC_BAKEFILE_CHECK_BASIC_STUFF
1778 AC_BAKEFILE_PLATFORM
1779 AC_BAKEFILE_SUFFIXES
1780 AC_BAKEFILE_SHARED_LD
1781 AC_BAKEFILE_SHARED_VERSIONS
1783 AC_BAKEFILE_RES_COMPILERS
1785 builtin(include, autoconf_inc.m4)