dnl Version: $Id$
dnl ---------------------------------------------------------------------------
+
+dnl ===========================================================================
+dnl Objective-C(++) related macros
+dnl ===========================================================================
+m4_define([AC_WX_LANG_OBJECTIVEC],
+[AC_LANG(C)
+ac_ext=m
+])
+
+m4_define([AC_WX_LANG_OBJECTIVECPLUSPLUS],
+[AC_LANG(C++)
+ac_ext=mm
+])
+
dnl ===========================================================================
dnl macros to find the a file in the list of include/lib paths
dnl ===========================================================================
else
wx_cv_version_script=no
fi
+
+ dnl There's a problem in some old linkers with --version-script that
+ dnl can cause linking to fail when you have objects with vtables in
+ dnl libs 3 deep. This is known to happen in netbsd and openbsd with
+ dnl ld 2.11.2.
+ dnl
+ dnl To test for this we need to make some shared libs and
+ dnl unfortunately we can't be sure of the right way to do that. If the
+ dnl first two compiles don't succeed then it looks like the test isn't
+ dnl working and the result is ignored, but if OTOH the first two
+ dnl succeed but the third does not then the bug has been detected and
+ dnl the --version-script flag is dropped.
+ if test $wx_cv_version_script = yes
+ then
+ echo "struct B { virtual ~B() { } }; \
+ struct D : public B { }; \
+ void F() { D d; }" > conftest.cpp
+
+ if AC_TRY_COMMAND([
+ $CXX -shared -fPIC -o conftest1.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+ -Wl,--version-script,conftest.sym >/dev/null 2>/dev/null]) &&
+ AC_TRY_COMMAND([
+ $CXX -shared -fPIC -o conftest2.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+ -Wl,--version-script,conftest.sym conftest1.output >/dev/null 2>/dev/null])
+ then
+ if AC_TRY_COMMAND([
+ $CXX -shared -fPIC -o conftest3.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+ -Wl,--version-script,conftest.sym conftest2.output conftest1.output >/dev/null 2>/dev/null])
+ then
+ wx_cv_version_script=yes
+ else
+ wx_cv_version_script=no
+ fi
+ fi
+ fi
+
rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
+ rm -f conftest1.output conftest2.output conftest3.output
])
if test $wx_cv_version_script = yes ; then
LDFLAGS_VERSIONING="-Wl,--version-script,$1"
fi
])
+dnl Based on autoconf _AC_LANG_COMPILER_GNU
+dnl _AC_BAKEFILE_LANG_COMPILER(NAME, LANG, SYMBOL, IF-YES, IF-NO)
+AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER],
+[
+ AC_LANG_PUSH($2)
+ AC_CACHE_CHECK(
+ [whether we are using the $1 $2 compiler],
+ [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3],
+ [AC_TRY_COMPILE(
+ [],
+ [
+ #ifndef $3
+ choke me
+ #endif
+ ],
+ [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=yes],
+ [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=no]
+ )
+ ]
+ )
+ AC_LANG_POP($2)
+ if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3" = "xyes"; then
+ :; $4
+ else
+ :; $5
+ fi
+])
+
+dnl Loosely based on autoconf AC_PROG_CC
+AC_DEFUN([AC_BAKEFILE_PROG_SUNCC],
+[
+ _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes)
+])
+
+dnl Loosely based on autoconf AC_PROG_CC
+AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX],
+[
+ _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes)
+])
+
dnl ===========================================================================
dnl "3rd party" macros included here because they are not widely available
fi
])
+dnl http://autoconf-archive.cryp.to/ac_cxx_dynamic_cast.html
+AC_DEFUN([AC_CXX_DYNAMIC_CAST],
+[AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
+ac_cv_cxx_dynamic_cast,
+[AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <typeinfo>
+class Base { public : Base () {} virtual void f () = 0;};
+class Derived : public Base { public : Derived () {} virtual void f () {} };],[
+Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
+ ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
+ AC_LANG_RESTORE
+])
+if test "$ac_cv_cxx_dynamic_cast" = yes; then
+ AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
+fi
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl Compiler detection macros by David Elliott
+dnl ---------------------------------------------------------------------------
+
+
+dnl ===========================================================================
+dnl Macros to detect non-GNU compilers (MetroWerks, XLC)
+dnl ===========================================================================
+
+dnl Based on autoconf _AC_LANG_COMPILER_GNU
+AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
+[AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
+ [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
+ [AC_TRY_COMPILE([],[#ifndef __MWERKS__
+ choke me
+#endif
+],
+ [bakefile_compiler_mwerks=yes],
+ [bakefile_compiler_mwerks=no])
+ bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
+ ])
+])
+
+dnl Loosely based on autoconf AC_PROG_CC
+dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
+AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
+[AC_LANG_PUSH(C)
+_AC_BAKEFILE_LANG_COMPILER_MWERKS
+MWCC=`test $bakefile_cv_c_compiler_mwerks = yes && echo yes`
+AC_LANG_POP(C)
+])
+
+dnl Loosely based on autoconf AC_PROG_CXX
+dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
+AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
+[AC_LANG_PUSH(C++)
+_AC_BAKEFILE_LANG_COMPILER_MWERKS
+MWCXX=`test $bakefile_cv_cxx_compiler_mwerks = yes && echo yes`
+AC_LANG_POP(C++)
+])
+
+dnl Based on autoconf _AC_LANG_COMPILER_GNU
+AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_XLC],
+[AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler],
+ [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc],
+ [AC_TRY_COMPILE([],[#ifndef __xlC__
+ choke me
+#endif
+],
+ [wx_compiler_xlc=yes],
+ [wx_compiler_xlc=no])
+ wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc
+ ])
+])
+
+dnl Loosely based on autoconf AC_PROG_CC
+AC_DEFUN([AC_BAKEFILE_PROG_XLCC],
+[AC_LANG_PUSH(C)
+_AC_BAKEFILE_LANG_COMPILER_XLC
+XLCC=`test $wx_cv_c_compiler_xlc = yes && echo yes`
+AC_LANG_POP(C)
+])
+
+dnl Loosely based on autoconf AC_PROG_CXX
+AC_DEFUN([AC_BAKEFILE_PROG_XLCXX],
+[AC_LANG_PUSH(C++)
+_AC_BAKEFILE_LANG_COMPILER_XLC
+XLCXX=`test $wx_cv_cxx_compiler_xlc = yes && echo yes`
+AC_LANG_POP(C++)
+])
+
+
+dnl ===========================================================================
+dnl macros to detect specialty compiler options
+dnl ===========================================================================
+
+dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
+AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO],
+[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto,
+dnl First create an empty conf test
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+dnl Now remove .o and .c.o or .cc.o
+rm -f conftest.$ac_objext conftest.$ac_ext.o
+dnl Now compile the test
+AS_IF([AC_TRY_EVAL(ac_compile)],
+dnl If the test succeeded look for conftest.c.o or conftest.cc.o
+[for ac_file in `(ls conftest.* 2>/dev/null)`; do
+ case $ac_file in
+ conftest.$ac_ext.o)
+ wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
+ ;;
+ *)
+ ;;
+ esac
+done],
+[AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
+]) dnl AS_IF
+
+rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
+]) dnl AC_CACHE_CHECK
+
+if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
+ if test "[]_AC_LANG_ABBREV[]" = "c"; then
+ CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
+ fi
+ if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
+ CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
+ fi
+fi
+]) dnl AC_DEFUN
+
+
+dnl ===========================================================================
+dnl Macros to do all of the compiler detections as one macro
+dnl ===========================================================================
+AC_DEFUN([AC_BAKEFILE_PROG_CC],
+[
+ AC_PROG_CC
+ AC_BAKEFILE_METROWERKS_EXTO
+ dnl By the time we find out that we need -ext o some tests have failed.
+ if test "x$wx_cv_c_exto" '!=' "x"; then
+ unset ac_cv_prog_cc_g
+ _AC_PROG_CC_G
+ fi
+ AC_BAKEFILE_PROG_MWCC
+ AC_BAKEFILE_PROG_XLCC
+ AC_BAKEFILE_PROG_SUNCC
+])
+
+AC_DEFUN([AC_BAKEFILE_PROG_CXX],
+[
+ AC_PROG_CXX
+ AC_BAKEFILE_METROWERKS_EXTO
+ dnl By the time we find out that we need -ext o some tests have failed.
+ if test "x$wx_cv_cxx_exto" '!=' "x"; then
+ unset ac_cv_prog_cxx_g
+ _AC_PROG_CXX_G
+ fi
+ AC_BAKEFILE_PROG_MWCXX
+ AC_BAKEFILE_PROG_XLCXX
+ AC_BAKEFILE_PROG_SUNCXX
+])
+
+
# Configure paths for GTK+
# Owen Taylor 1997-2001
rm -f conf.sdltest
])
+dnl Perform a check for a GStreamer element using gst-inspect
+dnl Thomas Vander Stichele <thomas at apestaart dot org>
+dnl Last modification: 25/01/2005
+
+dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
+
+AC_DEFUN([AM_GST_ELEMENT_CHECK],
+[
+ if test "x$GST_INSPECT" == "x"; then
+ AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, [])
+ fi
+
+ if test "x$GST_INSPECT" != "x"; then
+ AC_MSG_CHECKING(GStreamer element $1)
+ if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then
+ AC_MSG_RESULT(found.)
+ $2
+ else
+ AC_MSG_RESULT(not found.)
+ $3
+ fi
+ fi
+])
+
dnl ---------------------------------------------------------------------------
dnl Support macros for makefiles generated by BAKEFILE.
dnl ---------------------------------------------------------------------------
dnl Lots of compiler & linker detection code contained here was taken from
dnl wxWindows configure.in script (see http://www.wxwindows.org)
-dnl Based on autoconf _AC_LANG_COMPILER_GNU
-AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
-[AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
- [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
- [AC_TRY_COMPILE([],[#ifndef __MWERKS__
- choke me
-#endif
-],
- [bakefile_compiler_mwerks=yes],
- [bakefile_compiler_mwerks=no])
- bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
- ])
-])
-dnl Loosely based on autoconf AC_PROG_CC
-dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
-AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
-[AC_LANG_PUSH(C)
-_AC_BAKEFILE_LANG_COMPILER_MWERKS
-MWCC=`test $bakefile_compiler_mwerks = yes && echo yes`
-AC_LANG_POP(C)
-])
-
-dnl Loosely based on autoconf AC_PROG_CXX
-dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
-AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
-[AC_LANG_PUSH(C++)
-_AC_BAKEFILE_LANG_COMPILER_MWERKS
-MWCXX=`test $bakefile_compiler_mwerks = yes && echo yes`
-AC_LANG_POP(C++)
-])
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE_GNUMAKE
*-*-sunos4* | \
*-*-osf* | \
*-*-dgux5* | \
- *-*-sysv5* )
+ *-*-sysv5* | \
+ *-pc-msdosdjgpp )
dnl defaults are ok
;;
DEPS_TRACKING=1
DEPSFLAG_MWCC="-MM"
AC_MSG_RESULT([mwcc])
+ elif test "x$SUNCC" = "xyes"; then
+ DEPSMODE=suncc
+ DEPS_TRACKING=1
+ DEPSFLAG_SUNCC="-xM1"
+ AC_MSG_RESULT([suncc])
else
AC_MSG_RESULT([none])
fi
dnl ---------------------------------------------------------------------------
-dnl AC_BAKEFILE
+dnl AC_BAKEFILE([autoconf_inc.m4 inclusion])
dnl
dnl To be used in configure.in of any project using Bakefile-generated mks
dnl
dnl BAKEFILE_HOST set this to override host detection, defaults
dnl to ${host}
dnl BAKEFILE_FORCE_PLATFORM set to override platform detection
+dnl
+dnl Example usage:
+dnl
+dnl AC_BAKEFILE([FOO(autoconf_inc.m4)])
+dnl
+dnl (replace FOO with m4_include above, aclocal would die otherwise)
+dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing
+dnl we can do...)
dnl ---------------------------------------------------------------------------
AC_DEFUN([AC_BAKEFILE],
AC_BAKEFILE_DEPS
AC_BAKEFILE_RES_COMPILERS
- BAKEFILE_BAKEFILE_M4_VERSION="0.1.4"
-
- m4_include([autoconf_inc.m4])
+ BAKEFILE_BAKEFILE_M4_VERSION="0.1.8"
+
+ dnl includes autoconf_inc.m4:
+ $1
if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then
AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.])
AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH],
[
dnl ===================== dllar.sh begins here =====================
+dnl (Created by merge-scripts.py from dllar.sh
+dnl file do not edit here!)
D='$'
cat <<EOF >dllar.sh
#!/bin/sh
AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS],
[
dnl ===================== bk-deps begins here =====================
+dnl (Created by merge-scripts.py from bk-deps
+dnl file do not edit here!)
D='$'
cat <<EOF >bk-deps
#!/bin/sh
DEPSDIR=.deps
DEPSFLAG_GCC="${DEPSFLAG_GCC}"
DEPSFLAG_MWCC="${DEPSFLAG_MWCC}"
+DEPSFLAG_SUNCC="${DEPSFLAG_SUNCC}"
mkdir -p ${D}DEPSDIR
done
${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d
exit 0
+elif test ${D}DEPSMODE = suncc; then
+ ${D}* || exit
+ # Run compiler again with deps flag and redirect into the dep file.
+ # It doesn't work if the '-o FILE' option is used, but without it the
+ # dependency file will contain the wrong name for the object. So it is
+ # removed from the command line, and the dep file is fixed with sed.
+ cmd=""
+ while test ${D}# -gt 0; do
+ case "${D}1" in
+ -o )
+ shift
+ objfile=${D}1
+ ;;
+ * )
+ eval arg${D}#=\\${D}1
+ cmd="${D}cmd \\${D}arg${D}#"
+ ;;
+ esac
+ shift
+ done
+ eval "${D}cmd ${D}DEPSFLAG_SUNCC" | sed "s|.*:|${D}objfile:|" >${D}{DEPSDIR}/${D}{objfile}.d
+ exit 0
else
${D}*
exit ${D}?
AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
[
dnl ===================== shared-ld-sh begins here =====================
+dnl (Created by merge-scripts.py from shared-ld-sh
+dnl file do not edit here!)
D='$'
cat <<EOF >shared-ld-sh
#!/bin/sh
shift
;;
- -l*|-L*|-flat_namespace|-headerpad_max_install_names)
+ -l*|-L*|-Wl,*|-flat_namespace|-headerpad_max_install_names)
# collect these options
args="${D}{args} ${D}1"
;;
AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
[
dnl ===================== bk-make-pch begins here =====================
+dnl (Created by merge-scripts.py from bk-make-pch
+dnl file do not edit here!)
D='$'
cat <<EOF >bk-make-pch
#!/bin/sh