]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
added extra parentheses to wxDynamicCast() to allow using it like wxDynamicCast(foo...
[wxWidgets.git] / configure.in
index 657eca782455f962285af435cff027c1f1b3b9c1..c1e6a71bbf207e47e100a19549481ce1f8bc43dd 100644 (file)
@@ -656,8 +656,8 @@ dnl ============================
 dnl these options use AC_ARG_WITH and not WX_ARG_WITH on purpose - we cache
 dnl these values manually
 for toolkit in `echo $ALL_TOOLKITS`; do
-  LINE=`grep "wxUSE_$toolkit" ${wx_arg_cache_file}`
-  if test "x$LINE" != x ; then
+  LINE=`grep "wxUSE_$toolkit=" ${wx_arg_cache_file}`
+  if test "x$LINE" != "x" ; then
     has_toolkit_in_cache=1
     eval "DEFAULT_$LINE"
     eval "CACHE_$toolkit=1"
@@ -688,7 +688,7 @@ AC_ARG_WITH(microwin,      [  --with-microwin         use MicroWindows], [wxUSE_
 AC_ARG_WITH(x11,           [  --with-x11              use X11], [wxUSE_X11="$withval" wxUSE_UNIVERSAL="yes" CACHE_X11=1 TOOLKIT_GIVEN=1])
 WX_ARG_ENABLE(nanox,       [  --enable-nanox          use NanoX], wxUSE_NANOX)
 
-AC_ARG_ENABLE(gtk2,        [  --enable-gtk2           use GTK+ 2.0 if available (EXPERIMENTAL)],wxUSE_GTK2="yes",wxUSE_GTK2="no")
+WX_ARG_ENABLE(gtk2,        [  --enable-gtk2           use GTK+ 2.0 if available (EXPERIMENTAL)], wxUSE_GTK2)
 
 WX_ARG_SYS_WITH(libpng,    [  --with-libpng           use libpng (PNG image format)], wxUSE_LIBPNG)
 WX_ARG_SYS_WITH(libjpeg,   [  --with-libjpeg          use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
@@ -1094,10 +1094,10 @@ if test "$wxUSE_GUI" = "yes"; then
       1)
       ;;
       0)
-        AC_MSG_ERROR(Please specify a toolkit - cannot determine the default for ${host})
+        AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
       ;;
       *)
-        AC_MSG_ERROR(Please specify at most one toolkit (may be some are cached?))
+        AC_MSG_ERROR(Please specify at most one toolkit (maybe some are cached in configarg.cache?))
     esac
 
     dnl cache the wxUSE_<TOOLKIT> values too
@@ -1357,10 +1357,6 @@ if test "$ac_cv_header_wchar_h" != "yes"; then
     AC_CHECK_HEADERS(wcstr.h)
 fi
 
-dnl checking for wctype.h is useless as we need wcslen(), not just wchar_t and
-dnl this function is never provided by it
-dnl AC_CHECK_HEADERS(wctype.h)
-
 dnl defines HAVE_FNMATCH_H
 AC_CHECK_HEADERS(fnmatch.h)
 
@@ -1912,19 +1908,6 @@ if test "$wxUSE_GUI" = "yes"; then
                 wx_cv_lib_gtk=
                 if test "x$wxUSE_GTK2" = "xyes"; then
                     AM_PATH_GTK_2_0(2.0.0, wx_cv_lib_gtk=2.0, , $GTK_MODULES)
-
-                    if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
-                        PKG_CHECK_MODULES(PANGOFT2, pangoft2,
-                            [
-                                CXXFLAGS="$CXXFLAGS $PANGOFT2_CFLAGS"
-                                LIBS="$LIBS $PANGOFT2_LIBS"
-                            ],
-                            [
-                                AC_MSG_WARN([pangoft2 library not found, library will be compiled without printing support])
-                                wxUSE_PRINTING_ARCHITECTURE="no"
-                            ]
-                        )
-                    fi
                 fi
 
                 if test -z "$wx_cv_lib_gtk"; then
@@ -1970,6 +1953,21 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                     ;;
         esac
 
+        if test "$WXGTK20" = 1; then
+            if test "$wxUSE_PRINTING_ARCHITECTURE" = "yes" ; then
+                PKG_CHECK_MODULES(PANGOFT2, pangoft2,
+                    [
+                        CXXFLAGS="$CXXFLAGS $PANGOFT2_CFLAGS"
+                        LIBS="$LIBS $PANGOFT2_LIBS"
+                    ],
+                    [
+                        AC_MSG_WARN([pangoft2 library not found, library will be compiled without printing support])
+                        wxUSE_PRINTING_ARCHITECTURE="no"
+                    ]
+                )
+            fi
+        fi
+
         TOOLKIT_INCLUDE="$wx_cv_cflags_gtk"
         GUI_TK_LIBRARY="$wx_cv_libs_gtk"
 
@@ -2181,7 +2179,9 @@ equivalent variable and GTK+ is version 1.2.3 or above.
         AC_MSG_CHECKING(for Motif/Lesstif headers)
         WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
         if test "$ac_find_includes" != "" ; then
-            AC_MSG_RESULT(found $ac_find_includes)
+            AC_MSG_RESULT(found in $ac_find_includes)
+            WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+            TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
         else
             AC_TRY_COMPILE(
                 [
@@ -2206,16 +2206,17 @@ equivalent variable and GTK+ is version 1.2.3 or above.
             AC_MSG_CHECKING(for Motif/Lesstif library)
             WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
             if test "$ac_find_libraries" != "" ; then
-                WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
-                WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
+                AC_MSG_RESULT(found at $ac_find_libraries)
 
+                WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
                 GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
-                TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
-                AC_MSG_RESULT(found at $ac_find_libraries)
             else
-                dnl it might happen that we found headers in one of the standard
-                dnl paths but the libs are elsewhere - we do need to try to
-                dnl compile a sample program then here
+                dnl it might happen that we found headers in one of the
+                dnl standard paths but the libs are elsewhere - we do need to
+                dnl try to compile a sample program then here
+                save_CFLAGS=$CFLAGS
+                CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
                 AC_TRY_COMPILE(
                     [
                         #include <Xm/Xm.h>
@@ -2233,6 +2234,8 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                         AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
                     ]
                 )
+
+                CFLAGS=$save_CFLAGS
             fi
         fi
 
@@ -2242,10 +2245,14 @@ equivalent variable and GTK+ is version 1.2.3 or above.
         if test "$ac_find_libraries" != "" ; then
             WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
             GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link"
+
             xpm_link=" -lXpm"
             AC_DEFINE(wxHAVE_LIB_XPM)
             AC_MSG_RESULT(found at $ac_find_libraries)
         else
+            save_CFLAGS=$CFLAGS
+            CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
             AC_TRY_COMPILE(
                 [
                     #include <X11/xpm.h>
@@ -2265,6 +2272,8 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                     AC_MSG_WARN(library will be compiled without support for images in XPM format)
                 ]
             )
+
+            CFLAGS=$save_CFLAGS
         fi
 
         AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])
@@ -2277,6 +2286,9 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                     if test "$libs_found" = "0"; then                
                         save_LIBS="$LIBS"
                         LIBS="$GUI_TK_LIBRARY -lXm${xpm_link} ${libp} -lXmu -lXext -lXt${libsm_ice} -lX11"
+                        save_CFLAGS=$CFLAGS
+                        CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
                         AC_TRY_LINK(
                             [
                                 #include <Xm/Xm.h>
@@ -2296,7 +2308,9 @@ equivalent variable and GTK+ is version 1.2.3 or above.
                                 libs_found=1
                             ], []
                         )
+
                         LIBS="$save_LIBS"
+                        CFLAGS=$save_CFLAGS
                     fi
                 done
             fi
@@ -2889,46 +2903,34 @@ dnl Check for functions
 dnl ---------------------------------------------------------------------------
 
 dnl don't check for wchar_t functions if we haven't got wchar_t itself
-WCHAR_OK=0
 if test "$wx_cv_sizeof_wchar_t" != "0"; then
-    dnl check for wcslen
+    AC_DEFINE(wxUSE_WCHAR_T)
+
+    dnl check for wcslen in all possible places
+    WCSLEN_FOUND=0
     WCHAR_LINK=
-    AC_CHECK_FUNCS(wcslen, [
-                    AC_DEFINE(HAVE_WCSLEN)
-                    WCHAR_OK=1
-                  ])
+    AC_CHECK_FUNCS(wcslen, WCSLEN_FOUND=1)
 
-    if test "$WCHAR_OK" = 0; then
+    if test "$WCSLEN_FOUND" = 0; then
         if test "$TOOLKIT" = "MSW"; then
-            AC_CHECK_LIB(msvcrt, wcslen, [
-                AC_DEFINE(HAVE_WCSLEN)
-                WCHAR_OK=1
-            ])
+            AC_CHECK_LIB(msvcrt, wcslen, WCHAR_OK=1)
         else
             AC_CHECK_LIB(w, wcslen, [
-                            AC_DEFINE(HAVE_WCSLEN)
                             WCHAR_LINK=" -lw"
-                            WCHAR_OK=1
+                            WCSLEN_FOUND=1
                         ])
         fi
     fi
-fi
 
-dnl we need at least the definition of wchar_t itself and wcslen() to compile
-dnl with wchar_t support -- turn it off if we don't have this
-if test "$WCHAR_OK" = 1; then
-    AC_DEFINE(wxUSE_WCHAR_T)
+    if test "$WCSLEN_FOUND" = 1; then
+        AC_DEFINE(HAVE_WCSLEN)
+    fi
 
-    dnl also try to use wcsrtombs instead of wcstombs which is buggy in old GNU
+    dnl try to use wcsrtombs instead of wcstombs which is buggy in old GNU
     dnl libc versions if possible
     AC_CHECK_FUNCS(wcsrtombs)
 else
-    dnl use built-in wcslen for Darwin (what about other BSD based systems?)
-    if test "$USE_DARWIN" = 1; then
-        AC_DEFINE(wxUSE_WCHAR_T)
-    else
-        AC_MSG_WARN([Wide character support is unavailable])
-    fi
+    AC_MSG_WARN([Wide character support is unavailable])
 fi
 
 dnl check for vprintf/vsprintf() which are GNU extensions
@@ -3041,6 +3043,11 @@ if test "$wx_cv_func_vsscanf" = yes; then
     AC_DEFINE(HAVE_VSSCANF)
 fi
 
+if test "$wxUSE_UNICODE" = yes; then
+    dnl look if we have wide char IO functions
+    AC_CHECK_FUNCS(fputwc wprintf vswprintf)
+fi
+
 dnl the following tests are for Unix(like) systems only
 if test "$TOOLKIT" != "MSW"; then
 
@@ -3962,11 +3969,6 @@ dnl ------------------------------------------------------------------------
 
 dnl VZ: the GUI hooks wxSocket needs are not implemented yet in wxX11
 if test "$wxUSE_SOCKETS" = "yes"; then
-    if test "$wxUSE_X11" = "1"; then
-        AC_MSG_WARN([wxSocket not yet supported under X11... disabled])
-        wxUSE_SOCKETS="no"
-    fi
-
     if test "$wxUSE_MGL" = "1"; then
         AC_MSG_WARN([wxSocket not yet supported under MGL... disabled])
         wxUSE_SOCKETS="no"
@@ -4231,15 +4233,17 @@ if test "$wxUSE_CONSTRAINTS" = "yes"; then
 fi
 
 if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
-    if test "$wxUSE_UNIVERSAL" = "yes"; then
-        AC_MSG_WARN(MDI not yet supported for wxUniversal... disabled)
-        wxUSE_MDI_ARCHITECTURE=no
-    fi
 
-    if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
-        AC_DEFINE(wxUSE_MDI_ARCHITECTURE)
-        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi"
-    fi
+dnl     There is now experimental generic MDI support 
+dnl     if test "$wxUSE_UNIVERSAL" = "yes"; then
+dnl         AC_MSG_WARN(MDI not yet supported for wxUniversal... disabled)
+dnl         wxUSE_MDI_ARCHITECTURE=no
+dnl     fi
+
+   if test "$wxUSE_MDI_ARCHITECTURE" = "yes"; then
+       AC_DEFINE(wxUSE_MDI_ARCHITECTURE)
+       SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS mdi"
+   fi
 fi
 
 if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = "yes" ; then
@@ -4309,8 +4313,18 @@ if test "$wxUSE_MSW" = 1 -a \( "$wxUSE_DATAOBJ"       = "yes" \
 
     if test "$ac_cv_header_ole2_h" = "yes" ; then
         if test "$GCC" = yes ; then
+            AC_LANG_SAVE
+            AC_LANG_CPLUSPLUS
+
+            AC_MSG_CHECKING([if g++ requires -fvtable-thunks])
+            AC_TRY_COMPILE([#include <windows.h>
+                            #include <ole2.h>],
+                           [],
+                           [AC_MSG_RESULT(no)],
+                           [AC_MSG_RESULT(yes)
+                            CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"])
+            AC_LANG_RESTORE
             ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
-            CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"
             LIBS=" -lrpcrt4 -loleaut32 -lole32 -luuid$LIBS"
             AC_DEFINE(wxUSE_OLE)
 
@@ -4918,7 +4932,7 @@ if test "$wxUSE_GUI" = "yes"; then
     dnl      ipc, mfc, nativdlg, oleauto, ownerdrw
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs \
                      drawing dynamic erase event exec font image \
-                     minimal richedit rotate widgets"
+                     minimal propsize rotate widgets"
 
     dnl this is needed to be able to find AFM files
     CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"
@@ -4964,8 +4978,8 @@ fi
 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE $INCLUDES"
 
 dnl remove the extra white space from the cc/c++/ld options
-CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'`
-CXXFLAGS=`echo $CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \+/ /g'`
+CFLAGS=`echo $EXTRA_CFLAGS $CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'`
+CXXFLAGS=`echo $EXTRA_CFLAGS $CXXFLAGS $CXXWARNINGS | sed 's/ \+/ /g'`
 LIBS=`echo $LIBS | sed 's/ \+/ /g'`
 
 LDFLAGS="$LDFLAGS $PROFILE"