]> git.saurik.com Git - wxWidgets.git/blobdiff - aclocal.m4
Don't use wxID_ANY so events from child wxListCtrl's don't confuse the
[wxWidgets.git] / aclocal.m4
index 2d201c30de36986586c020bcdd482cde0a55d9e9..73259c5da783b0db14f1f15c03c0b80e4baba474 100644 (file)
@@ -1080,7 +1080,7 @@ dnl ---------------------------------------------------------------------------
 AC_DEFUN(AC_BAKEFILE_GNUMAKE,
 [
     dnl does make support "-include" (only GNU make does AFAIK)?
-    AC_CACHE_CHECK([if make is GNU make], wx_cv_prog_makeisgnu,
+    AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu,
     [
         if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
                 egrep -s GNU > /dev/null); then
@@ -1111,14 +1111,18 @@ AC_DEFUN(AC_BAKEFILE_PLATFORM,
     PLATFORM_MSDOS=0
     PLATFORM_MAC=0
     PLATFORM_MACOSX=0
+    PLATFORM_OS2=0
     
     case "${host}" in
         *-*-cygwin* | *-*-mingw32* )
             PLATFORM_WIN32=1
         ;;
-        *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx )
+        *-pc-msdosdjgpp )
             PLATFORM_MSDOS=1
         ;;
+        *-pc-os2_emx | *-pc-os2-emx )
+            PLATFORM_OS2=1
+        ;;
         powerpc-*-darwin* )
             PLATFORM_MAC=1
             PLATFORM_MACOSX=1
@@ -1133,6 +1137,7 @@ AC_DEFUN(AC_BAKEFILE_PLATFORM,
     AC_SUBST(PLATFORM_MSDOS)
     AC_SUBST(PLATFORM_MAC)
     AC_SUBST(PLATFORM_MACOSX)
+    AC_SUBST(PLATFORM_OS2)
 ])
 
 
@@ -1147,12 +1152,16 @@ dnl ---------------------------------------------------------------------------
 AC_DEFUN(AC_BAKEFILE_SUFFIXES,
 [
     SO_SUFFIX="so"
+    SO_SUFFIX_MODULE="so"
     EXEEXT=""
+    LIBPREFIX=lib
     DLLPREFIX=lib
+    DLLPREFIX_MODULE=
     
     case "${host}" in
         *-hp-hpux* )
             SO_SUFFIX="sl"
+            SO_SUFFIX_MODULE="sl"
         ;;
         *-*-aix* )
             dnl quoting from
@@ -1161,24 +1170,35 @@ AC_DEFUN(AC_BAKEFILE_SUFFIXES,
             dnl     .a extension. This will explain why you can't link with an
             dnl     .so and why it works with the name changed to .a.
             SO_SUFFIX="a"
+            SO_SUFFIX_MODULE="a"
         ;;
         *-*-cygwin* | *-*-mingw32* )
             SO_SUFFIX="dll"
+            SO_SUFFIX_MODULE="dll"
             EXEEXT=".exe"
             DLLPREFIX=""
         ;;
-        *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx )
+        *-pc-msdosdjgpp )
             EXEEXT=".exe"
             DLLPREFIX=""
         ;;
+        *-pc-os2_emx | *-pc-os2-emx )
+            EXEEXT=".exe"
+            DLLPREFIX=""
+            LIBPREFIX=""
+        ;;
         powerpc-*-darwin* )
             SO_SUFFIX="dylib"
+            SO_SUFFIX_MODULE="bundle"
         ;;
     esac
 
     AC_SUBST(SO_SUFFIX)
+    AC_SUBST(SO_SUFFIX_MODULE)
     AC_SUBST(EXEEXT)
+    AC_SUBST(LIBPREFIX)
     AC_SUBST(DLLPREFIX)
+    AC_SUBST(DLLPREFIX_MODULE)
 ])
 
 
@@ -1271,6 +1291,7 @@ AC_DEFUN(AC_BAKEFILE_SHARED_LD,
 verbose=0
 args=""
 objects=""
+linking_flag="-dynamiclib"
 
 while test \${#} -gt 0; do
     case \${1} in
@@ -1290,8 +1311,8 @@ while test \${#} -gt 0; do
         args="\${args} \${1}"
         ;;
 
-       -dynamiclib)
-        # skip these options
+       -dynamiclib|-bundle)
+        linking_flag="\${1}"
         ;;
 
        -*)
@@ -1299,7 +1320,7 @@ while test \${#} -gt 0; do
         exit 1
         ;;
 
-        *.o | *.a)
+        *.o | *.a | *.dylib)
         # collect object files
         objects="\${objects} \${1}"
         ;;
@@ -1329,9 +1350,9 @@ fi
 # Link the shared library from the single module created
 #
 if test \${verbose} = 1; then
-    echo "cc -dynamiclib master.\$\$.o \${args}"
+    echo "cc \${linking_flag} master.\$\$.o \${args}"
 fi
-c++ -dynamiclib master.\$\$.o \${args}
+c++ \${linking_flag} master.\$\$.o \${args}
 status=\$?
 if test \${status} != 0; then
     exit \${status}
@@ -1346,8 +1367,10 @@ exit 0
 EOF
         chmod +x shared-ld-sh
 
-        SHARED_LD_CC="`pwd`/shared-ld-sh -undefined suppress -flat_namespace -o"
+        SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -undefined suppress -flat_namespace -o"
+        SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -undefined suppress -flat_namespace -o"
         SHARED_LD_CXX="$SHARED_LD_CC"
+        SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC"
         PIC_FLAG="-dynamic -fPIC"
         dnl FIXME - what about C libs? Gilles says to use c++ because it doesn't
         dnl         matter for C projects and matters for C++ ones
@@ -1390,6 +1413,7 @@ EOF
       *-*-sunos4* | \
       *-*-osf* | \
       *-*-dgux5* | \
+      *-pc-os2_emx | *-pc-os2-emx | \
       *-*-sysv5* )
         dnl defaults are ok
       ;;
@@ -1398,8 +1422,17 @@ EOF
         AC_MSG_ERROR(unknown system type $host.)
     esac
 
+    if test "x$SHARED_LD_MODULE_CC" = "x" ; then
+        SHARED_LD_MODULE_CC="$SHARED_LD_CC"
+    fi
+    if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
+        SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
+    fi
+
     AC_SUBST(SHARED_LD_CC)
     AC_SUBST(SHARED_LD_CXX)
+    AC_SUBST(SHARED_LD_MODULE_CC)
+    AC_SUBST(SHARED_LD_MODULE_CXX)
     AC_SUBST(PIC_FLAG)
 ])
 
@@ -1458,12 +1491,85 @@ dnl ---------------------------------------------------------------------------
 
 AC_DEFUN(AC_BAKEFILE_DEPS,
 [
-    DEPS_TYPE=no
+    AC_MSG_CHECKING([for dependency tracking method])
+    DEPS_TRACKING=0
+
     if test "x$GCC" = "xyes"; then
-        DEPS_TYPE=gcc
+        DEPSMODE=gcc
+        DEPS_TRACKING=1
+        case "${host}" in
+            powerpc-*-darwin* )
+                dnl -cpp-precomp (the default) conflicts with -MMD option
+                dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html)
+                DEPSFLAG_GCC="-no-cpp-precomp -MMD"
+            ;;
+            * )
+                DEPSFLAG_GCC="-MMD"
+            ;;
+        esac
+        AC_MSG_RESULT([gcc])
+    else
+        AC_MSG_RESULT([none])
+    fi
+
+    if test $DEPS_TRACKING = 1 ; then
+        cat <<EOF >bk-deps
+#!/bin/sh
+
+# This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
+# script. It is used to track C/C++ files dependencies in portable way.
+#
+# Permission is given to use this file in any way.
+
+DEPSMODE=$DEPSMODE
+DEPSDIR=.deps
+DEPSFLAG_GCC="$DEPSFLAG_GCC"
+
+mkdir -p \$DEPSDIR
+
+if test \$DEPSMODE = gcc ; then
+    \${*} \${DEPSFLAG_GCC}
+    status=\${?}
+    if test \${status} != 0 ; then
+        exit \${status}
+    fi
+    # move created file to the location we want it in:
+    while test \${#} -gt 0; do
+        case "\${1}" in
+            -o )
+                shift
+                objfile=\${1}
+            ;;
+            -* )
+            ;;
+            * )
+                srcfile=\${1}
+            ;;
+        esac
+        shift
+    done
+    depfile=\`basename \$srcfile | sed -e 's/\..*$/.d/g'\`
+    depobjname=\`echo \$depfile |sed -e 's/\.d/.o/g'\`
+    if test -f \$depfile ; then
+        sed -e "s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d
+        rm -f \$depfile
+    else
+        depfile=\`basename \$objfile | sed -e 's/\..*$/.d/g'\`
+        if test -f \$depfile ; then
+            sed -e "/^\$objfile/! s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d
+            rm -f \$depfile
+        fi
+    fi
+    exit 0
+else
+    \${*}
+    exit \${?}
+fi
+EOF
+        chmod +x bk-deps
     fi
     
-    AC_SUBST(DEPS_TYPE)
+    AC_SUBST(DEPS_TRACKING)
 ])
 
 dnl ---------------------------------------------------------------------------
@@ -1498,6 +1604,13 @@ AC_DEFUN(AC_BAKEFILE_CHECK_BASIC_STUFF,
             ;;
     esac
     AC_SUBST(INSTALL_DIR)
+
+    LDFLAGS_GUI=
+    case ${host} in
+        *-*-cygwin* | *-*-mingw32* )
+        LDFLAGS_GUI="-Wl,--subsystem,windows -mwindows"
+    esac
+    AC_SUBST(LDFLAGS_GUI)
 ])
 
 
@@ -1532,6 +1645,103 @@ AC_DEFUN(AC_BAKEFILE_RES_COMPILERS,
     AC_SUBST(SETFILE)
 ])
 
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_PRECOMP_HEADERS
+dnl
+dnl Check for precompiled headers support (GCC >= 3.4)
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN(AC_BAKEFILE_PRECOMP_HEADERS,
+[
+
+    AC_ARG_ENABLE([precomp-headers],
+                  [  --disable-precomp-headers  don't use precompiled headers even if compiler can],
+                  [bk_use_pch="$enableval"])
+
+    GCC_PCH=0
+
+    if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
+        if test "x$GCC" = "xyes"; then
+            dnl test if we have gcc-3.4:
+            AC_MSG_CHECKING([if the compiler supports precompiled headers])
+            AC_TRY_COMPILE([],
+                [
+                    #if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
+                        #error "no pch support"
+                    #endif
+                    #if (__GNUC__ < 3)
+                        #error "no pch support"
+                    #endif
+                    #if (__GNUC__ == 3) && \
+                       ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \
+                       ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3)))
+                        #error "no pch support"
+                    #endif
+                ],
+                [
+                    AC_MSG_RESULT([yes])
+                    dnl FIXME - this is temporary, till .gch dependencies 
+                    dnl         are fixed in generated Makefiles
+                    CPPFLAGS="-fpch-deps $CPPFLAGS"
+                    GCC_PCH=1
+                ],
+                [
+                    AC_MSG_RESULT([no])
+                ])
+            if test $GCC_PCH = 1 ; then
+                cat <<EOF >bk-make-pch
+#!/bin/sh
+
+# This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
+# script. It is used to generated precompiled headers.
+#
+# Permission is given to use this file in any way.
+
+outfile="\${1}"
+header="\${2}"
+shift
+shift
+
+compiler=
+headerfile=
+while test \${#} -gt 0; do
+    case "\${1}" in
+        -I* )
+            incdir=\`echo \${1} | sed -e 's/-I\(.*\)/\1/g'\`
+            if test "x\${headerfile}" = "x" -a -f "\${incdir}/\${header}" ; then
+                headerfile="\${incdir}/\${header}"
+            fi
+        ;;
+    esac
+    compiler="\${compiler} \${1}"
+    shift
+done
+
+if test "x\${headerfile}" = "x" ; then
+    echo "error: can't find header \${header} in include paths" >2
+else
+    if test -f \${outfile} ; then
+        rm -f \${outfile}
+    else
+        mkdir -p \`dirname \${outfile}\`
+    fi
+    depsfile=".deps/\`basename \${outfile}\`.d"
+    mkdir -p .deps
+    # can do this because gcc is >= 3.4:
+    \${compiler} -o \${outfile} -MMD -MF "\${depsfile}" "\${headerfile}"
+    exit \${?}
+fi
+EOF
+                chmod +x bk-make-pch
+            fi
+        fi
+    fi
+
+    AC_SUBST(GCC_PCH)
+])
+
+
+
 dnl ---------------------------------------------------------------------------
 dnl AC_BAKEFILE
 dnl