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 ---------------------------------------------------------------------------
25 dnl ===========================================================================
26 dnl Objective-C(++) related macros
27 dnl ===========================================================================
28 m4_define([AC_WX_LANG_OBJECTIVEC],
33 m4_define([AC_WX_LANG_OBJECTIVECPLUSPLUS],
38 dnl ===========================================================================
39 dnl macros to find the a file in the list of include/lib paths
40 dnl ===========================================================================
42 dnl ---------------------------------------------------------------------------
43 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
44 dnl to the full name of the file that was found or leaves it empty if not found
45 dnl ---------------------------------------------------------------------------
46 AC_DEFUN([WX_PATH_FIND_INCLUDES],
49 for ac_dir in $1 /usr/include;
51 if test -f "$ac_dir/$2"; then
52 ac_find_includes=$ac_dir
58 dnl ---------------------------------------------------------------------------
59 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
60 dnl to the full name of the file that was found or leaves it empty if not found
61 dnl ---------------------------------------------------------------------------
62 AC_DEFUN([WX_PATH_FIND_LIBRARIES],
65 for ac_dir in $1 /usr/lib;
67 for ac_extension in a so sl dylib; do
68 if test -f "$ac_dir/lib$2.$ac_extension"; then
69 ac_find_libraries=$ac_dir
76 dnl ---------------------------------------------------------------------------
77 dnl Path to include, already defined
78 dnl ---------------------------------------------------------------------------
79 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
81 dnl never add -I/usr/include to the CPPFLAGS
82 if test "x$1" = "x/usr/include"; then
85 echo "$2" | grep "\-I$1" > /dev/null
87 if test $result = 0; then
90 ac_path_to_include=" -I$1"
95 dnl ---------------------------------------------------------------------------
96 dnl Path to link, already defined
97 dnl ---------------------------------------------------------------------------
98 AC_DEFUN([WX_LINK_PATH_EXIST],
100 echo "$2" | grep "\-L$1" > /dev/null
102 if test $result = 0; then
105 ac_path_to_link=" -L$1"
109 dnl ===========================================================================
110 dnl C++ features test
111 dnl ===========================================================================
113 dnl ---------------------------------------------------------------------------
114 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
115 dnl or only the old <iostream.h> one - it may be generally assumed that if
116 dnl <iostream> exists, the other "new" headers (without .h) exist too.
118 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false)
119 dnl ---------------------------------------------------------------------------
121 AC_DEFUN([WX_CPP_NEW_HEADERS],
126 AC_CHECK_HEADERS(iostream)
128 if test "$ac_cv_header_iostream" = "yes" ; then
129 ifelse([$1], , :, [$1])
131 ifelse([$2], , :, [$2])
137 dnl ---------------------------------------------------------------------------
138 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
140 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
141 dnl ---------------------------------------------------------------------------
143 AC_DEFUN([WX_CPP_BOOL],
145 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
169 if test "$wx_cv_cpp_bool" = "yes"; then
174 dnl ---------------------------------------------------------------------------
175 dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
176 dnl keyword and defines HAVE_EXPLICIT if this is the case
177 dnl ---------------------------------------------------------------------------
179 AC_DEFUN([WX_CPP_EXPLICIT],
181 AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
187 dnl do the test in 2 steps: first check that the compiler knows about the
188 dnl explicit keyword at all and then verify that it really honours it
191 class Foo { public: explicit Foo(int) {} };
199 class Foo { public: explicit Foo(int) {} };
200 static void TakeFoo(const Foo& foo) { }
216 if test "$wx_cv_explicit" = "yes"; then
217 AC_DEFINE(HAVE_EXPLICIT)
221 dnl ---------------------------------------------------------------------------
222 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
223 dnl ---------------------------------------------------------------------------
225 AC_DEFUN([WX_C_BIGENDIAN],
226 [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
227 [ac_cv_c_bigendian=unknown
228 # See if sys/param.h defines the BYTE_ORDER macro.
229 AC_TRY_COMPILE([#include <sys/types.h>
230 #include <sys/param.h>], [
231 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
233 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
234 AC_TRY_COMPILE([#include <sys/types.h>
235 #include <sys/param.h>], [
236 #if BYTE_ORDER != BIG_ENDIAN
238 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
239 if test $ac_cv_c_bigendian = unknown; then
240 AC_TRY_RUN([main () {
241 /* Are we little or big endian? From Harbison&Steele. */
245 char c[sizeof (long)];
248 exit (u.c[sizeof (long) - 1] == 1);
249 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
251 if test $ac_cv_c_bigendian = unknown; then
252 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])
254 if test $ac_cv_c_bigendian = yes; then
255 AC_DEFINE(WORDS_BIGENDIAN)
259 dnl ---------------------------------------------------------------------------
260 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
261 dnl ---------------------------------------------------------------------------
263 AC_DEFUN([WX_ARG_CACHE_INIT],
265 wx_arg_cache_file="configarg.cache"
266 echo "loading argument cache $wx_arg_cache_file"
267 rm -f ${wx_arg_cache_file}.tmp
268 touch ${wx_arg_cache_file}.tmp
269 touch ${wx_arg_cache_file}
272 AC_DEFUN([WX_ARG_CACHE_FLUSH],
274 echo "saving argument cache $wx_arg_cache_file"
275 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
278 dnl this macro checks for a three-valued command line --with argument:
279 dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
280 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
281 AC_DEFUN([WX_ARG_SYS_WITH],
283 AC_MSG_CHECKING([for --with-$1])
285 AC_ARG_WITH($1, [$2],
287 if test "$withval" = yes; then
288 ac_cv_use_$1='$3=yes'
289 elif test "$withval" = no; then
291 elif test "$withval" = sys; then
292 ac_cv_use_$1='$3=sys'
293 elif test "$withval" = builtin; then
294 ac_cv_use_$1='$3=builtin'
296 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
300 LINE=`grep "$3" ${wx_arg_cache_file}`
301 if test "x$LINE" != x ; then
307 ac_cv_use_$1='$3='$DEFAULT_$3
311 if test "$no_cache" != 1; then
312 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
315 if test "$$3" = yes; then
317 elif test "$$3" = no; then
319 elif test "$$3" = sys; then
320 AC_MSG_RESULT([system version])
321 elif test "$$3" = builtin; then
322 AC_MSG_RESULT([builtin version])
324 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
328 dnl this macro checks for a command line argument and caches the result
329 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
330 AC_DEFUN([WX_ARG_WITH],
332 AC_MSG_CHECKING([for --with-$1])
334 AC_ARG_WITH($1, [$2],
336 if test "$withval" = yes; then
337 ac_cv_use_$1='$3=yes'
343 LINE=`grep "$3" ${wx_arg_cache_file}`
344 if test "x$LINE" != x ; then
350 ac_cv_use_$1='$3='$DEFAULT_$3
354 if test "$no_cache" != 1; then
355 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
358 if test "$$3" = yes; then
365 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
366 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
368 dnl enablestring is a hack and allows to show "checking for --disable-foo"
369 dnl message when running configure instead of the default "checking for
370 dnl --enable-foo" one whih is useful for the options enabled by default
371 AC_DEFUN([WX_ARG_ENABLE],
374 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
376 AC_ARG_ENABLE($1, [$2],
378 if test "$enableval" = yes; then
379 ac_cv_use_$1='$3=yes'
385 LINE=`grep "$3" ${wx_arg_cache_file}`
386 if test "x$LINE" != x ; then
392 ac_cv_use_$1='$3='$DEFAULT_$3
396 if test "$no_cache" != 1; then
397 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
400 if test "$$3" = yes; then
408 dnl ===========================================================================
409 dnl Linker features test
410 dnl ===========================================================================
412 dnl ---------------------------------------------------------------------------
413 dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
414 dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
415 dnl version script file named versionfile
417 dnl call WX_VERSIONED_SYMBOLS(versionfile)
418 dnl ---------------------------------------------------------------------------
419 AC_DEFUN([WX_VERSIONED_SYMBOLS],
423 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
425 dnl dnl Check for known non-gcc cases:
426 dnl case "${host}" in
428 dnl if test "x$GCC" != "xyes" ; then
429 dnl LDFLAGS_VERSIONING="-M $1"
430 dnl found_versioning=yes
435 dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
436 if test $found_versioning = no ; then
437 AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
439 echo "VER_1 { *; };" >conftest.sym
440 echo "int main() { return 0; }" >conftest.cpp
443 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
444 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
445 if test -s conftest.stderr ; then
446 wx_cv_version_script=no
448 wx_cv_version_script=yes
451 wx_cv_version_script=no
454 dnl There's a problem in some old linkers with --version-script that
455 dnl can cause linking to fail when you have objects with vtables in
456 dnl libs 3 deep. This is known to happen in netbsd and openbsd with
459 dnl To test for this we need to make some shared libs and
460 dnl unfortunately we can't be sure of the right way to do that. If the
461 dnl first two compiles don't succeed then it looks like the test isn't
462 dnl working and the result is ignored, but if OTOH the first two
463 dnl succeed but the third does not then the bug has been detected and
464 dnl the --version-script flag is dropped.
465 if test $wx_cv_version_script = yes
467 echo "struct B { virtual ~B() { } }; \
468 struct D : public B { }; \
469 void F() { D d; }" > conftest.cpp
472 $CXX -shared -fPIC -o conftest1.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
473 -Wl,--version-script,conftest.sym >/dev/null 2>/dev/null]) &&
475 $CXX -shared -fPIC -o conftest2.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
476 -Wl,--version-script,conftest.sym conftest1.output >/dev/null 2>/dev/null])
479 $CXX -shared -fPIC -o conftest3.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
480 -Wl,--version-script,conftest.sym conftest2.output conftest1.output >/dev/null 2>/dev/null])
482 wx_cv_version_script=yes
484 wx_cv_version_script=no
489 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
490 rm -f conftest1.output conftest2.output conftest3.output
492 if test $wx_cv_version_script = yes ; then
493 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
499 dnl ===========================================================================
500 dnl "3rd party" macros included here because they are not widely available
501 dnl ===========================================================================
503 dnl ---------------------------------------------------------------------------
504 dnl test for availability of iconv()
505 dnl ---------------------------------------------------------------------------
507 dnl From Bruno Haible.
511 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
512 dnl those with the standalone portable GNU libiconv installed).
514 AC_ARG_WITH([libiconv-prefix],
515 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
516 for dir in `echo "$withval" | tr : ' '`; do
517 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
518 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
522 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
523 am_cv_func_iconv="no, consider installing GNU libiconv"
525 AC_TRY_LINK([#include <stdlib.h>
527 [iconv_t cd = iconv_open("","");
528 iconv(cd,NULL,NULL,NULL,NULL);
530 am_cv_func_iconv=yes)
531 if test "$am_cv_func_iconv" != yes; then
534 AC_TRY_LINK([#include <stdlib.h>
536 [iconv_t cd = iconv_open("","");
537 iconv(cd,NULL,NULL,NULL,NULL);
540 am_cv_func_iconv=yes)
544 if test "$am_cv_func_iconv" = yes; then
545 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
546 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
554 #if defined(__STDC__) || defined(__cplusplus)
555 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
561 wx_cv_func_iconv_const="no",
562 wx_cv_func_iconv_const="yes"
567 if test "x$wx_cv_func_iconv_const" = "xyes"; then
571 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
572 [Define as const if the declaration of iconv() needs const.])
575 if test "$am_cv_lib_iconv" = yes; then
581 dnl ---------------------------------------------------------------------------
582 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
583 dnl ---------------------------------------------------------------------------
585 dnl WX_SYS_LARGEFILE_TEST
587 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
588 dnl arithmetic properly but this failed miserably with gcc under Linux
589 dnl whereas the system still supports 64 bit files, so now simply check
590 dnl that off_t is big enough
591 define(WX_SYS_LARGEFILE_TEST,
593 unsigned int field: sizeof(off_t) == 8;
598 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
599 define(WX_SYS_LARGEFILE_MACRO_VALUE,
601 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
603 AC_TRY_COMPILE([#define $1 $2
604 #include <sys/types.h>],
605 WX_SYS_LARGEFILE_TEST,
611 if test "$$3" != no; then
613 AC_DEFINE_UNQUOTED([$1], [$$3])
620 dnl By default, many hosts won't let programs access large files;
621 dnl one must use special compiler options to get large-file access to work.
622 dnl For more details about this brain damage please see:
623 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
624 AC_DEFUN([AC_SYS_LARGEFILE],
625 [AC_ARG_ENABLE(largefile,
626 [ --disable-largefile omit support for large files])
627 if test "$enable_largefile" != no; then
628 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
629 dnl _LARGE_FILES -- for AIX
631 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
632 if test "x$wx_largefile" != "xyes"; then
633 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
636 AC_MSG_CHECKING(if large file support is available)
637 if test "x$wx_largefile" = "xyes"; then
638 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
640 AC_MSG_RESULT($wx_largefile)
645 dnl Available from the GNU Autoconf Macro Archive at:
646 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
648 AC_DEFUN([AC_CXX_CONST_CAST],
649 [AC_CACHE_CHECK(whether the compiler supports const_cast<>,
650 ac_cv_cxx_const_cast,
653 AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
654 ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
657 if test "$ac_cv_cxx_const_cast" = yes; then
658 AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
662 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html
663 AC_DEFUN([AC_CXX_REINTERPRET_CAST],
664 [AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
665 ac_cv_cxx_reinterpret_cast,
668 AC_TRY_COMPILE([#include <typeinfo>
669 class Base { public : Base () {} virtual void f () = 0;};
670 class Derived : public Base { public : Derived () {} virtual void f () {} };
671 class Unrelated { public : Unrelated () {} };
672 int g (Unrelated&) { return 0; }],[
673 Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
674 ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
677 if test "$ac_cv_cxx_reinterpret_cast" = yes; then
678 AC_DEFINE(HAVE_REINTERPRET_CAST,,
679 [define if the compiler supports reinterpret_cast<>])
683 dnl and http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html
684 AC_DEFUN([AC_CXX_STATIC_CAST],
685 [AC_CACHE_CHECK(whether the compiler supports static_cast<>,
686 ac_cv_cxx_static_cast,
689 AC_TRY_COMPILE([#include <typeinfo>
690 class Base { public : Base () {} virtual void f () = 0; };
691 class Derived : public Base { public : Derived () {} virtual void f () {} };
692 int g (Derived&) { return 0; }],[
693 Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
694 ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no)
697 if test "$ac_cv_cxx_static_cast" = yes; then
698 AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>])
702 dnl http://autoconf-archive.cryp.to/ac_cxx_dynamic_cast.html
703 AC_DEFUN([AC_CXX_DYNAMIC_CAST],
704 [AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
705 ac_cv_cxx_dynamic_cast,
708 AC_TRY_COMPILE([#include <typeinfo>
709 class Base { public : Base () {} virtual void f () = 0;};
710 class Derived : public Base { public : Derived () {} virtual void f () {} };],[
711 Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
712 ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
715 if test "$ac_cv_cxx_dynamic_cast" = yes; then
716 AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
721 dnl ---------------------------------------------------------------------------
722 dnl Compiler detection macros by David Elliott
723 dnl ---------------------------------------------------------------------------
726 dnl ===========================================================================
727 dnl Macros to detect non-GNU compilers (MetroWerks, XLC)
728 dnl ===========================================================================
730 dnl Based on autoconf _AC_LANG_COMPILER_GNU
731 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
732 [AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
733 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
734 [AC_TRY_COMPILE([],[#ifndef __MWERKS__
738 [bakefile_compiler_mwerks=yes],
739 [bakefile_compiler_mwerks=no])
740 bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
744 dnl Loosely based on autoconf AC_PROG_CC
745 dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
746 AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
748 _AC_BAKEFILE_LANG_COMPILER_MWERKS
749 MWCC=`test $bakefile_cv_c_compiler_mwerks = yes && echo yes`
753 dnl Loosely based on autoconf AC_PROG_CXX
754 dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
755 AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
757 _AC_BAKEFILE_LANG_COMPILER_MWERKS
758 MWCXX=`test $bakefile_cv_cxx_compiler_mwerks = yes && echo yes`
762 dnl Based on autoconf _AC_LANG_COMPILER_GNU
763 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_XLC],
764 [AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler],
765 [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc],
766 [AC_TRY_COMPILE([],[#ifndef __xlC__
770 [wx_compiler_xlc=yes],
771 [wx_compiler_xlc=no])
772 wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc
776 dnl Loosely based on autoconf AC_PROG_CC
777 AC_DEFUN([AC_BAKEFILE_PROG_XLCC],
779 _AC_BAKEFILE_LANG_COMPILER_XLC
780 XLCC=`test $wx_cv_c_compiler_xlc = yes && echo yes`
784 dnl Loosely based on autoconf AC_PROG_CXX
785 AC_DEFUN([AC_BAKEFILE_PROG_XLCXX],
787 _AC_BAKEFILE_LANG_COMPILER_XLC
788 XLCXX=`test $wx_cv_cxx_compiler_xlc = yes && echo yes`
793 dnl ===========================================================================
794 dnl macros to detect specialty compiler options
795 dnl ===========================================================================
797 dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
798 AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO],
799 [AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto,
800 dnl First create an empty conf test
801 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
802 dnl Now remove .o and .c.o or .cc.o
803 rm -f conftest.$ac_objext conftest.$ac_ext.o
804 dnl Now compile the test
805 AS_IF([AC_TRY_EVAL(ac_compile)],
806 dnl If the test succeeded look for conftest.c.o or conftest.cc.o
807 [for ac_file in `(ls conftest.* 2>/dev/null)`; do
810 wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
816 [AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
819 rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
820 ]) dnl AC_CACHE_CHECK
822 if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
823 if test "[]_AC_LANG_ABBREV[]" = "c"; then
824 CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
826 if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
827 CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
833 dnl ===========================================================================
834 dnl Macros to do all of the compiler detections as one macro
835 dnl ===========================================================================
836 AC_DEFUN([AC_BAKEFILE_PROG_CC],
839 AC_BAKEFILE_METROWERKS_EXTO
840 dnl By the time we find out that we need -ext o some tests have failed.
841 if test "x$wx_cv_c_exto" '!=' "x"; then
842 unset ac_cv_prog_cc_g
845 AC_BAKEFILE_PROG_MWCC
846 AC_BAKEFILE_PROG_XLCC
849 AC_DEFUN([AC_BAKEFILE_PROG_CXX],
852 AC_BAKEFILE_METROWERKS_EXTO
853 dnl By the time we find out that we need -ext o some tests have failed.
854 if test "x$wx_cv_cxx_exto" '!=' "x"; then
855 unset ac_cv_prog_cxx_g
858 AC_BAKEFILE_PROG_MWCXX
859 AC_BAKEFILE_PROG_XLCXX
863 # Configure paths for GTK+
864 # Owen Taylor 1997-2001
866 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
867 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
868 dnl pass to pkg-config
870 AC_DEFUN([AM_PATH_GTK_2_0],
872 dnl Get the cflags and libraries from pkg-config
874 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
875 , enable_gtktest=yes)
877 pkg_config_args=gtk+-2.0
882 pkg_config_args="$pkg_config_args gthread-2.0"
889 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
891 if test x$PKG_CONFIG != xno ; then
892 if pkg-config --atleast-pkgconfig-version 0.7 ; then
895 echo "*** pkg-config too old; version 0.7 or better required."
903 min_gtk_version=ifelse([$1], ,2.0.0,$1)
904 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
906 if test x$PKG_CONFIG != xno ; then
907 ## don't try to run the test against uninstalled libtool libs
908 if $PKG_CONFIG --uninstalled $pkg_config_args; then
909 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
913 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
920 if test x"$no_gtk" = x ; then
921 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
922 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
923 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
924 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
925 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
926 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
927 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
928 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
929 if test "x$enable_gtktest" = "xyes" ; then
930 ac_save_CFLAGS="$CFLAGS"
932 CFLAGS="$CFLAGS $GTK_CFLAGS"
933 LIBS="$GTK_LIBS $LIBS"
935 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
936 dnl checks the results of pkg-config to some extent)
947 int major, minor, micro;
950 system ("touch conf.gtktest");
952 /* HP/UX 9 (%@#!) writes to sscanf strings */
953 tmp_version = g_strdup("$min_gtk_version");
954 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
955 printf("%s, bad version string\n", "$min_gtk_version");
959 if ((gtk_major_version != $gtk_config_major_version) ||
960 (gtk_minor_version != $gtk_config_minor_version) ||
961 (gtk_micro_version != $gtk_config_micro_version))
963 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
964 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
965 gtk_major_version, gtk_minor_version, gtk_micro_version);
966 printf ("*** was found! If pkg-config was correct, then it is best\n");
967 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
968 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
969 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
970 printf("*** required on your system.\n");
971 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
972 printf("*** to point to the correct configuration files\n");
974 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
975 (gtk_minor_version != GTK_MINOR_VERSION) ||
976 (gtk_micro_version != GTK_MICRO_VERSION))
978 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
979 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
980 printf("*** library (version %d.%d.%d)\n",
981 gtk_major_version, gtk_minor_version, gtk_micro_version);
985 if ((gtk_major_version > major) ||
986 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
987 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
993 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
994 gtk_major_version, gtk_minor_version, gtk_micro_version);
995 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
996 major, minor, micro);
997 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
999 printf("*** If you have already installed a sufficiently new version, this error\n");
1000 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
1001 printf("*** being found. The easiest way to fix this is to remove the old version\n");
1002 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
1003 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
1004 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1005 printf("*** so that the correct libraries are found at run-time))\n");
1010 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1011 CFLAGS="$ac_save_CFLAGS"
1012 LIBS="$ac_save_LIBS"
1015 if test "x$no_gtk" = x ; then
1016 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
1017 ifelse([$2], , :, [$2])
1020 if test "$PKG_CONFIG" = "no" ; then
1021 echo "*** A new enough version of pkg-config was not found."
1022 echo "*** See http://pkgconfig.sourceforge.net"
1024 if test -f conf.gtktest ; then
1027 echo "*** Could not run GTK+ test program, checking why..."
1028 ac_save_CFLAGS="$CFLAGS"
1029 ac_save_LIBS="$LIBS"
1030 CFLAGS="$CFLAGS $GTK_CFLAGS"
1031 LIBS="$LIBS $GTK_LIBS"
1033 #include <gtk/gtk.h>
1035 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
1036 [ echo "*** The test program compiled, but did not run. This usually means"
1037 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
1038 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
1039 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1040 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1041 echo "*** is required on your system"
1043 echo "*** If you have an old version installed, it is best to remove it, although"
1044 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1045 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1046 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
1047 CFLAGS="$ac_save_CFLAGS"
1048 LIBS="$ac_save_LIBS"
1053 ifelse([$3], , :, [$3])
1055 AC_SUBST(GTK_CFLAGS)
1060 # Configure paths for GTK+
1061 # Owen Taylor 97-11-3
1063 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
1064 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
1066 AC_DEFUN(AM_PATH_GTK,
1068 dnl Get the cflags and libraries from the gtk-config script
1070 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
1071 gtk_config_prefix="$withval", gtk_config_prefix="")
1072 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
1073 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
1074 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1075 , enable_gtktest=yes)
1081 gtk_config_args="$gtk_config_args gthread"
1086 if test x$gtk_config_exec_prefix != x ; then
1087 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
1088 if test x${GTK_CONFIG+set} != xset ; then
1089 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
1092 if test x$gtk_config_prefix != x ; then
1093 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
1094 if test x${GTK_CONFIG+set} != xset ; then
1095 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
1099 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
1100 min_gtk_version=ifelse([$1], ,0.99.7,$1)
1101 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1103 if test "$GTK_CONFIG" = "no" ; then
1106 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
1107 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
1108 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
1109 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1110 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
1111 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1112 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
1113 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1114 if test "x$enable_gtktest" = "xyes" ; then
1115 ac_save_CFLAGS="$CFLAGS"
1116 ac_save_LIBS="$LIBS"
1117 CFLAGS="$CFLAGS $GTK_CFLAGS"
1118 LIBS="$GTK_LIBS $LIBS"
1120 dnl Now check if the installed GTK is sufficiently new. (Also sanity
1121 dnl checks the results of gtk-config to some extent
1125 #include <gtk/gtk.h>
1132 int major, minor, micro;
1135 system ("touch conf.gtktest");
1137 /* HP/UX 9 (%@#!) writes to sscanf strings */
1138 tmp_version = g_strdup("$min_gtk_version");
1139 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
1140 printf("%s, bad version string\n", "$min_gtk_version");
1144 if ((gtk_major_version != $gtk_config_major_version) ||
1145 (gtk_minor_version != $gtk_config_minor_version) ||
1146 (gtk_micro_version != $gtk_config_micro_version))
1148 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
1149 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
1150 gtk_major_version, gtk_minor_version, gtk_micro_version);
1151 printf ("*** was found! If gtk-config was correct, then it is best\n");
1152 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
1153 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1154 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1155 printf("*** required on your system.\n");
1156 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
1157 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
1158 printf("*** before re-running configure\n");
1160 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
1161 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
1162 (gtk_minor_version != GTK_MINOR_VERSION) ||
1163 (gtk_micro_version != GTK_MICRO_VERSION))
1165 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
1166 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
1167 printf("*** library (version %d.%d.%d)\n",
1168 gtk_major_version, gtk_minor_version, gtk_micro_version);
1170 #endif /* defined (GTK_MAJOR_VERSION) ... */
1173 if ((gtk_major_version > major) ||
1174 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1175 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
1181 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
1182 gtk_major_version, gtk_minor_version, gtk_micro_version);
1183 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
1184 major, minor, micro);
1185 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
1187 printf("*** If you have already installed a sufficiently new version, this error\n");
1188 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
1189 printf("*** being found. The easiest way to fix this is to remove the old version\n");
1190 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
1191 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
1192 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1193 printf("*** so that the correct libraries are found at run-time))\n");
1198 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1199 CFLAGS="$ac_save_CFLAGS"
1200 LIBS="$ac_save_LIBS"
1203 if test "x$no_gtk" = x ; then
1205 ifelse([$2], , :, [$2])
1208 if test "$GTK_CONFIG" = "no" ; then
1209 echo "*** The gtk-config script installed by GTK could not be found"
1210 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
1211 echo "*** your path, or set the GTK_CONFIG environment variable to the"
1212 echo "*** full path to gtk-config."
1214 if test -f conf.gtktest ; then
1217 echo "*** Could not run GTK test program, checking why..."
1218 CFLAGS="$CFLAGS $GTK_CFLAGS"
1219 LIBS="$LIBS $GTK_LIBS"
1221 #include <gtk/gtk.h>
1223 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
1224 [ echo "*** The test program compiled, but did not run. This usually means"
1225 echo "*** that the run-time linker is not finding GTK or finding the wrong"
1226 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
1227 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1228 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1229 echo "*** is required on your system"
1231 echo "*** If you have an old version installed, it is best to remove it, although"
1232 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1234 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
1235 echo "*** came with the system with the command"
1237 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
1238 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1239 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
1240 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
1241 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
1242 CFLAGS="$ac_save_CFLAGS"
1243 LIBS="$ac_save_LIBS"
1248 ifelse([$3], , :, [$3])
1250 AC_SUBST(GTK_CFLAGS)
1256 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1257 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1258 dnl also defines GSTUFF_PKG_ERRORS on error
1259 AC_DEFUN(PKG_CHECK_MODULES, [
1262 if test -z "$PKG_CONFIG"; then
1263 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1266 if test "$PKG_CONFIG" = "no" ; then
1267 echo "*** The pkg-config script could not be found. Make sure it is"
1268 echo "*** in your path, or set the PKG_CONFIG environment variable"
1269 echo "*** to the full path to pkg-config."
1270 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1272 PKG_CONFIG_MIN_VERSION=0.9.0
1273 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1274 AC_MSG_CHECKING(for $2)
1276 if $PKG_CONFIG --exists "$2" ; then
1280 AC_MSG_CHECKING($1_CFLAGS)
1281 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1282 AC_MSG_RESULT($$1_CFLAGS)
1284 AC_MSG_CHECKING($1_LIBS)
1285 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1286 AC_MSG_RESULT($$1_LIBS)
1290 ## If we have a custom action on failure, don't print errors, but
1291 ## do set a variable so people can do so.
1292 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1293 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1299 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1300 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1304 if test $succeeded = yes; then
1305 ifelse([$3], , :, [$3])
1307 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])
1313 # Configure paths for SDL
1314 # Sam Lantinga 9/21/99
1315 # stolen from Manish Singh
1316 # stolen back from Frank Belew
1317 # stolen from Manish Singh
1318 # Shamelessly stolen from Owen Taylor
1320 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1321 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
1323 AC_DEFUN([AM_PATH_SDL],
1325 dnl Get the cflags and libraries from the sdl-config script
1327 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
1328 sdl_prefix="$withval", sdl_prefix="")
1329 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
1330 sdl_exec_prefix="$withval", sdl_exec_prefix="")
1331 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
1332 , enable_sdltest=yes)
1334 if test x$sdl_exec_prefix != x ; then
1335 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
1336 if test x${SDL_CONFIG+set} != xset ; then
1337 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
1340 if test x$sdl_prefix != x ; then
1341 sdl_args="$sdl_args --prefix=$sdl_prefix"
1342 if test x${SDL_CONFIG+set} != xset ; then
1343 SDL_CONFIG=$sdl_prefix/bin/sdl-config
1347 AC_REQUIRE([AC_CANONICAL_TARGET])
1348 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
1349 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
1350 min_sdl_version=ifelse([$1], ,0.11.0,$1)
1351 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
1353 if test "$SDL_CONFIG" = "no" ; then
1356 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
1357 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
1359 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
1360 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1361 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
1362 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1363 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
1364 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1365 if test "x$enable_sdltest" = "xyes" ; then
1366 ac_save_CFLAGS="$CFLAGS"
1367 ac_save_CXXFLAGS="$CXXFLAGS"
1368 ac_save_LIBS="$LIBS"
1369 CFLAGS="$CFLAGS $SDL_CFLAGS"
1370 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1371 LIBS="$LIBS $SDL_LIBS"
1373 dnl Now check if the installed SDL is sufficiently new. (Also sanity
1374 dnl checks the results of sdl-config to some extent
1384 my_strdup (char *str)
1390 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
1391 strcpy (new_str, str);
1399 int main (int argc, char *argv[])
1401 int major, minor, micro;
1404 /* This hangs on some systems (?)
1405 system ("touch conf.sdltest");
1407 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
1409 /* HP/UX 9 (%@#!) writes to sscanf strings */
1410 tmp_version = my_strdup("$min_sdl_version");
1411 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
1412 printf("%s, bad version string\n", "$min_sdl_version");
1416 if (($sdl_major_version > major) ||
1417 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
1418 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
1424 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
1425 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
1426 printf("*** best to upgrade to the required version.\n");
1427 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
1428 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
1429 printf("*** config.cache before re-running configure\n");
1434 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1435 CFLAGS="$ac_save_CFLAGS"
1436 CXXFLAGS="$ac_save_CXXFLAGS"
1437 LIBS="$ac_save_LIBS"
1440 if test "x$no_sdl" = x ; then
1442 ifelse([$2], , :, [$2])
1445 if test "$SDL_CONFIG" = "no" ; then
1446 echo "*** The sdl-config script installed by SDL could not be found"
1447 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
1448 echo "*** your path, or set the SDL_CONFIG environment variable to the"
1449 echo "*** full path to sdl-config."
1451 if test -f conf.sdltest ; then
1454 echo "*** Could not run SDL test program, checking why..."
1455 CFLAGS="$CFLAGS $SDL_CFLAGS"
1456 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1457 LIBS="$LIBS $SDL_LIBS"
1462 int main(int argc, char *argv[])
1465 #define main K_and_R_C_main
1467 [ echo "*** The test program compiled, but did not run. This usually means"
1468 echo "*** that the run-time linker is not finding SDL or finding the wrong"
1469 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
1470 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1471 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1472 echo "*** is required on your system"
1474 echo "*** If you have an old version installed, it is best to remove it, although"
1475 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1476 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1477 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
1478 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
1479 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
1480 CFLAGS="$ac_save_CFLAGS"
1481 CXXFLAGS="$ac_save_CXXFLAGS"
1482 LIBS="$ac_save_LIBS"
1487 ifelse([$3], , :, [$3])
1489 AC_SUBST(SDL_CFLAGS)
1494 dnl Perform a check for a GStreamer element using gst-inspect
1495 dnl Thomas Vander Stichele <thomas at apestaart dot org>
1496 dnl Last modification: 25/01/2005
1498 dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
1500 AC_DEFUN([AM_GST_ELEMENT_CHECK],
1502 if test "x$GST_INSPECT" == "x"; then
1503 AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, [])
1506 if test "x$GST_INSPECT" != "x"; then
1507 AC_MSG_CHECKING(GStreamer element $1)
1508 if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then
1509 AC_MSG_RESULT(found.)
1512 AC_MSG_RESULT(not found.)
1518 dnl ---------------------------------------------------------------------------
1519 dnl Support macros for makefiles generated by BAKEFILE.
1520 dnl ---------------------------------------------------------------------------
1522 dnl Lots of compiler & linker detection code contained here was taken from
1523 dnl wxWindows configure.in script (see http://www.wxwindows.org)
1527 dnl ---------------------------------------------------------------------------
1528 dnl AC_BAKEFILE_GNUMAKE
1530 dnl Detects GNU make
1531 dnl ---------------------------------------------------------------------------
1533 AC_DEFUN([AC_BAKEFILE_GNUMAKE],
1535 dnl does make support "-include" (only GNU make does AFAIK)?
1536 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
1538 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
1539 egrep -s GNU > /dev/null); then
1540 bakefile_cv_prog_makeisgnu="yes"
1542 bakefile_cv_prog_makeisgnu="no"
1546 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
1551 AC_SUBST(IF_GNU_MAKE)
1554 dnl ---------------------------------------------------------------------------
1555 dnl AC_BAKEFILE_PLATFORM
1557 dnl Detects platform and sets PLATFORM_XXX variables accordingly
1558 dnl ---------------------------------------------------------------------------
1560 AC_DEFUN([AC_BAKEFILE_PLATFORM],
1571 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
1572 case "${BAKEFILE_HOST}" in
1573 *-*-cygwin* | *-*-mingw32* )
1579 *-pc-os2_emx | *-pc-os2-emx )
1589 powerpc-apple-macos* )
1594 if test "$wxUSE_WINE" = "yes"; then
1602 case "$BAKEFILE_FORCE_PLATFORM" in
1623 AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
1628 AC_SUBST(PLATFORM_UNIX)
1629 AC_SUBST(PLATFORM_WIN32)
1630 AC_SUBST(PLATFORM_MSDOS)
1631 AC_SUBST(PLATFORM_MAC)
1632 AC_SUBST(PLATFORM_MACOS)
1633 AC_SUBST(PLATFORM_MACOSX)
1634 AC_SUBST(PLATFORM_OS2)
1635 AC_SUBST(PLATFORM_BEOS)
1639 dnl ---------------------------------------------------------------------------
1640 dnl AC_BAKEFILE_PLATFORM_SPECIFICS
1642 dnl Sets misc platform-specific settings
1643 dnl ---------------------------------------------------------------------------
1645 AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
1647 AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
1648 [use OMF object format (OS/2)]),
1649 [bk_os2_use_omf="$enableval"])
1651 case "${BAKEFILE_HOST}" in
1653 dnl For Unix to MacOS X porting instructions, see:
1654 dnl http://fink.sourceforge.net/doc/porting/porting.html
1655 CFLAGS="$CFLAGS -fno-common"
1656 CXXFLAGS="$CXXFLAGS -fno-common"
1659 *-pc-os2_emx | *-pc-os2-emx )
1660 if test "x$bk_os2_use_omf" = "xyes" ; then
1663 LDFLAGS="-Zomf $LDFLAGS"
1664 CFLAGS="-Zomf $CFLAGS"
1665 CXXFLAGS="-Zomf $CXXFLAGS"
1673 LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
1678 dnl ---------------------------------------------------------------------------
1679 dnl AC_BAKEFILE_SUFFIXES
1681 dnl Detects shared various suffixes for shared libraries, libraries, programs,
1683 dnl ---------------------------------------------------------------------------
1685 AC_DEFUN([AC_BAKEFILE_SUFFIXES],
1688 SO_SUFFIX_MODULE="so"
1696 case "${BAKEFILE_HOST}" in
1699 SO_SUFFIX_MODULE="sl"
1703 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
1704 dnl Both archive libraries and shared libraries on AIX have an
1705 dnl .a extension. This will explain why you can't link with an
1706 dnl .so and why it works with the name changed to .a.
1708 SO_SUFFIX_MODULE="a"
1710 *-*-cygwin* | *-*-mingw32* )
1712 SO_SUFFIX_MODULE="dll"
1713 DLLIMP_SUFFIX="dll.a"
1721 *-pc-os2_emx | *-pc-os2-emx )
1723 SO_SUFFIX_MODULE="dll"
1724 DLLIMP_SUFFIX=$OS2_LIBEXT
1728 LIBEXT=".$OS2_LIBEXT"
1732 SO_SUFFIX_MODULE="bundle"
1736 if test "x$DLLIMP_SUFFIX" = "x" ; then
1737 DLLIMP_SUFFIX="$SO_SUFFIX"
1741 AC_SUBST(SO_SUFFIX_MODULE)
1742 AC_SUBST(DLLIMP_SUFFIX)
1747 AC_SUBST(DLLPREFIX_MODULE)
1751 dnl ---------------------------------------------------------------------------
1752 dnl AC_BAKEFILE_SHARED_LD
1754 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
1755 dnl and SHARED_LD_CXX.
1756 dnl ---------------------------------------------------------------------------
1758 AC_DEFUN([AC_BAKEFILE_SHARED_LD],
1760 dnl the extra compiler flags needed for compilation of shared library
1762 if test "x$GCC" = "xyes"; then
1763 dnl the switch for gcc is the same under all platforms
1767 dnl Defaults for GCC and ELF .so shared libs:
1768 SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
1769 SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
1771 case "${BAKEFILE_HOST}" in
1773 dnl default settings are good for gcc but not for the native HP-UX
1774 if test "x$GCC" != "xyes"; then
1775 dnl no idea why it wants it, but it does
1776 LDFLAGS="$LDFLAGS -L/usr/lib"
1778 SHARED_LD_CC="${CC} -b -o"
1779 SHARED_LD_CXX="${CXX} -b -o"
1785 if test "x$GCC" != "xyes"; then
1786 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
1790 #ifndef __INTEL_COMPILER
1794 bakefile_cv_prog_icc=yes,
1795 bakefile_cv_prog_icc=no
1798 if test "$bakefile_cv_prog_icc" = "yes"; then
1805 if test "x$GCC" != xyes ; then
1806 SHARED_LD_CC="${CC} -G -o"
1807 SHARED_LD_CXX="${CXX} -G -o"
1813 dnl Most apps benefit from being fully binded (its faster and static
1814 dnl variables initialized at startup work).
1815 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
1816 dnl or with a double stage link in order to create a single module
1817 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
1819 dnl If using newer dev tools then there is a -single_module flag that
1820 dnl we can use to do this, otherwise we'll need to use a helper
1821 dnl script. Check the version of gcc to see which way we can go:
1822 AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [
1825 #if (__GNUC__ < 3) || \
1826 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
1838 if test "$wx_cv_gcc31" = "no"; then
1839 AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
1840 chmod +x shared-ld-sh
1842 dnl Use the shared-ld-sh helper script
1843 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
1844 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
1845 SHARED_LD_CXX="$SHARED_LD_CC"
1846 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
1848 dnl Use the -single_module flag and let the linker do it for us
1849 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
1850 SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
1851 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
1852 SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
1855 PIC_FLAG="-dynamic -fPIC"
1859 dnl default settings are ok for gcc
1860 if test "x$GCC" != "xyes"; then
1861 dnl the abs path below used to be hardcoded here so I guess it must
1862 dnl be some sort of standard location under AIX?
1863 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
1864 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
1865 dnl FIXME - what about makeCSharedLib?
1866 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
1867 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
1872 dnl can't use gcc under BeOS for shared library creation because it
1873 dnl complains about missing 'main'
1874 SHARED_LD_CC="${LD} -nostart -o"
1875 SHARED_LD_CXX="${LD} -nostart -o"
1879 dnl default settings are ok for gcc
1880 if test "x$GCC" != "xyes"; then
1885 *-*-cygwin* | *-*-mingw32* )
1887 SHARED_LD_CC="\$(CC) -shared -o"
1888 SHARED_LD_CXX="\$(CXX) -shared -o"
1891 *-pc-os2_emx | *-pc-os2-emx )
1892 SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1893 SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1895 AC_BAKEFILE_CREATE_FILE_DLLAR_SH
1899 powerpc-apple-macos* | \
1900 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
1910 AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
1913 if test "x$PIC_FLAG" != "x" ; then
1914 PIC_FLAG="$PIC_FLAG -DPIC"
1917 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
1918 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
1920 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
1921 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
1924 AC_SUBST(SHARED_LD_CC)
1925 AC_SUBST(SHARED_LD_CXX)
1926 AC_SUBST(SHARED_LD_MODULE_CC)
1927 AC_SUBST(SHARED_LD_MODULE_CXX)
1932 dnl ---------------------------------------------------------------------------
1933 dnl AC_BAKEFILE_SHARED_VERSIONS
1935 dnl Detects linker options for attaching versions (sonames) to shared libs.
1936 dnl ---------------------------------------------------------------------------
1938 AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
1947 case "${BAKEFILE_HOST}" in
1948 *-*-linux* | *-*-freebsd* )
1949 SONAME_FLAG="-Wl,-soname,"
1969 AC_SUBST(USE_SOVERSION)
1970 AC_SUBST(USE_SOVERLINUX)
1971 AC_SUBST(USE_SOVERSOLARIS)
1972 AC_SUBST(USE_MACVERSION)
1973 AC_SUBST(USE_SOSYMLINKS)
1974 AC_SUBST(SONAME_FLAG)
1978 dnl ---------------------------------------------------------------------------
1979 dnl AC_BAKEFILE_DEPS
1981 dnl Detects available C/C++ dependency tracking options
1982 dnl ---------------------------------------------------------------------------
1984 AC_DEFUN([AC_BAKEFILE_DEPS],
1986 AC_MSG_CHECKING([for dependency tracking method])
1989 if test "x$GCC" = "xyes"; then
1992 case "${BAKEFILE_HOST}" in
1994 dnl -cpp-precomp (the default) conflicts with -MMD option
1995 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
1996 DEPSFLAG_GCC="-no-cpp-precomp -MMD"
2002 AC_MSG_RESULT([gcc])
2003 elif test "x$MWCC" = "xyes"; then
2007 AC_MSG_RESULT([mwcc])
2009 AC_MSG_RESULT([none])
2012 if test $DEPS_TRACKING = 1 ; then
2013 AC_BAKEFILE_CREATE_FILE_BK_DEPS
2017 AC_SUBST(DEPS_TRACKING)
2020 dnl ---------------------------------------------------------------------------
2021 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
2023 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
2025 dnl ---------------------------------------------------------------------------
2027 AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
2036 AC_CHECK_TOOL(AR, ar, ar)
2037 AC_CHECK_TOOL(STRIP, strip, :)
2038 AC_CHECK_TOOL(NM, nm, :)
2040 case ${BAKEFILE_HOST} in
2042 dnl HP-UX install doesn't handle the "-d" switch so don't
2044 INSTALL_DIR="mkdir -p"
2046 *) INSTALL_DIR="$INSTALL -d"
2049 AC_SUBST(INSTALL_DIR)
2052 case ${BAKEFILE_HOST} in
2053 *-*-cygwin* | *-*-mingw32* )
2054 LDFLAGS_GUI="-mwindows"
2056 AC_SUBST(LDFLAGS_GUI)
2060 dnl ---------------------------------------------------------------------------
2061 dnl AC_BAKEFILE_RES_COMPILERS
2063 dnl Checks for presence of resource compilers for win32 or mac
2064 dnl ---------------------------------------------------------------------------
2066 AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
2071 case ${BAKEFILE_HOST} in
2072 *-*-cygwin* | *-*-mingw32* )
2073 dnl Check for win32 resources compiler:
2074 if test "$build" != "$host" ; then
2075 RESCOMP=$host_alias-windres
2077 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
2081 *-*-darwin* | powerpc-apple-macos* )
2082 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
2083 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
2091 dnl ---------------------------------------------------------------------------
2092 dnl AC_BAKEFILE_PRECOMP_HEADERS
2094 dnl Check for precompiled headers support (GCC >= 3.4)
2095 dnl ---------------------------------------------------------------------------
2097 AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
2100 AC_ARG_ENABLE([precomp-headers],
2101 AS_HELP_STRING([--disable-precomp-headers],
2102 [don't use precompiled headers even if compiler can]),
2103 [bk_use_pch="$enableval"])
2107 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
2108 if test "x$GCC" = "xyes"; then
2109 dnl test if we have gcc-3.4:
2110 AC_MSG_CHECKING([if the compiler supports precompiled headers])
2113 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
2114 #error "no pch support"
2117 #error "no pch support"
2119 #if (__GNUC__ == 3) && \
2120 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
2121 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
2122 #error "no pch support"
2126 AC_MSG_RESULT([yes])
2132 if test $GCC_PCH = 1 ; then
2133 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
2134 chmod +x bk-make-pch
2144 dnl ---------------------------------------------------------------------------
2145 dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
2147 dnl To be used in configure.in of any project using Bakefile-generated mks
2149 dnl Behaviour can be modified by setting following variables:
2150 dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
2151 dnl to perform check for basic tools like ranlib
2152 dnl BAKEFILE_HOST set this to override host detection, defaults
2154 dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
2158 dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
2160 dnl (replace FOO with m4_include above, aclocal would die otherwise)
2161 dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
2163 dnl ---------------------------------------------------------------------------
2165 AC_DEFUN([AC_BAKEFILE],
2169 if test "x$BAKEFILE_HOST" = "x"; then
2170 BAKEFILE_HOST="${host}"
2173 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
2174 AC_BAKEFILE_CHECK_BASIC_STUFF
2177 AC_BAKEFILE_PLATFORM
2178 AC_BAKEFILE_PLATFORM_SPECIFICS
2179 AC_BAKEFILE_SUFFIXES
2180 AC_BAKEFILE_SHARED_LD
2181 AC_BAKEFILE_SHARED_VERSIONS
2183 AC_BAKEFILE_RES_COMPILERS
2185 BAKEFILE_BAKEFILE_M4_VERSION="0.1.8"
2187 dnl includes autoconf_inc.m4:
2190 if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
2191 AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
2196 dnl ---------------------------------------------------------------------------
2197 dnl Embedded copies of helper scripts follow:
2198 dnl ---------------------------------------------------------------------------
2200 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
2202 dnl ===================== dllar.sh begins here =====================
2203 dnl (Created by merge-scripts.py from dllar.sh
2204 dnl file do not edit here!)
2209 # dllar - a tool to build both a .dll and an .a file
2210 # from a set of object (.o) files for EMX/OS2.
2212 # Written by Andrew Zabolotny, bit@freya.etu.ru
2213 # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
2215 # This script will accept a set of files on the command line.
2216 # All the public symbols from the .o files will be exported into
2217 # a .DEF file, then linker will be run (through gcc) against them to
2218 # build a shared library consisting of all given .o files. All libraries
2219 # (.a) will be first decompressed into component .o files then act as
2220 # described above. You can optionally give a description (-d "description")
2221 # which will be put into .DLL. To see the list of accepted options (as well
2222 # as command-line format) simply run this program without options. The .DLL
2223 # is built to be imported by name (there is no guarantee that new versions
2224 # of the library you build will have same ordinals for same symbols).
2226 # dllar is free software; you can redistribute it and/or modify
2227 # it under the terms of the GNU General Public License as published by
2228 # the Free Software Foundation; either version 2, or (at your option)
2229 # any later version.
2231 # dllar is distributed in the hope that it will be useful,
2232 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2233 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2234 # GNU General Public License for more details.
2236 # You should have received a copy of the GNU General Public License
2237 # along with dllar; see the file COPYING. If not, write to the Free
2238 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2241 # To successfuly run this program you will need:
2242 # - Current drive should have LFN support (HPFS, ext2, network, etc)
2243 # (Sometimes dllar generates filenames which won't fit 8.3 scheme)
2245 # (used to build the .dll)
2247 # (used to create .def file from .o files)
2249 # (used to create .a file from .def file)
2250 # - GNU text utilites (cat, sort, uniq)
2251 # used to process emxexp output
2252 # - GNU file utilities (mv, rm)
2254 # - lxlite (optional, see flag below)
2255 # (used for general .dll cleanup)
2262 # basnam, variant of basename, which does _not_ remove the path, _iff_
2263 # second argument (suffix to remove) is given
2267 echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
2270 echo ${D}1 | sed 's/'${D}2'${D}//'
2273 echo "error in basnam ${D}*"
2279 # Cleanup temporary files and output
2282 for i in ${D}inputFiles ; do
2285 rm -rf \`basnam ${D}i !\`
2292 # Kill result in case of failure as there is just to many stupid make/nmake
2293 # things out there which doesn't do this.
2294 if @<:@ ${D}# -eq 0 @:>@; then
2295 rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
2299 # Print usage and exit script with rc=1.
2301 echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
2302 echo ' @<:@-name-mangler-script script.sh@:>@'
2303 echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
2304 echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
2305 echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
2306 echo ' @<:@*.o@:>@ @<:@*.a@:>@'
2307 echo '*> "output_file" should have no extension.'
2308 echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
2309 echo ' The import library name is derived from this and is set to "name".a,'
2310 echo ' unless overridden by -import'
2311 echo '*> "importlib_name" should have no extension.'
2312 echo ' If it has the .o, or .a extension, it is automatically removed.'
2313 echo ' This name is used as the import library name and may be longer and'
2314 echo ' more descriptive than the DLL name which has to follow the old '
2315 echo ' 8.3 convention of FAT.'
2316 echo '*> "script.sh may be given to override the output_file name by a'
2317 echo ' different name. It is mainly useful if the regular make process'
2318 echo ' of some package does not take into account OS/2 restriction of'
2319 echo ' DLL name lengths. It takes the importlib name as input and is'
2320 echo ' supposed to procude a shorter name as output. The script should'
2321 echo ' expect to get importlib_name without extension and should produce'
2322 echo ' a (max.) 8 letter name without extension.'
2323 echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
2324 echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
2325 echo ' These flags will be put at the start of GCC command line.'
2326 echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
2327 echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
2328 echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
2329 echo ' If the last character of a symbol is "*", all symbols beginning'
2330 echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
2331 echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
2332 echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
2333 echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
2334 echo ' C runtime DLLs.'
2335 echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
2336 echo '*> All other switches (for example -L./ or -lmylib) will be passed'
2337 echo ' unchanged to GCC at the end of command line.'
2338 echo '*> If you create a DLL from a library and you do not specify -o,'
2339 echo ' the basename for DLL and import library will be set to library name,'
2340 echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
2341 echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
2342 echo ' library will be renamed into gcc_s.a.'
2345 echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
2346 echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
2351 # Execute a command.
2352 # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
2353 # @Uses Whatever CleanUp() uses.
2359 if @<:@ ${D}rcCmd -ne 0 @:>@; then
2360 echo "command failed, exit code="${D}rcCmd
2375 CFLAGS="-s -Zcrtdll"
2377 EXPORT_BY_ORDINALS=0
2386 curDirS=${D}{curDirS}"/"
2392 while @<:@ ${D}1 @:>@; do
2395 EXPORT_BY_ORDINALS=1;
2405 -name-mangler-script)
2426 exclude_symbols=${D}{exclude_symbols}${D}1" "
2430 library_flags=${D}{library_flags}${D}1" "
2449 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
2452 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`"
2453 if @<:@ ${D}omfLinking -eq 1 @:>@; then
2454 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib"
2456 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a"
2461 if @<:@ ${D}libsToLink -ne 0 @:>@; then
2462 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
2464 for file in ${D}1 ; do
2465 if @<:@ -f ${D}file @:>@; then
2466 inputFiles="${D}{inputFiles} ${D}file"
2470 if @<:@ ${D}found -eq 0 @:>@; then
2471 echo "ERROR: No file(s) found: "${D}1
2478 done # iterate cmdline words
2481 if @<:@ -z "${D}inputFiles" @:>@; then
2482 echo "dllar: no input files"
2486 # Now extract all .o files from .a files
2488 for file in ${D}inputFiles ; do
2499 EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
2504 dirname=\`basnam ${D}file ${D}suffix\`"_%"
2506 if @<:@ ${D}? -ne 0 @:>@; then
2507 echo "Failed to create subdirectory ./${D}dirname"
2511 # Append '!' to indicate archive
2512 newInputFiles="${D}newInputFiles ${D}{dirname}!"
2513 doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
2516 for subfile in ${D}dirname/*.o* ; do
2517 if @<:@ -f ${D}subfile @:>@; then
2519 if @<:@ -s ${D}subfile @:>@; then
2520 # FIXME: This should be: is file size > 32 byte, _not_ > 0!
2521 newInputFiles="${D}newInputFiles ${D}subfile"
2525 if @<:@ ${D}found -eq 0 @:>@; then
2526 echo "WARNING: there are no files in archive \\'${D}file\\'"
2530 newInputFiles="${D}{newInputFiles} ${D}file"
2534 inputFiles="${D}newInputFiles"
2536 # Output filename(s).
2538 if @<:@ -z ${D}outFile @:>@; then
2540 set outFile ${D}inputFiles; outFile=${D}2
2543 # If it is an archive, remove the '!' and the '_%' suffixes
2546 outFile=\`basnam ${D}outFile _%!\`
2553 outFile=\`basnam ${D}outFile .dll\`
2556 outFile=\`basnam ${D}outFile .DLL\`
2559 outFile=\`basnam ${D}outFile .o\`
2562 outFile=\`basnam ${D}outFile .obj\`
2565 outFile=\`basnam ${D}outFile .a\`
2568 outFile=\`basnam ${D}outFile .lib\`
2573 case ${D}outimpFile in
2575 outimpFile=\`basnam ${D}outimpFile .a\`
2578 outimpFile=\`basnam ${D}outimpFile .lib\`
2583 if @<:@ -z ${D}outimpFile @:>@; then
2584 outimpFile=${D}outFile
2586 defFile="${D}{outFile}.def"
2587 arcFile="${D}{outimpFile}.a"
2588 arcFile2="${D}{outimpFile}.lib"
2590 #create ${D}dllFile as something matching 8.3 restrictions,
2591 if @<:@ -z ${D}renameScript @:>@ ; then
2592 dllFile="${D}outFile"
2594 dllFile=\`${D}renameScript ${D}outimpFile\`
2597 if @<:@ ${D}do_backup -ne 0 @:>@ ; then
2598 if @<:@ -f ${D}arcFile @:>@ ; then
2599 doCommand "mv ${D}arcFile ${D}{outFile}_s.a"
2601 if @<:@ -f ${D}arcFile2 @:>@ ; then
2602 doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib"
2606 # Extract public symbols from all the object files.
2607 tmpdefFile=${D}{defFile}_%
2608 rm -f ${D}tmpdefFile
2609 for file in ${D}inputFiles ; do
2614 doCommand "emxexp -u ${D}file >> ${D}tmpdefFile"
2619 # Create the def file.
2621 echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile
2622 dllFile="${D}{dllFile}.dll"
2623 if @<:@ ! -z ${D}description @:>@; then
2624 echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile
2626 echo "EXPORTS" >> ${D}defFile
2628 doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%"
2629 grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile
2631 # Checks if the export is ok or not.
2632 for word in ${D}exclude_symbols; do
2633 grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}%
2634 mv ${D}{tmpdefFile}% ${D}tmpdefFile
2638 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
2639 sed "=" < ${D}tmpdefFile | \\
2643 s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/
2645 ' > ${D}{tmpdefFile}%
2646 grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile
2648 rm -f ${D}{tmpdefFile}%
2650 cat ${D}tmpdefFile >> ${D}defFile
2651 rm -f ${D}tmpdefFile
2653 # Do linking, create implib, and apply lxlite.
2655 for file in ${D}inputFiles ; do
2660 gccCmdl="${D}gccCmdl ${D}file"
2664 doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS"
2665 touch "${D}{outFile}.dll"
2667 doCommand "emximp -o ${D}arcFile ${D}defFile"
2668 if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then
2670 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
2673 doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile"
2675 doCommand "emxomf -s -l ${D}arcFile"
2681 dnl ===================== dllar.sh ends here =====================
2684 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
2686 dnl ===================== bk-deps begins here =====================
2687 dnl (Created by merge-scripts.py from bk-deps
2688 dnl file do not edit here!)
2693 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2694 # script. It is used to track C/C++ files dependencies in portable way.
2696 # Permission is given to use this file in any way.
2698 DEPSMODE=${DEPSMODE}
2700 DEPSFLAG_GCC="${DEPSFLAG_GCC}"
2701 DEPSFLAG_MWCC="${DEPSFLAG_MWCC}"
2703 mkdir -p ${D}DEPSDIR
2705 if test ${D}DEPSMODE = gcc ; then
2706 ${D}* ${D}{DEPSFLAG_GCC}
2708 if test ${D}{status} != 0 ; then
2711 # move created file to the location we want it in:
2712 while test ${D}# -gt 0; do
2726 depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\`
2727 depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\`
2728 if test -f ${D}depfile ; then
2729 sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
2732 depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\`
2733 if test -f ${D}depfile ; then
2734 sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
2739 elif test ${D}DEPSMODE = mwcc ; then
2742 if test ${D}{status} != 0 ; then
2745 # Run mwcc again with -MM and redirect into the dep file we want
2746 # NOTE: We can't use shift here because we need ${D}* to be valid
2748 for arg in ${D}* ; do
2749 if test "${D}prevarg" = "-o"; then
2762 ${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d
2769 dnl ===================== bk-deps ends here =====================
2772 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
2774 dnl ===================== shared-ld-sh begins here =====================
2775 dnl (Created by merge-scripts.py from shared-ld-sh
2776 dnl file do not edit here!)
2778 cat <<EOF >shared-ld-sh
2780 #-----------------------------------------------------------------------------
2781 #-- Name: distrib/mac/shared-ld-sh
2782 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
2783 #-- Author: Gilles Depeyrot
2784 #-- Copyright: (c) 2002 Gilles Depeyrot
2785 #-- Licence: any use permitted
2786 #-----------------------------------------------------------------------------
2791 linking_flag="-dynamiclib"
2793 while test ${D}# -gt 0; do
2800 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
2801 # collect these options and values
2802 args="${D}{args} ${D}1 ${D}2"
2806 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
2807 # collect these options
2808 args="${D}{args} ${D}1"
2811 -dynamiclib|-bundle)
2812 linking_flag="${D}1"
2816 echo "shared-ld: unhandled option '${D}1'"
2820 *.o | *.a | *.dylib)
2821 # collect object files
2822 objects="${D}{objects} ${D}1"
2826 echo "shared-ld: unhandled argument '${D}1'"
2835 # Link one module containing all the others
2837 if test ${D}{verbose} = 1; then
2838 echo "c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o"
2840 c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o
2842 if test ${D}{status} != 0; then
2847 # Link the shared library from the single module created
2849 if test ${D}{verbose} = 1; then
2850 echo "cc ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
2852 c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}
2854 if test ${D}{status} != 0; then
2859 # Remove intermediate module
2861 rm -f master.${D}${D}.o
2865 dnl ===================== shared-ld-sh ends here =====================
2868 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
2870 dnl ===================== bk-make-pch begins here =====================
2871 dnl (Created by merge-scripts.py from bk-make-pch
2872 dnl file do not edit here!)
2874 cat <<EOF >bk-make-pch
2877 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2878 # script. It is used to generated precompiled headers.
2880 # Permission is given to use this file in any way.
2889 while test ${D}{#} -gt 0; do
2892 incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\`
2893 if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then
2894 headerfile="${D}{incdir}/${D}{header}"
2898 compiler="${D}{compiler} ${D}{1}"
2902 if test "x${D}{headerfile}" = "x" ; then
2903 echo "error: can't find header ${D}{header} in include paths" >2
2905 if test -f ${D}{outfile} ; then
2908 mkdir -p \`dirname ${D}{outfile}\`
2910 depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d"
2912 # can do this because gcc is >= 3.4:
2913 ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}"
2917 dnl ===================== bk-make-pch ends here =====================
2921 dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2923 AC_DEFUN(AM_PATH_CPPUNIT,
2926 AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
2927 cppunit_config_prefix="$withval", cppunit_config_prefix="")
2928 AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
2929 cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
2931 if test x$cppunit_config_exec_prefix != x ; then
2932 cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
2933 if test x${CPPUNIT_CONFIG+set} != xset ; then
2934 CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
2937 if test x$cppunit_config_prefix != x ; then
2938 cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
2939 if test x${CPPUNIT_CONFIG+set} != xset ; then
2940 CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
2944 AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
2945 cppunit_version_min=$1
2947 AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
2949 if test "$CPPUNIT_CONFIG" = "no" ; then
2952 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
2953 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
2954 cppunit_version=`$CPPUNIT_CONFIG --version`
2956 cppunit_major_version=`echo $cppunit_version | \
2957 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2958 cppunit_minor_version=`echo $cppunit_version | \
2959 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2960 cppunit_micro_version=`echo $cppunit_version | \
2961 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2963 cppunit_major_min=`echo $cppunit_version_min | \
2964 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2965 cppunit_minor_min=`echo $cppunit_version_min | \
2966 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2967 cppunit_micro_min=`echo $cppunit_version_min | \
2968 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2970 cppunit_version_proper=`expr \
2971 $cppunit_major_version \> $cppunit_major_min \| \
2972 $cppunit_major_version \= $cppunit_major_min \& \
2973 $cppunit_minor_version \> $cppunit_minor_min \| \
2974 $cppunit_major_version \= $cppunit_major_min \& \
2975 $cppunit_minor_version \= $cppunit_minor_min \& \
2976 $cppunit_micro_version \>= $cppunit_micro_min `
2978 if test "$cppunit_version_proper" = "1" ; then
2979 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
2986 if test "x$no_cppunit" = x ; then
2987 ifelse([$2], , :, [$2])
2991 ifelse([$3], , :, [$3])
2994 AC_SUBST(CPPUNIT_CFLAGS)
2995 AC_SUBST(CPPUNIT_LIBS)