]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
added new wx-config --query-xxx options and use them in (Unix) bakefile presets inste...
[wxWidgets.git] / configure.in
index d69f568ab5b328315586c211a871d109d3831dd8..3e0012dc6e14364910c3e5d2cf3783f65cb6aa2e 100644 (file)
@@ -26,6 +26,16 @@ dnl sets build, host variables and the same with _alias
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
+dnl notice that if --host was given but --build was not, cross_compiling is
+dnl only set to "maybe" and not "yes" and will be either set to "yes" later or
+dnl configure will exit with error in AC_PROG_CC so don't test for = "yes" here
+if test "$cross_compiling" != "no"; then
+    HOST_PREFIX="${host_alias}-"
+    HOST_SUFFIX="-$host_alias"
+else
+    HOST_PREFIX=
+    HOST_SUFFIX=
+fi
 
 dnl When making releases do:
 dnl
@@ -126,7 +136,8 @@ DEFAULT_DEFAULT_wxUSE_DFB=0
 
 PROGRAM_EXT=
 SAMPLES_RPATH_FLAG=
-SAMPLES_RPATH_POSTLINK=
+DYLIB_RPATH_INSTALL=
+DYLIB_RPATH_POSTLINK=
 
 DEFAULT_STD_FLAG=yes
 
@@ -313,18 +324,6 @@ case "${host}" in
     AC_DEFINE(__DARWIN__)
     AC_DEFINE(TARGET_CARBON)
     DEFAULT_DEFAULT_wxUSE_OSX_CARBON=1
-    DEFAULT_STD_FLAG=no
-  ;;
-  powerpc-apple-macos* )
-    dnl Classic Mac OS (< X)
-    USE_UNIX=0
-    dnl For some reason the test that should be cross-compiler capable fails
-    dnl However, there is no doubt that MacOS PowerPC is big endian.
-    ac_cv_c_bigendian=yes
-    dnl AC_DEFINE(TARGET_CARBON)
-    dnl platform.h needs TARGET_CARBON before setup.h, we'll add it to CPPFLAGS
-    DEFAULT_DEFAULT_wxUSE_OSX_CARBON=1
-    DEFAULT_STD_FLAG=no
   ;;
 
   *-*-beos* )
@@ -377,6 +376,7 @@ dnl automatic features
 DEFAULT_wxUSE_UNICODE_UTF8=auto
 DEFAULT_wxUSE_OPENGL=auto
 DEFAULT_wxUSE_MEDIACTRL=auto
+DEFAULT_wxUSE_COMPILER_TLS=auto
 
 DEFAULT_wxUSE_UNICODE_UTF8_LOCALE=no
 
@@ -624,7 +624,7 @@ if test "$USE_OS2" = 1; then
     WX_ARG_ENABLE(omf,     [  --enable-omf            use OMF object format], wxUSE_OMF)
 fi
 
-dnl --enablle-debug is equivalent to both --enable-debug_flag and
+dnl --enable-debug is equivalent to both --enable-debug_flag and
 dnl --enable-debug_info
 if test "$wxUSE_DEBUG" = "yes"; then
     DEFAULT_wxUSE_DEBUG_FLAG=yes
@@ -671,18 +671,12 @@ WX_ARG_ENABLE_PARAM(universal_binary, [[  --enable-universal_binary  create Mac
 WX_ARG_ENABLE(compat26,      [  --enable-compat26       enable wxWidgets 2.6 compatibility], WXWIN_COMPATIBILITY_2_6)
 WX_ARG_DISABLE(compat28,     [  --disable-compat28      disable wxWidgets 2.8 compatibility], WXWIN_COMPATIBILITY_2_8)
 
-dnl currently we don't provide a switch for disabling it as it shouldn't be
-dnl necessary to do it unless the compiler doesn't support the new events and
-dnl this should be tested for by configure itself (but also isn't done yet
-dnl because there are no known examples of such compilers among the currently
-dnl supported ones)
-AC_DEFINE(wxEVENTS_COMPATIBILITY_2_8, 0)
-
 WX_ARG_DISABLE(rpath,        [  --disable-rpath         disable use of rpath for uninstalled builds], wxUSE_RPATH)
 
 WX_ARG_ENABLE(objc_uniquifying,[  --enable-objc_uniquifying enable Objective-C class name uniquifying], wxUSE_OBJC_UNIQUIFYING)
 
 WX_ARG_DISABLE(visibility,   [  --disable-visibility    disable use of ELF symbols visibility even if supported], wxUSE_VISIBILITY)
+WX_ARG_DISABLE(tls,          [  --disable-tls           disable use of compiler TLS support], wxUSE_COMPILER_TLS)
 
 dnl ---------------------------------------------------------------------------
 dnl optional non GUI features
@@ -1012,7 +1006,7 @@ dnl   defines CFLAGS
 dnl
 dnl this magic incantation is needed to prevent AC_PROG_CC from setting the
 dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add
-dnl -g and -O flags ourselves below
+dnl (if not already present in C*FLAGS) the -g and -O flags ourselves below
 CFLAGS=${CFLAGS:=}
 AC_BAKEFILE_PROG_CC
 
@@ -3772,19 +3766,21 @@ if test "$wxUSE_SHARED" = "yes"; then
       ;;
 
       *-*-darwin* )
-        install_name_tool=`which install_name_tool`
+        install_name_tool=`which ${HOST_PREFIX}install_name_tool`
         if test "$install_name_tool" -a -x "$install_name_tool"; then
-            SAMPLES_RPATH_POSTLINK="\$(wx_top_builddir)/change-install-names \$(LIBDIRNAME) \$(prefix) \$@"
+            DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
             cat <<EOF >change-install-names
 #!/bin/sh
 libnames=\`cd \${1} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
-inst_cmd="install_name_tool "
 for i in \${libnames} ; do
-    inst_cmd="\${inst_cmd} -change \${2}/lib/\${i} \${1}/\${i}"
+    ${HOST_PREFIX}install_name_tool -id \${1}/\${i} \${1}/\${i}
+    for dep in \${libnames} ; do
+        ${HOST_PREFIX}install_name_tool -change \${2}/\${dep} \${1}/\${dep} \${1}/\${i}
+    done
 done
-\${inst_cmd} \${3}
 EOF
             chmod +x change-install-names
+            DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${libdir} \$(wx_top_builddir)/lib"
         fi
 
         dnl the HEADER_PAD_OPTION is required by some wx samples to avoid the error:
@@ -3811,7 +3807,7 @@ EOF
 
     if test $wxUSE_RPATH = "no"; then
         SAMPLES_RPATH_FLAG=''
-        SAMPLES_RPATH_POSTLINK=''
+        DYLIB_PATH_POSTLINK=''
         WXCONFIG_RPATH=''
     fi
 
@@ -3853,15 +3849,9 @@ fi
 
 WX_VERSION_TAG=`echo WX${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}_${WX_RELEASE} | tr '[[a-z]]' '[[A-Z]]'`
 
-TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}"
+TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}"
 
-TOOLCHAIN_FULLNAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}-${WX_DEBUGTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
-
-if test "$cross_compiling" = "yes"; then
-    HOST_SUFFIX="-$host_alias"
-    TOOLCHAIN_NAME="$TOOLCHAIN_NAME$HOST_SUFFIX"
-    TOOLCHAIN_FULLNAME="${host_alias}-$TOOLCHAIN_FULLNAME"
-fi
+TOOLCHAIN_FULLNAME="${HOST_PREFIX}${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}-${WX_DEBUGTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
 
 dnl library link name
 dnl These just save us from exporting lib_{unicode,debug,flavour}_suffix.
@@ -4985,48 +4975,59 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
         fi
       fi
 
-      dnl test for compiler thread-specific variables support
-      AC_CACHE_CHECK([for __thread keyword],
-                     wx_cv_cc___thread,
-          [
-              AC_TRY_COMPILE([#include <pthread.h>],
-                  [
-                      static __thread int n = 0;
-                      static __thread int *p = 0;
-                  ],
-                  wx_cv_cc___thread=yes,
-                  wx_cv_cc___thread=no
-              )
-          ]
-      )
-
-      if test "$wx_cv_cc___thread" = "yes"; then
-          AX_GXX_VERSION
-          if test -n "$ax_cv_gxx_version"; then
-              dnl g++ supports __thread since at least version 3.3 but its support
-              dnl seems to be broken until 4.1, see
-              dnl   http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/108388
-              dnl
-              dnl NB: we still need to test __thread support with
-              dnl     AC_TRY_COMPILE above even for g++ 4 as it doesn't
-              dnl     support it for all architectures (e.g. it doesn't
-              dnl     work under OS X)
-              AC_MSG_CHECKING([whether __thread support in g++ is usable])
-              case "$ax_cv_gxx_version" in
-                1.* | 2.* | 3.* )
-                    AC_MSG_RESULT([no, it's broken])
-                    wx_cv_cc___thread=no
-                    ;;
-                *)
-                    AC_MSG_RESULT([yes, it works])
-                    ;;
-              esac
+      if test "$wxUSE_COMPILER_TLS" = "auto"; then
+          if test "$USE_NETBSD" = 1; then
+              AC_MSG_WARN([Disabling TLS under NetBSD, please contact wx-dev if it works now])
+              wxUSE_COMPILER_TLS=no
+          else
+              wxUSE_COMPILER_TLS=yes
           fi
       fi
 
-      if test "$wx_cv_cc___thread" = "yes"; then
-        AC_DEFINE(HAVE___THREAD_KEYWORD)
-      fi
+      if test "$wxUSE_COMPILER_TLS" = "yes"; then
+          dnl test for compiler thread-specific variables support
+          AC_CACHE_CHECK([for __thread keyword],
+                         wx_cv_cc___thread,
+              [
+                  AC_TRY_COMPILE([#include <pthread.h>],
+                      [
+                          static __thread int n = 0;
+                          static __thread int *p = 0;
+                      ],
+                      wx_cv_cc___thread=yes,
+                      wx_cv_cc___thread=no
+                  )
+              ]
+          )
+
+          if test "$wx_cv_cc___thread" = "yes"; then
+              AX_GXX_VERSION
+              if test -n "$ax_cv_gxx_version"; then
+                  dnl g++ supports __thread since at least version 3.3 but its support
+                  dnl seems to be broken until 4.1, see
+                  dnl   http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/108388
+                  dnl
+                  dnl NB: we still need to test __thread support with
+                  dnl     AC_TRY_COMPILE above even for g++ 4 as it doesn't
+                  dnl     support it for all architectures (e.g. it doesn't
+                  dnl     work under OS X)
+                  AC_MSG_CHECKING([whether __thread support in g++ is usable])
+                  case "$ax_cv_gxx_version" in
+                    1.* | 2.* | 3.* )
+                        AC_MSG_RESULT([no, it's broken])
+                        wx_cv_cc___thread=no
+                        ;;
+                    *)
+                        AC_MSG_RESULT([yes, it works])
+                        ;;
+                  esac
+              fi
+          fi
+
+          if test "$wx_cv_cc___thread" = "yes"; then
+            AC_DEFINE(HAVE___THREAD_KEYWORD)
+          fi
+        fi
     fi
 
 dnl from if !MSW
@@ -5139,7 +5140,13 @@ fi
 dnl DEBUG_CFLAGS contains debugging options (supposed to be the same for C and C++
 dnl compilers: we'd need a separate DEBUG_CXXFLAGS if this is ever not the case)
 DEBUG_CFLAGS=
-if test "$wxUSE_DEBUG_INFO" = "yes" ; then
+if `echo $CXXFLAGS $CFLAGS | grep " -g" >/dev/null`; then
+    dnl the CXXFLAGS or the CFLAGS variable already contains the -g flag
+    dnl (e.g. it was specified by the user before running configure); since
+    dnl later they will be merged with DEBUG_CFLAGS, don't set the -g option
+    dnl in DEBUG_CFLAGS to avoid (possibly different) flag duplicates
+    AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -g flag; ignoring the --enable-debug_info option])
+elif test "$wxUSE_DEBUG_INFO" = "yes" ; then
     DEBUG_CFLAGS="-g"
 fi
 
@@ -5212,29 +5219,37 @@ fi
 
 dnl C/C++ compiler option for optimization (supposed to be the same for both)
 OPTIMISE_CFLAGS=
-if test "$wxUSE_OPTIMISE" = "no" ; then
-    if test "$GCC" = yes ; then
-        dnl use -O0 because compiling with it is faster than compiling with no
-        dnl optimization options at all (at least with g++ 3.2)
-        OPTIMISE_CFLAGS="-O0"
-    fi
+if `echo $CXXFLAGS $CFLAGS | grep " -O" >/dev/null`; then
+    dnl the CXXFLAGS or the CFLAGS variable already contains -O optimization flag
+    dnl (e.g. it was specified by the user before running configure); since
+    dnl later they will be merged with OPTIMISE_CFLAGS, don't set the -O option
+    dnl in OPTIMISE_CFLAGS to avoid (possibly different) flag duplicates
+    AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -O flag; ignoring the --disable-optimise option])
 else
-    if test "$GCC" = yes ; then
-        case "${host}" in
-            *-pc-os2_emx | *-pc-os2-emx )
-                dnl Not all of the supported gcc versions understand
-                dnl -fstrict-aliasing and none actually needs it (yet).
-                OPTIMISE_CFLAGS="-O2"
-            ;;
-            *)
-                dnl Switch on optimisation but keep strict-aliasing off for
-                dnl now (see -fstrict-aliasing in the gcc manual). When it is
-                dnl switched back on consider using -Wstrict-aliasing=2.
-                OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
-            ;;
-        esac
+    if test "$wxUSE_OPTIMISE" = "no" ; then
+        if test "$GCC" = yes ; then
+            dnl use -O0 because compiling with it is faster than compiling with no
+            dnl optimization options at all (at least with g++ 3.2)
+            OPTIMISE_CFLAGS="-O0"
+        fi
     else
-        OPTIMISE_CFLAGS="-O"
+        if test "$GCC" = yes ; then
+            case "${host}" in
+                *-pc-os2_emx | *-pc-os2-emx )
+                    dnl Not all of the supported gcc versions understand
+                    dnl -fstrict-aliasing and none actually needs it (yet).
+                    OPTIMISE_CFLAGS="-O2"
+                ;;
+                *)
+                    dnl Switch on optimisation but keep strict-aliasing off for
+                    dnl now (see -fstrict-aliasing in the gcc manual). When it is
+                    dnl switched back on consider using -Wstrict-aliasing=2.
+                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
+                ;;
+            esac
+        else
+            OPTIMISE_CFLAGS="-O"
+        fi
     fi
 fi
 
@@ -5820,65 +5835,6 @@ if test "$ac_cv_func_gettimeofday" = "yes"; then
 fi
 
 if test "$wxUSE_DATETIME" = "yes"; then
-    dnl check for strptime and for its declaration as some systems lack it
-    AC_CHECK_FUNC(strptime)
-    if test "$ac_cv_func_strptime" = "yes"; then
-        AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
-            [
-                AC_LANG_PUSH(C++)
-                AC_TRY_COMPILE(
-                    [
-                        #include <time.h>
-                    ],
-                    [
-                        struct tm t;
-                        strptime("foo", "bar", &t);
-                    ],
-                    wx_cv_func_strptime_decl=yes,
-                    wx_cv_func_strptime_decl=no
-                )
-                AC_LANG_POP()
-            ]
-        )
-    fi
-    if test "$wx_cv_func_strptime_decl" = "yes"; then
-        AC_DEFINE(HAVE_STRPTIME_DECL)
-    else
-        wx_strptime_decl="extern char *strptime(const char *, const char *, struct tm *);"
-    fi
-    if test "$ac_cv_func_strptime" = "yes"; then
-        dnl strptime() behaviour doesn't conform to POSIX under Mac OS X <
-        dnl 10.5 and possibly other BSD variants, check that strptime() we
-        dnl have fails to parse format when the string doesn't match it instea
-        dnl of just stopping immediately and returning non-NULL
-        AC_CACHE_CHECK([whether strptime() fails on invalid strings],
-            wx_cv_func_strptime_ok,
-            [AC_RUN_IFELSE(
-                [
-                    #include <stdlib.h>
-                    #include <time.h>
-                    #include "confdefs.h"
-
-                    $wx_strptime_decl
-
-                    int main()
-                    {
-                        struct tm t;
-                        return !!strptime("", "%x", &t);
-                    }
-                ],
-                wx_cv_func_strptime_ok=yes,
-                wx_cv_func_strptime_ok=no,
-                dnl be pessimistic when cross-compiling
-                wx_cv_func_strptime_ok=no
-            )]
-        )
-
-        if test "$wx_cv_func_strptime_ok" = "yes"; then
-            AC_DEFINE(HAVE_STRPTIME)
-        fi
-    fi
-
     dnl check for timezone variable
     dnl   doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
     AC_CACHE_CHECK(for timezone variable in <time.h>,
@@ -6669,7 +6625,6 @@ fi
 if test "$wxUSE_EDITABLELISTBOX" = "yes"; then
     AC_DEFINE(wxUSE_EDITABLELISTBOX)
     USES_CONTROLS=1
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS editlbox"
 fi
 
 if test "$wxUSE_NOTEBOOK" = "yes"; then
@@ -6961,6 +6916,13 @@ if test "$wxUSE_STC" = "yes"; then
    AC_DEFINE(wxUSE_STC)
    USE_STC=1
    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS stc"
+
+   dnl python is used to update src/stc.h (see build/bakefiles/scintilla.bkl)
+   AC_PATH_PROG(PYTHON, python)
+   if test "x$PYTHON" = "x"; then
+     COND_PYTHON="#"
+   fi
+   AC_SUBST(COND_PYTHON)
 fi
 
 if test "$wxUSE_MENUS" = "yes"; then
@@ -7273,7 +7235,7 @@ dnl ---------------------------------------------------------------------------
 dnl get the string with OS info - used by wxGetOsDescription() on MacOS X
 dnl ---------------------------------------------------------------------------
 
-if test "$cross_compiling" = "yes"; then
+if test "$cross_compiling" != "no"; then
     dnl Use best guess from host as we can't use uname when cross compiling
     OSINFO="\"$host\""
 else
@@ -7391,9 +7353,8 @@ if test "$wxUSE_GUI" = "yes"; then
 
     dnl TODO some samples are never built so far: mfc (requires VC++)
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs drawing \
-                     erase event exec font image minimal mobile \
-                     mobile/wxedit mobile/styles render \
-                     shaped svg taborder vscroll widgets"
+                     erase event exec font image minimal render \
+                     shaped svg taborder vscroll widgets wrapsizer"
 
     if test "$wxUSE_MONOLITHIC" != "yes"; then
         SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS console"
@@ -7634,8 +7595,9 @@ if test "$TOOLKIT_LOWERCASE" = "xxx"; then
 fi
 AC_SUBST(TOOLKIT_LOWERCASE)
 AC_SUBST(TOOLKIT_VERSION)
+AC_SUBST(DYLIB_RPATH_INSTALL)
+AC_SUBST(DYLIB_RPATH_POSTLINK)
 AC_SUBST(SAMPLES_RPATH_FLAG)
-AC_SUBST(SAMPLES_RPATH_POSTLINK)
 AC_SUBST(HEADER_PAD_OPTION)
 AC_SUBST(HOST_SUFFIX)
 AC_SUBST(CPPUNIT_CFLAGS)
@@ -7990,10 +7952,7 @@ AC_PROG_MAKE_SET
 AC_CONFIG_HEADERS([lib/wx/include/${TOOLCHAIN_FULLNAME}/wx/setup.h:setup.h.in])
 
 if test "$USE_WIN32" = 1; then
-    AC_CONFIG_COMMANDS(
-        [
-            rcdefs.h
-        ],
+    AC_CONFIG_COMMANDS([rcdefs.h],
         [
             mkdir -p $outdir &&
             $CPP $infile | sed 's/^# *[1-9].*//;s/^ *//;/./,/^$/!d' > $outdir/rcdefs.h