]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
Fix wxMotif checkbox for Motif 1.2. (need to backport)
[wxWidgets.git] / configure.in
index 9dec117684bb4531db486537a52fbd75afcc629e..5b21d7585a08ed2abe86ebee685dd7d03d4f6acd 100644 (file)
@@ -1517,7 +1517,6 @@ if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
     CXXFLAGS="$CXXFLAGS -qunique"
 fi
 
-
 dnl This case is for PowerPC OS X vs. everything else
 case "${host}" in
   powerpc-*-darwin* )
@@ -2126,9 +2125,11 @@ SEARCH_INCLUDE="\
 
 dnl try to find out the standard lib locations for the systems with multiple
 dnl ABIs
+AC_MSG_CHECKING([for libraries directory])
+
 case "${host}" in
-    *-*-linux* | *-*-irix6* | *-*-solaris2* )
-        AC_CACHE_CHECK([for libraries directory],
+    *-*-irix6* )
+        AC_CACHE_VAL(
             wx_cv_std_libpath,
             [
                 for d in WX_STD_LIBPATH(); do
@@ -2153,12 +2154,33 @@ case "${host}" in
         )
         ;;
 
+    *-*-solaris2* )
+        dnl use ../lib or ../lib/64 depending on the size of void*
+        if test "$ac_cv_sizeof_void_p" = 8 -a -d "/usr/lib/64"; then
+            wx_cv_std_libpath="lib/64"
+        else
+            wx_cv_std_libpath="lib"
+        fi
+        ;;
+
+    *-*-linux* )
+        dnl use ../lib or ../lib64 depending on the size of void*
+        if test "$ac_cv_sizeof_void_p" = 8 -a \
+                -d "/usr/lib64" -a ! -h "/usr/lib64"; then
+            wx_cv_std_libpath="lib64"
+        else
+            wx_cv_std_libpath="lib"
+        fi
+        ;;
+
     *)
         wx_cv_std_libpath="lib";
         ;;
 esac
 
-SEARCH_LIB=`echo "$SEARCH_INCLUDE" | sed s@include@$wx_cv_std_libpath@g`
+AC_MSG_RESULT($wx_cv_std_libpath)
+
+SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s@include@$wx_cv_std_libpath@g` /usr/$wx_cv_std_libpath"
 
 dnl Cross compiling with gcc?
 if test "$build" != "$host" -a "$GCC" = yes; then
@@ -2720,8 +2742,32 @@ if test "$wxUSE_GUI" = "yes"; then
 
                 dnl detect GTK2
                 wx_cv_lib_gtk=
-                if test "x$wxGTK_VERSION" != "x1"; then
+                if test "x$wxGTK_VERSION" != "x1"
+                then
+                    dnl The gthread.pc that ships with solaris returns '-mt',
+                    dnl it's correct for Sun CC, but gcc requires '-pthreads'.
+                    dnl So disable the compile check and remove the -mt below.
+                    case "${host}" in
+                        *-*-solaris2* )
+                            if test "$wxUSE_THREADS" = "yes" -a "$GCC" = yes; then
+                               enable_gtktest=no
+                            fi
+                    esac
+
                     AM_PATH_GTK_2_0(2.0.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
+
+                    dnl Remove the '-mt' for gcc on solaris
+                    case "${host}" in
+                        *-*-solaris2* )
+                            if test "$wxUSE_THREADS" = "yes" -a "$GCC" = yes; then
+                                GTK_CFLAGS=`echo $GTK_CFLAGS | sed 's/-mt//'`
+                                GTK_LIBS=`echo $GTK_LIBS | sed 's/-mt//'`
+                            fi
+                            dnl solaris also requires -lX11 for static lib
+                            if test "$wxUSE_SHARED" != "yes"; then
+                                GTK_LIBS="$GTK_LIBS -lX11"
+                            fi
+                    esac
                 fi
 
                 dnl detect GTK1.x
@@ -3101,6 +3147,8 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
             dnl path -- try to compile a test program to check for this
             save_CFLAGS=$CFLAGS
             CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+            save_LIBS="$LIBS"
+            LIBS="$GUI_TK_LIBRARY -lXm -lXmu -lXext -lX11"
 
             AC_TRY_LINK(
                 [
@@ -3115,12 +3163,13 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
                     COMPILED_X_PROGRAM=1
                 ],
                 [
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
-                    ]
-                )
+                    AC_MSG_RESULT(no)
+                    AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+                ]
+            )
 
             CFLAGS=$save_CFLAGS
+            LIBS="$save_LIBS"
         fi
 
         AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])
@@ -4793,16 +4842,31 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
             [
                pthread_mutexattr_t attr;
                pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-            ], [
-               wx_cv_type_pthread_mutexattr_t=yes
-            ], [
-               wx_cv_type_pthread_mutexattr_t=no
-            ]
+            ],
+            wx_cv_type_pthread_mutexattr_t=yes,
+            wx_cv_type_pthread_mutexattr_t=no
         )
       ])
 
       if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
         AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
+
+        dnl check if we already have the declaration we need, it is not
+        dnl present in some systems' headers
+        AC_CACHE_CHECK([for pthread_mutexattr_settype declaration],
+                       wx_cv_func_pthread_mutexattr_settype_decl, [
+                       AC_TRY_COMPILE([#include <pthread.h>],
+                           [
+                               pthread_mutexattr_t attr;
+                               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+                           ],
+                           wx_cv_func_pthread_mutexattr_settype_decl=yes,
+                           wx_cv_func_pthread_mutexattr_settype_decl=no
+                       )
+        ])
+        if test "$wx_cv_func_pthread_mutexattr_settype_decl" = "yes"; then
+            AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL)
+        fi
       else
         dnl don't despair, there may be another way to do it
         AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
@@ -5387,11 +5451,34 @@ fi
 
 dnl ---------------------------------------------------------------------------
 dnl time/date functions
-dnl ------------------------------------------------------------------------
+dnl ---------------------------------------------------------------------------
 
 if test "$wxUSE_DATETIME" = "yes"; then
-    dnl check for strptime
+    dnl check for strptime and for its declaration as some systems lack it
     AC_CHECK_FUNCS(strptime)
+    if test "$ac_cv_func_strptime" = "yes"; then
+        AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
+            [
+                AC_LANG_SAVE
+                AC_LANG_CPLUSPLUS
+                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_RESTORE
+            ]
+        )
+    fi
+    if test "$wx_cv_func_strptime_decl" = "yes"; then
+        AC_DEFINE(HAVE_STRPTIME_DECL)
+    fi
 
     dnl check for timezone variable
     dnl   doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
@@ -5589,9 +5676,9 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                         dnl converting between incompatible pointer types, so
                         dnl try to use it to get the correct behaviour at
                         dnl least with gcc (otherwise we'd always use size_t)
-                        CFLAGS_OLD="$CFLAGS"
+                        CXXFLAGS_OLD="$CXXFLAGS"
                         if test "$GCC" = yes ; then
-                            CFLAGS="$CFLAGS -Werror"
+                            CXXFLAGS="$CXXFLAGS -Werror"
                         fi
 
                         AC_TRY_COMPILE(
@@ -5618,7 +5705,7 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                             )
                         )
 
-                        CFLAGS="$CFLAGS_OLD"
+                        CXXFLAGS="$CXXFLAGS_OLD"
                     ]
                 )
             ])
@@ -5650,9 +5737,9 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                         dnl converting between incompatible pointer types, so
                         dnl try to use it to get the correct behaviour at
                         dnl least with gcc (otherwise we'd always use size_t)
-                        CFLAGS_OLD="$CFLAGS"
+                        CXXFLAGS_OLD="$CXXFLAGS"
                         if test "$GCC" = yes ; then
-                            CFLAGS="$CFLAGS -Werror"
+                            CXXFLAGS="$CXXFLAGS -Werror"
                         fi
 
                         AC_TRY_COMPILE(
@@ -5679,7 +5766,7 @@ if test "$wxUSE_SOCKETS" = "yes" ; then
                             )
                         )
 
-                        CFLAGS="$CFLAGS_OLD"
+                        CXXFLAGS="$CXXFLAGS_OLD"
                     ]
                 )
             ])
@@ -6800,10 +6887,42 @@ INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
 -I\${top_srcdir}/include $TOOLKIT_INCLUDE"
 
 dnl C/C++ compiler options used to compile wxWidgets
-if test "$GXX" = yes ; then
-    dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
+dnl
+dnl check for icc before gcc as icc is also recognized as gcc
+if test "x$INTELCC" = "xyes" ; then
+    dnl Warnings which can't be easily suppressed in C code are disabled:
+    dnl
+    dnl     remark #810: conversion from "x" to "y" may lose significant bits
+    dnl     remark #869: parameter "foo" was never referenced
+    dnl     remark #1572: floating-point equality and inequality comparisons
+    dnl                   are unreliable
+    dnl     remark #1684: conversion from pointer to same-sized integral type
+    dnl
+    dnl (for others see below)
+    CWARNINGS="-Wall -wd810,869,981,1418,1572,1684"
+elif test "$GCC" = yes ; then
     CWARNINGS="-Wall -Wundef"
-    CXXWARNINGS="$CWARNINGS -Wno-ctor-dtor-privacy" 
+fi
+
+if test "x$INTELCXX" = "xyes" ; then
+    dnl Intel compiler gives some warnings which simply can't be worked
+    dnl around or of which we have too many (810, 869) so it's impractical to
+    dnl keep them enabled even if in theory it would be nice and some others
+    dnl (279) are generated for standard macros and so there is nothing we can
+    dnl do about them
+    dnl
+    dnl     remark #279: controlling expression is constant
+    dnl     remark #383: value copied to temporary, reference to temporary used
+    dnl     remark #444: destructor for base class "xxx" is not virtual
+    dnl     remark #810: conversion from "x" to "y" may lose significant bits
+    dnl     remark #869: parameter "foo" was never referenced
+    dnl     remark #981: operands are evaluated in unspecified order
+    dnl     remark #1418: external definition with no prior declaration
+    dnl     remark #1419: external declaration in primary source file
+    CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419"
+elif test "$GXX" = yes ; then
+    dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
+    CXXWARNINGS="-Wall -Wundef -Wno-ctor-dtor-privacy" 
 fi
 
 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"
@@ -7012,76 +7131,12 @@ if test "$wxUSE_OMF" = "yes"; then
     esac
 fi
 
-dnl According to Vaclav, if NO_GCC_PRAGMA is used for any reason it needs to
-dnl be in wx-config output.  Not doing so could result in link problems.
-GCC_PRAGMA_FLAGS=""
-PCH_FLAGS=""
-
-dnl Find out if we have to define WX_PRECOMP (and thus NO_GCC_PRAGMA)
+dnl find out if the compiler supports PCH
+dnl
+dnl TODO: this should be in bakefile
 if test $GCC_PCH = 1 ; then
-    PCH_FLAGS="-DWX_PRECOMP"
-    GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-else
-    dnl Find out if we have to define NO_GCC_PRAGMA
-    if test "$GCC" = yes; then
-        AC_MSG_CHECKING([if this GCC version is >= 4.0 and needs -DNO_GCC_PRAGMA])
-        AC_TRY_COMPILE([],
-            [#if (__GNUC__ < 4)
-             Not GCC 4.0 or greater
-             #endif
-            ],
-            [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-             AC_MSG_RESULT([yes])],
-            [AC_MSG_RESULT([no])
-            case "${host}" in
-                *-*-darwin* )
-                    dnl Some Apple's GCC version are broken and can't handle the
-                    dnl pragmas:
-                    GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-                ;;
-                *-*-mingw32* )
-                    dnl MinGW GCC versions > 3.2 have problems with
-                    dnl static member of classes derived from templates
-                    dnl in combination with #pragma interface/implementation
-                    dnl (the test case uses 4 files)
-                    dnl ... and with exceptions handling (undefined symbols needed
-                    dnl to correctly calls dtors when unwinding) as well
-                    if test "$wxUSE_STL" = "yes" -o \
-                    "$wxUSE_NO_EXCEPTIONS" != "yes" -o \
-                    "$wxUSE_NO_RTTI" != "yes"; then
-                        AC_MSG_CHECKING([if this MinGW version needs -DNO_GCC_PRAGMA])
-                        AC_TRY_COMPILE([],
-                            [#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
-                             Not GCC 3.2 or greater
-                             #endif
-                            ],
-                            [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-                             AC_MSG_RESULT([yes])],
-                            [AC_MSG_RESULT([no])])
-                    fi
-                    ;;
-                *-pc-os2_emx | *-pc-os2-emx )
-                    dnl GCC versions ported to OS/2 have similar problems with
-                    dnl static member of classes in combination with STL and
-                    dnl pragma interface/implementation
-                    if test "$wxUSE_STL" = "yes"; then
-                        AC_MSG_CHECKING([if this gcc version needs -DNO_GCC_PRAGMA])
-                        AC_TRY_COMPILE([],
-                            [#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
-                             Not GCC 3.2 or greater
-                             #endif
-                            ],
-                            [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
-                             AC_MSG_RESULT([yes])],
-                            [AC_MSG_RESULT([no])])
-                    fi
-                    ;;
-            esac
-dnl  closing bracket of if GCC < 4.0
-        ] ) 
-    fi
+    CPPFLAGS="-DWX_PRECOMP $CPPFLAGS"
 fi
-CPPFLAGS="$PCH_FLAGS $GCC_PRAGMA_FLAGS $CPPFLAGS"
 
 
 dnl for convenience, sort the samples in alphabetical order