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 Based on autoconf _AC_LANG_COMPILER_GNU
65 AC_DEFUN([_AC_WX_LANG_COMPILER_XLC],
66 [AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler],
67 [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc],
68 [AC_TRY_COMPILE([],[#ifndef __xlC__
72 [wx_compiler_xlc=yes],
74 wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc
78 dnl Loosely based on autoconf AC_PROG_CC
79 AC_DEFUN([AC_WX_PROG_XLCC],
81 _AC_WX_LANG_COMPILER_XLC
82 XLCC=`test $wx_compiler_xlc = yes && echo yes`
86 dnl Loosely based on autoconf AC_PROG_CXX
87 AC_DEFUN([AC_WX_PROG_XLCXX],
89 _AC_WX_LANG_COMPILER_XLC
90 XLCXX=`test $wx_compiler_xlc = yes && echo yes`
95 dnl ===========================================================================
96 dnl macros to find the a file in the list of include/lib paths
97 dnl ===========================================================================
99 dnl ---------------------------------------------------------------------------
100 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
101 dnl to the full name of the file that was found or leaves it empty if not found
102 dnl ---------------------------------------------------------------------------
103 AC_DEFUN([WX_PATH_FIND_INCLUDES],
106 for ac_dir in $1 /usr/include;
108 if test -f "$ac_dir/$2"; then
109 ac_find_includes=$ac_dir
115 dnl ---------------------------------------------------------------------------
116 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
117 dnl to the full name of the file that was found or leaves it empty if not found
118 dnl ---------------------------------------------------------------------------
119 AC_DEFUN([WX_PATH_FIND_LIBRARIES],
122 for ac_dir in $1 /usr/lib;
124 for ac_extension in a so sl dylib; do
125 if test -f "$ac_dir/lib$2.$ac_extension"; then
126 ac_find_libraries=$ac_dir
133 dnl ---------------------------------------------------------------------------
134 dnl Path to include, already defined
135 dnl ---------------------------------------------------------------------------
136 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
138 dnl never add -I/usr/include to the CPPFLAGS
139 if test "x$1" = "x/usr/include"; then
140 ac_path_to_include=""
142 echo "$2" | grep "\-I$1" > /dev/null
144 if test $result = 0; then
145 ac_path_to_include=""
147 ac_path_to_include=" -I$1"
152 dnl ---------------------------------------------------------------------------
153 dnl Path to link, already defined
154 dnl ---------------------------------------------------------------------------
155 AC_DEFUN([WX_LINK_PATH_EXIST],
157 echo "$2" | grep "\-L$1" > /dev/null
159 if test $result = 0; then
162 ac_path_to_link=" -L$1"
166 dnl ===========================================================================
167 dnl C++ features test
168 dnl ===========================================================================
170 dnl ---------------------------------------------------------------------------
171 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
172 dnl or only the old <iostream.h> one - it may be generally assumed that if
173 dnl <iostream> exists, the other "new" headers (without .h) exist too.
175 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false)
176 dnl ---------------------------------------------------------------------------
178 AC_DEFUN([WX_CPP_NEW_HEADERS],
183 AC_CHECK_HEADERS(iostream)
185 if test "$ac_cv_header_iostream" = "yes" ; then
186 ifelse([$1], , :, [$1])
188 ifelse([$2], , :, [$2])
194 dnl ---------------------------------------------------------------------------
195 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
197 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
198 dnl ---------------------------------------------------------------------------
200 AC_DEFUN([WX_CPP_BOOL],
202 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
226 if test "$wx_cv_cpp_bool" = "yes"; then
231 dnl ---------------------------------------------------------------------------
232 dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
233 dnl keyword and defines HAVE_EXPLICIT if this is the case
234 dnl ---------------------------------------------------------------------------
236 AC_DEFUN([WX_CPP_EXPLICIT],
238 AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
244 dnl do the test in 2 steps: first check that the compiler knows about the
245 dnl explicit keyword at all and then verify that it really honours it
248 class Foo { public: explicit Foo(int) {} };
256 class Foo { public: explicit Foo(int) {} };
257 static void TakeFoo(const Foo& foo) { }
273 if test "$wx_cv_explicit" = "yes"; then
274 AC_DEFINE(HAVE_EXPLICIT)
278 dnl ---------------------------------------------------------------------------
279 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
280 dnl ---------------------------------------------------------------------------
282 AC_DEFUN([WX_C_BIGENDIAN],
283 [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
284 [ac_cv_c_bigendian=unknown
285 # See if sys/param.h defines the BYTE_ORDER macro.
286 AC_TRY_COMPILE([#include <sys/types.h>
287 #include <sys/param.h>], [
288 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
290 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
291 AC_TRY_COMPILE([#include <sys/types.h>
292 #include <sys/param.h>], [
293 #if BYTE_ORDER != BIG_ENDIAN
295 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
296 if test $ac_cv_c_bigendian = unknown; then
297 AC_TRY_RUN([main () {
298 /* Are we little or big endian? From Harbison&Steele. */
302 char c[sizeof (long)];
305 exit (u.c[sizeof (long) - 1] == 1);
306 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
308 if test $ac_cv_c_bigendian = unknown; then
309 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])
311 if test $ac_cv_c_bigendian = yes; then
312 AC_DEFINE(WORDS_BIGENDIAN)
316 dnl ---------------------------------------------------------------------------
317 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
318 dnl ---------------------------------------------------------------------------
320 AC_DEFUN([WX_ARG_CACHE_INIT],
322 wx_arg_cache_file="configarg.cache"
323 echo "loading argument cache $wx_arg_cache_file"
324 rm -f ${wx_arg_cache_file}.tmp
325 touch ${wx_arg_cache_file}.tmp
326 touch ${wx_arg_cache_file}
329 AC_DEFUN([WX_ARG_CACHE_FLUSH],
331 echo "saving argument cache $wx_arg_cache_file"
332 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
335 dnl this macro checks for a three-valued command line --with argument:
336 dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
337 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
338 AC_DEFUN([WX_ARG_SYS_WITH],
340 AC_MSG_CHECKING([for --with-$1])
342 AC_ARG_WITH($1, [$2],
344 if test "$withval" = yes; then
345 ac_cv_use_$1='$3=yes'
346 elif test "$withval" = no; then
348 elif test "$withval" = sys; then
349 ac_cv_use_$1='$3=sys'
350 elif test "$withval" = builtin; then
351 ac_cv_use_$1='$3=builtin'
353 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
357 LINE=`grep "$3" ${wx_arg_cache_file}`
358 if test "x$LINE" != x ; then
364 ac_cv_use_$1='$3='$DEFAULT_$3
368 if test "$no_cache" != 1; then
369 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
372 if test "$$3" = yes; then
374 elif test "$$3" = no; then
376 elif test "$$3" = sys; then
377 AC_MSG_RESULT([system version])
378 elif test "$$3" = builtin; then
379 AC_MSG_RESULT([builtin version])
381 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
385 dnl this macro checks for a command line argument and caches the result
386 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
387 AC_DEFUN([WX_ARG_WITH],
389 AC_MSG_CHECKING([for --with-$1])
391 AC_ARG_WITH($1, [$2],
393 if test "$withval" = yes; then
394 ac_cv_use_$1='$3=yes'
400 LINE=`grep "$3" ${wx_arg_cache_file}`
401 if test "x$LINE" != x ; then
407 ac_cv_use_$1='$3='$DEFAULT_$3
411 if test "$no_cache" != 1; then
412 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
415 if test "$$3" = yes; then
422 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
423 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
425 dnl enablestring is a hack and allows to show "checking for --disable-foo"
426 dnl message when running configure instead of the default "checking for
427 dnl --enable-foo" one whih is useful for the options enabled by default
428 AC_DEFUN([WX_ARG_ENABLE],
431 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
433 AC_ARG_ENABLE($1, [$2],
435 if test "$enableval" = yes; then
436 ac_cv_use_$1='$3=yes'
442 LINE=`grep "$3" ${wx_arg_cache_file}`
443 if test "x$LINE" != x ; then
449 ac_cv_use_$1='$3='$DEFAULT_$3
453 if test "$no_cache" != 1; then
454 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
457 if test "$$3" = yes; then
465 dnl ===========================================================================
466 dnl Linker features test
467 dnl ===========================================================================
469 dnl ---------------------------------------------------------------------------
470 dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
471 dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
472 dnl version script file named versionfile
474 dnl call WX_VERSIONED_SYMBOLS(versionfile)
475 dnl ---------------------------------------------------------------------------
476 AC_DEFUN([WX_VERSIONED_SYMBOLS],
480 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
482 dnl dnl Check for known non-gcc cases:
483 dnl case "${host}" in
485 dnl if test "x$GCC" != "xyes" ; then
486 dnl LDFLAGS_VERSIONING="-M $1"
487 dnl found_versioning=yes
492 dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
493 if test $found_versioning = no ; then
494 AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
496 echo "VER_1 { *; };" >conftest.sym
497 echo "int main() { return 0; }" >conftest.cpp
500 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
501 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
502 if test -s conftest.stderr ; then
503 wx_cv_version_script=no
505 wx_cv_version_script=yes
508 wx_cv_version_script=no
510 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
512 if test $wx_cv_version_script = yes ; then
513 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
519 dnl ===========================================================================
520 dnl "3rd party" macros included here because they are not widely available
521 dnl ===========================================================================
523 dnl ---------------------------------------------------------------------------
524 dnl test for availability of iconv()
525 dnl ---------------------------------------------------------------------------
527 dnl From Bruno Haible.
531 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
532 dnl those with the standalone portable GNU libiconv installed).
534 AC_ARG_WITH([libiconv-prefix],
535 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
536 for dir in `echo "$withval" | tr : ' '`; do
537 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
538 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
542 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
543 am_cv_func_iconv="no, consider installing GNU libiconv"
545 AC_TRY_LINK([#include <stdlib.h>
547 [iconv_t cd = iconv_open("","");
548 iconv(cd,NULL,NULL,NULL,NULL);
550 am_cv_func_iconv=yes)
551 if test "$am_cv_func_iconv" != yes; then
554 AC_TRY_LINK([#include <stdlib.h>
556 [iconv_t cd = iconv_open("","");
557 iconv(cd,NULL,NULL,NULL,NULL);
560 am_cv_func_iconv=yes)
564 if test "$am_cv_func_iconv" = yes; then
565 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
566 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
574 #if defined(__STDC__) || defined(__cplusplus)
575 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
581 wx_cv_func_iconv_const="no",
582 wx_cv_func_iconv_const="yes"
587 if test "x$wx_cv_func_iconv_const" = "xyes"; then
591 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
592 [Define as const if the declaration of iconv() needs const.])
595 if test "$am_cv_lib_iconv" = yes; then
601 dnl ---------------------------------------------------------------------------
602 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
603 dnl ---------------------------------------------------------------------------
605 dnl WX_SYS_LARGEFILE_TEST
607 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
608 dnl arithmetic properly but this failed miserably with gcc under Linux
609 dnl whereas the system still supports 64 bit files, so now simply check
610 dnl that off_t is big enough
611 define(WX_SYS_LARGEFILE_TEST,
613 unsigned int field: sizeof(off_t) == 8;
618 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
619 define(WX_SYS_LARGEFILE_MACRO_VALUE,
621 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
623 AC_TRY_COMPILE([#define $1 $2
624 #include <sys/types.h>],
625 WX_SYS_LARGEFILE_TEST,
631 if test "$$3" != no; then
633 AC_DEFINE_UNQUOTED([$1], [$$3])
640 dnl By default, many hosts won't let programs access large files;
641 dnl one must use special compiler options to get large-file access to work.
642 dnl For more details about this brain damage please see:
643 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
644 AC_DEFUN([AC_SYS_LARGEFILE],
645 [AC_ARG_ENABLE(largefile,
646 [ --disable-largefile omit support for large files])
647 if test "$enable_largefile" != no; then
648 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
649 dnl _LARGE_FILES -- for AIX
651 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
652 if test "x$wx_largefile" != "xyes"; then
653 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
656 AC_MSG_CHECKING(if large file support is available)
657 if test "x$wx_largefile" = "xyes"; then
658 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
660 AC_MSG_RESULT($wx_largefile)
665 dnl Available from the GNU Autoconf Macro Archive at:
666 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
668 AC_DEFUN([AC_CXX_CONST_CAST],
669 [AC_CACHE_CHECK(whether the compiler supports const_cast<>,
670 ac_cv_cxx_const_cast,
673 AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
674 ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
677 if test "$ac_cv_cxx_const_cast" = yes; then
678 AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
682 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html
683 AC_DEFUN([AC_CXX_REINTERPRET_CAST],
684 [AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
685 ac_cv_cxx_reinterpret_cast,
688 AC_TRY_COMPILE([#include <typeinfo>
689 class Base { public : Base () {} virtual void f () = 0;};
690 class Derived : public Base { public : Derived () {} virtual void f () {} };
691 class Unrelated { public : Unrelated () {} };
692 int g (Unrelated&) { return 0; }],[
693 Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
694 ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
697 if test "$ac_cv_cxx_reinterpret_cast" = yes; then
698 AC_DEFINE(HAVE_REINTERPRET_CAST,,
699 [define if the compiler supports reinterpret_cast<>])
703 dnl and http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html
704 AC_DEFUN([AC_CXX_STATIC_CAST],
705 [AC_CACHE_CHECK(whether the compiler supports static_cast<>,
706 ac_cv_cxx_static_cast,
709 AC_TRY_COMPILE([#include <typeinfo>
710 class Base { public : Base () {} virtual void f () = 0; };
711 class Derived : public Base { public : Derived () {} virtual void f () {} };
712 int g (Derived&) { return 0; }],[
713 Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
714 ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no)
717 if test "$ac_cv_cxx_static_cast" = yes; then
718 AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>])
722 dnl ---------------------------------------------------------------------------
723 dnl Support macros for makefiles generated by BAKEFILE.
724 dnl ---------------------------------------------------------------------------
726 dnl Lots of compiler & linker detection code contained here was taken from
727 dnl wxWindows configure.in script (see http://www.wxwindows.org)
729 dnl Based on autoconf _AC_LANG_COMPILER_GNU
730 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
731 [AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
732 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
733 [AC_TRY_COMPILE([],[#ifndef __MWERKS__
737 [bakefile_compiler_mwerks=yes],
738 [bakefile_compiler_mwerks=no])
739 bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
743 dnl Loosely based on autoconf AC_PROG_CC
744 dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
745 AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
747 _AC_BAKEFILE_LANG_COMPILER_MWERKS
748 MWCC=`test $bakefile_compiler_mwerks = yes && echo yes`
752 dnl Loosely based on autoconf AC_PROG_CXX
753 dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
754 AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
756 _AC_BAKEFILE_LANG_COMPILER_MWERKS
757 MWCXX=`test $bakefile_compiler_mwerks = yes && echo yes`
761 dnl ---------------------------------------------------------------------------
762 dnl AC_BAKEFILE_GNUMAKE
765 dnl ---------------------------------------------------------------------------
767 AC_DEFUN([AC_BAKEFILE_GNUMAKE],
769 dnl does make support "-include" (only GNU make does AFAIK)?
770 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
772 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
773 egrep -s GNU > /dev/null); then
774 bakefile_cv_prog_makeisgnu="yes"
776 bakefile_cv_prog_makeisgnu="no"
780 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
785 AC_SUBST(IF_GNU_MAKE)
788 dnl ---------------------------------------------------------------------------
789 dnl AC_BAKEFILE_PLATFORM
791 dnl Detects platform and sets PLATFORM_XXX variables accordingly
792 dnl ---------------------------------------------------------------------------
794 AC_DEFUN([AC_BAKEFILE_PLATFORM],
805 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
806 case "${BAKEFILE_HOST}" in
807 *-*-cygwin* | *-*-mingw32* )
813 *-pc-os2_emx | *-pc-os2-emx )
823 powerpc-apple-macos* )
832 case "$BAKEFILE_FORCE_PLATFORM" in
853 AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
858 AC_SUBST(PLATFORM_UNIX)
859 AC_SUBST(PLATFORM_WIN32)
860 AC_SUBST(PLATFORM_MSDOS)
861 AC_SUBST(PLATFORM_MAC)
862 AC_SUBST(PLATFORM_MACOS)
863 AC_SUBST(PLATFORM_MACOSX)
864 AC_SUBST(PLATFORM_OS2)
865 AC_SUBST(PLATFORM_BEOS)
869 dnl ---------------------------------------------------------------------------
870 dnl AC_BAKEFILE_PLATFORM_SPECIFICS
872 dnl Sets misc platform-specific settings
873 dnl ---------------------------------------------------------------------------
875 AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
877 AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
878 [use OMF object format (OS/2)]),
879 [bk_os2_use_omf="$enableval"])
881 case "${BAKEFILE_HOST}" in
883 dnl For Unix to MacOS X porting instructions, see:
884 dnl http://fink.sourceforge.net/doc/porting/porting.html
885 CFLAGS="$CFLAGS -fno-common"
886 CXXFLAGS="$CXXFLAGS -fno-common"
889 *-pc-os2_emx | *-pc-os2-emx )
890 if test "x$bk_os2_use_omf" = "xyes" ; then
893 LDFLAGS="-Zomf $LDFLAGS"
894 CFLAGS="-Zomf $CFLAGS"
895 CXXFLAGS="-Zomf $CXXFLAGS"
903 LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
908 dnl ---------------------------------------------------------------------------
909 dnl AC_BAKEFILE_SUFFIXES
911 dnl Detects shared various suffixes for shared libraries, libraries, programs,
913 dnl ---------------------------------------------------------------------------
915 AC_DEFUN([AC_BAKEFILE_SUFFIXES],
918 SO_SUFFIX_MODULE="so"
926 case "${BAKEFILE_HOST}" in
929 SO_SUFFIX_MODULE="sl"
933 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
934 dnl Both archive libraries and shared libraries on AIX have an
935 dnl .a extension. This will explain why you can't link with an
936 dnl .so and why it works with the name changed to .a.
940 *-*-cygwin* | *-*-mingw32* )
942 SO_SUFFIX_MODULE="dll"
943 DLLIMP_SUFFIX="dll.a"
951 *-pc-os2_emx | *-pc-os2-emx )
953 SO_SUFFIX_MODULE="dll"
954 DLLIMP_SUFFIX=$OS2_LIBEXT
958 LIBEXT=".$OS2_LIBEXT"
962 SO_SUFFIX_MODULE="bundle"
966 if test "x$DLLIMP_SUFFIX" = "x" ; then
967 DLLIMP_SUFFIX="$SO_SUFFIX"
971 AC_SUBST(SO_SUFFIX_MODULE)
972 AC_SUBST(DLLIMP_SUFFIX)
977 AC_SUBST(DLLPREFIX_MODULE)
981 dnl ---------------------------------------------------------------------------
982 dnl AC_BAKEFILE_SHARED_LD
984 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
985 dnl and SHARED_LD_CXX.
986 dnl ---------------------------------------------------------------------------
988 AC_DEFUN([AC_BAKEFILE_SHARED_LD],
990 dnl the extra compiler flags needed for compilation of shared library
992 if test "x$GCC" = "xyes"; then
993 dnl the switch for gcc is the same under all platforms
997 dnl Defaults for GCC and ELF .so shared libs:
998 SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
999 SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
1001 case "${BAKEFILE_HOST}" in
1003 dnl default settings are good for gcc but not for the native HP-UX
1004 if test "x$GCC" != "xyes"; then
1005 dnl no idea why it wants it, but it does
1006 LDFLAGS="$LDFLAGS -L/usr/lib"
1008 SHARED_LD_CC="${CC} -b -o"
1009 SHARED_LD_CXX="${CXX} -b -o"
1015 if test "x$GCC" != "xyes"; then
1016 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
1020 #ifndef __INTEL_COMPILER
1024 bakefile_cv_prog_icc=yes,
1025 bakefile_cv_prog_icc=no
1028 if test "$bakefile_cv_prog_icc" = "yes"; then
1035 if test "x$GCC" != xyes ; then
1036 SHARED_LD_CC="${CC} -G -o"
1037 SHARED_LD_CXX="${CXX} -G -o"
1043 dnl Most apps benefit from being fully binded (its faster and static
1044 dnl variables initialized at startup work).
1045 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
1046 dnl or with a double stage link in order to create a single module
1047 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
1049 dnl If using newer dev tools then there is a -single_module flag that
1050 dnl we can use to do this, otherwise we'll need to use a helper
1051 dnl script. Check the version of gcc to see which way we can go:
1052 AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [
1055 #if (__GNUC__ < 3) || \
1056 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
1068 if test "$wx_cv_gcc31" = "no"; then
1069 AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
1070 chmod +x shared-ld-sh
1072 dnl Use the shared-ld-sh helper script
1073 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
1074 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
1075 SHARED_LD_CXX="$SHARED_LD_CC"
1076 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
1078 dnl Use the -single_module flag and let the linker do it for us
1079 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
1080 SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
1081 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
1082 SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
1085 PIC_FLAG="-dynamic -fPIC"
1089 dnl default settings are ok for gcc
1090 if test "x$GCC" != "xyes"; then
1091 dnl the abs path below used to be hardcoded here so I guess it must
1092 dnl be some sort of standard location under AIX?
1093 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
1094 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
1095 dnl FIXME - what about makeCSharedLib?
1096 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
1097 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
1102 dnl can't use gcc under BeOS for shared library creation because it
1103 dnl complains about missing 'main'
1104 SHARED_LD_CC="${LD} -nostart -o"
1105 SHARED_LD_CXX="${LD} -nostart -o"
1109 dnl default settings are ok for gcc
1110 if test "x$GCC" != "xyes"; then
1115 *-*-cygwin* | *-*-mingw32* )
1117 SHARED_LD_CC="\$(CC) -shared -o"
1118 SHARED_LD_CXX="\$(CXX) -shared -o"
1121 *-pc-os2_emx | *-pc-os2-emx )
1122 SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1123 SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1125 AC_BAKEFILE_CREATE_FILE_DLLAR_SH
1129 powerpc-apple-macos* | \
1130 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
1139 AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
1142 if test "x$PIC_FLAG" != "x" ; then
1143 PIC_FLAG="$PIC_FLAG -DPIC"
1146 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
1147 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
1149 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
1150 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
1153 AC_SUBST(SHARED_LD_CC)
1154 AC_SUBST(SHARED_LD_CXX)
1155 AC_SUBST(SHARED_LD_MODULE_CC)
1156 AC_SUBST(SHARED_LD_MODULE_CXX)
1161 dnl ---------------------------------------------------------------------------
1162 dnl AC_BAKEFILE_SHARED_VERSIONS
1164 dnl Detects linker options for attaching versions (sonames) to shared libs.
1165 dnl ---------------------------------------------------------------------------
1167 AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
1176 case "${BAKEFILE_HOST}" in
1177 *-*-linux* | *-*-freebsd* )
1178 SONAME_FLAG="-Wl,-soname,"
1198 AC_SUBST(USE_SOVERSION)
1199 AC_SUBST(USE_SOVERLINUX)
1200 AC_SUBST(USE_SOVERSOLARIS)
1201 AC_SUBST(USE_MACVERSION)
1202 AC_SUBST(USE_SOSYMLINKS)
1203 AC_SUBST(SONAME_FLAG)
1207 dnl ---------------------------------------------------------------------------
1208 dnl AC_BAKEFILE_DEPS
1210 dnl Detects available C/C++ dependency tracking options
1211 dnl ---------------------------------------------------------------------------
1213 AC_DEFUN([AC_BAKEFILE_DEPS],
1215 AC_MSG_CHECKING([for dependency tracking method])
1218 if test "x$GCC" = "xyes"; then
1221 case "${BAKEFILE_HOST}" in
1223 dnl -cpp-precomp (the default) conflicts with -MMD option
1224 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
1225 DEPSFLAG_GCC="-no-cpp-precomp -MMD"
1231 AC_MSG_RESULT([gcc])
1232 elif test "x$MWCC" = "xyes"; then
1236 AC_MSG_RESULT([mwcc])
1238 AC_MSG_RESULT([none])
1241 if test $DEPS_TRACKING = 1 ; then
1242 AC_BAKEFILE_CREATE_FILE_BK_DEPS
1246 AC_SUBST(DEPS_TRACKING)
1249 dnl ---------------------------------------------------------------------------
1250 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
1252 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
1254 dnl ---------------------------------------------------------------------------
1256 AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
1265 AC_CHECK_TOOL(AR, ar, ar)
1266 AC_CHECK_TOOL(STRIP, strip, :)
1267 AC_CHECK_TOOL(NM, nm, :)
1269 case ${BAKEFILE_HOST} in
1271 dnl HP-UX install doesn't handle the "-d" switch so don't
1273 INSTALL_DIR="mkdir -p"
1275 *) INSTALL_DIR="$INSTALL -d"
1278 AC_SUBST(INSTALL_DIR)
1281 case ${BAKEFILE_HOST} in
1282 *-*-cygwin* | *-*-mingw32* )
1283 LDFLAGS_GUI="-mwindows"
1285 AC_SUBST(LDFLAGS_GUI)
1289 dnl ---------------------------------------------------------------------------
1290 dnl AC_BAKEFILE_RES_COMPILERS
1292 dnl Checks for presence of resource compilers for win32 or mac
1293 dnl ---------------------------------------------------------------------------
1295 AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
1300 case ${BAKEFILE_HOST} in
1301 *-*-cygwin* | *-*-mingw32* )
1302 dnl Check for win32 resources compiler:
1303 if test "$build" != "$host" ; then
1304 RESCOMP=$host_alias-windres
1306 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
1310 *-*-darwin* | powerpc-apple-macos* )
1311 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
1312 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
1320 dnl ---------------------------------------------------------------------------
1321 dnl AC_BAKEFILE_PRECOMP_HEADERS
1323 dnl Check for precompiled headers support (GCC >= 3.4)
1324 dnl ---------------------------------------------------------------------------
1326 AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
1329 AC_ARG_ENABLE([precomp-headers],
1330 AS_HELP_STRING([--disable-precomp-headers],
1331 [don't use precompiled headers even if compiler can]),
1332 [bk_use_pch="$enableval"])
1336 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
1337 if test "x$GCC" = "xyes"; then
1338 dnl test if we have gcc-3.4:
1339 AC_MSG_CHECKING([if the compiler supports precompiled headers])
1342 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
1343 #error "no pch support"
1346 #error "no pch support"
1348 #if (__GNUC__ == 3) && \
1349 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
1350 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
1351 #error "no pch support"
1355 AC_MSG_RESULT([yes])
1361 if test $GCC_PCH = 1 ; then
1362 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
1363 chmod +x bk-make-pch
1373 dnl ---------------------------------------------------------------------------
1374 dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
1376 dnl To be used in configure.in of any project using Bakefile-generated mks
1378 dnl Behaviour can be modified by setting following variables:
1379 dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
1380 dnl to perform check for basic tools like ranlib
1381 dnl BAKEFILE_HOST set this to override host detection, defaults
1383 dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
1387 dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
1389 dnl (replace FOO with m4_include above, aclocal would die otherwise)
1390 dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
1392 dnl ---------------------------------------------------------------------------
1394 AC_DEFUN([AC_BAKEFILE],
1398 if test "x$BAKEFILE_HOST" = "x"; then
1399 BAKEFILE_HOST="${host}"
1402 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
1403 AC_BAKEFILE_CHECK_BASIC_STUFF
1406 AC_BAKEFILE_PLATFORM
1407 AC_BAKEFILE_PLATFORM_SPECIFICS
1408 AC_BAKEFILE_SUFFIXES
1409 AC_BAKEFILE_SHARED_LD
1410 AC_BAKEFILE_SHARED_VERSIONS
1412 AC_BAKEFILE_RES_COMPILERS
1414 BAKEFILE_BAKEFILE_M4_VERSION="0.1.7"
1416 dnl includes autoconf_inc.m4:
1419 if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
1420 AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
1425 dnl ---------------------------------------------------------------------------
1426 dnl Embedded copies of helper scripts follow:
1427 dnl ---------------------------------------------------------------------------
1429 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
1431 dnl ===================== dllar.sh begins here =====================
1432 dnl (Created by merge-scripts.py from dllar.sh
1433 dnl file do not edit here!)
1438 # dllar - a tool to build both a .dll and an .a file
1439 # from a set of object (.o) files for EMX/OS2.
1441 # Written by Andrew Zabolotny, bit@freya.etu.ru
1442 # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
1444 # This script will accept a set of files on the command line.
1445 # All the public symbols from the .o files will be exported into
1446 # a .DEF file, then linker will be run (through gcc) against them to
1447 # build a shared library consisting of all given .o files. All libraries
1448 # (.a) will be first decompressed into component .o files then act as
1449 # described above. You can optionally give a description (-d "description")
1450 # which will be put into .DLL. To see the list of accepted options (as well
1451 # as command-line format) simply run this program without options. The .DLL
1452 # is built to be imported by name (there is no guarantee that new versions
1453 # of the library you build will have same ordinals for same symbols).
1455 # dllar is free software; you can redistribute it and/or modify
1456 # it under the terms of the GNU General Public License as published by
1457 # the Free Software Foundation; either version 2, or (at your option)
1458 # any later version.
1460 # dllar is distributed in the hope that it will be useful,
1461 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1462 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1463 # GNU General Public License for more details.
1465 # You should have received a copy of the GNU General Public License
1466 # along with dllar; see the file COPYING. If not, write to the Free
1467 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA
1470 # To successfuly run this program you will need:
1471 # - Current drive should have LFN support (HPFS, ext2, network, etc)
1472 # (Sometimes dllar generates filenames which won't fit 8.3 scheme)
1474 # (used to build the .dll)
1476 # (used to create .def file from .o files)
1478 # (used to create .a file from .def file)
1479 # - GNU text utilites (cat, sort, uniq)
1480 # used to process emxexp output
1481 # - GNU file utilities (mv, rm)
1483 # - lxlite (optional, see flag below)
1484 # (used for general .dll cleanup)
1491 # basnam, variant of basename, which does _not_ remove the path, _iff_
1492 # second argument (suffix to remove) is given
1496 echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
1499 echo ${D}1 | sed 's/'${D}2'${D}//'
1502 echo "error in basnam ${D}*"
1508 # Cleanup temporary files and output
1511 for i in ${D}inputFiles ; do
1514 rm -rf \`basnam ${D}i !\`
1521 # Kill result in case of failure as there is just to many stupid make/nmake
1522 # things out there which doesn't do this.
1523 if @<:@ ${D}# -eq 0 @:>@; then
1524 rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
1528 # Print usage and exit script with rc=1.
1530 echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
1531 echo ' @<:@-name-mangler-script script.sh@:>@'
1532 echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
1533 echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
1534 echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
1535 echo ' @<:@*.o@:>@ @<:@*.a@:>@'
1536 echo '*> "output_file" should have no extension.'
1537 echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
1538 echo ' The import library name is derived from this and is set to "name".a,'
1539 echo ' unless overridden by -import'
1540 echo '*> "importlib_name" should have no extension.'
1541 echo ' If it has the .o, or .a extension, it is automatically removed.'
1542 echo ' This name is used as the import library name and may be longer and'
1543 echo ' more descriptive than the DLL name which has to follow the old '
1544 echo ' 8.3 convention of FAT.'
1545 echo '*> "script.sh may be given to override the output_file name by a'
1546 echo ' different name. It is mainly useful if the regular make process'
1547 echo ' of some package does not take into account OS/2 restriction of'
1548 echo ' DLL name lengths. It takes the importlib name as input and is'
1549 echo ' supposed to procude a shorter name as output. The script should'
1550 echo ' expect to get importlib_name without extension and should produce'
1551 echo ' a (max.) 8 letter name without extension.'
1552 echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
1553 echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
1554 echo ' These flags will be put at the start of GCC command line.'
1555 echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
1556 echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
1557 echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
1558 echo ' If the last character of a symbol is "*", all symbols beginning'
1559 echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
1560 echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
1561 echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
1562 echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
1563 echo ' C runtime DLLs.'
1564 echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
1565 echo '*> All other switches (for example -L./ or -lmylib) will be passed'
1566 echo ' unchanged to GCC at the end of command line.'
1567 echo '*> If you create a DLL from a library and you do not specify -o,'
1568 echo ' the basename for DLL and import library will be set to library name,'
1569 echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
1570 echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
1571 echo ' library will be renamed into gcc_s.a.'
1574 echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
1575 echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
1580 # Execute a command.
1581 # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
1582 # @Uses Whatever CleanUp() uses.
1588 if @<:@ ${D}rcCmd -ne 0 @:>@; then
1589 echo "command failed, exit code="${D}rcCmd
1604 CFLAGS="-s -Zcrtdll"
1606 EXPORT_BY_ORDINALS=0
1615 curDirS=${D}{curDirS}"/"
1621 while @<:@ ${D}1 @:>@; do
1624 EXPORT_BY_ORDINALS=1;
1634 -name-mangler-script)
1655 exclude_symbols=${D}{exclude_symbols}${D}1" "
1659 library_flags=${D}{library_flags}${D}1" "
1678 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1681 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`"
1682 if @<:@ ${D}omfLinking -eq 1 @:>@; then
1683 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib"
1685 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a"
1690 if @<:@ ${D}libsToLink -ne 0 @:>@; then
1691 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1693 for file in ${D}1 ; do
1694 if @<:@ -f ${D}file @:>@; then
1695 inputFiles="${D}{inputFiles} ${D}file"
1699 if @<:@ ${D}found -eq 0 @:>@; then
1700 echo "ERROR: No file(s) found: "${D}1
1707 done # iterate cmdline words
1710 if @<:@ -z "${D}inputFiles" @:>@; then
1711 echo "dllar: no input files"
1715 # Now extract all .o files from .a files
1717 for file in ${D}inputFiles ; do
1728 EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
1733 dirname=\`basnam ${D}file ${D}suffix\`"_%"
1735 if @<:@ ${D}? -ne 0 @:>@; then
1736 echo "Failed to create subdirectory ./${D}dirname"
1740 # Append '!' to indicate archive
1741 newInputFiles="${D}newInputFiles ${D}{dirname}!"
1742 doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
1745 for subfile in ${D}dirname/*.o* ; do
1746 if @<:@ -f ${D}subfile @:>@; then
1748 if @<:@ -s ${D}subfile @:>@; then
1749 # FIXME: This should be: is file size > 32 byte, _not_ > 0!
1750 newInputFiles="${D}newInputFiles ${D}subfile"
1754 if @<:@ ${D}found -eq 0 @:>@; then
1755 echo "WARNING: there are no files in archive \\'${D}file\\'"
1759 newInputFiles="${D}{newInputFiles} ${D}file"
1763 inputFiles="${D}newInputFiles"
1765 # Output filename(s).
1767 if @<:@ -z ${D}outFile @:>@; then
1769 set outFile ${D}inputFiles; outFile=${D}2
1772 # If it is an archive, remove the '!' and the '_%' suffixes
1775 outFile=\`basnam ${D}outFile _%!\`
1782 outFile=\`basnam ${D}outFile .dll\`
1785 outFile=\`basnam ${D}outFile .DLL\`
1788 outFile=\`basnam ${D}outFile .o\`
1791 outFile=\`basnam ${D}outFile .obj\`
1794 outFile=\`basnam ${D}outFile .a\`
1797 outFile=\`basnam ${D}outFile .lib\`
1802 case ${D}outimpFile in
1804 outimpFile=\`basnam ${D}outimpFile .a\`
1807 outimpFile=\`basnam ${D}outimpFile .lib\`
1812 if @<:@ -z ${D}outimpFile @:>@; then
1813 outimpFile=${D}outFile
1815 defFile="${D}{outFile}.def"
1816 arcFile="${D}{outimpFile}.a"
1817 arcFile2="${D}{outimpFile}.lib"
1819 #create ${D}dllFile as something matching 8.3 restrictions,
1820 if @<:@ -z ${D}renameScript @:>@ ; then
1821 dllFile="${D}outFile"
1823 dllFile=\`${D}renameScript ${D}outimpFile\`
1826 if @<:@ ${D}do_backup -ne 0 @:>@ ; then
1827 if @<:@ -f ${D}arcFile @:>@ ; then
1828 doCommand "mv ${D}arcFile ${D}{outFile}_s.a"
1830 if @<:@ -f ${D}arcFile2 @:>@ ; then
1831 doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib"
1835 # Extract public symbols from all the object files.
1836 tmpdefFile=${D}{defFile}_%
1837 rm -f ${D}tmpdefFile
1838 for file in ${D}inputFiles ; do
1843 doCommand "emxexp -u ${D}file >> ${D}tmpdefFile"
1848 # Create the def file.
1850 echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile
1851 dllFile="${D}{dllFile}.dll"
1852 if @<:@ ! -z ${D}description @:>@; then
1853 echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile
1855 echo "EXPORTS" >> ${D}defFile
1857 doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%"
1858 grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile
1860 # Checks if the export is ok or not.
1861 for word in ${D}exclude_symbols; do
1862 grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}%
1863 mv ${D}{tmpdefFile}% ${D}tmpdefFile
1867 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1868 sed "=" < ${D}tmpdefFile | \\
1872 s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/
1874 ' > ${D}{tmpdefFile}%
1875 grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile
1877 rm -f ${D}{tmpdefFile}%
1879 cat ${D}tmpdefFile >> ${D}defFile
1880 rm -f ${D}tmpdefFile
1882 # Do linking, create implib, and apply lxlite.
1884 for file in ${D}inputFiles ; do
1889 gccCmdl="${D}gccCmdl ${D}file"
1893 doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS"
1894 touch "${D}{outFile}.dll"
1896 doCommand "emximp -o ${D}arcFile ${D}defFile"
1897 if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then
1899 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1902 doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile"
1904 doCommand "emxomf -s -l ${D}arcFile"
1910 dnl ===================== dllar.sh ends here =====================
1913 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
1915 dnl ===================== bk-deps begins here =====================
1916 dnl (Created by merge-scripts.py from bk-deps
1917 dnl file do not edit here!)
1922 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1923 # script. It is used to track C/C++ files dependencies in portable way.
1925 # Permission is given to use this file in any way.
1927 DEPSMODE=${DEPSMODE}
1929 DEPSFLAG_GCC="${DEPSFLAG_GCC}"
1930 DEPSFLAG_MWCC="${DEPSFLAG_MWCC}"
1932 mkdir -p ${D}DEPSDIR
1934 if test ${D}DEPSMODE = gcc ; then
1935 ${D}* ${D}{DEPSFLAG_GCC}
1937 if test ${D}{status} != 0 ; then
1940 # move created file to the location we want it in:
1941 while test ${D}# -gt 0; do
1955 depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\`
1956 depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\`
1957 if test -f ${D}depfile ; then
1958 sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1961 depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\`
1962 if test -f ${D}depfile ; then
1963 sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1968 elif test ${D}DEPSMODE = mwcc ; then
1971 if test ${D}{status} != 0 ; then
1974 # Run mwcc again with -MM and redirect into the dep file we want
1975 # NOTE: We can't use shift here because we need ${D}* to be valid
1977 for arg in ${D}* ; do
1978 if test "${D}prevarg" = "-o"; then
1991 ${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d
1998 dnl ===================== bk-deps ends here =====================
2001 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
2003 dnl ===================== shared-ld-sh begins here =====================
2004 dnl (Created by merge-scripts.py from shared-ld-sh
2005 dnl file do not edit here!)
2007 cat <<EOF >shared-ld-sh
2009 #-----------------------------------------------------------------------------
2010 #-- Name: distrib/mac/shared-ld-sh
2011 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
2012 #-- Author: Gilles Depeyrot
2013 #-- Copyright: (c) 2002 Gilles Depeyrot
2014 #-- Licence: any use permitted
2015 #-----------------------------------------------------------------------------
2020 linking_flag="-dynamiclib"
2022 while test ${D}# -gt 0; do
2029 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
2030 # collect these options and values
2031 args="${D}{args} ${D}1 ${D}2"
2035 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
2036 # collect these options
2037 args="${D}{args} ${D}1"
2040 -dynamiclib|-bundle)
2041 linking_flag="${D}1"
2045 echo "shared-ld: unhandled option '${D}1'"
2049 *.o | *.a | *.dylib)
2050 # collect object files
2051 objects="${D}{objects} ${D}1"
2055 echo "shared-ld: unhandled argument '${D}1'"
2064 # Link one module containing all the others
2066 if test ${D}{verbose} = 1; then
2067 echo "c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o"
2069 c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o
2071 if test ${D}{status} != 0; then
2076 # Link the shared library from the single module created
2078 if test ${D}{verbose} = 1; then
2079 echo "cc ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
2081 c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}
2083 if test ${D}{status} != 0; then
2088 # Remove intermediate module
2090 rm -f master.${D}${D}.o
2094 dnl ===================== shared-ld-sh ends here =====================
2097 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
2099 dnl ===================== bk-make-pch begins here =====================
2100 dnl (Created by merge-scripts.py from bk-make-pch
2101 dnl file do not edit here!)
2103 cat <<EOF >bk-make-pch
2106 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2107 # script. It is used to generated precompiled headers.
2109 # Permission is given to use this file in any way.
2118 while test ${D}{#} -gt 0; do
2121 incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\`
2122 if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then
2123 headerfile="${D}{incdir}/${D}{header}"
2127 compiler="${D}{compiler} ${D}{1}"
2131 if test "x${D}{headerfile}" = "x" ; then
2132 echo "error: can't find header ${D}{header} in include paths" >2
2134 if test -f ${D}{outfile} ; then
2137 mkdir -p \`dirname ${D}{outfile}\`
2139 depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d"
2141 # can do this because gcc is >= 3.4:
2142 ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}"
2146 dnl ===================== bk-make-pch ends here =====================
2149 # Configure paths for GTK+
2150 # Owen Taylor 1997-2001
2152 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2153 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
2154 dnl pass to pkg-config
2156 AC_DEFUN([AM_PATH_GTK_2_0],
2158 dnl Get the cflags and libraries from pkg-config
2160 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
2161 , enable_gtktest=yes)
2163 pkg_config_args=gtk+-2.0
2168 pkg_config_args="$pkg_config_args gthread-2.0"
2175 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2177 if test x$PKG_CONFIG != xno ; then
2178 if pkg-config --atleast-pkgconfig-version 0.7 ; then
2181 echo "*** pkg-config too old; version 0.7 or better required."
2189 min_gtk_version=ifelse([$1], ,2.0.0,$1)
2190 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
2192 if test x$PKG_CONFIG != xno ; then
2193 ## don't try to run the test against uninstalled libtool libs
2194 if $PKG_CONFIG --uninstalled $pkg_config_args; then
2195 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
2199 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
2206 if test x"$no_gtk" = x ; then
2207 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
2208 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
2209 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2210 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2211 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2212 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2213 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2214 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2215 if test "x$enable_gtktest" = "xyes" ; then
2216 ac_save_CFLAGS="$CFLAGS"
2217 ac_save_LIBS="$LIBS"
2218 CFLAGS="$CFLAGS $GTK_CFLAGS"
2219 LIBS="$GTK_LIBS $LIBS"
2221 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
2222 dnl checks the results of pkg-config to some extent)
2226 #include <gtk/gtk.h>
2233 int major, minor, micro;
2236 system ("touch conf.gtktest");
2238 /* HP/UX 9 (%@#!) writes to sscanf strings */
2239 tmp_version = g_strdup("$min_gtk_version");
2240 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2241 printf("%s, bad version string\n", "$min_gtk_version");
2245 if ((gtk_major_version != $gtk_config_major_version) ||
2246 (gtk_minor_version != $gtk_config_minor_version) ||
2247 (gtk_micro_version != $gtk_config_micro_version))
2249 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2250 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2251 gtk_major_version, gtk_minor_version, gtk_micro_version);
2252 printf ("*** was found! If pkg-config was correct, then it is best\n");
2253 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2254 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2255 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2256 printf("*** required on your system.\n");
2257 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
2258 printf("*** to point to the correct configuration files\n");
2260 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2261 (gtk_minor_version != GTK_MINOR_VERSION) ||
2262 (gtk_micro_version != GTK_MICRO_VERSION))
2264 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2265 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2266 printf("*** library (version %d.%d.%d)\n",
2267 gtk_major_version, gtk_minor_version, gtk_micro_version);
2271 if ((gtk_major_version > major) ||
2272 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2273 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2279 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2280 gtk_major_version, gtk_minor_version, gtk_micro_version);
2281 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2282 major, minor, micro);
2283 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2285 printf("*** If you have already installed a sufficiently new version, this error\n");
2286 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
2287 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2288 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
2289 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
2290 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2291 printf("*** so that the correct libraries are found at run-time))\n");
2296 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2297 CFLAGS="$ac_save_CFLAGS"
2298 LIBS="$ac_save_LIBS"
2301 if test "x$no_gtk" = x ; then
2302 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
2303 ifelse([$2], , :, [$2])
2306 if test "$PKG_CONFIG" = "no" ; then
2307 echo "*** A new enough version of pkg-config was not found."
2308 echo "*** See http://pkgconfig.sourceforge.net"
2310 if test -f conf.gtktest ; then
2313 echo "*** Could not run GTK+ test program, checking why..."
2314 ac_save_CFLAGS="$CFLAGS"
2315 ac_save_LIBS="$LIBS"
2316 CFLAGS="$CFLAGS $GTK_CFLAGS"
2317 LIBS="$LIBS $GTK_LIBS"
2319 #include <gtk/gtk.h>
2321 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2322 [ echo "*** The test program compiled, but did not run. This usually means"
2323 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
2324 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
2325 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2326 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2327 echo "*** is required on your system"
2329 echo "*** If you have an old version installed, it is best to remove it, although"
2330 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
2331 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2332 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
2333 CFLAGS="$ac_save_CFLAGS"
2334 LIBS="$ac_save_LIBS"
2339 ifelse([$3], , :, [$3])
2341 AC_SUBST(GTK_CFLAGS)
2346 # Configure paths for GTK+
2347 # Owen Taylor 97-11-3
2349 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2350 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2352 AC_DEFUN(AM_PATH_GTK,
2354 dnl Get the cflags and libraries from the gtk-config script
2356 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
2357 gtk_config_prefix="$withval", gtk_config_prefix="")
2358 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2359 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2360 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2361 , enable_gtktest=yes)
2367 gtk_config_args="$gtk_config_args gthread"
2372 if test x$gtk_config_exec_prefix != x ; then
2373 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2374 if test x${GTK_CONFIG+set} != xset ; then
2375 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2378 if test x$gtk_config_prefix != x ; then
2379 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2380 if test x${GTK_CONFIG+set} != xset ; then
2381 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2385 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2386 min_gtk_version=ifelse([$1], ,0.99.7,$1)
2387 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2389 if test "$GTK_CONFIG" = "no" ; then
2392 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2393 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2394 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2395 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2396 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2397 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2398 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2399 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2400 if test "x$enable_gtktest" = "xyes" ; then
2401 ac_save_CFLAGS="$CFLAGS"
2402 ac_save_LIBS="$LIBS"
2403 CFLAGS="$CFLAGS $GTK_CFLAGS"
2404 LIBS="$GTK_LIBS $LIBS"
2406 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2407 dnl checks the results of gtk-config to some extent
2411 #include <gtk/gtk.h>
2418 int major, minor, micro;
2421 system ("touch conf.gtktest");
2423 /* HP/UX 9 (%@#!) writes to sscanf strings */
2424 tmp_version = g_strdup("$min_gtk_version");
2425 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2426 printf("%s, bad version string\n", "$min_gtk_version");
2430 if ((gtk_major_version != $gtk_config_major_version) ||
2431 (gtk_minor_version != $gtk_config_minor_version) ||
2432 (gtk_micro_version != $gtk_config_micro_version))
2434 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2435 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2436 gtk_major_version, gtk_minor_version, gtk_micro_version);
2437 printf ("*** was found! If gtk-config was correct, then it is best\n");
2438 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2439 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2440 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2441 printf("*** required on your system.\n");
2442 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2443 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2444 printf("*** before re-running configure\n");
2446 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2447 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2448 (gtk_minor_version != GTK_MINOR_VERSION) ||
2449 (gtk_micro_version != GTK_MICRO_VERSION))
2451 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2452 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2453 printf("*** library (version %d.%d.%d)\n",
2454 gtk_major_version, gtk_minor_version, gtk_micro_version);
2456 #endif /* defined (GTK_MAJOR_VERSION) ... */
2459 if ((gtk_major_version > major) ||
2460 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2461 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2467 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2468 gtk_major_version, gtk_minor_version, gtk_micro_version);
2469 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2470 major, minor, micro);
2471 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2473 printf("*** If you have already installed a sufficiently new version, this error\n");
2474 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2475 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2476 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2477 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2478 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2479 printf("*** so that the correct libraries are found at run-time))\n");
2484 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2485 CFLAGS="$ac_save_CFLAGS"
2486 LIBS="$ac_save_LIBS"
2489 if test "x$no_gtk" = x ; then
2491 ifelse([$2], , :, [$2])
2494 if test "$GTK_CONFIG" = "no" ; then
2495 echo "*** The gtk-config script installed by GTK could not be found"
2496 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2497 echo "*** your path, or set the GTK_CONFIG environment variable to the"
2498 echo "*** full path to gtk-config."
2500 if test -f conf.gtktest ; then
2503 echo "*** Could not run GTK test program, checking why..."
2504 CFLAGS="$CFLAGS $GTK_CFLAGS"
2505 LIBS="$LIBS $GTK_LIBS"
2507 #include <gtk/gtk.h>
2509 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2510 [ echo "*** The test program compiled, but did not run. This usually means"
2511 echo "*** that the run-time linker is not finding GTK or finding the wrong"
2512 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2513 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2514 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2515 echo "*** is required on your system"
2517 echo "*** If you have an old version installed, it is best to remove it, although"
2518 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2520 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2521 echo "*** came with the system with the command"
2523 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
2524 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2525 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2526 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2527 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2528 CFLAGS="$ac_save_CFLAGS"
2529 LIBS="$ac_save_LIBS"
2534 ifelse([$3], , :, [$3])
2536 AC_SUBST(GTK_CFLAGS)
2542 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
2543 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
2544 dnl also defines GSTUFF_PKG_ERRORS on error
2545 AC_DEFUN(PKG_CHECK_MODULES, [
2548 if test -z "$PKG_CONFIG"; then
2549 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2552 if test "$PKG_CONFIG" = "no" ; then
2553 echo "*** The pkg-config script could not be found. Make sure it is"
2554 echo "*** in your path, or set the PKG_CONFIG environment variable"
2555 echo "*** to the full path to pkg-config."
2556 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
2558 PKG_CONFIG_MIN_VERSION=0.9.0
2559 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
2560 AC_MSG_CHECKING(for $2)
2562 if $PKG_CONFIG --exists "$2" ; then
2566 AC_MSG_CHECKING($1_CFLAGS)
2567 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
2568 AC_MSG_RESULT($$1_CFLAGS)
2570 AC_MSG_CHECKING($1_LIBS)
2571 $1_LIBS=`$PKG_CONFIG --libs "$2"`
2572 AC_MSG_RESULT($$1_LIBS)
2576 ## If we have a custom action on failure, don't print errors, but
2577 ## do set a variable so people can do so.
2578 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
2579 ifelse([$4], ,echo $$1_PKG_ERRORS,)
2585 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
2586 echo "*** See http://www.freedesktop.org/software/pkgconfig"
2590 if test $succeeded = yes; then
2591 ifelse([$3], , :, [$3])
2593 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])
2599 # Configure paths for SDL
2600 # Sam Lantinga 9/21/99
2601 # stolen from Manish Singh
2602 # stolen back from Frank Belew
2603 # stolen from Manish Singh
2604 # Shamelessly stolen from Owen Taylor
2606 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2607 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
2609 AC_DEFUN([AM_PATH_SDL],
2611 dnl Get the cflags and libraries from the sdl-config script
2613 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
2614 sdl_prefix="$withval", sdl_prefix="")
2615 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
2616 sdl_exec_prefix="$withval", sdl_exec_prefix="")
2617 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
2618 , enable_sdltest=yes)
2620 if test x$sdl_exec_prefix != x ; then
2621 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
2622 if test x${SDL_CONFIG+set} != xset ; then
2623 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
2626 if test x$sdl_prefix != x ; then
2627 sdl_args="$sdl_args --prefix=$sdl_prefix"
2628 if test x${SDL_CONFIG+set} != xset ; then
2629 SDL_CONFIG=$sdl_prefix/bin/sdl-config
2633 AC_REQUIRE([AC_CANONICAL_TARGET])
2634 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
2635 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
2636 min_sdl_version=ifelse([$1], ,0.11.0,$1)
2637 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
2639 if test "$SDL_CONFIG" = "no" ; then
2642 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
2643 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
2645 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
2646 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2647 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
2648 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2649 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
2650 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2651 if test "x$enable_sdltest" = "xyes" ; then
2652 ac_save_CFLAGS="$CFLAGS"
2653 ac_save_CXXFLAGS="$CXXFLAGS"
2654 ac_save_LIBS="$LIBS"
2655 CFLAGS="$CFLAGS $SDL_CFLAGS"
2656 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2657 LIBS="$LIBS $SDL_LIBS"
2659 dnl Now check if the installed SDL is sufficiently new. (Also sanity
2660 dnl checks the results of sdl-config to some extent
2670 my_strdup (char *str)
2676 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
2677 strcpy (new_str, str);
2685 int main (int argc, char *argv[])
2687 int major, minor, micro;
2690 /* This hangs on some systems (?)
2691 system ("touch conf.sdltest");
2693 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
2695 /* HP/UX 9 (%@#!) writes to sscanf strings */
2696 tmp_version = my_strdup("$min_sdl_version");
2697 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2698 printf("%s, bad version string\n", "$min_sdl_version");
2702 if (($sdl_major_version > major) ||
2703 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
2704 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
2710 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
2711 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
2712 printf("*** best to upgrade to the required version.\n");
2713 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
2714 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
2715 printf("*** config.cache before re-running configure\n");
2720 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2721 CFLAGS="$ac_save_CFLAGS"
2722 CXXFLAGS="$ac_save_CXXFLAGS"
2723 LIBS="$ac_save_LIBS"
2726 if test "x$no_sdl" = x ; then
2728 ifelse([$2], , :, [$2])
2731 if test "$SDL_CONFIG" = "no" ; then
2732 echo "*** The sdl-config script installed by SDL could not be found"
2733 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
2734 echo "*** your path, or set the SDL_CONFIG environment variable to the"
2735 echo "*** full path to sdl-config."
2737 if test -f conf.sdltest ; then
2740 echo "*** Could not run SDL test program, checking why..."
2741 CFLAGS="$CFLAGS $SDL_CFLAGS"
2742 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2743 LIBS="$LIBS $SDL_LIBS"
2748 int main(int argc, char *argv[])
2751 #define main K_and_R_C_main
2753 [ echo "*** The test program compiled, but did not run. This usually means"
2754 echo "*** that the run-time linker is not finding SDL or finding the wrong"
2755 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
2756 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2757 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2758 echo "*** is required on your system"
2760 echo "*** If you have an old version installed, it is best to remove it, although"
2761 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2762 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2763 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
2764 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
2765 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
2766 CFLAGS="$ac_save_CFLAGS"
2767 CXXFLAGS="$ac_save_CXXFLAGS"
2768 LIBS="$ac_save_LIBS"
2773 ifelse([$3], , :, [$3])
2775 AC_SUBST(SDL_CFLAGS)
2780 dnl Perform a check for a GStreamer element using gst-inspect
2781 dnl Thomas Vander Stichele <thomas at apestaart dot org>
2782 dnl Last modification: 25/01/2005
2784 dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
2786 AC_DEFUN([AM_GST_ELEMENT_CHECK],
2788 if test "x$GST_INSPECT" == "x"; then
2789 AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, [])
2792 if test "x$GST_INSPECT" != "x"; then
2793 AC_MSG_CHECKING(GStreamer element $1)
2794 if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then
2795 AC_MSG_RESULT(found.)
2798 AC_MSG_RESULT(not found.)
2805 dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2807 AC_DEFUN(AM_PATH_CPPUNIT,
2810 AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
2811 cppunit_config_prefix="$withval", cppunit_config_prefix="")
2812 AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
2813 cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
2815 if test x$cppunit_config_exec_prefix != x ; then
2816 cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
2817 if test x${CPPUNIT_CONFIG+set} != xset ; then
2818 CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
2821 if test x$cppunit_config_prefix != x ; then
2822 cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
2823 if test x${CPPUNIT_CONFIG+set} != xset ; then
2824 CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
2828 AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
2829 cppunit_version_min=$1
2831 AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
2833 if test "$CPPUNIT_CONFIG" = "no" ; then
2836 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
2837 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
2838 cppunit_version=`$CPPUNIT_CONFIG --version`
2840 cppunit_major_version=`echo $cppunit_version | \
2841 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2842 cppunit_minor_version=`echo $cppunit_version | \
2843 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2844 cppunit_micro_version=`echo $cppunit_version | \
2845 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2847 cppunit_major_min=`echo $cppunit_version_min | \
2848 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2849 cppunit_minor_min=`echo $cppunit_version_min | \
2850 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2851 cppunit_micro_min=`echo $cppunit_version_min | \
2852 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2854 cppunit_version_proper=`expr \
2855 $cppunit_major_version \> $cppunit_major_min \| \
2856 $cppunit_major_version \= $cppunit_major_min \& \
2857 $cppunit_minor_version \> $cppunit_minor_min \| \
2858 $cppunit_major_version \= $cppunit_major_min \& \
2859 $cppunit_minor_version \= $cppunit_minor_min \& \
2860 $cppunit_micro_version \>= $cppunit_micro_min `
2862 if test "$cppunit_version_proper" = "1" ; then
2863 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
2870 if test "x$no_cppunit" = x ; then
2871 ifelse([$2], , :, [$2])
2875 ifelse([$3], , :, [$3])
2878 AC_SUBST(CPPUNIT_CFLAGS)
2879 AC_SUBST(CPPUNIT_LIBS)