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`
94 dnl ===========================================================================
95 dnl Objective-C(++) related macros
96 dnl ===========================================================================
97 m4_define([AC_WX_LANG_OBJECTIVEC],
102 m4_define([AC_WX_LANG_OBJECTIVECPLUSPLUS],
107 dnl ===========================================================================
108 dnl macros to find the a file in the list of include/lib paths
109 dnl ===========================================================================
111 dnl ---------------------------------------------------------------------------
112 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
113 dnl to the full name of the file that was found or leaves it empty if not found
114 dnl ---------------------------------------------------------------------------
115 AC_DEFUN([WX_PATH_FIND_INCLUDES],
118 for ac_dir in $1 /usr/include;
120 if test -f "$ac_dir/$2"; then
121 ac_find_includes=$ac_dir
127 dnl ---------------------------------------------------------------------------
128 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
129 dnl to the full name of the file that was found or leaves it empty if not found
130 dnl ---------------------------------------------------------------------------
131 AC_DEFUN([WX_PATH_FIND_LIBRARIES],
134 for ac_dir in $1 /usr/lib;
136 for ac_extension in a so sl dylib; do
137 if test -f "$ac_dir/lib$2.$ac_extension"; then
138 ac_find_libraries=$ac_dir
145 dnl ---------------------------------------------------------------------------
146 dnl Path to include, already defined
147 dnl ---------------------------------------------------------------------------
148 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
150 dnl never add -I/usr/include to the CPPFLAGS
151 if test "x$1" = "x/usr/include"; then
152 ac_path_to_include=""
154 echo "$2" | grep "\-I$1" > /dev/null
156 if test $result = 0; then
157 ac_path_to_include=""
159 ac_path_to_include=" -I$1"
164 dnl ---------------------------------------------------------------------------
165 dnl Path to link, already defined
166 dnl ---------------------------------------------------------------------------
167 AC_DEFUN([WX_LINK_PATH_EXIST],
169 echo "$2" | grep "\-L$1" > /dev/null
171 if test $result = 0; then
174 ac_path_to_link=" -L$1"
178 dnl ===========================================================================
179 dnl C++ features test
180 dnl ===========================================================================
182 dnl ---------------------------------------------------------------------------
183 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
184 dnl or only the old <iostream.h> one - it may be generally assumed that if
185 dnl <iostream> exists, the other "new" headers (without .h) exist too.
187 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false)
188 dnl ---------------------------------------------------------------------------
190 AC_DEFUN([WX_CPP_NEW_HEADERS],
195 AC_CHECK_HEADERS(iostream)
197 if test "$ac_cv_header_iostream" = "yes" ; then
198 ifelse([$1], , :, [$1])
200 ifelse([$2], , :, [$2])
206 dnl ---------------------------------------------------------------------------
207 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
209 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
210 dnl ---------------------------------------------------------------------------
212 AC_DEFUN([WX_CPP_BOOL],
214 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
238 if test "$wx_cv_cpp_bool" = "yes"; then
243 dnl ---------------------------------------------------------------------------
244 dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
245 dnl keyword and defines HAVE_EXPLICIT if this is the case
246 dnl ---------------------------------------------------------------------------
248 AC_DEFUN([WX_CPP_EXPLICIT],
250 AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
256 dnl do the test in 2 steps: first check that the compiler knows about the
257 dnl explicit keyword at all and then verify that it really honours it
260 class Foo { public: explicit Foo(int) {} };
268 class Foo { public: explicit Foo(int) {} };
269 static void TakeFoo(const Foo& foo) { }
285 if test "$wx_cv_explicit" = "yes"; then
286 AC_DEFINE(HAVE_EXPLICIT)
290 dnl ---------------------------------------------------------------------------
291 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
292 dnl ---------------------------------------------------------------------------
294 AC_DEFUN([WX_C_BIGENDIAN],
295 [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
296 [ac_cv_c_bigendian=unknown
297 # See if sys/param.h defines the BYTE_ORDER macro.
298 AC_TRY_COMPILE([#include <sys/types.h>
299 #include <sys/param.h>], [
300 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
302 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
303 AC_TRY_COMPILE([#include <sys/types.h>
304 #include <sys/param.h>], [
305 #if BYTE_ORDER != BIG_ENDIAN
307 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
308 if test $ac_cv_c_bigendian = unknown; then
309 AC_TRY_RUN([main () {
310 /* Are we little or big endian? From Harbison&Steele. */
314 char c[sizeof (long)];
317 exit (u.c[sizeof (long) - 1] == 1);
318 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
320 if test $ac_cv_c_bigendian = unknown; then
321 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])
323 if test $ac_cv_c_bigendian = yes; then
324 AC_DEFINE(WORDS_BIGENDIAN)
328 dnl ---------------------------------------------------------------------------
329 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
330 dnl ---------------------------------------------------------------------------
332 AC_DEFUN([WX_ARG_CACHE_INIT],
334 wx_arg_cache_file="configarg.cache"
335 echo "loading argument cache $wx_arg_cache_file"
336 rm -f ${wx_arg_cache_file}.tmp
337 touch ${wx_arg_cache_file}.tmp
338 touch ${wx_arg_cache_file}
341 AC_DEFUN([WX_ARG_CACHE_FLUSH],
343 echo "saving argument cache $wx_arg_cache_file"
344 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
347 dnl this macro checks for a three-valued command line --with argument:
348 dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
349 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
350 AC_DEFUN([WX_ARG_SYS_WITH],
352 AC_MSG_CHECKING([for --with-$1])
354 AC_ARG_WITH($1, [$2],
356 if test "$withval" = yes; then
357 ac_cv_use_$1='$3=yes'
358 elif test "$withval" = no; then
360 elif test "$withval" = sys; then
361 ac_cv_use_$1='$3=sys'
362 elif test "$withval" = builtin; then
363 ac_cv_use_$1='$3=builtin'
365 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
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
386 elif test "$$3" = no; then
388 elif test "$$3" = sys; then
389 AC_MSG_RESULT([system version])
390 elif test "$$3" = builtin; then
391 AC_MSG_RESULT([builtin version])
393 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
397 dnl this macro checks for a command line argument and caches the result
398 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
399 AC_DEFUN([WX_ARG_WITH],
401 AC_MSG_CHECKING([for --with-$1])
403 AC_ARG_WITH($1, [$2],
405 if test "$withval" = yes; then
406 ac_cv_use_$1='$3=yes'
412 LINE=`grep "$3" ${wx_arg_cache_file}`
413 if test "x$LINE" != x ; then
419 ac_cv_use_$1='$3='$DEFAULT_$3
423 if test "$no_cache" != 1; then
424 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
427 if test "$$3" = yes; then
434 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
435 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
437 dnl enablestring is a hack and allows to show "checking for --disable-foo"
438 dnl message when running configure instead of the default "checking for
439 dnl --enable-foo" one whih is useful for the options enabled by default
440 AC_DEFUN([WX_ARG_ENABLE],
443 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
445 AC_ARG_ENABLE($1, [$2],
447 if test "$enableval" = yes; then
448 ac_cv_use_$1='$3=yes'
454 LINE=`grep "$3" ${wx_arg_cache_file}`
455 if test "x$LINE" != x ; then
461 ac_cv_use_$1='$3='$DEFAULT_$3
465 if test "$no_cache" != 1; then
466 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
469 if test "$$3" = yes; then
477 dnl ===========================================================================
478 dnl Linker features test
479 dnl ===========================================================================
481 dnl ---------------------------------------------------------------------------
482 dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
483 dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
484 dnl version script file named versionfile
486 dnl call WX_VERSIONED_SYMBOLS(versionfile)
487 dnl ---------------------------------------------------------------------------
488 AC_DEFUN([WX_VERSIONED_SYMBOLS],
492 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
494 dnl dnl Check for known non-gcc cases:
495 dnl case "${host}" in
497 dnl if test "x$GCC" != "xyes" ; then
498 dnl LDFLAGS_VERSIONING="-M $1"
499 dnl found_versioning=yes
504 dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
505 if test $found_versioning = no ; then
506 AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
508 echo "VER_1 { *; };" >conftest.sym
509 echo "int main() { return 0; }" >conftest.cpp
512 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
513 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
514 if test -s conftest.stderr ; then
515 wx_cv_version_script=no
517 wx_cv_version_script=yes
520 wx_cv_version_script=no
522 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
524 if test $wx_cv_version_script = yes ; then
525 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
531 dnl ===========================================================================
532 dnl "3rd party" macros included here because they are not widely available
533 dnl ===========================================================================
535 dnl ---------------------------------------------------------------------------
536 dnl test for availability of iconv()
537 dnl ---------------------------------------------------------------------------
539 dnl From Bruno Haible.
543 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
544 dnl those with the standalone portable GNU libiconv installed).
546 AC_ARG_WITH([libiconv-prefix],
547 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
548 for dir in `echo "$withval" | tr : ' '`; do
549 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
550 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
554 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
555 am_cv_func_iconv="no, consider installing GNU libiconv"
557 AC_TRY_LINK([#include <stdlib.h>
559 [iconv_t cd = iconv_open("","");
560 iconv(cd,NULL,NULL,NULL,NULL);
562 am_cv_func_iconv=yes)
563 if test "$am_cv_func_iconv" != yes; then
566 AC_TRY_LINK([#include <stdlib.h>
568 [iconv_t cd = iconv_open("","");
569 iconv(cd,NULL,NULL,NULL,NULL);
572 am_cv_func_iconv=yes)
576 if test "$am_cv_func_iconv" = yes; then
577 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
578 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
586 #if defined(__STDC__) || defined(__cplusplus)
587 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
593 wx_cv_func_iconv_const="no",
594 wx_cv_func_iconv_const="yes"
599 if test "x$wx_cv_func_iconv_const" = "xyes"; then
603 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
604 [Define as const if the declaration of iconv() needs const.])
607 if test "$am_cv_lib_iconv" = yes; then
613 dnl ---------------------------------------------------------------------------
614 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
615 dnl ---------------------------------------------------------------------------
617 dnl WX_SYS_LARGEFILE_TEST
619 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
620 dnl arithmetic properly but this failed miserably with gcc under Linux
621 dnl whereas the system still supports 64 bit files, so now simply check
622 dnl that off_t is big enough
623 define(WX_SYS_LARGEFILE_TEST,
625 unsigned int field: sizeof(off_t) == 8;
630 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
631 define(WX_SYS_LARGEFILE_MACRO_VALUE,
633 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
635 AC_TRY_COMPILE([#define $1 $2
636 #include <sys/types.h>],
637 WX_SYS_LARGEFILE_TEST,
643 if test "$$3" != no; then
645 AC_DEFINE_UNQUOTED([$1], [$$3])
652 dnl By default, many hosts won't let programs access large files;
653 dnl one must use special compiler options to get large-file access to work.
654 dnl For more details about this brain damage please see:
655 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
656 AC_DEFUN([AC_SYS_LARGEFILE],
657 [AC_ARG_ENABLE(largefile,
658 [ --disable-largefile omit support for large files])
659 if test "$enable_largefile" != no; then
660 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
661 dnl _LARGE_FILES -- for AIX
663 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
664 if test "x$wx_largefile" != "xyes"; then
665 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
668 AC_MSG_CHECKING(if large file support is available)
669 if test "x$wx_largefile" = "xyes"; then
670 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
672 AC_MSG_RESULT($wx_largefile)
677 dnl Available from the GNU Autoconf Macro Archive at:
678 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
680 AC_DEFUN([AC_CXX_CONST_CAST],
681 [AC_CACHE_CHECK(whether the compiler supports const_cast<>,
682 ac_cv_cxx_const_cast,
685 AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
686 ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
689 if test "$ac_cv_cxx_const_cast" = yes; then
690 AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
694 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html
695 AC_DEFUN([AC_CXX_REINTERPRET_CAST],
696 [AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
697 ac_cv_cxx_reinterpret_cast,
700 AC_TRY_COMPILE([#include <typeinfo>
701 class Base { public : Base () {} virtual void f () = 0;};
702 class Derived : public Base { public : Derived () {} virtual void f () {} };
703 class Unrelated { public : Unrelated () {} };
704 int g (Unrelated&) { return 0; }],[
705 Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
706 ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
709 if test "$ac_cv_cxx_reinterpret_cast" = yes; then
710 AC_DEFINE(HAVE_REINTERPRET_CAST,,
711 [define if the compiler supports reinterpret_cast<>])
715 dnl and http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html
716 AC_DEFUN([AC_CXX_STATIC_CAST],
717 [AC_CACHE_CHECK(whether the compiler supports static_cast<>,
718 ac_cv_cxx_static_cast,
721 AC_TRY_COMPILE([#include <typeinfo>
722 class Base { public : Base () {} virtual void f () = 0; };
723 class Derived : public Base { public : Derived () {} virtual void f () {} };
724 int g (Derived&) { return 0; }],[
725 Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
726 ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no)
729 if test "$ac_cv_cxx_static_cast" = yes; then
730 AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>])
734 dnl http://autoconf-archive.cryp.to/ac_cxx_dynamic_cast.html
735 AC_DEFUN([AC_CXX_DYNAMIC_CAST],
736 [AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
737 ac_cv_cxx_dynamic_cast,
740 AC_TRY_COMPILE([#include <typeinfo>
741 class Base { public : Base () {} virtual void f () = 0;};
742 class Derived : public Base { public : Derived () {} virtual void f () {} };],[
743 Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
744 ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
747 if test "$ac_cv_cxx_dynamic_cast" = yes; then
748 AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
753 dnl ---------------------------------------------------------------------------
754 dnl Support macros for makefiles generated by BAKEFILE.
755 dnl ---------------------------------------------------------------------------
757 dnl Lots of compiler & linker detection code contained here was taken from
758 dnl wxWindows configure.in script (see http://www.wxwindows.org)
760 dnl Based on autoconf _AC_LANG_COMPILER_GNU
761 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
762 [AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
763 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
764 [AC_TRY_COMPILE([],[#ifndef __MWERKS__
768 [bakefile_compiler_mwerks=yes],
769 [bakefile_compiler_mwerks=no])
770 bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
774 dnl Loosely based on autoconf AC_PROG_CC
775 dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
776 AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
778 _AC_BAKEFILE_LANG_COMPILER_MWERKS
779 MWCC=`test $bakefile_compiler_mwerks = yes && echo yes`
783 dnl Loosely based on autoconf AC_PROG_CXX
784 dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
785 AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
787 _AC_BAKEFILE_LANG_COMPILER_MWERKS
788 MWCXX=`test $bakefile_compiler_mwerks = yes && echo yes`
792 dnl ---------------------------------------------------------------------------
793 dnl AC_BAKEFILE_GNUMAKE
796 dnl ---------------------------------------------------------------------------
798 AC_DEFUN([AC_BAKEFILE_GNUMAKE],
800 dnl does make support "-include" (only GNU make does AFAIK)?
801 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
803 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
804 egrep -s GNU > /dev/null); then
805 bakefile_cv_prog_makeisgnu="yes"
807 bakefile_cv_prog_makeisgnu="no"
811 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
816 AC_SUBST(IF_GNU_MAKE)
819 dnl ---------------------------------------------------------------------------
820 dnl AC_BAKEFILE_PLATFORM
822 dnl Detects platform and sets PLATFORM_XXX variables accordingly
823 dnl ---------------------------------------------------------------------------
825 AC_DEFUN([AC_BAKEFILE_PLATFORM],
836 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
837 case "${BAKEFILE_HOST}" in
838 *-*-cygwin* | *-*-mingw32* )
844 *-pc-os2_emx | *-pc-os2-emx )
854 powerpc-apple-macos* )
863 case "$BAKEFILE_FORCE_PLATFORM" in
884 AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
889 AC_SUBST(PLATFORM_UNIX)
890 AC_SUBST(PLATFORM_WIN32)
891 AC_SUBST(PLATFORM_MSDOS)
892 AC_SUBST(PLATFORM_MAC)
893 AC_SUBST(PLATFORM_MACOS)
894 AC_SUBST(PLATFORM_MACOSX)
895 AC_SUBST(PLATFORM_OS2)
896 AC_SUBST(PLATFORM_BEOS)
900 dnl ---------------------------------------------------------------------------
901 dnl AC_BAKEFILE_PLATFORM_SPECIFICS
903 dnl Sets misc platform-specific settings
904 dnl ---------------------------------------------------------------------------
906 AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
908 AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
909 [use OMF object format (OS/2)]),
910 [bk_os2_use_omf="$enableval"])
912 case "${BAKEFILE_HOST}" in
914 dnl For Unix to MacOS X porting instructions, see:
915 dnl http://fink.sourceforge.net/doc/porting/porting.html
916 CFLAGS="$CFLAGS -fno-common"
917 CXXFLAGS="$CXXFLAGS -fno-common"
920 *-pc-os2_emx | *-pc-os2-emx )
921 if test "x$bk_os2_use_omf" = "xyes" ; then
924 LDFLAGS="-Zomf $LDFLAGS"
925 CFLAGS="-Zomf $CFLAGS"
926 CXXFLAGS="-Zomf $CXXFLAGS"
934 LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
939 dnl ---------------------------------------------------------------------------
940 dnl AC_BAKEFILE_SUFFIXES
942 dnl Detects shared various suffixes for shared libraries, libraries, programs,
944 dnl ---------------------------------------------------------------------------
946 AC_DEFUN([AC_BAKEFILE_SUFFIXES],
949 SO_SUFFIX_MODULE="so"
957 case "${BAKEFILE_HOST}" in
960 SO_SUFFIX_MODULE="sl"
964 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
965 dnl Both archive libraries and shared libraries on AIX have an
966 dnl .a extension. This will explain why you can't link with an
967 dnl .so and why it works with the name changed to .a.
971 *-*-cygwin* | *-*-mingw32* )
973 SO_SUFFIX_MODULE="dll"
974 DLLIMP_SUFFIX="dll.a"
982 *-pc-os2_emx | *-pc-os2-emx )
984 SO_SUFFIX_MODULE="dll"
985 DLLIMP_SUFFIX=$OS2_LIBEXT
989 LIBEXT=".$OS2_LIBEXT"
993 SO_SUFFIX_MODULE="bundle"
997 if test "x$DLLIMP_SUFFIX" = "x" ; then
998 DLLIMP_SUFFIX="$SO_SUFFIX"
1002 AC_SUBST(SO_SUFFIX_MODULE)
1003 AC_SUBST(DLLIMP_SUFFIX)
1008 AC_SUBST(DLLPREFIX_MODULE)
1012 dnl ---------------------------------------------------------------------------
1013 dnl AC_BAKEFILE_SHARED_LD
1015 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
1016 dnl and SHARED_LD_CXX.
1017 dnl ---------------------------------------------------------------------------
1019 AC_DEFUN([AC_BAKEFILE_SHARED_LD],
1021 dnl the extra compiler flags needed for compilation of shared library
1023 if test "x$GCC" = "xyes"; then
1024 dnl the switch for gcc is the same under all platforms
1028 dnl Defaults for GCC and ELF .so shared libs:
1029 SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
1030 SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
1032 case "${BAKEFILE_HOST}" in
1034 dnl default settings are good for gcc but not for the native HP-UX
1035 if test "x$GCC" != "xyes"; then
1036 dnl no idea why it wants it, but it does
1037 LDFLAGS="$LDFLAGS -L/usr/lib"
1039 SHARED_LD_CC="${CC} -b -o"
1040 SHARED_LD_CXX="${CXX} -b -o"
1046 if test "x$GCC" != "xyes"; then
1047 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
1051 #ifndef __INTEL_COMPILER
1055 bakefile_cv_prog_icc=yes,
1056 bakefile_cv_prog_icc=no
1059 if test "$bakefile_cv_prog_icc" = "yes"; then
1066 if test "x$GCC" != xyes ; then
1067 SHARED_LD_CC="${CC} -G -o"
1068 SHARED_LD_CXX="${CXX} -G -o"
1074 dnl Most apps benefit from being fully binded (its faster and static
1075 dnl variables initialized at startup work).
1076 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
1077 dnl or with a double stage link in order to create a single module
1078 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
1080 dnl If using newer dev tools then there is a -single_module flag that
1081 dnl we can use to do this, otherwise we'll need to use a helper
1082 dnl script. Check the version of gcc to see which way we can go:
1083 AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [
1086 #if (__GNUC__ < 3) || \
1087 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
1099 if test "$wx_cv_gcc31" = "no"; then
1100 AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
1101 chmod +x shared-ld-sh
1103 dnl Use the shared-ld-sh helper script
1104 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
1105 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
1106 SHARED_LD_CXX="$SHARED_LD_CC"
1107 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
1109 dnl Use the -single_module flag and let the linker do it for us
1110 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
1111 SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
1112 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
1113 SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
1116 PIC_FLAG="-dynamic -fPIC"
1120 dnl default settings are ok for gcc
1121 if test "x$GCC" != "xyes"; then
1122 dnl the abs path below used to be hardcoded here so I guess it must
1123 dnl be some sort of standard location under AIX?
1124 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
1125 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
1126 dnl FIXME - what about makeCSharedLib?
1127 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
1128 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
1133 dnl can't use gcc under BeOS for shared library creation because it
1134 dnl complains about missing 'main'
1135 SHARED_LD_CC="${LD} -nostart -o"
1136 SHARED_LD_CXX="${LD} -nostart -o"
1140 dnl default settings are ok for gcc
1141 if test "x$GCC" != "xyes"; then
1146 *-*-cygwin* | *-*-mingw32* )
1148 SHARED_LD_CC="\$(CC) -shared -o"
1149 SHARED_LD_CXX="\$(CXX) -shared -o"
1152 *-pc-os2_emx | *-pc-os2-emx )
1153 SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1154 SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1156 AC_BAKEFILE_CREATE_FILE_DLLAR_SH
1160 powerpc-apple-macos* | \
1161 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
1170 AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
1173 if test "x$PIC_FLAG" != "x" ; then
1174 PIC_FLAG="$PIC_FLAG -DPIC"
1177 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
1178 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
1180 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
1181 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
1184 AC_SUBST(SHARED_LD_CC)
1185 AC_SUBST(SHARED_LD_CXX)
1186 AC_SUBST(SHARED_LD_MODULE_CC)
1187 AC_SUBST(SHARED_LD_MODULE_CXX)
1192 dnl ---------------------------------------------------------------------------
1193 dnl AC_BAKEFILE_SHARED_VERSIONS
1195 dnl Detects linker options for attaching versions (sonames) to shared libs.
1196 dnl ---------------------------------------------------------------------------
1198 AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
1207 case "${BAKEFILE_HOST}" in
1208 *-*-linux* | *-*-freebsd* )
1209 SONAME_FLAG="-Wl,-soname,"
1229 AC_SUBST(USE_SOVERSION)
1230 AC_SUBST(USE_SOVERLINUX)
1231 AC_SUBST(USE_SOVERSOLARIS)
1232 AC_SUBST(USE_MACVERSION)
1233 AC_SUBST(USE_SOSYMLINKS)
1234 AC_SUBST(SONAME_FLAG)
1238 dnl ---------------------------------------------------------------------------
1239 dnl AC_BAKEFILE_DEPS
1241 dnl Detects available C/C++ dependency tracking options
1242 dnl ---------------------------------------------------------------------------
1244 AC_DEFUN([AC_BAKEFILE_DEPS],
1246 AC_MSG_CHECKING([for dependency tracking method])
1249 if test "x$GCC" = "xyes"; then
1252 case "${BAKEFILE_HOST}" in
1254 dnl -cpp-precomp (the default) conflicts with -MMD option
1255 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
1256 DEPSFLAG_GCC="-no-cpp-precomp -MMD"
1262 AC_MSG_RESULT([gcc])
1263 elif test "x$MWCC" = "xyes"; then
1267 AC_MSG_RESULT([mwcc])
1269 AC_MSG_RESULT([none])
1272 if test $DEPS_TRACKING = 1 ; then
1273 AC_BAKEFILE_CREATE_FILE_BK_DEPS
1277 AC_SUBST(DEPS_TRACKING)
1280 dnl ---------------------------------------------------------------------------
1281 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
1283 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
1285 dnl ---------------------------------------------------------------------------
1287 AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
1296 AC_CHECK_TOOL(AR, ar, ar)
1297 AC_CHECK_TOOL(STRIP, strip, :)
1298 AC_CHECK_TOOL(NM, nm, :)
1300 case ${BAKEFILE_HOST} in
1302 dnl HP-UX install doesn't handle the "-d" switch so don't
1304 INSTALL_DIR="mkdir -p"
1306 *) INSTALL_DIR="$INSTALL -d"
1309 AC_SUBST(INSTALL_DIR)
1312 case ${BAKEFILE_HOST} in
1313 *-*-cygwin* | *-*-mingw32* )
1314 LDFLAGS_GUI="-mwindows"
1316 AC_SUBST(LDFLAGS_GUI)
1320 dnl ---------------------------------------------------------------------------
1321 dnl AC_BAKEFILE_RES_COMPILERS
1323 dnl Checks for presence of resource compilers for win32 or mac
1324 dnl ---------------------------------------------------------------------------
1326 AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
1331 case ${BAKEFILE_HOST} in
1332 *-*-cygwin* | *-*-mingw32* )
1333 dnl Check for win32 resources compiler:
1334 if test "$build" != "$host" ; then
1335 RESCOMP=$host_alias-windres
1337 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
1341 *-*-darwin* | powerpc-apple-macos* )
1342 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
1343 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
1351 dnl ---------------------------------------------------------------------------
1352 dnl AC_BAKEFILE_PRECOMP_HEADERS
1354 dnl Check for precompiled headers support (GCC >= 3.4)
1355 dnl ---------------------------------------------------------------------------
1357 AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
1360 AC_ARG_ENABLE([precomp-headers],
1361 AS_HELP_STRING([--disable-precomp-headers],
1362 [don't use precompiled headers even if compiler can]),
1363 [bk_use_pch="$enableval"])
1367 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
1368 if test "x$GCC" = "xyes"; then
1369 dnl test if we have gcc-3.4:
1370 AC_MSG_CHECKING([if the compiler supports precompiled headers])
1373 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
1374 #error "no pch support"
1377 #error "no pch support"
1379 #if (__GNUC__ == 3) && \
1380 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
1381 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
1382 #error "no pch support"
1386 AC_MSG_RESULT([yes])
1392 if test $GCC_PCH = 1 ; then
1393 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
1394 chmod +x bk-make-pch
1404 dnl ---------------------------------------------------------------------------
1405 dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
1407 dnl To be used in configure.in of any project using Bakefile-generated mks
1409 dnl Behaviour can be modified by setting following variables:
1410 dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
1411 dnl to perform check for basic tools like ranlib
1412 dnl BAKEFILE_HOST set this to override host detection, defaults
1414 dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
1418 dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
1420 dnl (replace FOO with m4_include above, aclocal would die otherwise)
1421 dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
1423 dnl ---------------------------------------------------------------------------
1425 AC_DEFUN([AC_BAKEFILE],
1429 if test "x$BAKEFILE_HOST" = "x"; then
1430 BAKEFILE_HOST="${host}"
1433 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
1434 AC_BAKEFILE_CHECK_BASIC_STUFF
1437 AC_BAKEFILE_PLATFORM
1438 AC_BAKEFILE_PLATFORM_SPECIFICS
1439 AC_BAKEFILE_SUFFIXES
1440 AC_BAKEFILE_SHARED_LD
1441 AC_BAKEFILE_SHARED_VERSIONS
1443 AC_BAKEFILE_RES_COMPILERS
1445 BAKEFILE_BAKEFILE_M4_VERSION="0.1.7"
1447 dnl includes autoconf_inc.m4:
1450 if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
1451 AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
1456 dnl ---------------------------------------------------------------------------
1457 dnl Embedded copies of helper scripts follow:
1458 dnl ---------------------------------------------------------------------------
1460 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
1462 dnl ===================== dllar.sh begins here =====================
1463 dnl (Created by merge-scripts.py from dllar.sh
1464 dnl file do not edit here!)
1469 # dllar - a tool to build both a .dll and an .a file
1470 # from a set of object (.o) files for EMX/OS2.
1472 # Written by Andrew Zabolotny, bit@freya.etu.ru
1473 # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
1475 # This script will accept a set of files on the command line.
1476 # All the public symbols from the .o files will be exported into
1477 # a .DEF file, then linker will be run (through gcc) against them to
1478 # build a shared library consisting of all given .o files. All libraries
1479 # (.a) will be first decompressed into component .o files then act as
1480 # described above. You can optionally give a description (-d "description")
1481 # which will be put into .DLL. To see the list of accepted options (as well
1482 # as command-line format) simply run this program without options. The .DLL
1483 # is built to be imported by name (there is no guarantee that new versions
1484 # of the library you build will have same ordinals for same symbols).
1486 # dllar is free software; you can redistribute it and/or modify
1487 # it under the terms of the GNU General Public License as published by
1488 # the Free Software Foundation; either version 2, or (at your option)
1489 # any later version.
1491 # dllar is distributed in the hope that it will be useful,
1492 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1493 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1494 # GNU General Public License for more details.
1496 # You should have received a copy of the GNU General Public License
1497 # along with dllar; see the file COPYING. If not, write to the Free
1498 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA
1501 # To successfuly run this program you will need:
1502 # - Current drive should have LFN support (HPFS, ext2, network, etc)
1503 # (Sometimes dllar generates filenames which won't fit 8.3 scheme)
1505 # (used to build the .dll)
1507 # (used to create .def file from .o files)
1509 # (used to create .a file from .def file)
1510 # - GNU text utilites (cat, sort, uniq)
1511 # used to process emxexp output
1512 # - GNU file utilities (mv, rm)
1514 # - lxlite (optional, see flag below)
1515 # (used for general .dll cleanup)
1522 # basnam, variant of basename, which does _not_ remove the path, _iff_
1523 # second argument (suffix to remove) is given
1527 echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
1530 echo ${D}1 | sed 's/'${D}2'${D}//'
1533 echo "error in basnam ${D}*"
1539 # Cleanup temporary files and output
1542 for i in ${D}inputFiles ; do
1545 rm -rf \`basnam ${D}i !\`
1552 # Kill result in case of failure as there is just to many stupid make/nmake
1553 # things out there which doesn't do this.
1554 if @<:@ ${D}# -eq 0 @:>@; then
1555 rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
1559 # Print usage and exit script with rc=1.
1561 echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
1562 echo ' @<:@-name-mangler-script script.sh@:>@'
1563 echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
1564 echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
1565 echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
1566 echo ' @<:@*.o@:>@ @<:@*.a@:>@'
1567 echo '*> "output_file" should have no extension.'
1568 echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
1569 echo ' The import library name is derived from this and is set to "name".a,'
1570 echo ' unless overridden by -import'
1571 echo '*> "importlib_name" should have no extension.'
1572 echo ' If it has the .o, or .a extension, it is automatically removed.'
1573 echo ' This name is used as the import library name and may be longer and'
1574 echo ' more descriptive than the DLL name which has to follow the old '
1575 echo ' 8.3 convention of FAT.'
1576 echo '*> "script.sh may be given to override the output_file name by a'
1577 echo ' different name. It is mainly useful if the regular make process'
1578 echo ' of some package does not take into account OS/2 restriction of'
1579 echo ' DLL name lengths. It takes the importlib name as input and is'
1580 echo ' supposed to procude a shorter name as output. The script should'
1581 echo ' expect to get importlib_name without extension and should produce'
1582 echo ' a (max.) 8 letter name without extension.'
1583 echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
1584 echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
1585 echo ' These flags will be put at the start of GCC command line.'
1586 echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
1587 echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
1588 echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
1589 echo ' If the last character of a symbol is "*", all symbols beginning'
1590 echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
1591 echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
1592 echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
1593 echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
1594 echo ' C runtime DLLs.'
1595 echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
1596 echo '*> All other switches (for example -L./ or -lmylib) will be passed'
1597 echo ' unchanged to GCC at the end of command line.'
1598 echo '*> If you create a DLL from a library and you do not specify -o,'
1599 echo ' the basename for DLL and import library will be set to library name,'
1600 echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
1601 echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
1602 echo ' library will be renamed into gcc_s.a.'
1605 echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
1606 echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
1611 # Execute a command.
1612 # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
1613 # @Uses Whatever CleanUp() uses.
1619 if @<:@ ${D}rcCmd -ne 0 @:>@; then
1620 echo "command failed, exit code="${D}rcCmd
1635 CFLAGS="-s -Zcrtdll"
1637 EXPORT_BY_ORDINALS=0
1646 curDirS=${D}{curDirS}"/"
1652 while @<:@ ${D}1 @:>@; do
1655 EXPORT_BY_ORDINALS=1;
1665 -name-mangler-script)
1686 exclude_symbols=${D}{exclude_symbols}${D}1" "
1690 library_flags=${D}{library_flags}${D}1" "
1709 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1712 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`"
1713 if @<:@ ${D}omfLinking -eq 1 @:>@; then
1714 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib"
1716 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a"
1721 if @<:@ ${D}libsToLink -ne 0 @:>@; then
1722 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1724 for file in ${D}1 ; do
1725 if @<:@ -f ${D}file @:>@; then
1726 inputFiles="${D}{inputFiles} ${D}file"
1730 if @<:@ ${D}found -eq 0 @:>@; then
1731 echo "ERROR: No file(s) found: "${D}1
1738 done # iterate cmdline words
1741 if @<:@ -z "${D}inputFiles" @:>@; then
1742 echo "dllar: no input files"
1746 # Now extract all .o files from .a files
1748 for file in ${D}inputFiles ; do
1759 EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
1764 dirname=\`basnam ${D}file ${D}suffix\`"_%"
1766 if @<:@ ${D}? -ne 0 @:>@; then
1767 echo "Failed to create subdirectory ./${D}dirname"
1771 # Append '!' to indicate archive
1772 newInputFiles="${D}newInputFiles ${D}{dirname}!"
1773 doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
1776 for subfile in ${D}dirname/*.o* ; do
1777 if @<:@ -f ${D}subfile @:>@; then
1779 if @<:@ -s ${D}subfile @:>@; then
1780 # FIXME: This should be: is file size > 32 byte, _not_ > 0!
1781 newInputFiles="${D}newInputFiles ${D}subfile"
1785 if @<:@ ${D}found -eq 0 @:>@; then
1786 echo "WARNING: there are no files in archive \\'${D}file\\'"
1790 newInputFiles="${D}{newInputFiles} ${D}file"
1794 inputFiles="${D}newInputFiles"
1796 # Output filename(s).
1798 if @<:@ -z ${D}outFile @:>@; then
1800 set outFile ${D}inputFiles; outFile=${D}2
1803 # If it is an archive, remove the '!' and the '_%' suffixes
1806 outFile=\`basnam ${D}outFile _%!\`
1813 outFile=\`basnam ${D}outFile .dll\`
1816 outFile=\`basnam ${D}outFile .DLL\`
1819 outFile=\`basnam ${D}outFile .o\`
1822 outFile=\`basnam ${D}outFile .obj\`
1825 outFile=\`basnam ${D}outFile .a\`
1828 outFile=\`basnam ${D}outFile .lib\`
1833 case ${D}outimpFile in
1835 outimpFile=\`basnam ${D}outimpFile .a\`
1838 outimpFile=\`basnam ${D}outimpFile .lib\`
1843 if @<:@ -z ${D}outimpFile @:>@; then
1844 outimpFile=${D}outFile
1846 defFile="${D}{outFile}.def"
1847 arcFile="${D}{outimpFile}.a"
1848 arcFile2="${D}{outimpFile}.lib"
1850 #create ${D}dllFile as something matching 8.3 restrictions,
1851 if @<:@ -z ${D}renameScript @:>@ ; then
1852 dllFile="${D}outFile"
1854 dllFile=\`${D}renameScript ${D}outimpFile\`
1857 if @<:@ ${D}do_backup -ne 0 @:>@ ; then
1858 if @<:@ -f ${D}arcFile @:>@ ; then
1859 doCommand "mv ${D}arcFile ${D}{outFile}_s.a"
1861 if @<:@ -f ${D}arcFile2 @:>@ ; then
1862 doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib"
1866 # Extract public symbols from all the object files.
1867 tmpdefFile=${D}{defFile}_%
1868 rm -f ${D}tmpdefFile
1869 for file in ${D}inputFiles ; do
1874 doCommand "emxexp -u ${D}file >> ${D}tmpdefFile"
1879 # Create the def file.
1881 echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile
1882 dllFile="${D}{dllFile}.dll"
1883 if @<:@ ! -z ${D}description @:>@; then
1884 echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile
1886 echo "EXPORTS" >> ${D}defFile
1888 doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%"
1889 grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile
1891 # Checks if the export is ok or not.
1892 for word in ${D}exclude_symbols; do
1893 grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}%
1894 mv ${D}{tmpdefFile}% ${D}tmpdefFile
1898 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1899 sed "=" < ${D}tmpdefFile | \\
1903 s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/
1905 ' > ${D}{tmpdefFile}%
1906 grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile
1908 rm -f ${D}{tmpdefFile}%
1910 cat ${D}tmpdefFile >> ${D}defFile
1911 rm -f ${D}tmpdefFile
1913 # Do linking, create implib, and apply lxlite.
1915 for file in ${D}inputFiles ; do
1920 gccCmdl="${D}gccCmdl ${D}file"
1924 doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS"
1925 touch "${D}{outFile}.dll"
1927 doCommand "emximp -o ${D}arcFile ${D}defFile"
1928 if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then
1930 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1933 doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile"
1935 doCommand "emxomf -s -l ${D}arcFile"
1941 dnl ===================== dllar.sh ends here =====================
1944 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
1946 dnl ===================== bk-deps begins here =====================
1947 dnl (Created by merge-scripts.py from bk-deps
1948 dnl file do not edit here!)
1953 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1954 # script. It is used to track C/C++ files dependencies in portable way.
1956 # Permission is given to use this file in any way.
1958 DEPSMODE=${DEPSMODE}
1960 DEPSFLAG_GCC="${DEPSFLAG_GCC}"
1961 DEPSFLAG_MWCC="${DEPSFLAG_MWCC}"
1963 mkdir -p ${D}DEPSDIR
1965 if test ${D}DEPSMODE = gcc ; then
1966 ${D}* ${D}{DEPSFLAG_GCC}
1968 if test ${D}{status} != 0 ; then
1971 # move created file to the location we want it in:
1972 while test ${D}# -gt 0; do
1986 depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\`
1987 depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\`
1988 if test -f ${D}depfile ; then
1989 sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1992 depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\`
1993 if test -f ${D}depfile ; then
1994 sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1999 elif test ${D}DEPSMODE = mwcc ; then
2002 if test ${D}{status} != 0 ; then
2005 # Run mwcc again with -MM and redirect into the dep file we want
2006 # NOTE: We can't use shift here because we need ${D}* to be valid
2008 for arg in ${D}* ; do
2009 if test "${D}prevarg" = "-o"; then
2022 ${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d
2029 dnl ===================== bk-deps ends here =====================
2032 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
2034 dnl ===================== shared-ld-sh begins here =====================
2035 dnl (Created by merge-scripts.py from shared-ld-sh
2036 dnl file do not edit here!)
2038 cat <<EOF >shared-ld-sh
2040 #-----------------------------------------------------------------------------
2041 #-- Name: distrib/mac/shared-ld-sh
2042 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
2043 #-- Author: Gilles Depeyrot
2044 #-- Copyright: (c) 2002 Gilles Depeyrot
2045 #-- Licence: any use permitted
2046 #-----------------------------------------------------------------------------
2051 linking_flag="-dynamiclib"
2053 while test ${D}# -gt 0; do
2060 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
2061 # collect these options and values
2062 args="${D}{args} ${D}1 ${D}2"
2066 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
2067 # collect these options
2068 args="${D}{args} ${D}1"
2071 -dynamiclib|-bundle)
2072 linking_flag="${D}1"
2076 echo "shared-ld: unhandled option '${D}1'"
2080 *.o | *.a | *.dylib)
2081 # collect object files
2082 objects="${D}{objects} ${D}1"
2086 echo "shared-ld: unhandled argument '${D}1'"
2095 # Link one module containing all the others
2097 if test ${D}{verbose} = 1; then
2098 echo "c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o"
2100 c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o
2102 if test ${D}{status} != 0; then
2107 # Link the shared library from the single module created
2109 if test ${D}{verbose} = 1; then
2110 echo "cc ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
2112 c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}
2114 if test ${D}{status} != 0; then
2119 # Remove intermediate module
2121 rm -f master.${D}${D}.o
2125 dnl ===================== shared-ld-sh ends here =====================
2128 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
2130 dnl ===================== bk-make-pch begins here =====================
2131 dnl (Created by merge-scripts.py from bk-make-pch
2132 dnl file do not edit here!)
2134 cat <<EOF >bk-make-pch
2137 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2138 # script. It is used to generated precompiled headers.
2140 # Permission is given to use this file in any way.
2149 while test ${D}{#} -gt 0; do
2152 incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\`
2153 if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then
2154 headerfile="${D}{incdir}/${D}{header}"
2158 compiler="${D}{compiler} ${D}{1}"
2162 if test "x${D}{headerfile}" = "x" ; then
2163 echo "error: can't find header ${D}{header} in include paths" >2
2165 if test -f ${D}{outfile} ; then
2168 mkdir -p \`dirname ${D}{outfile}\`
2170 depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d"
2172 # can do this because gcc is >= 3.4:
2173 ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}"
2177 dnl ===================== bk-make-pch ends here =====================
2180 # Configure paths for GTK+
2181 # Owen Taylor 1997-2001
2183 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2184 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
2185 dnl pass to pkg-config
2187 AC_DEFUN([AM_PATH_GTK_2_0],
2189 dnl Get the cflags and libraries from pkg-config
2191 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
2192 , enable_gtktest=yes)
2194 pkg_config_args=gtk+-2.0
2199 pkg_config_args="$pkg_config_args gthread-2.0"
2206 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2208 if test x$PKG_CONFIG != xno ; then
2209 if pkg-config --atleast-pkgconfig-version 0.7 ; then
2212 echo "*** pkg-config too old; version 0.7 or better required."
2220 min_gtk_version=ifelse([$1], ,2.0.0,$1)
2221 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
2223 if test x$PKG_CONFIG != xno ; then
2224 ## don't try to run the test against uninstalled libtool libs
2225 if $PKG_CONFIG --uninstalled $pkg_config_args; then
2226 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
2230 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
2237 if test x"$no_gtk" = x ; then
2238 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
2239 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
2240 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2241 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2242 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2243 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2244 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2245 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2246 if test "x$enable_gtktest" = "xyes" ; then
2247 ac_save_CFLAGS="$CFLAGS"
2248 ac_save_LIBS="$LIBS"
2249 CFLAGS="$CFLAGS $GTK_CFLAGS"
2250 LIBS="$GTK_LIBS $LIBS"
2252 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
2253 dnl checks the results of pkg-config to some extent)
2257 #include <gtk/gtk.h>
2264 int major, minor, micro;
2267 system ("touch conf.gtktest");
2269 /* HP/UX 9 (%@#!) writes to sscanf strings */
2270 tmp_version = g_strdup("$min_gtk_version");
2271 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2272 printf("%s, bad version string\n", "$min_gtk_version");
2276 if ((gtk_major_version != $gtk_config_major_version) ||
2277 (gtk_minor_version != $gtk_config_minor_version) ||
2278 (gtk_micro_version != $gtk_config_micro_version))
2280 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2281 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2282 gtk_major_version, gtk_minor_version, gtk_micro_version);
2283 printf ("*** was found! If pkg-config was correct, then it is best\n");
2284 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2285 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2286 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2287 printf("*** required on your system.\n");
2288 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
2289 printf("*** to point to the correct configuration files\n");
2291 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2292 (gtk_minor_version != GTK_MINOR_VERSION) ||
2293 (gtk_micro_version != GTK_MICRO_VERSION))
2295 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2296 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2297 printf("*** library (version %d.%d.%d)\n",
2298 gtk_major_version, gtk_minor_version, gtk_micro_version);
2302 if ((gtk_major_version > major) ||
2303 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2304 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2310 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2311 gtk_major_version, gtk_minor_version, gtk_micro_version);
2312 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2313 major, minor, micro);
2314 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2316 printf("*** If you have already installed a sufficiently new version, this error\n");
2317 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
2318 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2319 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
2320 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
2321 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2322 printf("*** so that the correct libraries are found at run-time))\n");
2327 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2328 CFLAGS="$ac_save_CFLAGS"
2329 LIBS="$ac_save_LIBS"
2332 if test "x$no_gtk" = x ; then
2333 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
2334 ifelse([$2], , :, [$2])
2337 if test "$PKG_CONFIG" = "no" ; then
2338 echo "*** A new enough version of pkg-config was not found."
2339 echo "*** See http://pkgconfig.sourceforge.net"
2341 if test -f conf.gtktest ; then
2344 echo "*** Could not run GTK+ test program, checking why..."
2345 ac_save_CFLAGS="$CFLAGS"
2346 ac_save_LIBS="$LIBS"
2347 CFLAGS="$CFLAGS $GTK_CFLAGS"
2348 LIBS="$LIBS $GTK_LIBS"
2350 #include <gtk/gtk.h>
2352 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2353 [ echo "*** The test program compiled, but did not run. This usually means"
2354 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
2355 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
2356 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2357 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2358 echo "*** is required on your system"
2360 echo "*** If you have an old version installed, it is best to remove it, although"
2361 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
2362 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2363 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
2364 CFLAGS="$ac_save_CFLAGS"
2365 LIBS="$ac_save_LIBS"
2370 ifelse([$3], , :, [$3])
2372 AC_SUBST(GTK_CFLAGS)
2377 # Configure paths for GTK+
2378 # Owen Taylor 97-11-3
2380 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2381 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2383 AC_DEFUN(AM_PATH_GTK,
2385 dnl Get the cflags and libraries from the gtk-config script
2387 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
2388 gtk_config_prefix="$withval", gtk_config_prefix="")
2389 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2390 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2391 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2392 , enable_gtktest=yes)
2398 gtk_config_args="$gtk_config_args gthread"
2403 if test x$gtk_config_exec_prefix != x ; then
2404 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2405 if test x${GTK_CONFIG+set} != xset ; then
2406 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2409 if test x$gtk_config_prefix != x ; then
2410 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2411 if test x${GTK_CONFIG+set} != xset ; then
2412 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2416 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2417 min_gtk_version=ifelse([$1], ,0.99.7,$1)
2418 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2420 if test "$GTK_CONFIG" = "no" ; then
2423 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2424 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2425 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2426 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2427 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2428 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2429 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2430 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2431 if test "x$enable_gtktest" = "xyes" ; then
2432 ac_save_CFLAGS="$CFLAGS"
2433 ac_save_LIBS="$LIBS"
2434 CFLAGS="$CFLAGS $GTK_CFLAGS"
2435 LIBS="$GTK_LIBS $LIBS"
2437 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2438 dnl checks the results of gtk-config to some extent
2442 #include <gtk/gtk.h>
2449 int major, minor, micro;
2452 system ("touch conf.gtktest");
2454 /* HP/UX 9 (%@#!) writes to sscanf strings */
2455 tmp_version = g_strdup("$min_gtk_version");
2456 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2457 printf("%s, bad version string\n", "$min_gtk_version");
2461 if ((gtk_major_version != $gtk_config_major_version) ||
2462 (gtk_minor_version != $gtk_config_minor_version) ||
2463 (gtk_micro_version != $gtk_config_micro_version))
2465 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2466 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2467 gtk_major_version, gtk_minor_version, gtk_micro_version);
2468 printf ("*** was found! If gtk-config was correct, then it is best\n");
2469 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2470 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2471 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2472 printf("*** required on your system.\n");
2473 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2474 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2475 printf("*** before re-running configure\n");
2477 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2478 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2479 (gtk_minor_version != GTK_MINOR_VERSION) ||
2480 (gtk_micro_version != GTK_MICRO_VERSION))
2482 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2483 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2484 printf("*** library (version %d.%d.%d)\n",
2485 gtk_major_version, gtk_minor_version, gtk_micro_version);
2487 #endif /* defined (GTK_MAJOR_VERSION) ... */
2490 if ((gtk_major_version > major) ||
2491 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2492 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2498 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2499 gtk_major_version, gtk_minor_version, gtk_micro_version);
2500 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2501 major, minor, micro);
2502 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2504 printf("*** If you have already installed a sufficiently new version, this error\n");
2505 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2506 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2507 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2508 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2509 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2510 printf("*** so that the correct libraries are found at run-time))\n");
2515 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2516 CFLAGS="$ac_save_CFLAGS"
2517 LIBS="$ac_save_LIBS"
2520 if test "x$no_gtk" = x ; then
2522 ifelse([$2], , :, [$2])
2525 if test "$GTK_CONFIG" = "no" ; then
2526 echo "*** The gtk-config script installed by GTK could not be found"
2527 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2528 echo "*** your path, or set the GTK_CONFIG environment variable to the"
2529 echo "*** full path to gtk-config."
2531 if test -f conf.gtktest ; then
2534 echo "*** Could not run GTK test program, checking why..."
2535 CFLAGS="$CFLAGS $GTK_CFLAGS"
2536 LIBS="$LIBS $GTK_LIBS"
2538 #include <gtk/gtk.h>
2540 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2541 [ echo "*** The test program compiled, but did not run. This usually means"
2542 echo "*** that the run-time linker is not finding GTK or finding the wrong"
2543 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2544 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2545 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2546 echo "*** is required on your system"
2548 echo "*** If you have an old version installed, it is best to remove it, although"
2549 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2551 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2552 echo "*** came with the system with the command"
2554 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
2555 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2556 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2557 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2558 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2559 CFLAGS="$ac_save_CFLAGS"
2560 LIBS="$ac_save_LIBS"
2565 ifelse([$3], , :, [$3])
2567 AC_SUBST(GTK_CFLAGS)
2573 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
2574 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
2575 dnl also defines GSTUFF_PKG_ERRORS on error
2576 AC_DEFUN(PKG_CHECK_MODULES, [
2579 if test -z "$PKG_CONFIG"; then
2580 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2583 if test "$PKG_CONFIG" = "no" ; then
2584 echo "*** The pkg-config script could not be found. Make sure it is"
2585 echo "*** in your path, or set the PKG_CONFIG environment variable"
2586 echo "*** to the full path to pkg-config."
2587 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
2589 PKG_CONFIG_MIN_VERSION=0.9.0
2590 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
2591 AC_MSG_CHECKING(for $2)
2593 if $PKG_CONFIG --exists "$2" ; then
2597 AC_MSG_CHECKING($1_CFLAGS)
2598 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
2599 AC_MSG_RESULT($$1_CFLAGS)
2601 AC_MSG_CHECKING($1_LIBS)
2602 $1_LIBS=`$PKG_CONFIG --libs "$2"`
2603 AC_MSG_RESULT($$1_LIBS)
2607 ## If we have a custom action on failure, don't print errors, but
2608 ## do set a variable so people can do so.
2609 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
2610 ifelse([$4], ,echo $$1_PKG_ERRORS,)
2616 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
2617 echo "*** See http://www.freedesktop.org/software/pkgconfig"
2621 if test $succeeded = yes; then
2622 ifelse([$3], , :, [$3])
2624 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])
2630 # Configure paths for SDL
2631 # Sam Lantinga 9/21/99
2632 # stolen from Manish Singh
2633 # stolen back from Frank Belew
2634 # stolen from Manish Singh
2635 # Shamelessly stolen from Owen Taylor
2637 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2638 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
2640 AC_DEFUN([AM_PATH_SDL],
2642 dnl Get the cflags and libraries from the sdl-config script
2644 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
2645 sdl_prefix="$withval", sdl_prefix="")
2646 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
2647 sdl_exec_prefix="$withval", sdl_exec_prefix="")
2648 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
2649 , enable_sdltest=yes)
2651 if test x$sdl_exec_prefix != x ; then
2652 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
2653 if test x${SDL_CONFIG+set} != xset ; then
2654 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
2657 if test x$sdl_prefix != x ; then
2658 sdl_args="$sdl_args --prefix=$sdl_prefix"
2659 if test x${SDL_CONFIG+set} != xset ; then
2660 SDL_CONFIG=$sdl_prefix/bin/sdl-config
2664 AC_REQUIRE([AC_CANONICAL_TARGET])
2665 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
2666 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
2667 min_sdl_version=ifelse([$1], ,0.11.0,$1)
2668 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
2670 if test "$SDL_CONFIG" = "no" ; then
2673 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
2674 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
2676 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
2677 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2678 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
2679 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2680 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
2681 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2682 if test "x$enable_sdltest" = "xyes" ; then
2683 ac_save_CFLAGS="$CFLAGS"
2684 ac_save_CXXFLAGS="$CXXFLAGS"
2685 ac_save_LIBS="$LIBS"
2686 CFLAGS="$CFLAGS $SDL_CFLAGS"
2687 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2688 LIBS="$LIBS $SDL_LIBS"
2690 dnl Now check if the installed SDL is sufficiently new. (Also sanity
2691 dnl checks the results of sdl-config to some extent
2701 my_strdup (char *str)
2707 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
2708 strcpy (new_str, str);
2716 int main (int argc, char *argv[])
2718 int major, minor, micro;
2721 /* This hangs on some systems (?)
2722 system ("touch conf.sdltest");
2724 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
2726 /* HP/UX 9 (%@#!) writes to sscanf strings */
2727 tmp_version = my_strdup("$min_sdl_version");
2728 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2729 printf("%s, bad version string\n", "$min_sdl_version");
2733 if (($sdl_major_version > major) ||
2734 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
2735 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
2741 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
2742 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
2743 printf("*** best to upgrade to the required version.\n");
2744 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
2745 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
2746 printf("*** config.cache before re-running configure\n");
2751 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2752 CFLAGS="$ac_save_CFLAGS"
2753 CXXFLAGS="$ac_save_CXXFLAGS"
2754 LIBS="$ac_save_LIBS"
2757 if test "x$no_sdl" = x ; then
2759 ifelse([$2], , :, [$2])
2762 if test "$SDL_CONFIG" = "no" ; then
2763 echo "*** The sdl-config script installed by SDL could not be found"
2764 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
2765 echo "*** your path, or set the SDL_CONFIG environment variable to the"
2766 echo "*** full path to sdl-config."
2768 if test -f conf.sdltest ; then
2771 echo "*** Could not run SDL test program, checking why..."
2772 CFLAGS="$CFLAGS $SDL_CFLAGS"
2773 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2774 LIBS="$LIBS $SDL_LIBS"
2779 int main(int argc, char *argv[])
2782 #define main K_and_R_C_main
2784 [ echo "*** The test program compiled, but did not run. This usually means"
2785 echo "*** that the run-time linker is not finding SDL or finding the wrong"
2786 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
2787 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2788 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2789 echo "*** is required on your system"
2791 echo "*** If you have an old version installed, it is best to remove it, although"
2792 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2793 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2794 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
2795 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
2796 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
2797 CFLAGS="$ac_save_CFLAGS"
2798 CXXFLAGS="$ac_save_CXXFLAGS"
2799 LIBS="$ac_save_LIBS"
2804 ifelse([$3], , :, [$3])
2806 AC_SUBST(SDL_CFLAGS)
2811 dnl Perform a check for a GStreamer element using gst-inspect
2812 dnl Thomas Vander Stichele <thomas at apestaart dot org>
2813 dnl Last modification: 25/01/2005
2815 dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
2817 AC_DEFUN([AM_GST_ELEMENT_CHECK],
2819 if test "x$GST_INSPECT" == "x"; then
2820 AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, [])
2823 if test "x$GST_INSPECT" != "x"; then
2824 AC_MSG_CHECKING(GStreamer element $1)
2825 if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then
2826 AC_MSG_RESULT(found.)
2829 AC_MSG_RESULT(not found.)
2836 dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2838 AC_DEFUN(AM_PATH_CPPUNIT,
2841 AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
2842 cppunit_config_prefix="$withval", cppunit_config_prefix="")
2843 AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
2844 cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
2846 if test x$cppunit_config_exec_prefix != x ; then
2847 cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
2848 if test x${CPPUNIT_CONFIG+set} != xset ; then
2849 CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
2852 if test x$cppunit_config_prefix != x ; then
2853 cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
2854 if test x${CPPUNIT_CONFIG+set} != xset ; then
2855 CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
2859 AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
2860 cppunit_version_min=$1
2862 AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
2864 if test "$CPPUNIT_CONFIG" = "no" ; then
2867 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
2868 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
2869 cppunit_version=`$CPPUNIT_CONFIG --version`
2871 cppunit_major_version=`echo $cppunit_version | \
2872 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2873 cppunit_minor_version=`echo $cppunit_version | \
2874 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2875 cppunit_micro_version=`echo $cppunit_version | \
2876 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2878 cppunit_major_min=`echo $cppunit_version_min | \
2879 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2880 cppunit_minor_min=`echo $cppunit_version_min | \
2881 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2882 cppunit_micro_min=`echo $cppunit_version_min | \
2883 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2885 cppunit_version_proper=`expr \
2886 $cppunit_major_version \> $cppunit_major_min \| \
2887 $cppunit_major_version \= $cppunit_major_min \& \
2888 $cppunit_minor_version \> $cppunit_minor_min \| \
2889 $cppunit_major_version \= $cppunit_major_min \& \
2890 $cppunit_minor_version \= $cppunit_minor_min \& \
2891 $cppunit_micro_version \>= $cppunit_micro_min `
2893 if test "$cppunit_version_proper" = "1" ; then
2894 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
2901 if test "x$no_cppunit" = x ; then
2902 ifelse([$2], , :, [$2])
2906 ifelse([$3], , :, [$3])
2909 AC_SUBST(CPPUNIT_CFLAGS)
2910 AC_SUBST(CPPUNIT_LIBS)