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 detect specialty compiler options
26 dnl ===========================================================================
28 dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
29 AC_DEFUN([AC_WX_METROWERKS_EXTO],
30 [AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto,
31 dnl First create an empty conf test
32 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
33 dnl Now remove .o and .c.o or .cc.o
34 rm -f conftest.$ac_objext conftest.$ac_ext.o
35 dnl Now compile the test
36 AS_IF([AC_TRY_EVAL(ac_compile)],
37 dnl If the test succeeded look for conftest.c.o or conftest.cc.o
38 [for ac_file in `(ls conftest.* 2>/dev/null)`; do
41 wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
47 [AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
50 rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
53 if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
54 if test "[]_AC_LANG_ABBREV[]" = "c"; then
55 CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
57 if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
58 CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
64 dnl ===========================================================================
65 dnl macros to find the a file in the list of include/lib paths
66 dnl ===========================================================================
68 dnl ---------------------------------------------------------------------------
69 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
70 dnl to the full name of the file that was found or leaves it empty if not found
71 dnl ---------------------------------------------------------------------------
72 AC_DEFUN([WX_PATH_FIND_INCLUDES],
75 for ac_dir in $1 /usr/include;
77 if test -f "$ac_dir/$2"; then
78 ac_find_includes=$ac_dir
84 dnl ---------------------------------------------------------------------------
85 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
86 dnl to the full name of the file that was found or leaves it empty if not found
87 dnl ---------------------------------------------------------------------------
88 AC_DEFUN([WX_PATH_FIND_LIBRARIES],
91 for ac_dir in $1 /usr/lib;
93 for ac_extension in a so sl dylib; do
94 if test -f "$ac_dir/lib$2.$ac_extension"; then
95 ac_find_libraries=$ac_dir
102 dnl ---------------------------------------------------------------------------
103 dnl Path to include, already defined
104 dnl ---------------------------------------------------------------------------
105 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
107 dnl never add -I/usr/include to the CPPFLAGS
108 if test "x$1" = "x/usr/include"; then
109 ac_path_to_include=""
111 echo "$2" | grep "\-I$1" > /dev/null
113 if test $result = 0; then
114 ac_path_to_include=""
116 ac_path_to_include=" -I$1"
121 dnl ---------------------------------------------------------------------------
122 dnl Path to link, already defined
123 dnl ---------------------------------------------------------------------------
124 AC_DEFUN([WX_LINK_PATH_EXIST],
126 echo "$2" | grep "\-L$1" > /dev/null
128 if test $result = 0; then
131 ac_path_to_link=" -L$1"
135 dnl ===========================================================================
136 dnl C++ features test
137 dnl ===========================================================================
139 dnl ---------------------------------------------------------------------------
140 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
141 dnl or only the old <iostream.h> one - it may be generally assumed that if
142 dnl <iostream> exists, the other "new" headers (without .h) exist too.
144 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false)
145 dnl ---------------------------------------------------------------------------
147 AC_DEFUN([WX_CPP_NEW_HEADERS],
152 AC_CHECK_HEADERS(iostream)
154 if test "$ac_cv_header_iostream" = "yes" ; then
155 ifelse([$1], , :, [$1])
157 ifelse([$2], , :, [$2])
163 dnl ---------------------------------------------------------------------------
164 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
166 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
167 dnl ---------------------------------------------------------------------------
169 AC_DEFUN([WX_CPP_BOOL],
171 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
195 if test "$wx_cv_cpp_bool" = "yes"; then
200 dnl ---------------------------------------------------------------------------
201 dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
202 dnl keyword and defines HAVE_EXPLICIT if this is the case
203 dnl ---------------------------------------------------------------------------
205 AC_DEFUN([WX_CPP_EXPLICIT],
207 AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
213 dnl do the test in 2 steps: first check that the compiler knows about the
214 dnl explicit keyword at all and then verify that it really honours it
217 class Foo { public: explicit Foo(int) {} };
225 class Foo { public: explicit Foo(int) {} };
226 static void TakeFoo(const Foo& foo) { }
242 if test "$wx_cv_explicit" = "yes"; then
243 AC_DEFINE(HAVE_EXPLICIT)
247 dnl ---------------------------------------------------------------------------
248 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
249 dnl ---------------------------------------------------------------------------
251 AC_DEFUN([WX_C_BIGENDIAN],
252 [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
253 [ac_cv_c_bigendian=unknown
254 # See if sys/param.h defines the BYTE_ORDER macro.
255 AC_TRY_COMPILE([#include <sys/types.h>
256 #include <sys/param.h>], [
257 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
259 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
260 AC_TRY_COMPILE([#include <sys/types.h>
261 #include <sys/param.h>], [
262 #if BYTE_ORDER != BIG_ENDIAN
264 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
265 if test $ac_cv_c_bigendian = unknown; then
266 AC_TRY_RUN([main () {
267 /* Are we little or big endian? From Harbison&Steele. */
271 char c[sizeof (long)];
274 exit (u.c[sizeof (long) - 1] == 1);
275 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
277 if test $ac_cv_c_bigendian = unknown; then
278 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])
280 if test $ac_cv_c_bigendian = yes; then
281 AC_DEFINE(WORDS_BIGENDIAN)
285 dnl ---------------------------------------------------------------------------
286 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
287 dnl ---------------------------------------------------------------------------
289 AC_DEFUN([WX_ARG_CACHE_INIT],
291 wx_arg_cache_file="configarg.cache"
292 echo "loading argument cache $wx_arg_cache_file"
293 rm -f ${wx_arg_cache_file}.tmp
294 touch ${wx_arg_cache_file}.tmp
295 touch ${wx_arg_cache_file}
298 AC_DEFUN([WX_ARG_CACHE_FLUSH],
300 echo "saving argument cache $wx_arg_cache_file"
301 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
304 dnl this macro checks for a three-valued command line --with argument:
305 dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
306 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
307 AC_DEFUN([WX_ARG_SYS_WITH],
309 AC_MSG_CHECKING([for --with-$1])
311 AC_ARG_WITH($1, [$2],
313 if test "$withval" = yes; then
314 ac_cv_use_$1='$3=yes'
315 elif test "$withval" = no; then
317 elif test "$withval" = sys; then
318 ac_cv_use_$1='$3=sys'
319 elif test "$withval" = builtin; then
320 ac_cv_use_$1='$3=builtin'
322 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
326 LINE=`grep "$3" ${wx_arg_cache_file}`
327 if test "x$LINE" != x ; then
333 ac_cv_use_$1='$3='$DEFAULT_$3
337 if test "$no_cache" != 1; then
338 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
341 if test "$$3" = yes; then
343 elif test "$$3" = no; then
345 elif test "$$3" = sys; then
346 AC_MSG_RESULT([system version])
347 elif test "$$3" = builtin; then
348 AC_MSG_RESULT([builtin version])
350 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
354 dnl this macro checks for a command line argument and caches the result
355 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
356 AC_DEFUN([WX_ARG_WITH],
358 AC_MSG_CHECKING([for --with-$1])
360 AC_ARG_WITH($1, [$2],
362 if test "$withval" = yes; then
363 ac_cv_use_$1='$3=yes'
369 LINE=`grep "$3" ${wx_arg_cache_file}`
370 if test "x$LINE" != x ; then
376 ac_cv_use_$1='$3='$DEFAULT_$3
380 if test "$no_cache" != 1; then
381 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
384 if test "$$3" = yes; then
391 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
392 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
394 dnl enablestring is a hack and allows to show "checking for --disable-foo"
395 dnl message when running configure instead of the default "checking for
396 dnl --enable-foo" one whih is useful for the options enabled by default
397 AC_DEFUN([WX_ARG_ENABLE],
400 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
402 AC_ARG_ENABLE($1, [$2],
404 if test "$enableval" = yes; then
405 ac_cv_use_$1='$3=yes'
411 LINE=`grep "$3" ${wx_arg_cache_file}`
412 if test "x$LINE" != x ; then
418 ac_cv_use_$1='$3='$DEFAULT_$3
422 if test "$no_cache" != 1; then
423 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
426 if test "$$3" = yes; then
434 dnl ===========================================================================
435 dnl Linker features test
436 dnl ===========================================================================
438 dnl ---------------------------------------------------------------------------
439 dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
440 dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
441 dnl version script file named versionfile
443 dnl call WX_VERSIONED_SYMBOLS(versionfile)
444 dnl ---------------------------------------------------------------------------
445 AC_DEFUN([WX_VERSIONED_SYMBOLS],
449 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
451 dnl dnl Check for known non-gcc cases:
452 dnl case "${host}" in
454 dnl if test "x$GCC" != "xyes" ; then
455 dnl LDFLAGS_VERSIONING="-M $1"
456 dnl found_versioning=yes
461 dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
462 if test $found_versioning = no ; then
463 AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
465 echo "VER_1 { *; };" >conftest.sym
466 echo "int main() { return 0; }" >conftest.cpp
469 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
470 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
471 if test -s conftest.stderr ; then
472 wx_cv_version_script=no
474 wx_cv_version_script=yes
477 wx_cv_version_script=no
479 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
481 if test $wx_cv_version_script = yes ; then
482 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
488 dnl ===========================================================================
489 dnl "3rd party" macros included here because they are not widely available
490 dnl ===========================================================================
492 dnl ---------------------------------------------------------------------------
493 dnl test for availability of iconv()
494 dnl ---------------------------------------------------------------------------
496 dnl From Bruno Haible.
500 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
501 dnl those with the standalone portable GNU libiconv installed).
503 AC_ARG_WITH([libiconv-prefix],
504 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
505 for dir in `echo "$withval" | tr : ' '`; do
506 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
507 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
511 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
512 am_cv_func_iconv="no, consider installing GNU libiconv"
514 AC_TRY_LINK([#include <stdlib.h>
516 [iconv_t cd = iconv_open("","");
517 iconv(cd,NULL,NULL,NULL,NULL);
519 am_cv_func_iconv=yes)
520 if test "$am_cv_func_iconv" != yes; then
523 AC_TRY_LINK([#include <stdlib.h>
525 [iconv_t cd = iconv_open("","");
526 iconv(cd,NULL,NULL,NULL,NULL);
529 am_cv_func_iconv=yes)
533 if test "$am_cv_func_iconv" = yes; then
534 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
535 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
543 #if defined(__STDC__) || defined(__cplusplus)
544 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
550 wx_cv_func_iconv_const="no",
551 wx_cv_func_iconv_const="yes"
556 if test "x$wx_cv_func_iconv_const" = "xyes"; then
560 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
561 [Define as const if the declaration of iconv() needs const.])
564 if test "$am_cv_lib_iconv" = yes; then
570 dnl ---------------------------------------------------------------------------
571 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
572 dnl ---------------------------------------------------------------------------
574 dnl WX_SYS_LARGEFILE_TEST
576 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
577 dnl arithmetic properly but this failed miserably with gcc under Linux
578 dnl whereas the system still supports 64 bit files, so now simply check
579 dnl that off_t is big enough
580 define(WX_SYS_LARGEFILE_TEST,
582 unsigned int field: sizeof(off_t) == 8;
587 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
588 define(WX_SYS_LARGEFILE_MACRO_VALUE,
590 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
592 AC_TRY_COMPILE([#define $1 $2
593 #include <sys/types.h>],
594 WX_SYS_LARGEFILE_TEST,
600 if test "$$3" != no; then
602 AC_DEFINE_UNQUOTED([$1], [$$3])
609 dnl By default, many hosts won't let programs access large files;
610 dnl one must use special compiler options to get large-file access to work.
611 dnl For more details about this brain damage please see:
612 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
613 AC_DEFUN([AC_SYS_LARGEFILE],
614 [AC_ARG_ENABLE(largefile,
615 [ --disable-largefile omit support for large files])
616 if test "$enable_largefile" != no; then
617 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
618 dnl _LARGE_FILES -- for AIX
620 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
621 if test "x$wx_largefile" != "xyes"; then
622 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
625 AC_MSG_CHECKING(if large file support is available)
626 if test "x$wx_largefile" = "xyes"; then
627 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
629 AC_MSG_RESULT($wx_largefile)
634 dnl Available from the GNU Autoconf Macro Archive at:
635 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
637 AC_DEFUN([AC_CXX_CONST_CAST],
638 [AC_CACHE_CHECK(whether the compiler supports const_cast<>,
639 ac_cv_cxx_const_cast,
642 AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
643 ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
646 if test "$ac_cv_cxx_const_cast" = yes; then
647 AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
651 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html
652 AC_DEFUN([AC_CXX_REINTERPRET_CAST],
653 [AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
654 ac_cv_cxx_reinterpret_cast,
657 AC_TRY_COMPILE([#include <typeinfo>
658 class Base { public : Base () {} virtual void f () = 0;};
659 class Derived : public Base { public : Derived () {} virtual void f () {} };
660 class Unrelated { public : Unrelated () {} };
661 int g (Unrelated&) { return 0; }],[
662 Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
663 ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
666 if test "$ac_cv_cxx_reinterpret_cast" = yes; then
667 AC_DEFINE(HAVE_REINTERPRET_CAST,,
668 [define if the compiler supports reinterpret_cast<>])
672 dnl and http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html
673 AC_DEFUN([AC_CXX_STATIC_CAST],
674 [AC_CACHE_CHECK(whether the compiler supports static_cast<>,
675 ac_cv_cxx_static_cast,
678 AC_TRY_COMPILE([#include <typeinfo>
679 class Base { public : Base () {} virtual void f () = 0; };
680 class Derived : public Base { public : Derived () {} virtual void f () {} };
681 int g (Derived&) { return 0; }],[
682 Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
683 ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no)
686 if test "$ac_cv_cxx_static_cast" = yes; then
687 AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>])
691 dnl ---------------------------------------------------------------------------
692 dnl Support macros for makefiles generated by BAKEFILE.
693 dnl ---------------------------------------------------------------------------
695 dnl Lots of compiler & linker detection code contained here was taken from
696 dnl wxWindows configure.in script (see http://www.wxwindows.org)
698 dnl Based on autoconf _AC_LANG_COMPILER_GNU
699 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
700 [AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
701 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
702 [AC_TRY_COMPILE([],[#ifndef __MWERKS__
706 [bakefile_compiler_mwerks=yes],
707 [bakefile_compiler_mwerks=no])
708 bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
712 dnl Loosely based on autoconf AC_PROG_CC
713 dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
714 AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
716 _AC_BAKEFILE_LANG_COMPILER_MWERKS
717 MWCC=`test $bakefile_compiler_mwerks = yes && echo yes`
721 dnl Loosely based on autoconf AC_PROG_CXX
722 dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
723 AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
725 _AC_BAKEFILE_LANG_COMPILER_MWERKS
726 MWCXX=`test $bakefile_compiler_mwerks = yes && echo yes`
730 dnl ---------------------------------------------------------------------------
731 dnl AC_BAKEFILE_GNUMAKE
734 dnl ---------------------------------------------------------------------------
736 AC_DEFUN([AC_BAKEFILE_GNUMAKE],
738 dnl does make support "-include" (only GNU make does AFAIK)?
739 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
741 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
742 egrep -s GNU > /dev/null); then
743 bakefile_cv_prog_makeisgnu="yes"
745 bakefile_cv_prog_makeisgnu="no"
749 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
754 AC_SUBST(IF_GNU_MAKE)
757 dnl ---------------------------------------------------------------------------
758 dnl AC_BAKEFILE_PLATFORM
760 dnl Detects platform and sets PLATFORM_XXX variables accordingly
761 dnl ---------------------------------------------------------------------------
763 AC_DEFUN([AC_BAKEFILE_PLATFORM],
774 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
775 case "${BAKEFILE_HOST}" in
776 *-*-cygwin* | *-*-mingw32* )
782 *-pc-os2_emx | *-pc-os2-emx )
792 powerpc-apple-macos* )
801 case "$BAKEFILE_FORCE_PLATFORM" in
822 AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
827 AC_SUBST(PLATFORM_UNIX)
828 AC_SUBST(PLATFORM_WIN32)
829 AC_SUBST(PLATFORM_MSDOS)
830 AC_SUBST(PLATFORM_MAC)
831 AC_SUBST(PLATFORM_MACOS)
832 AC_SUBST(PLATFORM_MACOSX)
833 AC_SUBST(PLATFORM_OS2)
834 AC_SUBST(PLATFORM_BEOS)
838 dnl ---------------------------------------------------------------------------
839 dnl AC_BAKEFILE_PLATFORM_SPECIFICS
841 dnl Sets misc platform-specific settings
842 dnl ---------------------------------------------------------------------------
844 AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
846 AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
847 [use OMF object format (OS/2)]),
848 [bk_os2_use_omf="$enableval"])
850 case "${BAKEFILE_HOST}" in
852 dnl For Unix to MacOS X porting instructions, see:
853 dnl http://fink.sourceforge.net/doc/porting/porting.html
854 CFLAGS="$CFLAGS -fno-common"
855 CXXFLAGS="$CXXFLAGS -fno-common"
858 *-pc-os2_emx | *-pc-os2-emx )
859 if test "x$bk_os2_use_omf" = "xyes" ; then
862 LDFLAGS="-Zomf $LDFLAGS"
863 CFLAGS="-Zomf $CFLAGS"
864 CXXFLAGS="-Zomf $CXXFLAGS"
872 LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
877 dnl ---------------------------------------------------------------------------
878 dnl AC_BAKEFILE_SUFFIXES
880 dnl Detects shared various suffixes for shared libraries, libraries, programs,
882 dnl ---------------------------------------------------------------------------
884 AC_DEFUN([AC_BAKEFILE_SUFFIXES],
887 SO_SUFFIX_MODULE="so"
895 case "${BAKEFILE_HOST}" in
898 SO_SUFFIX_MODULE="sl"
902 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
903 dnl Both archive libraries and shared libraries on AIX have an
904 dnl .a extension. This will explain why you can't link with an
905 dnl .so and why it works with the name changed to .a.
909 *-*-cygwin* | *-*-mingw32* )
911 SO_SUFFIX_MODULE="dll"
912 DLLIMP_SUFFIX="dll.a"
920 *-pc-os2_emx | *-pc-os2-emx )
922 SO_SUFFIX_MODULE="dll"
923 DLLIMP_SUFFIX=$OS2_LIBEXT
927 LIBEXT=".$OS2_LIBEXT"
931 SO_SUFFIX_MODULE="bundle"
935 if test "x$DLLIMP_SUFFIX" = "x" ; then
936 DLLIMP_SUFFIX="$SO_SUFFIX"
940 AC_SUBST(SO_SUFFIX_MODULE)
941 AC_SUBST(DLLIMP_SUFFIX)
946 AC_SUBST(DLLPREFIX_MODULE)
950 dnl ---------------------------------------------------------------------------
951 dnl AC_BAKEFILE_SHARED_LD
953 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
954 dnl and SHARED_LD_CXX.
955 dnl ---------------------------------------------------------------------------
957 AC_DEFUN([AC_BAKEFILE_SHARED_LD],
959 dnl the extra compiler flags needed for compilation of shared library
961 if test "x$GCC" = "xyes"; then
962 dnl the switch for gcc is the same under all platforms
966 dnl Defaults for GCC and ELF .so shared libs:
967 SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
968 SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
970 case "${BAKEFILE_HOST}" in
972 dnl default settings are good for gcc but not for the native HP-UX
973 if test "x$GCC" != "xyes"; then
974 dnl no idea why it wants it, but it does
975 LDFLAGS="$LDFLAGS -L/usr/lib"
977 SHARED_LD_CC="${CC} -b -o"
978 SHARED_LD_CXX="${CXX} -b -o"
984 if test "x$GCC" != "xyes"; then
985 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
989 #ifndef __INTEL_COMPILER
993 bakefile_cv_prog_icc=yes,
994 bakefile_cv_prog_icc=no
997 if test "$bakefile_cv_prog_icc" = "yes"; then
1004 if test "x$GCC" != xyes ; then
1005 SHARED_LD_CC="${CC} -G -o"
1006 SHARED_LD_CXX="${CXX} -G -o"
1012 dnl Most apps benefit from being fully binded (its faster and static
1013 dnl variables initialized at startup work).
1014 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
1015 dnl or with a double stage link in order to create a single module
1016 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
1018 dnl If using newer dev tools then there is a -single_module flag that
1019 dnl we can use to do this, otherwise we'll need to use a helper
1020 dnl script. Check the version of gcc to see which way we can go:
1021 AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [
1024 #if (__GNUC__ < 3) || \
1025 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
1037 if test "$wx_cv_gcc31" = "no"; then
1038 AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
1039 chmod +x shared-ld-sh
1041 dnl Use the shared-ld-sh helper script
1042 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
1043 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
1044 SHARED_LD_CXX="$SHARED_LD_CC"
1045 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
1047 dnl Use the -single_module flag and let the linker do it for us
1048 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
1049 SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
1050 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
1051 SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
1054 PIC_FLAG="-dynamic -fPIC"
1058 dnl default settings are ok for gcc
1059 if test "x$GCC" != "xyes"; then
1060 dnl the abs path below used to be hardcoded here so I guess it must
1061 dnl be some sort of standard location under AIX?
1062 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
1063 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
1064 dnl FIXME - what about makeCSharedLib?
1065 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
1066 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
1071 dnl can't use gcc under BeOS for shared library creation because it
1072 dnl complains about missing 'main'
1073 SHARED_LD_CC="${LD} -nostart -o"
1074 SHARED_LD_CXX="${LD} -nostart -o"
1078 dnl default settings are ok for gcc
1079 if test "x$GCC" != "xyes"; then
1084 *-*-cygwin* | *-*-mingw32* )
1086 SHARED_LD_CC="\$(CC) -shared -o"
1087 SHARED_LD_CXX="\$(CXX) -shared -o"
1090 *-pc-os2_emx | *-pc-os2-emx )
1091 SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1092 SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1094 AC_BAKEFILE_CREATE_FILE_DLLAR_SH
1098 powerpc-apple-macos* | \
1099 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
1108 AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
1111 if test "x$PIC_FLAG" != "x" ; then
1112 PIC_FLAG="$PIC_FLAG -DPIC"
1115 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
1116 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
1118 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
1119 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
1122 AC_SUBST(SHARED_LD_CC)
1123 AC_SUBST(SHARED_LD_CXX)
1124 AC_SUBST(SHARED_LD_MODULE_CC)
1125 AC_SUBST(SHARED_LD_MODULE_CXX)
1130 dnl ---------------------------------------------------------------------------
1131 dnl AC_BAKEFILE_SHARED_VERSIONS
1133 dnl Detects linker options for attaching versions (sonames) to shared libs.
1134 dnl ---------------------------------------------------------------------------
1136 AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
1145 case "${BAKEFILE_HOST}" in
1146 *-*-linux* | *-*-freebsd* )
1147 SONAME_FLAG="-Wl,-soname,"
1167 AC_SUBST(USE_SOVERSION)
1168 AC_SUBST(USE_SOVERLINUX)
1169 AC_SUBST(USE_SOVERSOLARIS)
1170 AC_SUBST(USE_MACVERSION)
1171 AC_SUBST(USE_SOSYMLINKS)
1172 AC_SUBST(SONAME_FLAG)
1176 dnl ---------------------------------------------------------------------------
1177 dnl AC_BAKEFILE_DEPS
1179 dnl Detects available C/C++ dependency tracking options
1180 dnl ---------------------------------------------------------------------------
1182 AC_DEFUN([AC_BAKEFILE_DEPS],
1184 AC_MSG_CHECKING([for dependency tracking method])
1187 if test "x$GCC" = "xyes"; then
1190 case "${BAKEFILE_HOST}" in
1192 dnl -cpp-precomp (the default) conflicts with -MMD option
1193 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
1194 DEPSFLAG_GCC="-no-cpp-precomp -MMD"
1200 AC_MSG_RESULT([gcc])
1201 elif test "x$MWCC" = "xyes"; then
1205 AC_MSG_RESULT([mwcc])
1207 AC_MSG_RESULT([none])
1210 if test $DEPS_TRACKING = 1 ; then
1211 AC_BAKEFILE_CREATE_FILE_BK_DEPS
1215 AC_SUBST(DEPS_TRACKING)
1218 dnl ---------------------------------------------------------------------------
1219 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
1221 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
1223 dnl ---------------------------------------------------------------------------
1225 AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
1234 AC_CHECK_TOOL(AR, ar, ar)
1235 AC_CHECK_TOOL(STRIP, strip, :)
1236 AC_CHECK_TOOL(NM, nm, :)
1238 case ${BAKEFILE_HOST} in
1240 dnl HP-UX install doesn't handle the "-d" switch so don't
1242 INSTALL_DIR="mkdir -p"
1244 *) INSTALL_DIR="$INSTALL -d"
1247 AC_SUBST(INSTALL_DIR)
1250 case ${BAKEFILE_HOST} in
1251 *-*-cygwin* | *-*-mingw32* )
1252 LDFLAGS_GUI="-mwindows"
1254 AC_SUBST(LDFLAGS_GUI)
1258 dnl ---------------------------------------------------------------------------
1259 dnl AC_BAKEFILE_RES_COMPILERS
1261 dnl Checks for presence of resource compilers for win32 or mac
1262 dnl ---------------------------------------------------------------------------
1264 AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
1269 case ${BAKEFILE_HOST} in
1270 *-*-cygwin* | *-*-mingw32* )
1271 dnl Check for win32 resources compiler:
1272 if test "$build" != "$host" ; then
1273 RESCOMP=$host_alias-windres
1275 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
1279 *-*-darwin* | powerpc-apple-macos* )
1280 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
1281 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
1289 dnl ---------------------------------------------------------------------------
1290 dnl AC_BAKEFILE_PRECOMP_HEADERS
1292 dnl Check for precompiled headers support (GCC >= 3.4)
1293 dnl ---------------------------------------------------------------------------
1295 AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
1298 AC_ARG_ENABLE([precomp-headers],
1299 AS_HELP_STRING([--disable-precomp-headers],
1300 [don't use precompiled headers even if compiler can]),
1301 [bk_use_pch="$enableval"])
1305 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
1306 if test "x$GCC" = "xyes"; then
1307 dnl test if we have gcc-3.4:
1308 AC_MSG_CHECKING([if the compiler supports precompiled headers])
1311 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
1312 #error "no pch support"
1315 #error "no pch support"
1317 #if (__GNUC__ == 3) && \
1318 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
1319 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
1320 #error "no pch support"
1324 AC_MSG_RESULT([yes])
1330 if test $GCC_PCH = 1 ; then
1331 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
1332 chmod +x bk-make-pch
1342 dnl ---------------------------------------------------------------------------
1343 dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
1345 dnl To be used in configure.in of any project using Bakefile-generated mks
1347 dnl Behaviour can be modified by setting following variables:
1348 dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
1349 dnl to perform check for basic tools like ranlib
1350 dnl BAKEFILE_HOST set this to override host detection, defaults
1352 dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
1356 dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
1358 dnl (replace FOO with m4_include above, aclocal would die otherwise)
1359 dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
1361 dnl ---------------------------------------------------------------------------
1363 AC_DEFUN([AC_BAKEFILE],
1367 if test "x$BAKEFILE_HOST" = "x"; then
1368 BAKEFILE_HOST="${host}"
1371 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
1372 AC_BAKEFILE_CHECK_BASIC_STUFF
1375 AC_BAKEFILE_PLATFORM
1376 AC_BAKEFILE_PLATFORM_SPECIFICS
1377 AC_BAKEFILE_SUFFIXES
1378 AC_BAKEFILE_SHARED_LD
1379 AC_BAKEFILE_SHARED_VERSIONS
1381 AC_BAKEFILE_RES_COMPILERS
1383 BAKEFILE_BAKEFILE_M4_VERSION="0.1.7"
1385 dnl includes autoconf_inc.m4:
1388 if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
1389 AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
1394 dnl ---------------------------------------------------------------------------
1395 dnl Embedded copies of helper scripts follow:
1396 dnl ---------------------------------------------------------------------------
1398 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
1400 dnl ===================== dllar.sh begins here =====================
1401 dnl (Created by merge-scripts.py from dllar.sh
1402 dnl file do not edit here!)
1407 # dllar - a tool to build both a .dll and an .a file
1408 # from a set of object (.o) files for EMX/OS2.
1410 # Written by Andrew Zabolotny, bit@freya.etu.ru
1411 # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
1413 # This script will accept a set of files on the command line.
1414 # All the public symbols from the .o files will be exported into
1415 # a .DEF file, then linker will be run (through gcc) against them to
1416 # build a shared library consisting of all given .o files. All libraries
1417 # (.a) will be first decompressed into component .o files then act as
1418 # described above. You can optionally give a description (-d "description")
1419 # which will be put into .DLL. To see the list of accepted options (as well
1420 # as command-line format) simply run this program without options. The .DLL
1421 # is built to be imported by name (there is no guarantee that new versions
1422 # of the library you build will have same ordinals for same symbols).
1424 # dllar is free software; you can redistribute it and/or modify
1425 # it under the terms of the GNU General Public License as published by
1426 # the Free Software Foundation; either version 2, or (at your option)
1427 # any later version.
1429 # dllar is distributed in the hope that it will be useful,
1430 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1431 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1432 # GNU General Public License for more details.
1434 # You should have received a copy of the GNU General Public License
1435 # along with dllar; see the file COPYING. If not, write to the Free
1436 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA
1439 # To successfuly run this program you will need:
1440 # - Current drive should have LFN support (HPFS, ext2, network, etc)
1441 # (Sometimes dllar generates filenames which won't fit 8.3 scheme)
1443 # (used to build the .dll)
1445 # (used to create .def file from .o files)
1447 # (used to create .a file from .def file)
1448 # - GNU text utilites (cat, sort, uniq)
1449 # used to process emxexp output
1450 # - GNU file utilities (mv, rm)
1452 # - lxlite (optional, see flag below)
1453 # (used for general .dll cleanup)
1460 # basnam, variant of basename, which does _not_ remove the path, _iff_
1461 # second argument (suffix to remove) is given
1465 echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
1468 echo ${D}1 | sed 's/'${D}2'${D}//'
1471 echo "error in basnam ${D}*"
1477 # Cleanup temporary files and output
1480 for i in ${D}inputFiles ; do
1483 rm -rf \`basnam ${D}i !\`
1490 # Kill result in case of failure as there is just to many stupid make/nmake
1491 # things out there which doesn't do this.
1492 if @<:@ ${D}# -eq 0 @:>@; then
1493 rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
1497 # Print usage and exit script with rc=1.
1499 echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
1500 echo ' @<:@-name-mangler-script script.sh@:>@'
1501 echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
1502 echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
1503 echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
1504 echo ' @<:@*.o@:>@ @<:@*.a@:>@'
1505 echo '*> "output_file" should have no extension.'
1506 echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
1507 echo ' The import library name is derived from this and is set to "name".a,'
1508 echo ' unless overridden by -import'
1509 echo '*> "importlib_name" should have no extension.'
1510 echo ' If it has the .o, or .a extension, it is automatically removed.'
1511 echo ' This name is used as the import library name and may be longer and'
1512 echo ' more descriptive than the DLL name which has to follow the old '
1513 echo ' 8.3 convention of FAT.'
1514 echo '*> "script.sh may be given to override the output_file name by a'
1515 echo ' different name. It is mainly useful if the regular make process'
1516 echo ' of some package does not take into account OS/2 restriction of'
1517 echo ' DLL name lengths. It takes the importlib name as input and is'
1518 echo ' supposed to procude a shorter name as output. The script should'
1519 echo ' expect to get importlib_name without extension and should produce'
1520 echo ' a (max.) 8 letter name without extension.'
1521 echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
1522 echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
1523 echo ' These flags will be put at the start of GCC command line.'
1524 echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
1525 echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
1526 echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
1527 echo ' If the last character of a symbol is "*", all symbols beginning'
1528 echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
1529 echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
1530 echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
1531 echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
1532 echo ' C runtime DLLs.'
1533 echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
1534 echo '*> All other switches (for example -L./ or -lmylib) will be passed'
1535 echo ' unchanged to GCC at the end of command line.'
1536 echo '*> If you create a DLL from a library and you do not specify -o,'
1537 echo ' the basename for DLL and import library will be set to library name,'
1538 echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
1539 echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
1540 echo ' library will be renamed into gcc_s.a.'
1543 echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
1544 echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
1549 # Execute a command.
1550 # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
1551 # @Uses Whatever CleanUp() uses.
1557 if @<:@ ${D}rcCmd -ne 0 @:>@; then
1558 echo "command failed, exit code="${D}rcCmd
1573 CFLAGS="-s -Zcrtdll"
1575 EXPORT_BY_ORDINALS=0
1584 curDirS=${D}{curDirS}"/"
1590 while @<:@ ${D}1 @:>@; do
1593 EXPORT_BY_ORDINALS=1;
1603 -name-mangler-script)
1624 exclude_symbols=${D}{exclude_symbols}${D}1" "
1628 library_flags=${D}{library_flags}${D}1" "
1647 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1650 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`"
1651 if @<:@ ${D}omfLinking -eq 1 @:>@; then
1652 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib"
1654 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a"
1659 if @<:@ ${D}libsToLink -ne 0 @:>@; then
1660 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1662 for file in ${D}1 ; do
1663 if @<:@ -f ${D}file @:>@; then
1664 inputFiles="${D}{inputFiles} ${D}file"
1668 if @<:@ ${D}found -eq 0 @:>@; then
1669 echo "ERROR: No file(s) found: "${D}1
1676 done # iterate cmdline words
1679 if @<:@ -z "${D}inputFiles" @:>@; then
1680 echo "dllar: no input files"
1684 # Now extract all .o files from .a files
1686 for file in ${D}inputFiles ; do
1697 EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
1702 dirname=\`basnam ${D}file ${D}suffix\`"_%"
1704 if @<:@ ${D}? -ne 0 @:>@; then
1705 echo "Failed to create subdirectory ./${D}dirname"
1709 # Append '!' to indicate archive
1710 newInputFiles="${D}newInputFiles ${D}{dirname}!"
1711 doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
1714 for subfile in ${D}dirname/*.o* ; do
1715 if @<:@ -f ${D}subfile @:>@; then
1717 if @<:@ -s ${D}subfile @:>@; then
1718 # FIXME: This should be: is file size > 32 byte, _not_ > 0!
1719 newInputFiles="${D}newInputFiles ${D}subfile"
1723 if @<:@ ${D}found -eq 0 @:>@; then
1724 echo "WARNING: there are no files in archive \\'${D}file\\'"
1728 newInputFiles="${D}{newInputFiles} ${D}file"
1732 inputFiles="${D}newInputFiles"
1734 # Output filename(s).
1736 if @<:@ -z ${D}outFile @:>@; then
1738 set outFile ${D}inputFiles; outFile=${D}2
1741 # If it is an archive, remove the '!' and the '_%' suffixes
1744 outFile=\`basnam ${D}outFile _%!\`
1751 outFile=\`basnam ${D}outFile .dll\`
1754 outFile=\`basnam ${D}outFile .DLL\`
1757 outFile=\`basnam ${D}outFile .o\`
1760 outFile=\`basnam ${D}outFile .obj\`
1763 outFile=\`basnam ${D}outFile .a\`
1766 outFile=\`basnam ${D}outFile .lib\`
1771 case ${D}outimpFile in
1773 outimpFile=\`basnam ${D}outimpFile .a\`
1776 outimpFile=\`basnam ${D}outimpFile .lib\`
1781 if @<:@ -z ${D}outimpFile @:>@; then
1782 outimpFile=${D}outFile
1784 defFile="${D}{outFile}.def"
1785 arcFile="${D}{outimpFile}.a"
1786 arcFile2="${D}{outimpFile}.lib"
1788 #create ${D}dllFile as something matching 8.3 restrictions,
1789 if @<:@ -z ${D}renameScript @:>@ ; then
1790 dllFile="${D}outFile"
1792 dllFile=\`${D}renameScript ${D}outimpFile\`
1795 if @<:@ ${D}do_backup -ne 0 @:>@ ; then
1796 if @<:@ -f ${D}arcFile @:>@ ; then
1797 doCommand "mv ${D}arcFile ${D}{outFile}_s.a"
1799 if @<:@ -f ${D}arcFile2 @:>@ ; then
1800 doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib"
1804 # Extract public symbols from all the object files.
1805 tmpdefFile=${D}{defFile}_%
1806 rm -f ${D}tmpdefFile
1807 for file in ${D}inputFiles ; do
1812 doCommand "emxexp -u ${D}file >> ${D}tmpdefFile"
1817 # Create the def file.
1819 echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile
1820 dllFile="${D}{dllFile}.dll"
1821 if @<:@ ! -z ${D}description @:>@; then
1822 echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile
1824 echo "EXPORTS" >> ${D}defFile
1826 doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%"
1827 grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile
1829 # Checks if the export is ok or not.
1830 for word in ${D}exclude_symbols; do
1831 grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}%
1832 mv ${D}{tmpdefFile}% ${D}tmpdefFile
1836 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1837 sed "=" < ${D}tmpdefFile | \\
1841 s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/
1843 ' > ${D}{tmpdefFile}%
1844 grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile
1846 rm -f ${D}{tmpdefFile}%
1848 cat ${D}tmpdefFile >> ${D}defFile
1849 rm -f ${D}tmpdefFile
1851 # Do linking, create implib, and apply lxlite.
1853 for file in ${D}inputFiles ; do
1858 gccCmdl="${D}gccCmdl ${D}file"
1862 doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS"
1863 touch "${D}{outFile}.dll"
1865 doCommand "emximp -o ${D}arcFile ${D}defFile"
1866 if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then
1868 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1871 doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile"
1873 doCommand "emxomf -s -l ${D}arcFile"
1879 dnl ===================== dllar.sh ends here =====================
1882 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
1884 dnl ===================== bk-deps begins here =====================
1885 dnl (Created by merge-scripts.py from bk-deps
1886 dnl file do not edit here!)
1891 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1892 # script. It is used to track C/C++ files dependencies in portable way.
1894 # Permission is given to use this file in any way.
1896 DEPSMODE=${DEPSMODE}
1898 DEPSFLAG_GCC="${DEPSFLAG_GCC}"
1899 DEPSFLAG_MWCC="${DEPSFLAG_MWCC}"
1901 mkdir -p ${D}DEPSDIR
1903 if test ${D}DEPSMODE = gcc ; then
1904 ${D}* ${D}{DEPSFLAG_GCC}
1906 if test ${D}{status} != 0 ; then
1909 # move created file to the location we want it in:
1910 while test ${D}# -gt 0; do
1924 depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\`
1925 depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\`
1926 if test -f ${D}depfile ; then
1927 sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1930 depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\`
1931 if test -f ${D}depfile ; then
1932 sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1937 elif test ${D}DEPSMODE = mwcc ; then
1940 if test ${D}{status} != 0 ; then
1943 # Run mwcc again with -MM and redirect into the dep file we want
1944 # NOTE: We can't use shift here because we need ${D}* to be valid
1946 for arg in ${D}* ; do
1947 if test "${D}prevarg" = "-o"; then
1960 ${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d
1967 dnl ===================== bk-deps ends here =====================
1970 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
1972 dnl ===================== shared-ld-sh begins here =====================
1973 dnl (Created by merge-scripts.py from shared-ld-sh
1974 dnl file do not edit here!)
1976 cat <<EOF >shared-ld-sh
1978 #-----------------------------------------------------------------------------
1979 #-- Name: distrib/mac/shared-ld-sh
1980 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
1981 #-- Author: Gilles Depeyrot
1982 #-- Copyright: (c) 2002 Gilles Depeyrot
1983 #-- Licence: any use permitted
1984 #-----------------------------------------------------------------------------
1989 linking_flag="-dynamiclib"
1991 while test ${D}# -gt 0; do
1998 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
1999 # collect these options and values
2000 args="${D}{args} ${D}1 ${D}2"
2004 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
2005 # collect these options
2006 args="${D}{args} ${D}1"
2009 -dynamiclib|-bundle)
2010 linking_flag="${D}1"
2014 echo "shared-ld: unhandled option '${D}1'"
2018 *.o | *.a | *.dylib)
2019 # collect object files
2020 objects="${D}{objects} ${D}1"
2024 echo "shared-ld: unhandled argument '${D}1'"
2033 # Link one module containing all the others
2035 if test ${D}{verbose} = 1; then
2036 echo "c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o"
2038 c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o
2040 if test ${D}{status} != 0; then
2045 # Link the shared library from the single module created
2047 if test ${D}{verbose} = 1; then
2048 echo "cc ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
2050 c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}
2052 if test ${D}{status} != 0; then
2057 # Remove intermediate module
2059 rm -f master.${D}${D}.o
2063 dnl ===================== shared-ld-sh ends here =====================
2066 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
2068 dnl ===================== bk-make-pch begins here =====================
2069 dnl (Created by merge-scripts.py from bk-make-pch
2070 dnl file do not edit here!)
2072 cat <<EOF >bk-make-pch
2075 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2076 # script. It is used to generated precompiled headers.
2078 # Permission is given to use this file in any way.
2087 while test ${D}{#} -gt 0; do
2090 incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\`
2091 if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then
2092 headerfile="${D}{incdir}/${D}{header}"
2096 compiler="${D}{compiler} ${D}{1}"
2100 if test "x${D}{headerfile}" = "x" ; then
2101 echo "error: can't find header ${D}{header} in include paths" >2
2103 if test -f ${D}{outfile} ; then
2106 mkdir -p \`dirname ${D}{outfile}\`
2108 depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d"
2110 # can do this because gcc is >= 3.4:
2111 ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}"
2115 dnl ===================== bk-make-pch ends here =====================
2118 # Configure paths for GTK+
2119 # Owen Taylor 1997-2001
2121 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2122 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
2123 dnl pass to pkg-config
2125 AC_DEFUN([AM_PATH_GTK_2_0],
2127 dnl Get the cflags and libraries from pkg-config
2129 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
2130 , enable_gtktest=yes)
2132 pkg_config_args=gtk+-2.0
2137 pkg_config_args="$pkg_config_args gthread-2.0"
2144 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2146 if test x$PKG_CONFIG != xno ; then
2147 if pkg-config --atleast-pkgconfig-version 0.7 ; then
2150 echo "*** pkg-config too old; version 0.7 or better required."
2158 min_gtk_version=ifelse([$1], ,2.0.0,$1)
2159 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
2161 if test x$PKG_CONFIG != xno ; then
2162 ## don't try to run the test against uninstalled libtool libs
2163 if $PKG_CONFIG --uninstalled $pkg_config_args; then
2164 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
2168 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
2175 if test x"$no_gtk" = x ; then
2176 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
2177 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
2178 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2179 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2180 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2181 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2182 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2183 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2184 if test "x$enable_gtktest" = "xyes" ; then
2185 ac_save_CFLAGS="$CFLAGS"
2186 ac_save_LIBS="$LIBS"
2187 CFLAGS="$CFLAGS $GTK_CFLAGS"
2188 LIBS="$GTK_LIBS $LIBS"
2190 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
2191 dnl checks the results of pkg-config to some extent)
2195 #include <gtk/gtk.h>
2202 int major, minor, micro;
2205 system ("touch conf.gtktest");
2207 /* HP/UX 9 (%@#!) writes to sscanf strings */
2208 tmp_version = g_strdup("$min_gtk_version");
2209 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2210 printf("%s, bad version string\n", "$min_gtk_version");
2214 if ((gtk_major_version != $gtk_config_major_version) ||
2215 (gtk_minor_version != $gtk_config_minor_version) ||
2216 (gtk_micro_version != $gtk_config_micro_version))
2218 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2219 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2220 gtk_major_version, gtk_minor_version, gtk_micro_version);
2221 printf ("*** was found! If pkg-config was correct, then it is best\n");
2222 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2223 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2224 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2225 printf("*** required on your system.\n");
2226 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
2227 printf("*** to point to the correct configuration files\n");
2229 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2230 (gtk_minor_version != GTK_MINOR_VERSION) ||
2231 (gtk_micro_version != GTK_MICRO_VERSION))
2233 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2234 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2235 printf("*** library (version %d.%d.%d)\n",
2236 gtk_major_version, gtk_minor_version, gtk_micro_version);
2240 if ((gtk_major_version > major) ||
2241 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2242 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2248 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2249 gtk_major_version, gtk_minor_version, gtk_micro_version);
2250 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2251 major, minor, micro);
2252 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2254 printf("*** If you have already installed a sufficiently new version, this error\n");
2255 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
2256 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2257 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
2258 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
2259 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2260 printf("*** so that the correct libraries are found at run-time))\n");
2265 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2266 CFLAGS="$ac_save_CFLAGS"
2267 LIBS="$ac_save_LIBS"
2270 if test "x$no_gtk" = x ; then
2271 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
2272 ifelse([$2], , :, [$2])
2275 if test "$PKG_CONFIG" = "no" ; then
2276 echo "*** A new enough version of pkg-config was not found."
2277 echo "*** See http://pkgconfig.sourceforge.net"
2279 if test -f conf.gtktest ; then
2282 echo "*** Could not run GTK+ test program, checking why..."
2283 ac_save_CFLAGS="$CFLAGS"
2284 ac_save_LIBS="$LIBS"
2285 CFLAGS="$CFLAGS $GTK_CFLAGS"
2286 LIBS="$LIBS $GTK_LIBS"
2288 #include <gtk/gtk.h>
2290 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2291 [ echo "*** The test program compiled, but did not run. This usually means"
2292 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
2293 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
2294 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2295 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2296 echo "*** is required on your system"
2298 echo "*** If you have an old version installed, it is best to remove it, although"
2299 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
2300 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2301 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
2302 CFLAGS="$ac_save_CFLAGS"
2303 LIBS="$ac_save_LIBS"
2308 ifelse([$3], , :, [$3])
2310 AC_SUBST(GTK_CFLAGS)
2315 # Configure paths for GTK+
2316 # Owen Taylor 97-11-3
2318 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2319 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2321 AC_DEFUN(AM_PATH_GTK,
2323 dnl Get the cflags and libraries from the gtk-config script
2325 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
2326 gtk_config_prefix="$withval", gtk_config_prefix="")
2327 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2328 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2329 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2330 , enable_gtktest=yes)
2336 gtk_config_args="$gtk_config_args gthread"
2341 if test x$gtk_config_exec_prefix != x ; then
2342 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2343 if test x${GTK_CONFIG+set} != xset ; then
2344 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2347 if test x$gtk_config_prefix != x ; then
2348 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2349 if test x${GTK_CONFIG+set} != xset ; then
2350 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2354 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2355 min_gtk_version=ifelse([$1], ,0.99.7,$1)
2356 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2358 if test "$GTK_CONFIG" = "no" ; then
2361 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2362 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2363 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2364 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2365 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2366 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2367 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2368 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2369 if test "x$enable_gtktest" = "xyes" ; then
2370 ac_save_CFLAGS="$CFLAGS"
2371 ac_save_LIBS="$LIBS"
2372 CFLAGS="$CFLAGS $GTK_CFLAGS"
2373 LIBS="$GTK_LIBS $LIBS"
2375 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2376 dnl checks the results of gtk-config to some extent
2380 #include <gtk/gtk.h>
2387 int major, minor, micro;
2390 system ("touch conf.gtktest");
2392 /* HP/UX 9 (%@#!) writes to sscanf strings */
2393 tmp_version = g_strdup("$min_gtk_version");
2394 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2395 printf("%s, bad version string\n", "$min_gtk_version");
2399 if ((gtk_major_version != $gtk_config_major_version) ||
2400 (gtk_minor_version != $gtk_config_minor_version) ||
2401 (gtk_micro_version != $gtk_config_micro_version))
2403 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2404 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2405 gtk_major_version, gtk_minor_version, gtk_micro_version);
2406 printf ("*** was found! If gtk-config was correct, then it is best\n");
2407 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2408 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2409 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2410 printf("*** required on your system.\n");
2411 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2412 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2413 printf("*** before re-running configure\n");
2415 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2416 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2417 (gtk_minor_version != GTK_MINOR_VERSION) ||
2418 (gtk_micro_version != GTK_MICRO_VERSION))
2420 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2421 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2422 printf("*** library (version %d.%d.%d)\n",
2423 gtk_major_version, gtk_minor_version, gtk_micro_version);
2425 #endif /* defined (GTK_MAJOR_VERSION) ... */
2428 if ((gtk_major_version > major) ||
2429 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2430 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2436 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2437 gtk_major_version, gtk_minor_version, gtk_micro_version);
2438 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2439 major, minor, micro);
2440 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2442 printf("*** If you have already installed a sufficiently new version, this error\n");
2443 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2444 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2445 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2446 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2447 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2448 printf("*** so that the correct libraries are found at run-time))\n");
2453 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2454 CFLAGS="$ac_save_CFLAGS"
2455 LIBS="$ac_save_LIBS"
2458 if test "x$no_gtk" = x ; then
2460 ifelse([$2], , :, [$2])
2463 if test "$GTK_CONFIG" = "no" ; then
2464 echo "*** The gtk-config script installed by GTK could not be found"
2465 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2466 echo "*** your path, or set the GTK_CONFIG environment variable to the"
2467 echo "*** full path to gtk-config."
2469 if test -f conf.gtktest ; then
2472 echo "*** Could not run GTK test program, checking why..."
2473 CFLAGS="$CFLAGS $GTK_CFLAGS"
2474 LIBS="$LIBS $GTK_LIBS"
2476 #include <gtk/gtk.h>
2478 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2479 [ echo "*** The test program compiled, but did not run. This usually means"
2480 echo "*** that the run-time linker is not finding GTK or finding the wrong"
2481 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2482 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2483 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2484 echo "*** is required on your system"
2486 echo "*** If you have an old version installed, it is best to remove it, although"
2487 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2489 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2490 echo "*** came with the system with the command"
2492 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
2493 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2494 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2495 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2496 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2497 CFLAGS="$ac_save_CFLAGS"
2498 LIBS="$ac_save_LIBS"
2503 ifelse([$3], , :, [$3])
2505 AC_SUBST(GTK_CFLAGS)
2511 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
2512 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
2513 dnl also defines GSTUFF_PKG_ERRORS on error
2514 AC_DEFUN(PKG_CHECK_MODULES, [
2517 if test -z "$PKG_CONFIG"; then
2518 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2521 if test "$PKG_CONFIG" = "no" ; then
2522 echo "*** The pkg-config script could not be found. Make sure it is"
2523 echo "*** in your path, or set the PKG_CONFIG environment variable"
2524 echo "*** to the full path to pkg-config."
2525 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
2527 PKG_CONFIG_MIN_VERSION=0.9.0
2528 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
2529 AC_MSG_CHECKING(for $2)
2531 if $PKG_CONFIG --exists "$2" ; then
2535 AC_MSG_CHECKING($1_CFLAGS)
2536 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
2537 AC_MSG_RESULT($$1_CFLAGS)
2539 AC_MSG_CHECKING($1_LIBS)
2540 $1_LIBS=`$PKG_CONFIG --libs "$2"`
2541 AC_MSG_RESULT($$1_LIBS)
2545 ## If we have a custom action on failure, don't print errors, but
2546 ## do set a variable so people can do so.
2547 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
2548 ifelse([$4], ,echo $$1_PKG_ERRORS,)
2554 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
2555 echo "*** See http://www.freedesktop.org/software/pkgconfig"
2559 if test $succeeded = yes; then
2560 ifelse([$3], , :, [$3])
2562 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])
2568 # Configure paths for SDL
2569 # Sam Lantinga 9/21/99
2570 # stolen from Manish Singh
2571 # stolen back from Frank Belew
2572 # stolen from Manish Singh
2573 # Shamelessly stolen from Owen Taylor
2575 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2576 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
2578 AC_DEFUN([AM_PATH_SDL],
2580 dnl Get the cflags and libraries from the sdl-config script
2582 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
2583 sdl_prefix="$withval", sdl_prefix="")
2584 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
2585 sdl_exec_prefix="$withval", sdl_exec_prefix="")
2586 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
2587 , enable_sdltest=yes)
2589 if test x$sdl_exec_prefix != x ; then
2590 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
2591 if test x${SDL_CONFIG+set} != xset ; then
2592 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
2595 if test x$sdl_prefix != x ; then
2596 sdl_args="$sdl_args --prefix=$sdl_prefix"
2597 if test x${SDL_CONFIG+set} != xset ; then
2598 SDL_CONFIG=$sdl_prefix/bin/sdl-config
2602 AC_REQUIRE([AC_CANONICAL_TARGET])
2603 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
2604 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
2605 min_sdl_version=ifelse([$1], ,0.11.0,$1)
2606 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
2608 if test "$SDL_CONFIG" = "no" ; then
2611 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
2612 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
2614 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
2615 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2616 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
2617 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2618 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
2619 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2620 if test "x$enable_sdltest" = "xyes" ; then
2621 ac_save_CFLAGS="$CFLAGS"
2622 ac_save_CXXFLAGS="$CXXFLAGS"
2623 ac_save_LIBS="$LIBS"
2624 CFLAGS="$CFLAGS $SDL_CFLAGS"
2625 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2626 LIBS="$LIBS $SDL_LIBS"
2628 dnl Now check if the installed SDL is sufficiently new. (Also sanity
2629 dnl checks the results of sdl-config to some extent
2639 my_strdup (char *str)
2645 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
2646 strcpy (new_str, str);
2654 int main (int argc, char *argv[])
2656 int major, minor, micro;
2659 /* This hangs on some systems (?)
2660 system ("touch conf.sdltest");
2662 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
2664 /* HP/UX 9 (%@#!) writes to sscanf strings */
2665 tmp_version = my_strdup("$min_sdl_version");
2666 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2667 printf("%s, bad version string\n", "$min_sdl_version");
2671 if (($sdl_major_version > major) ||
2672 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
2673 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
2679 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
2680 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
2681 printf("*** best to upgrade to the required version.\n");
2682 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
2683 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
2684 printf("*** config.cache before re-running configure\n");
2689 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2690 CFLAGS="$ac_save_CFLAGS"
2691 CXXFLAGS="$ac_save_CXXFLAGS"
2692 LIBS="$ac_save_LIBS"
2695 if test "x$no_sdl" = x ; then
2697 ifelse([$2], , :, [$2])
2700 if test "$SDL_CONFIG" = "no" ; then
2701 echo "*** The sdl-config script installed by SDL could not be found"
2702 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
2703 echo "*** your path, or set the SDL_CONFIG environment variable to the"
2704 echo "*** full path to sdl-config."
2706 if test -f conf.sdltest ; then
2709 echo "*** Could not run SDL test program, checking why..."
2710 CFLAGS="$CFLAGS $SDL_CFLAGS"
2711 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2712 LIBS="$LIBS $SDL_LIBS"
2717 int main(int argc, char *argv[])
2720 #define main K_and_R_C_main
2722 [ echo "*** The test program compiled, but did not run. This usually means"
2723 echo "*** that the run-time linker is not finding SDL or finding the wrong"
2724 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
2725 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2726 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2727 echo "*** is required on your system"
2729 echo "*** If you have an old version installed, it is best to remove it, although"
2730 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2731 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2732 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
2733 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
2734 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
2735 CFLAGS="$ac_save_CFLAGS"
2736 CXXFLAGS="$ac_save_CXXFLAGS"
2737 LIBS="$ac_save_LIBS"
2742 ifelse([$3], , :, [$3])
2744 AC_SUBST(SDL_CFLAGS)
2749 dnl Perform a check for a GStreamer element using gst-inspect
2750 dnl Thomas Vander Stichele <thomas at apestaart dot org>
2751 dnl Last modification: 25/01/2005
2753 dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
2755 AC_DEFUN([AM_GST_ELEMENT_CHECK],
2757 if test "x$GST_INSPECT" == "x"; then
2758 AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, [])
2761 if test "x$GST_INSPECT" != "x"; then
2762 AC_MSG_CHECKING(GStreamer element $1)
2763 if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then
2764 AC_MSG_RESULT(found.)
2767 AC_MSG_RESULT(not found.)
2774 dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2776 AC_DEFUN(AM_PATH_CPPUNIT,
2779 AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
2780 cppunit_config_prefix="$withval", cppunit_config_prefix="")
2781 AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
2782 cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
2784 if test x$cppunit_config_exec_prefix != x ; then
2785 cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
2786 if test x${CPPUNIT_CONFIG+set} != xset ; then
2787 CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
2790 if test x$cppunit_config_prefix != x ; then
2791 cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
2792 if test x${CPPUNIT_CONFIG+set} != xset ; then
2793 CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
2797 AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
2798 cppunit_version_min=$1
2800 AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
2802 if test "$CPPUNIT_CONFIG" = "no" ; then
2805 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
2806 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
2807 cppunit_version=`$CPPUNIT_CONFIG --version`
2809 cppunit_major_version=`echo $cppunit_version | \
2810 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2811 cppunit_minor_version=`echo $cppunit_version | \
2812 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2813 cppunit_micro_version=`echo $cppunit_version | \
2814 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2816 cppunit_major_min=`echo $cppunit_version_min | \
2817 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2818 cppunit_minor_min=`echo $cppunit_version_min | \
2819 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2820 cppunit_micro_min=`echo $cppunit_version_min | \
2821 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2823 cppunit_version_proper=`expr \
2824 $cppunit_major_version \> $cppunit_major_min \| \
2825 $cppunit_major_version \= $cppunit_major_min \& \
2826 $cppunit_minor_version \> $cppunit_minor_min \| \
2827 $cppunit_major_version \= $cppunit_major_min \& \
2828 $cppunit_minor_version \= $cppunit_minor_min \& \
2829 $cppunit_micro_version \>= $cppunit_micro_min `
2831 if test "$cppunit_version_proper" = "1" ; then
2832 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
2839 if test "x$no_cppunit" = x ; then
2840 ifelse([$2], , :, [$2])
2844 ifelse([$3], , :, [$3])
2847 AC_SUBST(CPPUNIT_CFLAGS)
2848 AC_SUBST(CPPUNIT_LIBS)