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 find the a file in the list of include/lib paths
26 dnl ===========================================================================
28 dnl ---------------------------------------------------------------------------
29 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
30 dnl to the full name of the file that was found or leaves it empty if not found
31 dnl ---------------------------------------------------------------------------
32 AC_DEFUN([WX_PATH_FIND_INCLUDES],
35 for ac_dir in $1 /usr/include;
37 if test -f "$ac_dir/$2"; then
38 ac_find_includes=$ac_dir
44 dnl ---------------------------------------------------------------------------
45 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
46 dnl to the full name of the file that was found or leaves it empty if not found
47 dnl ---------------------------------------------------------------------------
48 AC_DEFUN([WX_PATH_FIND_LIBRARIES],
51 for ac_dir in $1 /usr/lib;
53 for ac_extension in a so sl dylib; do
54 if test -f "$ac_dir/lib$2.$ac_extension"; then
55 ac_find_libraries=$ac_dir
62 dnl ---------------------------------------------------------------------------
63 dnl Path to include, already defined
64 dnl ---------------------------------------------------------------------------
65 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
67 dnl never add -I/usr/include to the CPPFLAGS
68 if test "x$1" = "x/usr/include"; then
71 echo "$2" | grep "\-I$1" > /dev/null
73 if test $result = 0; then
76 ac_path_to_include=" -I$1"
81 dnl ---------------------------------------------------------------------------
82 dnl Path to link, already defined
83 dnl ---------------------------------------------------------------------------
84 AC_DEFUN([WX_LINK_PATH_EXIST],
86 echo "$2" | grep "\-L$1" > /dev/null
88 if test $result = 0; then
91 ac_path_to_link=" -L$1"
95 dnl ===========================================================================
97 dnl ===========================================================================
99 dnl ---------------------------------------------------------------------------
100 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
101 dnl or only the old <iostream.h> one - it may be generally assumed that if
102 dnl <iostream> exists, the other "new" headers (without .h) exist too.
104 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false)
105 dnl ---------------------------------------------------------------------------
107 AC_DEFUN([WX_CPP_NEW_HEADERS],
112 AC_CHECK_HEADERS(iostream)
114 if test "$ac_cv_header_iostream" = "yes" ; then
115 ifelse([$1], , :, [$1])
117 ifelse([$2], , :, [$2])
123 dnl ---------------------------------------------------------------------------
124 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
126 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
127 dnl ---------------------------------------------------------------------------
129 AC_DEFUN([WX_CPP_BOOL],
131 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
155 if test "$wx_cv_cpp_bool" = "yes"; then
160 dnl ---------------------------------------------------------------------------
161 dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
162 dnl keyword and defines HAVE_EXPLICIT if this is the case
163 dnl ---------------------------------------------------------------------------
165 AC_DEFUN([WX_CPP_EXPLICIT],
167 AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
173 dnl do the test in 2 steps: first check that the compiler knows about the
174 dnl explicit keyword at all and then verify that it really honours it
177 class Foo { public: explicit Foo(int) {} };
185 class Foo { public: explicit Foo(int) {} };
186 static void TakeFoo(const Foo& foo) { }
202 if test "$wx_cv_explicit" = "yes"; then
203 AC_DEFINE(HAVE_EXPLICIT)
207 dnl ---------------------------------------------------------------------------
208 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
209 dnl ---------------------------------------------------------------------------
211 AC_DEFUN([WX_C_BIGENDIAN],
212 [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
213 [ac_cv_c_bigendian=unknown
214 # See if sys/param.h defines the BYTE_ORDER macro.
215 AC_TRY_COMPILE([#include <sys/types.h>
216 #include <sys/param.h>], [
217 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
219 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
220 AC_TRY_COMPILE([#include <sys/types.h>
221 #include <sys/param.h>], [
222 #if BYTE_ORDER != BIG_ENDIAN
224 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
225 if test $ac_cv_c_bigendian = unknown; then
226 AC_TRY_RUN([main () {
227 /* Are we little or big endian? From Harbison&Steele. */
231 char c[sizeof (long)];
234 exit (u.c[sizeof (long) - 1] == 1);
235 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
237 if test $ac_cv_c_bigendian = unknown; then
238 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])
240 if test $ac_cv_c_bigendian = yes; then
241 AC_DEFINE(WORDS_BIGENDIAN)
245 dnl ---------------------------------------------------------------------------
246 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
247 dnl ---------------------------------------------------------------------------
249 AC_DEFUN([WX_ARG_CACHE_INIT],
251 wx_arg_cache_file="configarg.cache"
252 echo "loading argument cache $wx_arg_cache_file"
253 rm -f ${wx_arg_cache_file}.tmp
254 touch ${wx_arg_cache_file}.tmp
255 touch ${wx_arg_cache_file}
258 AC_DEFUN([WX_ARG_CACHE_FLUSH],
260 echo "saving argument cache $wx_arg_cache_file"
261 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
264 dnl this macro checks for a three-valued command line --with argument:
265 dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
266 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
267 AC_DEFUN([WX_ARG_SYS_WITH],
269 AC_MSG_CHECKING([for --with-$1])
271 AC_ARG_WITH($1, [$2],
273 if test "$withval" = yes; then
274 ac_cv_use_$1='$3=yes'
275 elif test "$withval" = no; then
277 elif test "$withval" = sys; then
278 ac_cv_use_$1='$3=sys'
279 elif test "$withval" = builtin; then
280 ac_cv_use_$1='$3=builtin'
282 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
286 LINE=`grep "$3" ${wx_arg_cache_file}`
287 if test "x$LINE" != x ; then
293 ac_cv_use_$1='$3='$DEFAULT_$3
297 if test "$no_cache" != 1; then
298 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
301 if test "$$3" = yes; then
303 elif test "$$3" = no; then
305 elif test "$$3" = sys; then
306 AC_MSG_RESULT([system version])
307 elif test "$$3" = builtin; then
308 AC_MSG_RESULT([builtin version])
310 AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
314 dnl this macro checks for a command line argument and caches the result
315 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
316 AC_DEFUN([WX_ARG_WITH],
318 AC_MSG_CHECKING([for --with-$1])
320 AC_ARG_WITH($1, [$2],
322 if test "$withval" = yes; then
323 ac_cv_use_$1='$3=yes'
329 LINE=`grep "$3" ${wx_arg_cache_file}`
330 if test "x$LINE" != x ; then
336 ac_cv_use_$1='$3='$DEFAULT_$3
340 if test "$no_cache" != 1; then
341 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
344 if test "$$3" = yes; then
351 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
352 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
354 dnl enablestring is a hack and allows to show "checking for --disable-foo"
355 dnl message when running configure instead of the default "checking for
356 dnl --enable-foo" one whih is useful for the options enabled by default
357 AC_DEFUN([WX_ARG_ENABLE],
360 AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
362 AC_ARG_ENABLE($1, [$2],
364 if test "$enableval" = yes; then
365 ac_cv_use_$1='$3=yes'
371 LINE=`grep "$3" ${wx_arg_cache_file}`
372 if test "x$LINE" != x ; then
378 ac_cv_use_$1='$3='$DEFAULT_$3
382 if test "$no_cache" != 1; then
383 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
386 if test "$$3" = yes; then
394 dnl ===========================================================================
395 dnl Linker features test
396 dnl ===========================================================================
398 dnl ---------------------------------------------------------------------------
399 dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
400 dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
401 dnl version script file named versionfile
403 dnl call WX_VERSIONED_SYMBOLS(versionfile)
404 dnl ---------------------------------------------------------------------------
405 AC_DEFUN([WX_VERSIONED_SYMBOLS],
409 dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
411 dnl dnl Check for known non-gcc cases:
412 dnl case "${host}" in
414 dnl if test "x$GCC" != "xyes" ; then
415 dnl LDFLAGS_VERSIONING="-M $1"
416 dnl found_versioning=yes
421 dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
422 if test $found_versioning = no ; then
423 AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
425 echo "VER_1 { *; };" >conftest.sym
426 echo "int main() { return 0; }" >conftest.cpp
429 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
430 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
431 if test -s conftest.stderr ; then
432 wx_cv_version_script=no
434 wx_cv_version_script=yes
437 wx_cv_version_script=no
439 rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
441 if test $wx_cv_version_script = yes ; then
442 LDFLAGS_VERSIONING="-Wl,--version-script,$1"
448 dnl ===========================================================================
449 dnl "3rd party" macros included here because they are not widely available
450 dnl ===========================================================================
452 dnl ---------------------------------------------------------------------------
453 dnl test for availability of iconv()
454 dnl ---------------------------------------------------------------------------
456 dnl From Bruno Haible.
460 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
461 dnl those with the standalone portable GNU libiconv installed).
463 AC_ARG_WITH([libiconv-prefix],
464 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
465 for dir in `echo "$withval" | tr : ' '`; do
466 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
467 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
471 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
472 am_cv_func_iconv="no, consider installing GNU libiconv"
474 AC_TRY_LINK([#include <stdlib.h>
476 [iconv_t cd = iconv_open("","");
477 iconv(cd,NULL,NULL,NULL,NULL);
479 am_cv_func_iconv=yes)
480 if test "$am_cv_func_iconv" != yes; then
483 AC_TRY_LINK([#include <stdlib.h>
485 [iconv_t cd = iconv_open("","");
486 iconv(cd,NULL,NULL,NULL,NULL);
489 am_cv_func_iconv=yes)
493 if test "$am_cv_func_iconv" = yes; then
494 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
495 AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
503 #if defined(__STDC__) || defined(__cplusplus)
504 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
510 wx_cv_func_iconv_const="no",
511 wx_cv_func_iconv_const="yes"
516 if test "x$wx_cv_func_iconv_const" = "xyes"; then
520 AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
521 [Define as const if the declaration of iconv() needs const.])
524 if test "$am_cv_lib_iconv" = yes; then
530 dnl ---------------------------------------------------------------------------
531 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
532 dnl ---------------------------------------------------------------------------
534 dnl WX_SYS_LARGEFILE_TEST
536 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
537 dnl arithmetic properly but this failed miserably with gcc under Linux
538 dnl whereas the system still supports 64 bit files, so now simply check
539 dnl that off_t is big enough
540 define(WX_SYS_LARGEFILE_TEST,
542 unsigned int field: sizeof(off_t) == 8;
547 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
548 define(WX_SYS_LARGEFILE_MACRO_VALUE,
550 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
552 AC_TRY_COMPILE([#define $1 $2
553 #include <sys/types.h>],
554 WX_SYS_LARGEFILE_TEST,
560 if test "$$3" != no; then
562 AC_DEFINE_UNQUOTED([$1], [$$3])
569 dnl By default, many hosts won't let programs access large files;
570 dnl one must use special compiler options to get large-file access to work.
571 dnl For more details about this brain damage please see:
572 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
573 AC_DEFUN([AC_SYS_LARGEFILE],
574 [AC_ARG_ENABLE(largefile,
575 [ --disable-largefile omit support for large files])
576 if test "$enable_largefile" != no; then
577 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
578 dnl _LARGE_FILES -- for AIX
580 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
581 if test "x$wx_largefile" != "xyes"; then
582 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
585 AC_MSG_CHECKING(if large file support is available)
586 if test "x$wx_largefile" = "xyes"; then
587 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
589 AC_MSG_RESULT($wx_largefile)
594 dnl Available from the GNU Autoconf Macro Archive at:
595 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
597 AC_DEFUN([AC_CXX_CONST_CAST],
598 [AC_CACHE_CHECK(whether the compiler supports const_cast<>,
599 ac_cv_cxx_const_cast,
602 AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
603 ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
606 if test "$ac_cv_cxx_const_cast" = yes; then
607 AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
611 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html
612 AC_DEFUN([AC_CXX_REINTERPRET_CAST],
613 [AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
614 ac_cv_cxx_reinterpret_cast,
617 AC_TRY_COMPILE([#include <typeinfo>
618 class Base { public : Base () {} virtual void f () = 0;};
619 class Derived : public Base { public : Derived () {} virtual void f () {} };
620 class Unrelated { public : Unrelated () {} };
621 int g (Unrelated&) { return 0; }],[
622 Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
623 ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
626 if test "$ac_cv_cxx_reinterpret_cast" = yes; then
627 AC_DEFINE(HAVE_REINTERPRET_CAST,,
628 [define if the compiler supports reinterpret_cast<>])
632 dnl and http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html
633 AC_DEFUN([AC_CXX_STATIC_CAST],
634 [AC_CACHE_CHECK(whether the compiler supports static_cast<>,
635 ac_cv_cxx_static_cast,
638 AC_TRY_COMPILE([#include <typeinfo>
639 class Base { public : Base () {} virtual void f () = 0; };
640 class Derived : public Base { public : Derived () {} virtual void f () {} };
641 int g (Derived&) { return 0; }],[
642 Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
643 ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no)
646 if test "$ac_cv_cxx_static_cast" = yes; then
647 AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>])
651 # Configure paths for GTK+
652 # Owen Taylor 1997-2001
654 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
655 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
656 dnl pass to pkg-config
658 AC_DEFUN([AM_PATH_GTK_2_0],
660 dnl Get the cflags and libraries from pkg-config
662 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
663 , enable_gtktest=yes)
665 pkg_config_args=gtk+-2.0
670 pkg_config_args="$pkg_config_args gthread-2.0"
677 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
679 if test x$PKG_CONFIG != xno ; then
680 if pkg-config --atleast-pkgconfig-version 0.7 ; then
683 echo "*** pkg-config too old; version 0.7 or better required."
691 min_gtk_version=ifelse([$1], ,2.0.0,$1)
692 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
694 if test x$PKG_CONFIG != xno ; then
695 ## don't try to run the test against uninstalled libtool libs
696 if $PKG_CONFIG --uninstalled $pkg_config_args; then
697 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
701 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
708 if test x"$no_gtk" = x ; then
709 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
710 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
711 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
712 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
713 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
714 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
715 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
716 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
717 if test "x$enable_gtktest" = "xyes" ; then
718 ac_save_CFLAGS="$CFLAGS"
720 CFLAGS="$CFLAGS $GTK_CFLAGS"
721 LIBS="$GTK_LIBS $LIBS"
723 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
724 dnl checks the results of pkg-config to some extent)
735 int major, minor, micro;
738 system ("touch conf.gtktest");
740 /* HP/UX 9 (%@#!) writes to sscanf strings */
741 tmp_version = g_strdup("$min_gtk_version");
742 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
743 printf("%s, bad version string\n", "$min_gtk_version");
747 if ((gtk_major_version != $gtk_config_major_version) ||
748 (gtk_minor_version != $gtk_config_minor_version) ||
749 (gtk_micro_version != $gtk_config_micro_version))
751 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
752 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
753 gtk_major_version, gtk_minor_version, gtk_micro_version);
754 printf ("*** was found! If pkg-config was correct, then it is best\n");
755 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
756 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
757 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
758 printf("*** required on your system.\n");
759 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
760 printf("*** to point to the correct configuration files\n");
762 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
763 (gtk_minor_version != GTK_MINOR_VERSION) ||
764 (gtk_micro_version != GTK_MICRO_VERSION))
766 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
767 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
768 printf("*** library (version %d.%d.%d)\n",
769 gtk_major_version, gtk_minor_version, gtk_micro_version);
773 if ((gtk_major_version > major) ||
774 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
775 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
781 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
782 gtk_major_version, gtk_minor_version, gtk_micro_version);
783 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
784 major, minor, micro);
785 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
787 printf("*** If you have already installed a sufficiently new version, this error\n");
788 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
789 printf("*** being found. The easiest way to fix this is to remove the old version\n");
790 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
791 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
792 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
793 printf("*** so that the correct libraries are found at run-time))\n");
798 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
799 CFLAGS="$ac_save_CFLAGS"
803 if test "x$no_gtk" = x ; then
804 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
805 ifelse([$2], , :, [$2])
808 if test "$PKG_CONFIG" = "no" ; then
809 echo "*** A new enough version of pkg-config was not found."
810 echo "*** See http://pkgconfig.sourceforge.net"
812 if test -f conf.gtktest ; then
815 echo "*** Could not run GTK+ test program, checking why..."
816 ac_save_CFLAGS="$CFLAGS"
818 CFLAGS="$CFLAGS $GTK_CFLAGS"
819 LIBS="$LIBS $GTK_LIBS"
823 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
824 [ echo "*** The test program compiled, but did not run. This usually means"
825 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
826 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
827 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
828 echo "*** to the installed location Also, make sure you have run ldconfig if that"
829 echo "*** is required on your system"
831 echo "*** If you have an old version installed, it is best to remove it, although"
832 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
833 [ echo "*** The test program failed to compile or link. See the file config.log for the"
834 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
835 CFLAGS="$ac_save_CFLAGS"
841 ifelse([$3], , :, [$3])
848 # Configure paths for GTK+
849 # Owen Taylor 97-11-3
851 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
852 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
854 AC_DEFUN(AM_PATH_GTK,
856 dnl Get the cflags and libraries from the gtk-config script
858 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
859 gtk_config_prefix="$withval", gtk_config_prefix="")
860 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
861 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
862 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
863 , enable_gtktest=yes)
869 gtk_config_args="$gtk_config_args gthread"
874 if test x$gtk_config_exec_prefix != x ; then
875 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
876 if test x${GTK_CONFIG+set} != xset ; then
877 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
880 if test x$gtk_config_prefix != x ; then
881 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
882 if test x${GTK_CONFIG+set} != xset ; then
883 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
887 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
888 min_gtk_version=ifelse([$1], ,0.99.7,$1)
889 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
891 if test "$GTK_CONFIG" = "no" ; then
894 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
895 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
896 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
897 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
898 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
899 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
900 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
901 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
902 if test "x$enable_gtktest" = "xyes" ; then
903 ac_save_CFLAGS="$CFLAGS"
905 CFLAGS="$CFLAGS $GTK_CFLAGS"
906 LIBS="$GTK_LIBS $LIBS"
908 dnl Now check if the installed GTK is sufficiently new. (Also sanity
909 dnl checks the results of gtk-config to some extent
920 int major, minor, micro;
923 system ("touch conf.gtktest");
925 /* HP/UX 9 (%@#!) writes to sscanf strings */
926 tmp_version = g_strdup("$min_gtk_version");
927 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
928 printf("%s, bad version string\n", "$min_gtk_version");
932 if ((gtk_major_version != $gtk_config_major_version) ||
933 (gtk_minor_version != $gtk_config_minor_version) ||
934 (gtk_micro_version != $gtk_config_micro_version))
936 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
937 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
938 gtk_major_version, gtk_minor_version, gtk_micro_version);
939 printf ("*** was found! If gtk-config was correct, then it is best\n");
940 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
941 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
942 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
943 printf("*** required on your system.\n");
944 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
945 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
946 printf("*** before re-running configure\n");
948 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
949 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
950 (gtk_minor_version != GTK_MINOR_VERSION) ||
951 (gtk_micro_version != GTK_MICRO_VERSION))
953 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
954 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
955 printf("*** library (version %d.%d.%d)\n",
956 gtk_major_version, gtk_minor_version, gtk_micro_version);
958 #endif /* defined (GTK_MAJOR_VERSION) ... */
961 if ((gtk_major_version > major) ||
962 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
963 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
969 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
970 gtk_major_version, gtk_minor_version, gtk_micro_version);
971 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
972 major, minor, micro);
973 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
975 printf("*** If you have already installed a sufficiently new version, this error\n");
976 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
977 printf("*** being found. The easiest way to fix this is to remove the old version\n");
978 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
979 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
980 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
981 printf("*** so that the correct libraries are found at run-time))\n");
986 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
987 CFLAGS="$ac_save_CFLAGS"
991 if test "x$no_gtk" = x ; then
993 ifelse([$2], , :, [$2])
996 if test "$GTK_CONFIG" = "no" ; then
997 echo "*** The gtk-config script installed by GTK could not be found"
998 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
999 echo "*** your path, or set the GTK_CONFIG environment variable to the"
1000 echo "*** full path to gtk-config."
1002 if test -f conf.gtktest ; then
1005 echo "*** Could not run GTK test program, checking why..."
1006 CFLAGS="$CFLAGS $GTK_CFLAGS"
1007 LIBS="$LIBS $GTK_LIBS"
1009 #include <gtk/gtk.h>
1011 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
1012 [ echo "*** The test program compiled, but did not run. This usually means"
1013 echo "*** that the run-time linker is not finding GTK or finding the wrong"
1014 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
1015 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1016 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1017 echo "*** is required on your system"
1019 echo "*** If you have an old version installed, it is best to remove it, although"
1020 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1022 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
1023 echo "*** came with the system with the command"
1025 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
1026 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1027 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
1028 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
1029 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
1030 CFLAGS="$ac_save_CFLAGS"
1031 LIBS="$ac_save_LIBS"
1036 ifelse([$3], , :, [$3])
1038 AC_SUBST(GTK_CFLAGS)
1044 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1045 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1046 dnl also defines GSTUFF_PKG_ERRORS on error
1047 AC_DEFUN(PKG_CHECK_MODULES, [
1050 if test -z "$PKG_CONFIG"; then
1051 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1054 if test "$PKG_CONFIG" = "no" ; then
1055 echo "*** The pkg-config script could not be found. Make sure it is"
1056 echo "*** in your path, or set the PKG_CONFIG environment variable"
1057 echo "*** to the full path to pkg-config."
1058 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1060 PKG_CONFIG_MIN_VERSION=0.9.0
1061 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1062 AC_MSG_CHECKING(for $2)
1064 if $PKG_CONFIG --exists "$2" ; then
1068 AC_MSG_CHECKING($1_CFLAGS)
1069 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1070 AC_MSG_RESULT($$1_CFLAGS)
1072 AC_MSG_CHECKING($1_LIBS)
1073 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1074 AC_MSG_RESULT($$1_LIBS)
1078 ## If we have a custom action on failure, don't print errors, but
1079 ## do set a variable so people can do so.
1080 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1081 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1087 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1088 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1092 if test $succeeded = yes; then
1093 ifelse([$3], , :, [$3])
1095 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])
1101 # Configure paths for SDL
1102 # Sam Lantinga 9/21/99
1103 # stolen from Manish Singh
1104 # stolen back from Frank Belew
1105 # stolen from Manish Singh
1106 # Shamelessly stolen from Owen Taylor
1108 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1109 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
1111 AC_DEFUN([AM_PATH_SDL],
1113 dnl Get the cflags and libraries from the sdl-config script
1115 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
1116 sdl_prefix="$withval", sdl_prefix="")
1117 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
1118 sdl_exec_prefix="$withval", sdl_exec_prefix="")
1119 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
1120 , enable_sdltest=yes)
1122 if test x$sdl_exec_prefix != x ; then
1123 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
1124 if test x${SDL_CONFIG+set} != xset ; then
1125 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
1128 if test x$sdl_prefix != x ; then
1129 sdl_args="$sdl_args --prefix=$sdl_prefix"
1130 if test x${SDL_CONFIG+set} != xset ; then
1131 SDL_CONFIG=$sdl_prefix/bin/sdl-config
1135 AC_REQUIRE([AC_CANONICAL_TARGET])
1136 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
1137 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
1138 min_sdl_version=ifelse([$1], ,0.11.0,$1)
1139 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
1141 if test "$SDL_CONFIG" = "no" ; then
1144 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
1145 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
1147 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
1148 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1149 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
1150 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1151 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
1152 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1153 if test "x$enable_sdltest" = "xyes" ; then
1154 ac_save_CFLAGS="$CFLAGS"
1155 ac_save_CXXFLAGS="$CXXFLAGS"
1156 ac_save_LIBS="$LIBS"
1157 CFLAGS="$CFLAGS $SDL_CFLAGS"
1158 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1159 LIBS="$LIBS $SDL_LIBS"
1161 dnl Now check if the installed SDL is sufficiently new. (Also sanity
1162 dnl checks the results of sdl-config to some extent
1172 my_strdup (char *str)
1178 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
1179 strcpy (new_str, str);
1187 int main (int argc, char *argv[])
1189 int major, minor, micro;
1192 /* This hangs on some systems (?)
1193 system ("touch conf.sdltest");
1195 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
1197 /* HP/UX 9 (%@#!) writes to sscanf strings */
1198 tmp_version = my_strdup("$min_sdl_version");
1199 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
1200 printf("%s, bad version string\n", "$min_sdl_version");
1204 if (($sdl_major_version > major) ||
1205 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
1206 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
1212 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
1213 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
1214 printf("*** best to upgrade to the required version.\n");
1215 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
1216 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
1217 printf("*** config.cache before re-running configure\n");
1222 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1223 CFLAGS="$ac_save_CFLAGS"
1224 CXXFLAGS="$ac_save_CXXFLAGS"
1225 LIBS="$ac_save_LIBS"
1228 if test "x$no_sdl" = x ; then
1230 ifelse([$2], , :, [$2])
1233 if test "$SDL_CONFIG" = "no" ; then
1234 echo "*** The sdl-config script installed by SDL could not be found"
1235 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
1236 echo "*** your path, or set the SDL_CONFIG environment variable to the"
1237 echo "*** full path to sdl-config."
1239 if test -f conf.sdltest ; then
1242 echo "*** Could not run SDL test program, checking why..."
1243 CFLAGS="$CFLAGS $SDL_CFLAGS"
1244 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1245 LIBS="$LIBS $SDL_LIBS"
1250 int main(int argc, char *argv[])
1253 #define main K_and_R_C_main
1255 [ echo "*** The test program compiled, but did not run. This usually means"
1256 echo "*** that the run-time linker is not finding SDL or finding the wrong"
1257 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
1258 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1259 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1260 echo "*** is required on your system"
1262 echo "*** If you have an old version installed, it is best to remove it, although"
1263 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1264 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1265 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
1266 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
1267 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
1268 CFLAGS="$ac_save_CFLAGS"
1269 CXXFLAGS="$ac_save_CXXFLAGS"
1270 LIBS="$ac_save_LIBS"
1275 ifelse([$3], , :, [$3])
1277 AC_SUBST(SDL_CFLAGS)
1282 dnl ---------------------------------------------------------------------------
1283 dnl Support macros for makefiles generated by BAKEFILE.
1284 dnl ---------------------------------------------------------------------------
1286 dnl Lots of compiler & linker detection code contained here was taken from
1287 dnl wxWindows configure.in script (see http://www.wxwindows.org)
1291 dnl ---------------------------------------------------------------------------
1292 dnl AC_BAKEFILE_GNUMAKE
1294 dnl Detects GNU make
1295 dnl ---------------------------------------------------------------------------
1297 AC_DEFUN([AC_BAKEFILE_GNUMAKE],
1299 dnl does make support "-include" (only GNU make does AFAIK)?
1300 AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
1302 if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
1303 egrep -s GNU > /dev/null); then
1304 bakefile_cv_prog_makeisgnu="yes"
1306 bakefile_cv_prog_makeisgnu="no"
1310 if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
1315 AC_SUBST(IF_GNU_MAKE)
1318 dnl ---------------------------------------------------------------------------
1319 dnl AC_BAKEFILE_PLATFORM
1321 dnl Detects platform and sets PLATFORM_XXX variables accordingly
1322 dnl ---------------------------------------------------------------------------
1324 AC_DEFUN([AC_BAKEFILE_PLATFORM],
1335 if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then
1336 case "${BAKEFILE_HOST}" in
1337 *-*-cygwin* | *-*-mingw32* )
1343 *-pc-os2_emx | *-pc-os2-emx )
1353 powerpc-apple-macos* )
1362 case "$BAKEFILE_FORCE_PLATFORM" in
1383 AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM])
1388 AC_SUBST(PLATFORM_UNIX)
1389 AC_SUBST(PLATFORM_WIN32)
1390 AC_SUBST(PLATFORM_MSDOS)
1391 AC_SUBST(PLATFORM_MAC)
1392 AC_SUBST(PLATFORM_MACOS)
1393 AC_SUBST(PLATFORM_MACOSX)
1394 AC_SUBST(PLATFORM_OS2)
1395 AC_SUBST(PLATFORM_BEOS)
1399 dnl ---------------------------------------------------------------------------
1400 dnl AC_BAKEFILE_PLATFORM_SPECIFICS
1402 dnl Sets misc platform-specific settings
1403 dnl ---------------------------------------------------------------------------
1405 AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS],
1407 AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf],
1408 [use OMF object format (OS/2)]),
1409 [bk_os2_use_omf="$enableval"])
1411 case "${BAKEFILE_HOST}" in
1413 dnl For Unix to MacOS X porting instructions, see:
1414 dnl http://fink.sourceforge.net/doc/porting/porting.html
1415 CFLAGS="$CFLAGS -fno-common"
1416 CXXFLAGS="$CXXFLAGS -fno-common"
1419 *-pc-os2_emx | *-pc-os2-emx )
1420 if test "x$bk_os2_use_omf" = "xyes" ; then
1423 LDFLAGS="-Zomf $LDFLAGS"
1424 CFLAGS="-Zomf $CFLAGS"
1425 CXXFLAGS="-Zomf $CXXFLAGS"
1433 LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS"
1438 dnl ---------------------------------------------------------------------------
1439 dnl AC_BAKEFILE_SUFFIXES
1441 dnl Detects shared various suffixes for shared libraries, libraries, programs,
1443 dnl ---------------------------------------------------------------------------
1445 AC_DEFUN([AC_BAKEFILE_SUFFIXES],
1448 SO_SUFFIX_MODULE="so"
1456 case "${BAKEFILE_HOST}" in
1459 SO_SUFFIX_MODULE="sl"
1463 dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
1464 dnl Both archive libraries and shared libraries on AIX have an
1465 dnl .a extension. This will explain why you can't link with an
1466 dnl .so and why it works with the name changed to .a.
1468 SO_SUFFIX_MODULE="a"
1470 *-*-cygwin* | *-*-mingw32* )
1472 SO_SUFFIX_MODULE="dll"
1473 DLLIMP_SUFFIX="dll.a"
1481 *-pc-os2_emx | *-pc-os2-emx )
1483 SO_SUFFIX_MODULE="dll"
1484 DLLIMP_SUFFIX=$OS2_LIBEXT
1488 LIBEXT=".$OS2_LIBEXT"
1492 SO_SUFFIX_MODULE="bundle"
1496 if test "x$DLLIMP_SUFFIX" = "x" ; then
1497 DLLIMP_SUFFIX="$SO_SUFFIX"
1501 AC_SUBST(SO_SUFFIX_MODULE)
1502 AC_SUBST(DLLIMP_SUFFIX)
1507 AC_SUBST(DLLPREFIX_MODULE)
1511 dnl ---------------------------------------------------------------------------
1512 dnl AC_BAKEFILE_SHARED_LD
1514 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
1515 dnl and SHARED_LD_CXX.
1516 dnl ---------------------------------------------------------------------------
1518 AC_DEFUN([AC_BAKEFILE_SHARED_LD],
1520 dnl the extra compiler flags needed for compilation of shared library
1522 if test "x$GCC" = "xyes"; then
1523 dnl the switch for gcc is the same under all platforms
1527 dnl Defaults for GCC and ELF .so shared libs:
1528 SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o"
1529 SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o"
1531 case "${BAKEFILE_HOST}" in
1533 dnl default settings are good for gcc but not for the native HP-UX
1534 if test "x$GCC" != "xyes"; then
1535 dnl no idea why it wants it, but it does
1536 LDFLAGS="$LDFLAGS -L/usr/lib"
1538 SHARED_LD_CC="${CC} -b -o"
1539 SHARED_LD_CXX="${CXX} -b -o"
1545 if test "x$GCC" != "xyes"; then
1546 AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
1550 #ifndef __INTEL_COMPILER
1554 bakefile_cv_prog_icc=yes,
1555 bakefile_cv_prog_icc=no
1558 if test "$bakefile_cv_prog_icc" = "yes"; then
1565 if test "x$GCC" != xyes ; then
1566 SHARED_LD_CC="${CC} -G -o"
1567 SHARED_LD_CXX="${CXX} -G -o"
1573 dnl Most apps benefit from being fully binded (its faster and static
1574 dnl variables initialized at startup work).
1575 dnl This can be done either with the exe linker flag -Wl,-bind_at_load
1576 dnl or with a double stage link in order to create a single module
1577 dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
1579 dnl If using newer dev tools then there is a -single_module flag that
1580 dnl we can use to do this, otherwise we'll need to use a helper
1581 dnl script. Check the version of gcc to see which way we can go:
1582 AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [
1585 #if (__GNUC__ < 3) || \
1586 ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
1598 if test "$wx_cv_gcc31" = "no"; then
1599 AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH
1600 chmod +x shared-ld-sh
1602 dnl Use the shared-ld-sh helper script
1603 SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
1604 SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
1605 SHARED_LD_CXX="$SHARED_LD_CC"
1606 SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
1608 dnl Use the -single_module flag and let the linker do it for us
1609 SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
1610 SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
1611 SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
1612 SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
1615 PIC_FLAG="-dynamic -fPIC"
1619 dnl default settings are ok for gcc
1620 if test "x$GCC" != "xyes"; then
1621 dnl the abs path below used to be hardcoded here so I guess it must
1622 dnl be some sort of standard location under AIX?
1623 AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
1624 makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
1625 dnl FIXME - what about makeCSharedLib?
1626 SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
1627 SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
1632 dnl can't use gcc under BeOS for shared library creation because it
1633 dnl complains about missing 'main'
1634 SHARED_LD_CC="${LD} -nostart -o"
1635 SHARED_LD_CXX="${LD} -nostart -o"
1639 dnl default settings are ok for gcc
1640 if test "x$GCC" != "xyes"; then
1645 *-*-cygwin* | *-*-mingw32* )
1647 SHARED_LD_CC="\$(CC) -shared -o"
1648 SHARED_LD_CXX="\$(CXX) -shared -o"
1651 *-pc-os2_emx | *-pc-os2-emx )
1652 SHARED_LD_CC="`pwd`/dllar.sh -o"
1653 SHARED_LD_CXX="`pwd`/dllar.sh -o"
1655 AC_BAKEFILE_CREATE_FILE_DLLAR_SH
1659 powerpc-apple-macos* | \
1660 *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
1669 AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.)
1672 if test "x$PIC_FLAG" != "x" ; then
1673 PIC_FLAG="$PIC_FLAG -DPIC"
1676 if test "x$SHARED_LD_MODULE_CC" = "x" ; then
1677 SHARED_LD_MODULE_CC="$SHARED_LD_CC"
1679 if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
1680 SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
1683 AC_SUBST(SHARED_LD_CC)
1684 AC_SUBST(SHARED_LD_CXX)
1685 AC_SUBST(SHARED_LD_MODULE_CC)
1686 AC_SUBST(SHARED_LD_MODULE_CXX)
1691 dnl ---------------------------------------------------------------------------
1692 dnl AC_BAKEFILE_SHARED_VERSIONS
1694 dnl Detects linker options for attaching versions (sonames) to shared libs.
1695 dnl ---------------------------------------------------------------------------
1697 AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS],
1706 case "${BAKEFILE_HOST}" in
1708 SONAME_FLAG="-Wl,-soname,"
1715 SONAME_FLAG="-Wl,-soname,"
1735 AC_SUBST(USE_SOVERSION)
1736 AC_SUBST(USE_SOVERLINUX)
1737 AC_SUBST(USE_SOVERSOLARIS)
1738 AC_SUBST(USE_MACVERSION)
1739 AC_SUBST(USE_SOSYMLINKS)
1740 AC_SUBST(SONAME_FLAG)
1744 dnl ---------------------------------------------------------------------------
1745 dnl AC_BAKEFILE_DEPS
1747 dnl Detects available C/C++ dependency tracking options
1748 dnl ---------------------------------------------------------------------------
1750 AC_DEFUN([AC_BAKEFILE_DEPS],
1752 AC_MSG_CHECKING([for dependency tracking method])
1755 if test "x$GCC" = "xyes"; then
1758 case "${BAKEFILE_HOST}" in
1760 dnl -cpp-precomp (the default) conflicts with -MMD option
1761 dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
1762 DEPSFLAG_GCC="-no-cpp-precomp -MMD"
1768 AC_MSG_RESULT([gcc])
1770 AC_MSG_RESULT([none])
1773 if test $DEPS_TRACKING = 1 ; then
1774 AC_BAKEFILE_CREATE_FILE_BK_DEPS
1778 AC_SUBST(DEPS_TRACKING)
1781 dnl ---------------------------------------------------------------------------
1782 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
1784 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
1786 dnl ---------------------------------------------------------------------------
1788 AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF],
1797 AC_CHECK_TOOL(AR, ar, ar)
1798 AC_CHECK_TOOL(STRIP, strip, :)
1799 AC_CHECK_TOOL(NM, nm, :)
1801 case ${BAKEFILE_HOST} in
1803 dnl HP-UX install doesn't handle the "-d" switch so don't
1805 INSTALL_DIR="mkdir -p"
1807 *) INSTALL_DIR="$INSTALL -d"
1810 AC_SUBST(INSTALL_DIR)
1813 case ${BAKEFILE_HOST} in
1814 *-*-cygwin* | *-*-mingw32* )
1815 LDFLAGS_GUI="-mwindows"
1817 AC_SUBST(LDFLAGS_GUI)
1821 dnl ---------------------------------------------------------------------------
1822 dnl AC_BAKEFILE_RES_COMPILERS
1824 dnl Checks for presence of resource compilers for win32 or mac
1825 dnl ---------------------------------------------------------------------------
1827 AC_DEFUN([AC_BAKEFILE_RES_COMPILERS],
1832 case ${BAKEFILE_HOST} in
1833 *-*-cygwin* | *-*-mingw32* )
1834 dnl Check for win32 resources compiler:
1835 if test "$build" != "$host" ; then
1836 RESCOMP=$host_alias-windres
1838 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
1842 *-*-darwin* | powerpc-apple-macos* )
1843 AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
1844 AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
1852 dnl ---------------------------------------------------------------------------
1853 dnl AC_BAKEFILE_PRECOMP_HEADERS
1855 dnl Check for precompiled headers support (GCC >= 3.4)
1856 dnl ---------------------------------------------------------------------------
1858 AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
1861 AC_ARG_ENABLE([precomp-headers],
1862 AS_HELP_STRING([--disable-precomp-headers],
1863 [don't use precompiled headers even if compiler can]),
1864 [bk_use_pch="$enableval"])
1868 if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
1869 if test "x$GCC" = "xyes"; then
1870 dnl test if we have gcc-3.4:
1871 AC_MSG_CHECKING([if the compiler supports precompiled headers])
1874 #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
1875 #error "no pch support"
1878 #error "no pch support"
1880 #if (__GNUC__ == 3) && \
1881 ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
1882 ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
1883 #error "no pch support"
1887 AC_MSG_RESULT([yes])
1893 if test $GCC_PCH = 1 ; then
1894 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH
1895 chmod +x bk-make-pch
1905 dnl ---------------------------------------------------------------------------
1908 dnl To be used in configure.in of any project using Bakefile-generated mks
1910 dnl Behaviour can be modified by setting following variables:
1911 dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to
1912 dnl to perform check for basic tools like ranlib
1913 dnl BAKEFILE_HOST set this to override host detection, defaults
1915 dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
1916 dnl ---------------------------------------------------------------------------
1918 AC_DEFUN([AC_BAKEFILE],
1922 if test "x$BAKEFILE_HOST" = "x"; then
1923 BAKEFILE_HOST="${host}"
1926 if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
1927 AC_BAKEFILE_CHECK_BASIC_STUFF
1930 AC_BAKEFILE_PLATFORM
1931 AC_BAKEFILE_PLATFORM_SPECIFICS
1932 AC_BAKEFILE_SUFFIXES
1933 AC_BAKEFILE_SHARED_LD
1934 AC_BAKEFILE_SHARED_VERSIONS
1936 AC_BAKEFILE_RES_COMPILERS
1938 BAKEFILE_BAKEFILE_M4_VERSION="0.1.4"
1940 builtin(include, autoconf_inc.m4)
1942 if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
1943 AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
1948 dnl ---------------------------------------------------------------------------
1949 dnl Embedded copies of helper scripts follow:
1950 dnl ---------------------------------------------------------------------------
1952 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
1954 dnl ===================== dllar.sh begins here =====================
1959 # dllar - a tool to build both a .dll and an .a file
1960 # from a set of object (.o) files for EMX/OS2.
1962 # Written by Andrew Zabolotny, bit@freya.etu.ru
1963 # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de
1965 # This script will accept a set of files on the command line.
1966 # All the public symbols from the .o files will be exported into
1967 # a .DEF file, then linker will be run (through gcc) against them to
1968 # build a shared library consisting of all given .o files. All libraries
1969 # (.a) will be first decompressed into component .o files then act as
1970 # described above. You can optionally give a description (-d "description")
1971 # which will be put into .DLL. To see the list of accepted options (as well
1972 # as command-line format) simply run this program without options. The .DLL
1973 # is built to be imported by name (there is no guarantee that new versions
1974 # of the library you build will have same ordinals for same symbols).
1976 # dllar is free software; you can redistribute it and/or modify
1977 # it under the terms of the GNU General Public License as published by
1978 # the Free Software Foundation; either version 2, or (at your option)
1979 # any later version.
1981 # dllar is distributed in the hope that it will be useful,
1982 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1983 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1984 # GNU General Public License for more details.
1986 # You should have received a copy of the GNU General Public License
1987 # along with dllar; see the file COPYING. If not, write to the Free
1988 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA
1991 # To successfuly run this program you will need:
1992 # - Current drive should have LFN support (HPFS, ext2, network, etc)
1993 # (Sometimes dllar generates filenames which won't fit 8.3 scheme)
1995 # (used to build the .dll)
1997 # (used to create .def file from .o files)
1999 # (used to create .a file from .def file)
2000 # - GNU text utilites (cat, sort, uniq)
2001 # used to process emxexp output
2002 # - GNU file utilities (mv, rm)
2004 # - lxlite (optional, see flag below)
2005 # (used for general .dll cleanup)
2012 # basnam, variant of basename, which does _not_ remove the path, _iff_
2013 # second argument (suffix to remove) is given
2017 echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//'
2020 echo ${D}1 | sed 's/'${D}2'${D}//'
2023 echo "error in basnam ${D}*"
2029 # Cleanup temporary files and output
2032 for i in ${D}inputFiles ; do
2035 rm -rf \`basnam ${D}i !\`
2042 # Kill result in case of failure as there is just to many stupid make/nmake
2043 # things out there which doesn't do this.
2044 if @<:@ ${D}# -eq 0 @:>@; then
2045 rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile
2049 # Print usage and exit script with rc=1.
2051 echo 'Usage: dllar @<:@-o@<:${utput}:>@ output_file@:>@ @<:@-i@<:${mport}:>@ importlib_name@:>@'
2052 echo ' @<:@-d@<:${escription}:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:${lags}:>@ "CFLAGS"@:>@'
2053 echo ' @<:@-ord@<:${inals}:>@@:>@ -ex@<:${clude}:>@ "symbol(s)"'
2054 echo ' @<:@-libf@<:${lags}:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:${dll}:>@@:>@ @<:@-nolxl@<:${ite}:>@@:>@'
2055 echo ' @<:@*.o@:>@ @<:@*.a@:>@'
2056 echo '*> "output_file" should have no extension.'
2057 echo ' If it has the .o, .a or .dll extension, it is automatically removed.'
2058 echo ' The import library name is derived from this and is set to "name".a,'
2059 echo ' unless overridden by -import'
2060 echo '*> "importlib_name" should have no extension.'
2061 echo ' If it has the .o, or .a extension, it is automatically removed.'
2062 echo ' This name is used as the import library name and may be longer and'
2063 echo ' more descriptive than the DLL name which has to follow the old '
2064 echo ' 8.3 convention of FAT.'
2065 echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)'
2066 echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
2067 echo ' These flags will be put at the start of GCC command line.'
2068 echo '*> -ord@<:${inals}:>@ tells dllar to export entries by ordinals. Be careful.'
2069 echo '*> -ex@<:${clude}:>@ defines symbols which will not be exported. You can define'
2070 echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
2071 echo ' If the last character of a symbol is "*", all symbols beginning'
2072 echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).'
2073 echo '*> -libf@<:${lags}:>@ can be used to add INITGLOBAL/INITINSTANCE and/or'
2074 echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
2075 echo '*> -nocrt@<:${dll}:>@ switch will disable linking the library against emx''s'
2076 echo ' C runtime DLLs.'
2077 echo '*> -nolxl@<:${ite}:>@ switch will disable running lxlite on the resulting DLL.'
2078 echo '*> All other switches (for example -L./ or -lmylib) will be passed'
2079 echo ' unchanged to GCC at the end of command line.'
2080 echo '*> If you create a DLL from a library and you do not specify -o,'
2081 echo ' the basename for DLL and import library will be set to library name,'
2082 echo ' the initial library will be renamed to 'name'_s.a (_s for static)'
2083 echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
2084 echo ' library will be renamed into gcc_s.a.'
2087 echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord'
2088 echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"'
2093 # Execute a command.
2094 # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script.
2095 # @Uses Whatever CleanUp() uses.
2101 if @<:@ ${D}rcCmd -ne 0 @:>@; then
2102 echo "command failed, exit code="${D}rcCmd
2116 CFLAGS="-s -Zcrtdll"
2118 EXPORT_BY_ORDINALS=0
2127 curDirS=${D}{curDirS}"/"
2132 while @<:@ ${D}1 @:>@; do
2135 EXPORT_BY_ORDINALS=1;
2162 exclude_symbols=${D}{exclude_symbols}${D}1" "
2166 library_flags=${D}{library_flags}${D}1" "
2182 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
2186 if @<:@ ${D}libsToLink -ne 0 @:>@; then
2187 EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1
2189 for file in ${D}1 ; do
2190 if @<:@ -f ${D}file @:>@; then
2191 inputFiles="${D}{inputFiles} ${D}file"
2195 if @<:@ ${D}found -eq 0 @:>@; then
2196 echo "ERROR: No file(s) found: "${D}1
2203 done # iterate cmdline words
2206 if @<:@ -z "${D}inputFiles" @:>@; then
2207 echo "dllar: no input files"
2211 # Now extract all .o files from .a files
2213 for file in ${D}inputFiles ; do
2224 EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf"
2229 dirname=\`basnam ${D}file ${D}suffix\`"_%"
2231 if @<:@ ${D}? -ne 0 @:>@; then
2232 echo "Failed to create subdirectory ./${D}dirname"
2236 # Append '!' to indicate archive
2237 newInputFiles="${D}newInputFiles ${D}{dirname}!"
2238 doCommand "cd ${D}dirname; ${D}AR x ../${D}file"
2241 for subfile in ${D}dirname/*.o* ; do
2242 if @<:@ -f ${D}subfile @:>@; then
2244 if @<:@ -s ${D}subfile @:>@; then
2245 # FIXME: This should be: is file size > 32 byte, _not_ > 0!
2246 newInputFiles="${D}newInputFiles ${D}subfile"
2250 if @<:@ ${D}found -eq 0 @:>@; then
2251 echo "WARNING: there are no files in archive \\'${D}file\\'"
2255 newInputFiles="${D}{newInputFiles} ${D}file"
2259 inputFiles="${D}newInputFiles"
2261 # Output filename(s).
2263 if @<:@ -z ${D}outFile @:>@; then
2265 set outFile ${D}inputFiles; outFile=${D}2
2268 # If it is an archive, remove the '!' and the '_%' suffixes
2271 outFile=\`basnam ${D}outFile _%!\`
2278 outFile=\`basnam ${D}outFile .dll\`
2281 outFile=\`basnam ${D}outFile .DLL\`
2284 outFile=\`basnam ${D}outFile .o\`
2287 outFile=\`basnam ${D}outFile .obj\`
2290 outFile=\`basnam ${D}outFile .a\`
2293 outFile=\`basnam ${D}outFile .lib\`
2298 case ${D}outimpFile in
2300 outimpFile=\`basnam ${D}outimpFile .a\`
2303 outimpFile=\`basnam ${D}outimpFile .lib\`
2308 if @<:@ -z ${D}outimpFile @:>@; then
2309 outimpFile=${D}outFile
2311 defFile="${D}{outFile}.def"
2312 arcFile="${D}{outimpFile}.a"
2313 arcFile2="${D}{outimpFile}.lib"
2314 dllFile="${D}outFile"
2315 # Add suffix to dllFile later, first we need a version to use as
2316 # name in .def file.
2318 if @<:@ ${D}do_backup -ne 0 @:>@ ; then
2319 if @<:@ -f ${D}arcFile @:>@ ; then
2320 doCommand "mv ${D}arcFile ${D}{outFile}_s.a"
2322 if @<:@ -f ${D}arcFile2 @:>@ ; then
2323 doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib"
2327 # Extract public symbols from all the object files.
2328 tmpdefFile=${D}{defFile}_%
2329 rm -f ${D}tmpdefFile
2330 for file in ${D}inputFiles ; do
2335 doCommand "emxexp -u ${D}file >> ${D}tmpdefFile"
2340 # Create the def file.
2342 echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile
2343 dllFile="${D}dllFile.dll"
2344 if @<:@ -n ${D}description @:>@; then
2345 echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile
2347 echo "EXPORTS" >> ${D}defFile
2349 doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%"
2350 grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile
2352 # Checks if the export is ok or not.
2353 for word in ${D}exclude_symbols; do
2354 grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}%
2355 mv ${D}{tmpdefFile}% ${D}tmpdefFile
2359 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
2360 sed "=" < ${D}tmpdefFile | \\
2364 s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/
2366 ' > ${D}{tmpdefFile}%
2367 grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile
2369 rm -f ${D}{tmpdefFile}%
2371 cat ${D}tmpdefFile >> ${D}defFile
2372 rm -f ${D}tmpdefFile
2374 # Do linking, create implib, and apply lxlite.
2376 for file in ${D}inputFiles ; do
2381 gccCmdl="${D}gccCmdl ${D}file"
2385 doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS"
2386 touch "${D}{outFile}.dll"
2388 doCommand "emximp -o ${D}arcFile ${D}defFile"
2389 if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then
2391 if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then
2394 doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile"
2396 doCommand "emxomf -s -l ${D}arcFile"
2402 dnl ===================== dllar.sh ends here =====================
2405 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
2407 dnl ===================== bk-deps begins here =====================
2412 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2413 # script. It is used to track C/C++ files dependencies in portable way.
2415 # Permission is given to use this file in any way.
2417 DEPSMODE=${DEPSMODE}
2419 DEPSFLAG_GCC="${DEPSFLAG_GCC}"
2421 mkdir -p ${D}DEPSDIR
2423 if test ${D}DEPSMODE = gcc ; then
2424 ${D}* ${D}{DEPSFLAG_GCC}
2426 if test ${D}{status} != 0 ; then
2429 # move created file to the location we want it in:
2430 while test ${D}# -gt 0; do
2444 depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\`
2445 depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\`
2446 if test -f ${D}depfile ; then
2447 sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
2450 depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\`
2451 if test -f ${D}depfile ; then
2452 sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d
2462 dnl ===================== bk-deps ends here =====================
2465 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
2467 dnl ===================== shared-ld-sh begins here =====================
2469 cat <<EOF >shared-ld-sh
2471 #-----------------------------------------------------------------------------
2472 #-- Name: distrib/mac/shared-ld-sh
2473 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
2474 #-- Author: Gilles Depeyrot
2475 #-- Copyright: (c) 2002 Gilles Depeyrot
2476 #-- Licence: any use permitted
2477 #-----------------------------------------------------------------------------
2482 linking_flag="-dynamiclib"
2484 while test ${D}# -gt 0; do
2491 -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
2492 # collect these options and values
2493 args="${D}{args} ${D}1 ${D}2"
2497 -l*|-L*|-flat_namespace|-headerpad_max_install_names)
2498 # collect these options
2499 args="${D}{args} ${D}1"
2502 -dynamiclib|-bundle)
2503 linking_flag="${D}1"
2507 echo "shared-ld: unhandled option '${D}1'"
2511 *.o | *.a | *.dylib)
2512 # collect object files
2513 objects="${D}{objects} ${D}1"
2517 echo "shared-ld: unhandled argument '${D}1'"
2526 # Link one module containing all the others
2528 if test ${D}{verbose} = 1; then
2529 echo "c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o"
2531 c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o
2533 if test ${D}{status} != 0; then
2538 # Link the shared library from the single module created
2540 if test ${D}{verbose} = 1; then
2541 echo "cc ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
2543 c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}
2545 if test ${D}{status} != 0; then
2550 # Remove intermediate module
2552 rm -f master.${D}${D}.o
2556 dnl ===================== shared-ld-sh ends here =====================
2559 AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
2561 dnl ===================== bk-make-pch begins here =====================
2563 cat <<EOF >bk-make-pch
2566 # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
2567 # script. It is used to generated precompiled headers.
2569 # Permission is given to use this file in any way.
2578 while test ${D}{#} -gt 0; do
2581 incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\`
2582 if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then
2583 headerfile="${D}{incdir}/${D}{header}"
2587 compiler="${D}{compiler} ${D}{1}"
2591 if test "x${D}{headerfile}" = "x" ; then
2592 echo "error: can't find header ${D}{header} in include paths" >2
2594 if test -f ${D}{outfile} ; then
2597 mkdir -p \`dirname ${D}{outfile}\`
2599 depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d"
2601 # can do this because gcc is >= 3.4:
2602 ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}"
2606 dnl ===================== bk-make-pch ends here =====================
2610 dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2612 AC_DEFUN(AM_PATH_CPPUNIT,
2615 AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
2616 cppunit_config_prefix="$withval", cppunit_config_prefix="")
2617 AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
2618 cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
2620 if test x$cppunit_config_exec_prefix != x ; then
2621 cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
2622 if test x${CPPUNIT_CONFIG+set} != xset ; then
2623 CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
2626 if test x$cppunit_config_prefix != x ; then
2627 cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
2628 if test x${CPPUNIT_CONFIG+set} != xset ; then
2629 CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
2633 AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
2634 cppunit_version_min=$1
2636 AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
2638 if test "$CPPUNIT_CONFIG" = "no" ; then
2641 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
2642 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
2643 cppunit_version=`$CPPUNIT_CONFIG --version`
2645 cppunit_major_version=`echo $cppunit_version | \
2646 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2647 cppunit_minor_version=`echo $cppunit_version | \
2648 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2649 cppunit_micro_version=`echo $cppunit_version | \
2650 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2652 cppunit_major_min=`echo $cppunit_version_min | \
2653 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2654 cppunit_minor_min=`echo $cppunit_version_min | \
2655 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2656 cppunit_micro_min=`echo $cppunit_version_min | \
2657 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2659 cppunit_version_proper=`expr \
2660 $cppunit_major_version \> $cppunit_major_min \| \
2661 $cppunit_major_version \= $cppunit_major_min \& \
2662 $cppunit_minor_version \> $cppunit_minor_min \| \
2663 $cppunit_major_version \= $cppunit_major_min \& \
2664 $cppunit_minor_version \= $cppunit_minor_min \& \
2665 $cppunit_micro_version \>= $cppunit_micro_min `
2667 if test "$cppunit_version_proper" = "1" ; then
2668 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
2675 if test "x$no_cppunit" = x ; then
2676 ifelse([$2], , :, [$2])
2680 ifelse([$3], , :, [$3])
2683 AC_SUBST(CPPUNIT_CFLAGS)
2684 AC_SUBST(CPPUNIT_LIBS)