]> git.saurik.com Git - wxWidgets.git/blobdiff - aclocal.m4
fixed warnings about possibly uninitialized variables; commented non trivial piece...
[wxWidgets.git] / aclocal.m4
index 310fb0910599dc5d8e849ec4d11cc4251f0b79c4..e0e1e62f50e5f38c4820445e6897dc119bd77d32 100644 (file)
@@ -21,6 +21,89 @@ dnl
 dnl Version: $Id$
 dnl ---------------------------------------------------------------------------
 
+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_WX_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 Based on autoconf _AC_LANG_COMPILER_GNU
+AC_DEFUN([_AC_WX_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_WX_PROG_XLCC],
+[AC_LANG_PUSH(C)
+_AC_WX_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_WX_PROG_XLCXX],
+[AC_LANG_PUSH(C++)
+_AC_WX_LANG_COMPILER_XLC
+XLCXX=`test $wx_cv_cxx_compiler_xlc = yes && echo yes`
+AC_LANG_POP(C++)
+])
+
+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 ===========================================================================
@@ -648,6 +731,25 @@ if test "$ac_cv_cxx_static_cast" = yes; then
 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 Support macros for makefiles generated by BAKEFILE.
 dnl ---------------------------------------------------------------------------
@@ -674,7 +776,7 @@ 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`
+MWCC=`test $bakefile_cv_c_compiler_mwerks = yes && echo yes`
 AC_LANG_POP(C)
 ])
 
@@ -683,7 +785,7 @@ 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`
+MWCXX=`test $bakefile_cv_cxx_compiler_mwerks = yes && echo yes`
 AC_LANG_POP(C++)
 ])
 
@@ -1340,7 +1442,7 @@ AC_DEFUN([AC_BAKEFILE],
     AC_BAKEFILE_DEPS
     AC_BAKEFILE_RES_COMPILERS
 
-    BAKEFILE_BAKEFILE_M4_VERSION="0.1.6"
+    BAKEFILE_BAKEFILE_M4_VERSION="0.1.8"
    
     dnl includes autoconf_inc.m4:
     $1
@@ -2579,8 +2681,10 @@ AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
     if test "x$enable_sdltest" = "xyes" ; then
       ac_save_CFLAGS="$CFLAGS"
+      ac_save_CXXFLAGS="$CXXFLAGS"
       ac_save_LIBS="$LIBS"
       CFLAGS="$CFLAGS $SDL_CFLAGS"
+      CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
       LIBS="$LIBS $SDL_LIBS"
 dnl
 dnl Now check if the installed SDL is sufficiently new. (Also sanity
@@ -2646,6 +2750,7 @@ int main (int argc, char *argv[])
 
 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
        CFLAGS="$ac_save_CFLAGS"
+       CXXFLAGS="$ac_save_CXXFLAGS"
        LIBS="$ac_save_LIBS"
      fi
   fi
@@ -2665,6 +2770,7 @@ int main (int argc, char *argv[])
        else
           echo "*** Could not run SDL test program, checking why..."
           CFLAGS="$CFLAGS $SDL_CFLAGS"
+          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
           LIBS="$LIBS $SDL_LIBS"
           AC_TRY_LINK([
 #include <stdio.h>
@@ -2689,6 +2795,7 @@ int main(int argc, char *argv[])
           echo "*** or that you have moved SDL since it was installed. In the latter case, you"
           echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
           CFLAGS="$ac_save_CFLAGS"
+          CXXFLAGS="$ac_save_CXXFLAGS"
           LIBS="$ac_save_LIBS"
        fi
      fi
@@ -2703,13 +2810,16 @@ int main(int argc, char *argv[])
 
 dnl Perform a check for a GStreamer element using gst-inspect
 dnl Thomas Vander Stichele <thomas at apestaart dot org>
-dnl Last modification: 23/10/2002
+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],
 [
-  AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, [])
+  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