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 http://autoconf-archive.cryp.to/ac_cxx_dynamic_cast.html
723 AC_DEFUN([AC_CXX_DYNAMIC_CAST],
724 [AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
725 ac_cv_cxx_dynamic_cast,
728 AC_TRY_COMPILE([#include <typeinfo>
729 class Base { public : Base () {} virtual void f () = 0;};
730 class Derived : public Base { public : Derived () {} virtual void f () {} };],[
731 Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
732 ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
735 if test "$ac_cv_cxx_dynamic_cast" = yes; then
736 AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
741 dnl ---------------------------------------------------------------------------
742 dnl Support macros for makefiles generated by BAKEFILE.
743 dnl ---------------------------------------------------------------------------
745 dnl Lots of compiler & linker detection code contained here was taken from
746 dnl wxWindows configure.in script (see http://www.wxwindows.org)
748 dnl Based on autoconf _AC_LANG_COMPILER_GNU
749 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
750 [AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
751 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
752 [AC_TRY_COMPILE([],[#ifndef __MWERKS__
756 [bakefile_compiler_mwerks=yes],
757 [bakefile_compiler_mwerks=no])
758 bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
762 dnl Loosely based on autoconf AC_PROG_CC
763 dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
764 AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
766 _AC_BAKEFILE_LANG_COMPILER_MWERKS
767 MWCC=`test $bakefile_compiler_mwerks = yes && echo yes`
771 dnl Loosely based on autoconf AC_PROG_CXX
772 dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
773 AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
775 _AC_BAKEFILE_LANG_COMPILER_MWERKS
776 MWCXX=`test $bakefile_compiler_mwerks = yes && echo yes`
780 dnl ---------------------------------------------------------------------------
781 dnl AC_BAKEFILE_GNUMAKE
784 dnl ---------------------------------------------------------------------------
786 AC_DEFUN([AC_BAKEFILE_GNUMAKE],
788 dnl does make support "-include" (only GNU make does AFAIK)?
789 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
791 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
792 egrep -s GNU > /dev/null); then
793 bakefile_cv_prog_makeisgnu="yes"
795 bakefile_cv_prog_makeisgnu="no"
799 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
804 AC_SUBST(IF_GNU_MAKE)
807 dnl ---------------------------------------------------------------------------
808 dnl AC_BAKEFILE_PLATFORM
810 dnl Detects platform and sets PLATFORM_XXX variables accordingly
811 dnl ---------------------------------------------------------------------------
813 AC_DEFUN([AC_BAKEFILE_PLATFORM],
824 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
825 case "${BAKEFILE_HOST}" in
826 *-*-cygwin* | *-*-mingw32* )
832 *-pc-os2_emx | *-pc-os2-emx )
842 powerpc-apple-macos* )
851 case "$BAKEFILE_FORCE_PLATFORM" in
872 AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
877 AC_SUBST(PLATFORM_UNIX)
878 AC_SUBST(PLATFORM_WIN32)
879 AC_SUBST(PLATFORM_MSDOS)
880 AC_SUBST(PLATFORM_MAC)
881 AC_SUBST(PLATFORM_MACOS)
882 AC_SUBST(PLATFORM_MACOSX)
883 AC_SUBST(PLATFORM_OS2)
884 AC_SUBST(PLATFORM_BEOS)
888 dnl ---------------------------------------------------------------------------
889 dnl AC_BAKEFILE_PLATFORM_SPECIFICS
891 dnl Sets misc platform-specific settings
892 dnl ---------------------------------------------------------------------------
894 AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
896 AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
897 [use OMF object format (OS/2)]),
898 [bk_os2_use_omf="$enableval"])
900 case "${BAKEFILE_HOST}" in
902 dnl For Unix to MacOS X porting instructions, see:
903 dnl http://fink.sourceforge.net/doc/porting/porting.html
904 CFLAGS="$CFLAGS -fno-common"
905 CXXFLAGS="$CXXFLAGS -fno-common"
908 *-pc-os2_emx | *-pc-os2-emx )
909 if test "x$bk_os2_use_omf" = "xyes" ; then
912 LDFLAGS="-Zomf $LDFLAGS"
913 CFLAGS="-Zomf $CFLAGS"
914 CXXFLAGS="-Zomf $CXXFLAGS"
922 LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
927 dnl ---------------------------------------------------------------------------
928 dnl AC_BAKEFILE_SUFFIXES
930 dnl Detects shared various suffixes for shared libraries, libraries, programs,
932 dnl ---------------------------------------------------------------------------
934 AC_DEFUN([AC_BAKEFILE_SUFFIXES],
937 SO_SUFFIX_MODULE="so"
945 case "${BAKEFILE_HOST}" in
948 SO_SUFFIX_MODULE="sl"
952 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
953 dnl Both archive libraries and shared libraries on AIX have an
954 dnl .a extension. This will explain why you can't link with an
955 dnl .so and why it works with the name changed to .a.
959 *-*-cygwin* | *-*-mingw32* )
961 SO_SUFFIX_MODULE="dll"
962 DLLIMP_SUFFIX="dll.a"
970 *-pc-os2_emx | *-pc-os2-emx )
972 SO_SUFFIX_MODULE="dll"
973 DLLIMP_SUFFIX=$OS2_LIBEXT
977 LIBEXT=".$OS2_LIBEXT"
981 SO_SUFFIX_MODULE="bundle"
985 if test "x$DLLIMP_SUFFIX" = "x" ; then
986 DLLIMP_SUFFIX="$SO_SUFFIX"
990 AC_SUBST(SO_SUFFIX_MODULE)
991 AC_SUBST(DLLIMP_SUFFIX)
996 AC_SUBST(DLLPREFIX_MODULE)
1000 dnl ---------------------------------------------------------------------------
1001 dnl AC_BAKEFILE_SHARED_LD
1003 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
1004 dnl and SHARED_LD_CXX.
1005 dnl ---------------------------------------------------------------------------
1007 AC_DEFUN([AC_BAKEFILE_SHARED_LD],
1009 dnl the extra compiler flags needed for compilation of shared library
1011 if test "x$GCC" = "xyes"; then
1012 dnl the switch for gcc is the same under all platforms
1016 dnl Defaults for GCC and ELF .so shared libs:
1017 SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
1018 SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
1020 case "${BAKEFILE_HOST}" in
1022 dnl default settings are good for gcc but not for the native HP-UX
1023 if test "x$GCC" != "xyes"; then
1024 dnl no idea why it wants it, but it does
1025 LDFLAGS="$LDFLAGS -L/usr/lib"
1027 SHARED_LD_CC="${CC} -b -o"
1028 SHARED_LD_CXX="${CXX} -b -o"
1034 if test "x$GCC" != "xyes"; then
1035 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
1039 #ifndef __INTEL_COMPILER
1043 bakefile_cv_prog_icc=yes,
1044 bakefile_cv_prog_icc=no
1047 if test "$bakefile_cv_prog_icc" = "yes"; then
1054 if test "x$GCC" != xyes ; then
1055 SHARED_LD_CC="${CC} -G -o"
1056 SHARED_LD_CXX="${CXX} -G -o"
1062 dnl Most apps benefit from being fully binded (its faster and static
1063 dnl variables initialized at startup work).
1064 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
1065 dnl or with a double stage link in order to create a single module
1066 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
1068 dnl If using newer dev tools then there is a -single_module flag that
1069 dnl we can use to do this, otherwise we'll need to use a helper
1070 dnl script. Check the version of gcc to see which way we can go:
1071 AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [
1074 #if (__GNUC__ < 3) || \
1075 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
1087 if test "$wx_cv_gcc31" = "no"; then
1088 AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
1089 chmod +x shared-ld-sh
1091 dnl Use the shared-ld-sh helper script
1092 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
1093 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
1094 SHARED_LD_CXX="$SHARED_LD_CC"
1095 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
1097 dnl Use the -single_module flag and let the linker do it for us
1098 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
1099 SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
1100 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
1101 SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
1104 PIC_FLAG="-dynamic -fPIC"
1108 dnl default settings are ok for gcc
1109 if test "x$GCC" != "xyes"; then
1110 dnl the abs path below used to be hardcoded here so I guess it must
1111 dnl be some sort of standard location under AIX?
1112 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
1113 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
1114 dnl FIXME - what about makeCSharedLib?
1115 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
1116 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
1121 dnl can't use gcc under BeOS for shared library creation because it
1122 dnl complains about missing 'main'
1123 SHARED_LD_CC="${LD} -nostart -o"
1124 SHARED_LD_CXX="${LD} -nostart -o"
1128 dnl default settings are ok for gcc
1129 if test "x$GCC" != "xyes"; then
1134 *-*-cygwin* | *-*-mingw32* )
1136 SHARED_LD_CC="\$(CC) -shared -o"
1137 SHARED_LD_CXX="\$(CXX) -shared -o"
1140 *-pc-os2_emx | *-pc-os2-emx )
1141 SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1142 SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o"
1144 AC_BAKEFILE_CREATE_FILE_DLLAR_SH
1148 powerpc-apple-macos* | \
1149 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
1158 AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
1161 if test "x$PIC_FLAG" != "x" ; then
1162 PIC_FLAG="$PIC_FLAG -DPIC"
1165 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
1166 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
1168 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
1169 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
1172 AC_SUBST(SHARED_LD_CC)
1173 AC_SUBST(SHARED_LD_CXX)
1174 AC_SUBST(SHARED_LD_MODULE_CC)
1175 AC_SUBST(SHARED_LD_MODULE_CXX)
1180 dnl ---------------------------------------------------------------------------
1181 dnl AC_BAKEFILE_SHARED_VERSIONS
1183 dnl Detects linker options for attaching versions (sonames) to shared libs.
1184 dnl ---------------------------------------------------------------------------
1186 AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
1195 case "${BAKEFILE_HOST}" in
1196 *-*-linux* | *-*-freebsd* )
1197 SONAME_FLAG="-Wl,-soname,"
1217 AC_SUBST(USE_SOVERSION)
1218 AC_SUBST(USE_SOVERLINUX)
1219 AC_SUBST(USE_SOVERSOLARIS)
1220 AC_SUBST(USE_MACVERSION)
1221 AC_SUBST(USE_SOSYMLINKS)
1222 AC_SUBST(SONAME_FLAG)
1226 dnl ---------------------------------------------------------------------------
1227 dnl AC_BAKEFILE_DEPS
1229 dnl Detects available C/C++ dependency tracking options
1230 dnl ---------------------------------------------------------------------------
1232 AC_DEFUN([AC_BAKEFILE_DEPS],
1234 AC_MSG_CHECKING([for dependency tracking method])
1237 if test "x$GCC" = "xyes"; then
1240 case "${BAKEFILE_HOST}" in
1242 dnl -cpp-precomp (the default) conflicts with -MMD option
1243 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
1244 DEPSFLAG_GCC="-no-cpp-precomp -MMD"
1250 AC_MSG_RESULT([gcc])
1251 elif test "x$MWCC" = "xyes"; then
1255 AC_MSG_RESULT([mwcc])
1257 AC_MSG_RESULT([none])
1260 if test $DEPS_TRACKING = 1 ; then
1261 AC_BAKEFILE_CREATE_FILE_BK_DEPS
1265 AC_SUBST(DEPS_TRACKING)
1268 dnl ---------------------------------------------------------------------------
1269 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
1271 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
1273 dnl ---------------------------------------------------------------------------
1275 AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
1284 AC_CHECK_TOOL(AR, ar, ar)
1285 AC_CHECK_TOOL(STRIP, strip, :)
1286 AC_CHECK_TOOL(NM, nm, :)
1288 case ${BAKEFILE_HOST} in
1290 dnl HP-UX install doesn't handle the "-d" switch so don't
1292 INSTALL_DIR="mkdir -p"
1294 *) INSTALL_DIR="$INSTALL -d"
1297 AC_SUBST(INSTALL_DIR)
1300 case ${BAKEFILE_HOST} in
1301 *-*-cygwin* | *-*-mingw32* )
1302 LDFLAGS_GUI="-mwindows"
1304 AC_SUBST(LDFLAGS_GUI)
1308 dnl ---------------------------------------------------------------------------
1309 dnl AC_BAKEFILE_RES_COMPILERS
1311 dnl Checks for presence of resource compilers for win32 or mac
1312 dnl ---------------------------------------------------------------------------
1314 AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
1319 case ${BAKEFILE_HOST} in
1320 *-*-cygwin* | *-*-mingw32* )
1321 dnl Check for win32 resources compiler:
1322 if test "$build" != "$host" ; then
1323 RESCOMP=$host_alias-windres
1325 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
1329 *-*-darwin* | powerpc-apple-macos* )
1330 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
1331 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
1339 dnl ---------------------------------------------------------------------------
1340 dnl AC_BAKEFILE_PRECOMP_HEADERS
1342 dnl Check for precompiled headers support (GCC >= 3.4)
1343 dnl ---------------------------------------------------------------------------
1345 AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
1348 AC_ARG_ENABLE([precomp-headers],
1349 AS_HELP_STRING([--disable-precomp-headers],
1350 [don't use precompiled headers even if compiler can]),
1351 [bk_use_pch="$enableval"])
1355 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
1356 if test "x$GCC" = "xyes"; then
1357 dnl test if we have gcc-3.4:
1358 AC_MSG_CHECKING([if the compiler supports precompiled headers])
1361 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
1362 #error "no pch support"
1365 #error "no pch support"
1367 #if (__GNUC__ == 3) && \
1368 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
1369 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
1370 #error "no pch support"
1374 AC_MSG_RESULT([yes])
1380 if test $GCC_PCH = 1 ; then
1381 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
1382 chmod +x bk-make-pch
1392 dnl ---------------------------------------------------------------------------
1393 dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
1395 dnl To be used in configure.in of any project using Bakefile-generated mks
1397 dnl Behaviour can be modified by setting following variables:
1398 dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
1399 dnl to perform check for basic tools like ranlib
1400 dnl BAKEFILE_HOST set this to override host detection, defaults
1402 dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
1406 dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
1408 dnl (replace FOO with m4_include above, aclocal would die otherwise)
1409 dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
1411 dnl ---------------------------------------------------------------------------
1413 AC_DEFUN([AC_BAKEFILE],
1417 if test "x$BAKEFILE_HOST" = "x"; then
1418 BAKEFILE_HOST="${host}"
1421 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
1422 AC_BAKEFILE_CHECK_BASIC_STUFF
1425 AC_BAKEFILE_PLATFORM
1426 AC_BAKEFILE_PLATFORM_SPECIFICS
1427 AC_BAKEFILE_SUFFIXES
1428 AC_BAKEFILE_SHARED_LD
1429 AC_BAKEFILE_SHARED_VERSIONS
1431 AC_BAKEFILE_RES_COMPILERS
1433 BAKEFILE_BAKEFILE_M4_VERSION="0.1.7"
1435 dnl includes autoconf_inc.m4:
1438 if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
1439 AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
1444 dnl ---------------------------------------------------------------------------
1445 dnl Embedded copies of helper scripts follow:
1446 dnl ---------------------------------------------------------------------------
1448 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
1450 dnl ===================== dllar.sh begins here =====================
1451 dnl (Created by merge-scripts.py from dllar.sh
1452 dnl file do not edit here!)
1457 # dllar - a tool to build both a .dll and an .a file
1458 # from a set of object (.o) files for EMX/OS2.
1460 # Written by Andrew Zabolotny, bit@freya.etu.ru
1461 # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
1463 # This script will accept a set of files on the command line.
1464 # All the public symbols from the .o files will be exported into
1465 # a .DEF file, then linker will be run (through gcc) against them to
1466 # build a shared library consisting of all given .o files. All libraries
1467 # (.a) will be first decompressed into component .o files then act as
1468 # described above. You can optionally give a description (-d "description")
1469 # which will be put into .DLL. To see the list of accepted options (as well
1470 # as command-line format) simply run this program without options. The .DLL
1471 # is built to be imported by name (there is no guarantee that new versions
1472 # of the library you build will have same ordinals for same symbols).
1474 # dllar is free software; you can redistribute it and/or modify
1475 # it under the terms of the GNU General Public License as published by
1476 # the Free Software Foundation; either version 2, or (at your option)
1477 # any later version.
1479 # dllar is distributed in the hope that it will be useful,
1480 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1481 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1482 # GNU General Public License for more details.
1484 # You should have received a copy of the GNU General Public License
1485 # along with dllar; see the file COPYING. If not, write to the Free
1486 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA
1489 # To successfuly run this program you will need:
1490 # - Current drive should have LFN support (HPFS, ext2, network, etc)
1491 # (Sometimes dllar generates filenames which won't fit 8.3 scheme)
1493 # (used to build the .dll)
1495 # (used to create .def file from .o files)
1497 # (used to create .a file from .def file)
1498 # - GNU text utilites (cat, sort, uniq)
1499 # used to process emxexp output
1500 # - GNU file utilities (mv, rm)
1502 # - lxlite (optional, see flag below)
1503 # (used for general .dll cleanup)
1510 # basnam, variant of basename, which does _not_ remove the path, _iff_
1511 # second argument (suffix to remove) is given
1515 echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
1518 echo ${D}1 | sed 's/'${D}2'${D}//'
1521 echo "error in basnam ${D}*"
1527 # Cleanup temporary files and output
1530 for i in ${D}inputFiles ; do
1533 rm -rf \`basnam ${D}i !\`
1540 # Kill result in case of failure as there is just to many stupid make/nmake
1541 # things out there which doesn't do this.
1542 if @<:@ ${D}# -eq 0 @:>@; then
1543 rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
1547 # Print usage and exit script with rc=1.
1549 echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@'
1550 echo ' @<:@-name-mangler-script script.sh@:>@'
1551 echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@'
1552 echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"'
1553 echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@'
1554 echo ' @<:@*.o@:>@ @<:@*.a@:>@'
1555 echo '*> "output_file" should have no extension.'
1556 echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
1557 echo ' The import library name is derived from this and is set to "name".a,'
1558 echo ' unless overridden by -import'
1559 echo '*> "importlib_name" should have no extension.'
1560 echo ' If it has the .o, or .a extension, it is automatically removed.'
1561 echo ' This name is used as the import library name and may be longer and'
1562 echo ' more descriptive than the DLL name which has to follow the old '
1563 echo ' 8.3 convention of FAT.'
1564 echo '*> "script.sh may be given to override the output_file name by a'
1565 echo ' different name. It is mainly useful if the regular make process'
1566 echo ' of some package does not take into account OS/2 restriction of'
1567 echo ' DLL name lengths. It takes the importlib name as input and is'
1568 echo ' supposed to procude a shorter name as output. The script should'
1569 echo ' expect to get importlib_name without extension and should produce'
1570 echo ' a (max.) 8 letter name without extension.'
1571 echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
1572 echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
1573 echo ' These flags will be put at the start of GCC command line.'
1574 echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.'
1575 echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define'
1576 echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
1577 echo ' If the last character of a symbol is "*", all symbols beginning'
1578 echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
1579 echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
1580 echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
1581 echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s'
1582 echo ' C runtime DLLs.'
1583 echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.'
1584 echo '*> All other switches (for example -L./ or -lmylib) will be passed'
1585 echo ' unchanged to GCC at the end of command line.'
1586 echo '*> If you create a DLL from a library and you do not specify -o,'
1587 echo ' the basename for DLL and import library will be set to library name,'
1588 echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
1589 echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
1590 echo ' library will be renamed into gcc_s.a.'
1593 echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
1594 echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
1599 # Execute a command.
1600 # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
1601 # @Uses Whatever CleanUp() uses.
1607 if @<:@ ${D}rcCmd -ne 0 @:>@; then
1608 echo "command failed, exit code="${D}rcCmd
1623 CFLAGS="-s -Zcrtdll"
1625 EXPORT_BY_ORDINALS=0
1634 curDirS=${D}{curDirS}"/"
1640 while @<:@ ${D}1 @:>@; do
1643 EXPORT_BY_ORDINALS=1;
1653 -name-mangler-script)
1674 exclude_symbols=${D}{exclude_symbols}${D}1" "
1678 library_flags=${D}{library_flags}${D}1" "
1697 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1700 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`"
1701 if @<:@ ${D}omfLinking -eq 1 @:>@; then
1702 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib"
1704 EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a"
1709 if @<:@ ${D}libsToLink -ne 0 @:>@; then
1710 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
1712 for file in ${D}1 ; do
1713 if @<:@ -f ${D}file @:>@; then
1714 inputFiles="${D}{inputFiles} ${D}file"
1718 if @<:@ ${D}found -eq 0 @:>@; then
1719 echo "ERROR: No file(s) found: "${D}1
1726 done # iterate cmdline words
1729 if @<:@ -z "${D}inputFiles" @:>@; then
1730 echo "dllar: no input files"
1734 # Now extract all .o files from .a files
1736 for file in ${D}inputFiles ; do
1747 EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
1752 dirname=\`basnam ${D}file ${D}suffix\`"_%"
1754 if @<:@ ${D}? -ne 0 @:>@; then
1755 echo "Failed to create subdirectory ./${D}dirname"
1759 # Append '!' to indicate archive
1760 newInputFiles="${D}newInputFiles ${D}{dirname}!"
1761 doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
1764 for subfile in ${D}dirname/*.o* ; do
1765 if @<:@ -f ${D}subfile @:>@; then
1767 if @<:@ -s ${D}subfile @:>@; then
1768 # FIXME: This should be: is file size > 32 byte, _not_ > 0!
1769 newInputFiles="${D}newInputFiles ${D}subfile"
1773 if @<:@ ${D}found -eq 0 @:>@; then
1774 echo "WARNING: there are no files in archive \\'${D}file\\'"
1778 newInputFiles="${D}{newInputFiles} ${D}file"
1782 inputFiles="${D}newInputFiles"
1784 # Output filename(s).
1786 if @<:@ -z ${D}outFile @:>@; then
1788 set outFile ${D}inputFiles; outFile=${D}2
1791 # If it is an archive, remove the '!' and the '_%' suffixes
1794 outFile=\`basnam ${D}outFile _%!\`
1801 outFile=\`basnam ${D}outFile .dll\`
1804 outFile=\`basnam ${D}outFile .DLL\`
1807 outFile=\`basnam ${D}outFile .o\`
1810 outFile=\`basnam ${D}outFile .obj\`
1813 outFile=\`basnam ${D}outFile .a\`
1816 outFile=\`basnam ${D}outFile .lib\`
1821 case ${D}outimpFile in
1823 outimpFile=\`basnam ${D}outimpFile .a\`
1826 outimpFile=\`basnam ${D}outimpFile .lib\`
1831 if @<:@ -z ${D}outimpFile @:>@; then
1832 outimpFile=${D}outFile
1834 defFile="${D}{outFile}.def"
1835 arcFile="${D}{outimpFile}.a"
1836 arcFile2="${D}{outimpFile}.lib"
1838 #create ${D}dllFile as something matching 8.3 restrictions,
1839 if @<:@ -z ${D}renameScript @:>@ ; then
1840 dllFile="${D}outFile"
1842 dllFile=\`${D}renameScript ${D}outimpFile\`
1845 if @<:@ ${D}do_backup -ne 0 @:>@ ; then
1846 if @<:@ -f ${D}arcFile @:>@ ; then
1847 doCommand "mv ${D}arcFile ${D}{outFile}_s.a"
1849 if @<:@ -f ${D}arcFile2 @:>@ ; then
1850 doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib"
1854 # Extract public symbols from all the object files.
1855 tmpdefFile=${D}{defFile}_%
1856 rm -f ${D}tmpdefFile
1857 for file in ${D}inputFiles ; do
1862 doCommand "emxexp -u ${D}file >> ${D}tmpdefFile"
1867 # Create the def file.
1869 echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile
1870 dllFile="${D}{dllFile}.dll"
1871 if @<:@ ! -z ${D}description @:>@; then
1872 echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile
1874 echo "EXPORTS" >> ${D}defFile
1876 doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%"
1877 grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile
1879 # Checks if the export is ok or not.
1880 for word in ${D}exclude_symbols; do
1881 grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}%
1882 mv ${D}{tmpdefFile}% ${D}tmpdefFile
1886 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1887 sed "=" < ${D}tmpdefFile | \\
1891 s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/
1893 ' > ${D}{tmpdefFile}%
1894 grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile
1896 rm -f ${D}{tmpdefFile}%
1898 cat ${D}tmpdefFile >> ${D}defFile
1899 rm -f ${D}tmpdefFile
1901 # Do linking, create implib, and apply lxlite.
1903 for file in ${D}inputFiles ; do
1908 gccCmdl="${D}gccCmdl ${D}file"
1912 doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS"
1913 touch "${D}{outFile}.dll"
1915 doCommand "emximp -o ${D}arcFile ${D}defFile"
1916 if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then
1918 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
1921 doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile"
1923 doCommand "emxomf -s -l ${D}arcFile"
1929 dnl ===================== dllar.sh ends here =====================
1932 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
1934 dnl ===================== bk-deps begins here =====================
1935 dnl (Created by merge-scripts.py from bk-deps
1936 dnl file do not edit here!)
1941 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
1942 # script. It is used to track C/C++ files dependencies in portable way.
1944 # Permission is given to use this file in any way.
1946 DEPSMODE=${DEPSMODE}
1948 DEPSFLAG_GCC="${DEPSFLAG_GCC}"
1949 DEPSFLAG_MWCC="${DEPSFLAG_MWCC}"
1951 mkdir -p ${D}DEPSDIR
1953 if test ${D}DEPSMODE = gcc ; then
1954 ${D}* ${D}{DEPSFLAG_GCC}
1956 if test ${D}{status} != 0 ; then
1959 # move created file to the location we want it in:
1960 while test ${D}# -gt 0; do
1974 depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\`
1975 depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\`
1976 if test -f ${D}depfile ; then
1977 sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1980 depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\`
1981 if test -f ${D}depfile ; then
1982 sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
1987 elif test ${D}DEPSMODE = mwcc ; then
1990 if test ${D}{status} != 0 ; then
1993 # Run mwcc again with -MM and redirect into the dep file we want
1994 # NOTE: We can't use shift here because we need ${D}* to be valid
1996 for arg in ${D}* ; do
1997 if test "${D}prevarg" = "-o"; then
2010 ${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d
2017 dnl ===================== bk-deps ends here =====================
2020 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
2022 dnl ===================== shared-ld-sh begins here =====================
2023 dnl (Created by merge-scripts.py from shared-ld-sh
2024 dnl file do not edit here!)
2026 cat <<EOF >shared-ld-sh
2028 #-----------------------------------------------------------------------------
2029 #-- Name: distrib/mac/shared-ld-sh
2030 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
2031 #-- Author: Gilles Depeyrot
2032 #-- Copyright: (c) 2002 Gilles Depeyrot
2033 #-- Licence: any use permitted
2034 #-----------------------------------------------------------------------------
2039 linking_flag="-dynamiclib"
2041 while test ${D}# -gt 0; do
2048 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
2049 # collect these options and values
2050 args="${D}{args} ${D}1 ${D}2"
2054 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
2055 # collect these options
2056 args="${D}{args} ${D}1"
2059 -dynamiclib|-bundle)
2060 linking_flag="${D}1"
2064 echo "shared-ld: unhandled option '${D}1'"
2068 *.o | *.a | *.dylib)
2069 # collect object files
2070 objects="${D}{objects} ${D}1"
2074 echo "shared-ld: unhandled argument '${D}1'"
2083 # Link one module containing all the others
2085 if test ${D}{verbose} = 1; then
2086 echo "c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o"
2088 c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o
2090 if test ${D}{status} != 0; then
2095 # Link the shared library from the single module created
2097 if test ${D}{verbose} = 1; then
2098 echo "cc ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
2100 c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}
2102 if test ${D}{status} != 0; then
2107 # Remove intermediate module
2109 rm -f master.${D}${D}.o
2113 dnl ===================== shared-ld-sh ends here =====================
2116 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
2118 dnl ===================== bk-make-pch begins here =====================
2119 dnl (Created by merge-scripts.py from bk-make-pch
2120 dnl file do not edit here!)
2122 cat <<EOF >bk-make-pch
2125 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2126 # script. It is used to generated precompiled headers.
2128 # Permission is given to use this file in any way.
2137 while test ${D}{#} -gt 0; do
2140 incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\`
2141 if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then
2142 headerfile="${D}{incdir}/${D}{header}"
2146 compiler="${D}{compiler} ${D}{1}"
2150 if test "x${D}{headerfile}" = "x" ; then
2151 echo "error: can't find header ${D}{header} in include paths" >2
2153 if test -f ${D}{outfile} ; then
2156 mkdir -p \`dirname ${D}{outfile}\`
2158 depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d"
2160 # can do this because gcc is >= 3.4:
2161 ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}"
2165 dnl ===================== bk-make-pch ends here =====================
2168 # Configure paths for GTK+
2169 # Owen Taylor 1997-2001
2171 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2172 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
2173 dnl pass to pkg-config
2175 AC_DEFUN([AM_PATH_GTK_2_0],
2177 dnl Get the cflags and libraries from pkg-config
2179 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
2180 , enable_gtktest=yes)
2182 pkg_config_args=gtk+-2.0
2187 pkg_config_args="$pkg_config_args gthread-2.0"
2194 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2196 if test x$PKG_CONFIG != xno ; then
2197 if pkg-config --atleast-pkgconfig-version 0.7 ; then
2200 echo "*** pkg-config too old; version 0.7 or better required."
2208 min_gtk_version=ifelse([$1], ,2.0.0,$1)
2209 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
2211 if test x$PKG_CONFIG != xno ; then
2212 ## don't try to run the test against uninstalled libtool libs
2213 if $PKG_CONFIG --uninstalled $pkg_config_args; then
2214 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
2218 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
2225 if test x"$no_gtk" = x ; then
2226 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
2227 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
2228 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2229 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2230 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2231 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2232 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2233 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2234 if test "x$enable_gtktest" = "xyes" ; then
2235 ac_save_CFLAGS="$CFLAGS"
2236 ac_save_LIBS="$LIBS"
2237 CFLAGS="$CFLAGS $GTK_CFLAGS"
2238 LIBS="$GTK_LIBS $LIBS"
2240 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
2241 dnl checks the results of pkg-config to some extent)
2245 #include <gtk/gtk.h>
2252 int major, minor, micro;
2255 system ("touch conf.gtktest");
2257 /* HP/UX 9 (%@#!) writes to sscanf strings */
2258 tmp_version = g_strdup("$min_gtk_version");
2259 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2260 printf("%s, bad version string\n", "$min_gtk_version");
2264 if ((gtk_major_version != $gtk_config_major_version) ||
2265 (gtk_minor_version != $gtk_config_minor_version) ||
2266 (gtk_micro_version != $gtk_config_micro_version))
2268 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2269 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2270 gtk_major_version, gtk_minor_version, gtk_micro_version);
2271 printf ("*** was found! If pkg-config was correct, then it is best\n");
2272 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2273 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2274 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2275 printf("*** required on your system.\n");
2276 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
2277 printf("*** to point to the correct configuration files\n");
2279 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2280 (gtk_minor_version != GTK_MINOR_VERSION) ||
2281 (gtk_micro_version != GTK_MICRO_VERSION))
2283 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2284 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2285 printf("*** library (version %d.%d.%d)\n",
2286 gtk_major_version, gtk_minor_version, gtk_micro_version);
2290 if ((gtk_major_version > major) ||
2291 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2292 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2298 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2299 gtk_major_version, gtk_minor_version, gtk_micro_version);
2300 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2301 major, minor, micro);
2302 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2304 printf("*** If you have already installed a sufficiently new version, this error\n");
2305 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
2306 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2307 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
2308 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
2309 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2310 printf("*** so that the correct libraries are found at run-time))\n");
2315 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2316 CFLAGS="$ac_save_CFLAGS"
2317 LIBS="$ac_save_LIBS"
2320 if test "x$no_gtk" = x ; then
2321 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
2322 ifelse([$2], , :, [$2])
2325 if test "$PKG_CONFIG" = "no" ; then
2326 echo "*** A new enough version of pkg-config was not found."
2327 echo "*** See http://pkgconfig.sourceforge.net"
2329 if test -f conf.gtktest ; then
2332 echo "*** Could not run GTK+ test program, checking why..."
2333 ac_save_CFLAGS="$CFLAGS"
2334 ac_save_LIBS="$LIBS"
2335 CFLAGS="$CFLAGS $GTK_CFLAGS"
2336 LIBS="$LIBS $GTK_LIBS"
2338 #include <gtk/gtk.h>
2340 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2341 [ echo "*** The test program compiled, but did not run. This usually means"
2342 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
2343 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
2344 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2345 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2346 echo "*** is required on your system"
2348 echo "*** If you have an old version installed, it is best to remove it, although"
2349 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
2350 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2351 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
2352 CFLAGS="$ac_save_CFLAGS"
2353 LIBS="$ac_save_LIBS"
2358 ifelse([$3], , :, [$3])
2360 AC_SUBST(GTK_CFLAGS)
2365 # Configure paths for GTK+
2366 # Owen Taylor 97-11-3
2368 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2369 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2371 AC_DEFUN(AM_PATH_GTK,
2373 dnl Get the cflags and libraries from the gtk-config script
2375 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
2376 gtk_config_prefix="$withval", gtk_config_prefix="")
2377 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2378 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2379 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2380 , enable_gtktest=yes)
2386 gtk_config_args="$gtk_config_args gthread"
2391 if test x$gtk_config_exec_prefix != x ; then
2392 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2393 if test x${GTK_CONFIG+set} != xset ; then
2394 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2397 if test x$gtk_config_prefix != x ; then
2398 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2399 if test x${GTK_CONFIG+set} != xset ; then
2400 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2404 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2405 min_gtk_version=ifelse([$1], ,0.99.7,$1)
2406 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2408 if test "$GTK_CONFIG" = "no" ; then
2411 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2412 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2413 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2414 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2415 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2416 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2417 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2418 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2419 if test "x$enable_gtktest" = "xyes" ; then
2420 ac_save_CFLAGS="$CFLAGS"
2421 ac_save_LIBS="$LIBS"
2422 CFLAGS="$CFLAGS $GTK_CFLAGS"
2423 LIBS="$GTK_LIBS $LIBS"
2425 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2426 dnl checks the results of gtk-config to some extent
2430 #include <gtk/gtk.h>
2437 int major, minor, micro;
2440 system ("touch conf.gtktest");
2442 /* HP/UX 9 (%@#!) writes to sscanf strings */
2443 tmp_version = g_strdup("$min_gtk_version");
2444 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2445 printf("%s, bad version string\n", "$min_gtk_version");
2449 if ((gtk_major_version != $gtk_config_major_version) ||
2450 (gtk_minor_version != $gtk_config_minor_version) ||
2451 (gtk_micro_version != $gtk_config_micro_version))
2453 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2454 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2455 gtk_major_version, gtk_minor_version, gtk_micro_version);
2456 printf ("*** was found! If gtk-config was correct, then it is best\n");
2457 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2458 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2459 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2460 printf("*** required on your system.\n");
2461 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2462 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2463 printf("*** before re-running configure\n");
2465 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2466 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2467 (gtk_minor_version != GTK_MINOR_VERSION) ||
2468 (gtk_micro_version != GTK_MICRO_VERSION))
2470 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2471 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2472 printf("*** library (version %d.%d.%d)\n",
2473 gtk_major_version, gtk_minor_version, gtk_micro_version);
2475 #endif /* defined (GTK_MAJOR_VERSION) ... */
2478 if ((gtk_major_version > major) ||
2479 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2480 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2486 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2487 gtk_major_version, gtk_minor_version, gtk_micro_version);
2488 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2489 major, minor, micro);
2490 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2492 printf("*** If you have already installed a sufficiently new version, this error\n");
2493 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2494 printf("*** being found. The easiest way to fix this is to remove the old version\n");
2495 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2496 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2497 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2498 printf("*** so that the correct libraries are found at run-time))\n");
2503 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2504 CFLAGS="$ac_save_CFLAGS"
2505 LIBS="$ac_save_LIBS"
2508 if test "x$no_gtk" = x ; then
2510 ifelse([$2], , :, [$2])
2513 if test "$GTK_CONFIG" = "no" ; then
2514 echo "*** The gtk-config script installed by GTK could not be found"
2515 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2516 echo "*** your path, or set the GTK_CONFIG environment variable to the"
2517 echo "*** full path to gtk-config."
2519 if test -f conf.gtktest ; then
2522 echo "*** Could not run GTK test program, checking why..."
2523 CFLAGS="$CFLAGS $GTK_CFLAGS"
2524 LIBS="$LIBS $GTK_LIBS"
2526 #include <gtk/gtk.h>
2528 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2529 [ echo "*** The test program compiled, but did not run. This usually means"
2530 echo "*** that the run-time linker is not finding GTK or finding the wrong"
2531 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2532 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2533 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2534 echo "*** is required on your system"
2536 echo "*** If you have an old version installed, it is best to remove it, although"
2537 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2539 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2540 echo "*** came with the system with the command"
2542 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
2543 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2544 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2545 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2546 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2547 CFLAGS="$ac_save_CFLAGS"
2548 LIBS="$ac_save_LIBS"
2553 ifelse([$3], , :, [$3])
2555 AC_SUBST(GTK_CFLAGS)
2561 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
2562 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
2563 dnl also defines GSTUFF_PKG_ERRORS on error
2564 AC_DEFUN(PKG_CHECK_MODULES, [
2567 if test -z "$PKG_CONFIG"; then
2568 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2571 if test "$PKG_CONFIG" = "no" ; then
2572 echo "*** The pkg-config script could not be found. Make sure it is"
2573 echo "*** in your path, or set the PKG_CONFIG environment variable"
2574 echo "*** to the full path to pkg-config."
2575 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
2577 PKG_CONFIG_MIN_VERSION=0.9.0
2578 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
2579 AC_MSG_CHECKING(for $2)
2581 if $PKG_CONFIG --exists "$2" ; then
2585 AC_MSG_CHECKING($1_CFLAGS)
2586 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
2587 AC_MSG_RESULT($$1_CFLAGS)
2589 AC_MSG_CHECKING($1_LIBS)
2590 $1_LIBS=`$PKG_CONFIG --libs "$2"`
2591 AC_MSG_RESULT($$1_LIBS)
2595 ## If we have a custom action on failure, don't print errors, but
2596 ## do set a variable so people can do so.
2597 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
2598 ifelse([$4], ,echo $$1_PKG_ERRORS,)
2604 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
2605 echo "*** See http://www.freedesktop.org/software/pkgconfig"
2609 if test $succeeded = yes; then
2610 ifelse([$3], , :, [$3])
2612 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])
2618 # Configure paths for SDL
2619 # Sam Lantinga 9/21/99
2620 # stolen from Manish Singh
2621 # stolen back from Frank Belew
2622 # stolen from Manish Singh
2623 # Shamelessly stolen from Owen Taylor
2625 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2626 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
2628 AC_DEFUN([AM_PATH_SDL],
2630 dnl Get the cflags and libraries from the sdl-config script
2632 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
2633 sdl_prefix="$withval", sdl_prefix="")
2634 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
2635 sdl_exec_prefix="$withval", sdl_exec_prefix="")
2636 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
2637 , enable_sdltest=yes)
2639 if test x$sdl_exec_prefix != x ; then
2640 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
2641 if test x${SDL_CONFIG+set} != xset ; then
2642 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
2645 if test x$sdl_prefix != x ; then
2646 sdl_args="$sdl_args --prefix=$sdl_prefix"
2647 if test x${SDL_CONFIG+set} != xset ; then
2648 SDL_CONFIG=$sdl_prefix/bin/sdl-config
2652 AC_REQUIRE([AC_CANONICAL_TARGET])
2653 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
2654 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
2655 min_sdl_version=ifelse([$1], ,0.11.0,$1)
2656 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
2658 if test "$SDL_CONFIG" = "no" ; then
2661 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
2662 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
2664 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
2665 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2666 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
2667 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2668 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
2669 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2670 if test "x$enable_sdltest" = "xyes" ; then
2671 ac_save_CFLAGS="$CFLAGS"
2672 ac_save_CXXFLAGS="$CXXFLAGS"
2673 ac_save_LIBS="$LIBS"
2674 CFLAGS="$CFLAGS $SDL_CFLAGS"
2675 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2676 LIBS="$LIBS $SDL_LIBS"
2678 dnl Now check if the installed SDL is sufficiently new. (Also sanity
2679 dnl checks the results of sdl-config to some extent
2689 my_strdup (char *str)
2695 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
2696 strcpy (new_str, str);
2704 int main (int argc, char *argv[])
2706 int major, minor, micro;
2709 /* This hangs on some systems (?)
2710 system ("touch conf.sdltest");
2712 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
2714 /* HP/UX 9 (%@#!) writes to sscanf strings */
2715 tmp_version = my_strdup("$min_sdl_version");
2716 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
2717 printf("%s, bad version string\n", "$min_sdl_version");
2721 if (($sdl_major_version > major) ||
2722 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
2723 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
2729 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
2730 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
2731 printf("*** best to upgrade to the required version.\n");
2732 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
2733 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
2734 printf("*** config.cache before re-running configure\n");
2739 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2740 CFLAGS="$ac_save_CFLAGS"
2741 CXXFLAGS="$ac_save_CXXFLAGS"
2742 LIBS="$ac_save_LIBS"
2745 if test "x$no_sdl" = x ; then
2747 ifelse([$2], , :, [$2])
2750 if test "$SDL_CONFIG" = "no" ; then
2751 echo "*** The sdl-config script installed by SDL could not be found"
2752 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
2753 echo "*** your path, or set the SDL_CONFIG environment variable to the"
2754 echo "*** full path to sdl-config."
2756 if test -f conf.sdltest ; then
2759 echo "*** Could not run SDL test program, checking why..."
2760 CFLAGS="$CFLAGS $SDL_CFLAGS"
2761 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2762 LIBS="$LIBS $SDL_LIBS"
2767 int main(int argc, char *argv[])
2770 #define main K_and_R_C_main
2772 [ echo "*** The test program compiled, but did not run. This usually means"
2773 echo "*** that the run-time linker is not finding SDL or finding the wrong"
2774 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
2775 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2776 echo "*** to the installed location Also, make sure you have run ldconfig if that"
2777 echo "*** is required on your system"
2779 echo "*** If you have an old version installed, it is best to remove it, although"
2780 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2781 [ echo "*** The test program failed to compile or link. See the file config.log for the"
2782 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
2783 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
2784 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
2785 CFLAGS="$ac_save_CFLAGS"
2786 CXXFLAGS="$ac_save_CXXFLAGS"
2787 LIBS="$ac_save_LIBS"
2792 ifelse([$3], , :, [$3])
2794 AC_SUBST(SDL_CFLAGS)
2799 dnl Perform a check for a GStreamer element using gst-inspect
2800 dnl Thomas Vander Stichele <thomas at apestaart dot org>
2801 dnl Last modification: 25/01/2005
2803 dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
2805 AC_DEFUN([AM_GST_ELEMENT_CHECK],
2807 if test "x$GST_INSPECT" == "x"; then
2808 AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, [])
2811 if test "x$GST_INSPECT" != "x"; then
2812 AC_MSG_CHECKING(GStreamer element $1)
2813 if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then
2814 AC_MSG_RESULT(found.)
2817 AC_MSG_RESULT(not found.)
2824 dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2826 AC_DEFUN(AM_PATH_CPPUNIT,
2829 AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
2830 cppunit_config_prefix="$withval", cppunit_config_prefix="")
2831 AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
2832 cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
2834 if test x$cppunit_config_exec_prefix != x ; then
2835 cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
2836 if test x${CPPUNIT_CONFIG+set} != xset ; then
2837 CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
2840 if test x$cppunit_config_prefix != x ; then
2841 cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
2842 if test x${CPPUNIT_CONFIG+set} != xset ; then
2843 CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
2847 AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
2848 cppunit_version_min=$1
2850 AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
2852 if test "$CPPUNIT_CONFIG" = "no" ; then
2855 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
2856 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
2857 cppunit_version=`$CPPUNIT_CONFIG --version`
2859 cppunit_major_version=`echo $cppunit_version | \
2860 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2861 cppunit_minor_version=`echo $cppunit_version | \
2862 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2863 cppunit_micro_version=`echo $cppunit_version | \
2864 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2866 cppunit_major_min=`echo $cppunit_version_min | \
2867 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2868 cppunit_minor_min=`echo $cppunit_version_min | \
2869 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2870 cppunit_micro_min=`echo $cppunit_version_min | \
2871 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2873 cppunit_version_proper=`expr \
2874 $cppunit_major_version \> $cppunit_major_min \| \
2875 $cppunit_major_version \= $cppunit_major_min \& \
2876 $cppunit_minor_version \> $cppunit_minor_min \| \
2877 $cppunit_major_version \= $cppunit_major_min \& \
2878 $cppunit_minor_version \= $cppunit_minor_min \& \
2879 $cppunit_micro_version \>= $cppunit_micro_min `
2881 if test "$cppunit_version_proper" = "1" ; then
2882 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
2889 if test "x$no_cppunit" = x ; then
2890 ifelse([$2], , :, [$2])
2894 ifelse([$3], , :, [$3])
2897 AC_SUBST(CPPUNIT_CFLAGS)
2898 AC_SUBST(CPPUNIT_LIBS)