]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxUSE_PRINTF_POS_PARAMS which can be used to force the use of built-in printf...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Jun 2006 14:24:53 +0000 (14:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Jun 2006 14:24:53 +0000 (14:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

configure.in
include/wx/mac/setup0.h
include/wx/motif/setup0.h
include/wx/msw/setup0.h
include/wx/msw/wince/setup.h
include/wx/os2/setup0.h
include/wx/palmos/setup0.h
include/wx/setup_inc.h
include/wx/wxchar.h
setup.h.in

index c062c92a7031e8cfce97efb81405aa9c2da4a68e..1cb41c1bac674bea6f641f6c4d5d13e5e5f5a2dd 100644 (file)
@@ -424,6 +424,7 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_SOUND=no
   DEFAULT_wxUSE_MEDIACTRL=no
   DEFAULT_wxUSE_GSTREAMER8=no
+  DEFAULT_wxUSE_PRINTF_POS_PARAM=no
   DEFAULT_wxUSE_INTL=no
   DEFAULT_wxUSE_CONFIG=no
   DEFAULT_wxUSE_FONTMAP=no
@@ -636,6 +637,7 @@ else
   DEFAULT_wxUSE_SOUND=yes
   DEFAULT_wxUSE_MEDIACTRL=no
   DEFAULT_wxUSE_GSTREAMER8=no
+  DEFAULT_wxUSE_PRINTF_POS_PARAM=yes
   DEFAULT_wxUSE_INTL=yes
   DEFAULT_wxUSE_CONFIG=yes
   DEFAULT_wxUSE_FONTMAP=yes
@@ -957,7 +959,7 @@ WX_ARG_ENABLE(unicode,       [  --enable-unicode        compile wxString with Un
 WX_ARG_ENABLE(sound,         [  --enable-sound          use wxSound class], wxUSE_SOUND)
 WX_ARG_ENABLE(mediactrl,     [  --enable-mediactrl      use wxMediaCtrl class], wxUSE_MEDIACTRL)
 WX_ARG_ENABLE(gstreamer8,     [  --enable-gstreamer8      force GStreamer 0.8 instead of 0.10 with the wxMediaCtrl class on unix], wxUSE_GSTREAMER8)
-WX_ARG_ENABLE(wxprintfv,     [  --enable-wxprintfv      use wxWidgets implementation of vprintf()], wxUSE_EXPERIMENTAL_PRINTF)
+WX_ARG_ENABLE(printfposparam,[  --enable-printfposparam use wxVsnprintf() which supports positional parameters], wxUSE_PRINTF_POS_PARAMS)
 WX_ARG_ENABLE(zipstream,     [  --enable-zipstream      use wxZip streams], wxUSE_ZIPSTREAM)
 
 WX_ARG_ENABLE(url,           [  --enable-url            use wxURL class], wxUSE_URL)
@@ -4320,8 +4322,41 @@ if test "$ac_cv_func_snprintf" = "yes"; then
             AC_DEFINE(HAVE_BROKEN_SNPRINTF_DECL)
         fi
     fi
+
+    if test "$wxUSE_PRINTF_POS_PARAMS" = "yes"; then
+
+        dnl check if snprintf() has support for positional arguments
+        dnl NB: if snprintf() has positional support we can safely suppose that also
+        dnl     other *printf() functions support them as they all belong to the same
+        dnl     family and they all fallback to the same implementation
+        AC_CACHE_CHECK([if snprintf supports positional arguments], wx_cv_func_snprintf_pos_params,
+            [
+                AC_TRY_RUN(
+                    [
+                        #include <stdio.h>
+
+                        int main (void)
+                        {
+                            char buffer[128];
+                            snprintf (buffer, 128, "%2\$d %3\$d %1\$d", 1, 2, 3);
+                            if (strcmp ("2 3 1", buffer) == 0)
+                                exit (0);
+                            exit (1);
+                        }
+                    ],
+                    wx_cv_func_snprintf_pos_params=no,
+                    wx_cv_func_snprintf_pos_params=yes
+                )
+            ]
+        )
+
+        if test "$wx_cv_func_snprintf_pos_params" = "yes"; then
+            AC_DEFINE(HAVE_UNIX98_PRINTF)
+        fi
+    fi
 fi
 
+
 if test "$wxUSE_UNICODE" = yes; then
     dnl also look if we have wide char IO functions
     AC_CHECK_FUNCS(wputc wputchar putws fputws wprintf vswprintf)
@@ -5648,6 +5683,11 @@ if test "$wxUSE_STREAMS" = "yes" ; then
   AC_DEFINE(wxUSE_STREAMS)
 fi
 
+if test "$wxUSE_PRINTF_POS_PARAMS" = "yes"; then
+  AC_DEFINE(wxUSE_PRINTF_POS_PARAMS)
+fi
+
+
 dnl ---------------------------------------------------------------------------
 dnl time/date functions
 dnl ---------------------------------------------------------------------------
index d0d22ba8023d9f2b1d1b389ad0dbb4e5617dad40..7892d9e7d39342140a25409470a08b94a3fc9837 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1 if you want to support multiple languages
-#define wxUSE_PRINTF_POS_PARAMS      0
+#define wxUSE_PRINTF_POS_PARAMS      1
 
 // ----------------------------------------------------------------------------
 // non GUI features selection
 #  define wxUSE_XML       0
 #endif
 
+// Use wxWidget's AUI docking system
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_AUI       1
+
 // ----------------------------------------------------------------------------
 // Individual GUI controls
 // ----------------------------------------------------------------------------
index cbaa364b7cb8e9d8636191bc617821613475c889..7383b34d84a44f43caec581a0afa3d5439d4ac47 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1 if you want to support multiple languages
-#define wxUSE_PRINTF_POS_PARAMS      0
+#define wxUSE_PRINTF_POS_PARAMS      1
 
 // ----------------------------------------------------------------------------
 // non GUI features selection
 #  define wxUSE_XML       0
 #endif
 
+// Use wxWidget's AUI docking system
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_AUI       1
+
 // ----------------------------------------------------------------------------
 // Individual GUI controls
 // ----------------------------------------------------------------------------
index 5d0fe0ccafa285f788ca483158f914c1cbd2104a..7f037a297d505e5dedb5b24936fccbb08f51fe8f 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1 if you want to support multiple languages
-#define wxUSE_PRINTF_POS_PARAMS      0
+#define wxUSE_PRINTF_POS_PARAMS      1
 
 // ----------------------------------------------------------------------------
 // non GUI features selection
index c2ed4b15916c6f98c7e0e12bab4806beab95cb34..bedbb881699abbbf22a7f0fefc4a4123547c3c40 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1 if you want to support multiple languages
-#define wxUSE_PRINTF_POS_PARAMS      0
+#define wxUSE_PRINTF_POS_PARAMS      1
 
 // ----------------------------------------------------------------------------
 // non GUI features selection
 #  define wxUSE_XML       0
 #endif
 
+// Use wxWidget's AUI docking system
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_AUI       1
+
 // ----------------------------------------------------------------------------
 // Individual GUI controls
 // ----------------------------------------------------------------------------
index e3e373be38d056339af17d5926188761da376188..61c097cbc7dc94d138b2ed07e4a6d2d73e42a427 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1 if you want to support multiple languages
-#define wxUSE_PRINTF_POS_PARAMS      0
+#define wxUSE_PRINTF_POS_PARAMS      1
 
 // ----------------------------------------------------------------------------
 // non GUI features selection
index f773ed6280ab223109167d42065b6858bb42a1be..60758eb5477f3e9a798af8087a2a7b7fc4e0c924 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1 if you want to support multiple languages
-#define wxUSE_PRINTF_POS_PARAMS      0
+#define wxUSE_PRINTF_POS_PARAMS      1
 
 // ----------------------------------------------------------------------------
 // non GUI features selection
 #  define wxUSE_XML       0
 #endif
 
+// Use wxWidget's AUI docking system
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_AUI       1
+
 // ----------------------------------------------------------------------------
 // Individual GUI controls
 // ----------------------------------------------------------------------------
index 282db2c2adb4ce8b1917a76938c542f5552f3f13..2228b7f0d4e66d4f05e16ba474a53df899401591 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1 if you want to support multiple languages
-#define wxUSE_PRINTF_POS_PARAMS      0
+#define wxUSE_PRINTF_POS_PARAMS      1
 
 // ----------------------------------------------------------------------------
 // non GUI features selection
index 22824283dd6c4ca551192e2c8f205863dcb3a2a5..7c70a8b4d32280ff30974c1fc9c29dcc3b4b6633 100644 (file)
@@ -883,7 +883,7 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
             #define wxVsnprintf_    _vsnwprintf
             #define wxSnprintf_     _snwprintf
         #endif /* Watcom */
-        #if defined(HAVE__VSNWPRINTF) && defined(HAVE_UNIX98_PRINTF)
+        #if defined(HAVE__VSNWPRINTF)
             #define wxVsnprintf_    _vsnwprintf
         /* MinGW?MSVCRT has the wrong vswprintf */
         /* Mac OS X has a somehow buggy vswprintf */
@@ -893,13 +893,13 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
     #else /* ASCII */
         /* all versions of CodeWarrior supported by wxWidgets apparently have */
         /* both snprintf() and vsnprintf() */
-        #if (defined(HAVE_SNPRINTF) && defined(HAVE_UNIX98_PRINTF)) \
+        #if defined(HAVE_SNPRINTF) \
             || defined(__MWERKS__) || defined(__WATCOMC__)
             #ifndef HAVE_BROKEN_SNPRINTF_DECL
                 #define wxSnprintf_     snprintf
             #endif
         #endif
-        #if (defined(HAVE_VSNPRINTF) && defined(HAVE_UNIX98_PRINTF)) \
+        #if defined(HAVE_VSNPRINTF) \
             || defined(__MWERKS__) || defined(__WATCOMC__)
             #if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
                 #define wxVsnprintf_    wx_fixed_vsnprintf
@@ -908,7 +908,28 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
             #endif
         #endif
     #endif
-#endif /* wxVsnprintf_ not defined yet */
+#endif /* wxVsnprintf_ not defined yet && !wxUSE_PRINTF_POS_PARAMS */
+
+#if !defined( wxVsnprintf_ ) && wxUSE_PRINTF_POS_PARAMS
+    /*
+        The systems where vsnprintf() supports positionals should define
+        the HAVE_UNIX98_PRINTF symbol.
+
+        On systems which don't (e.g. Windows) we are forced to use
+        our wxVsnprintf() implementation.
+    */
+    #if defined(HAVE_UNIX98_PRINTF)
+        #if wxUSE_UNICODE
+            #define wxVsnprintf_        vswprintf
+        #else /* ASCII */
+            #if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
+                #define wxVsnprintf_    wx_fixed_vsnprintf
+            #else
+                #define wxVsnprintf_    vsnprintf
+            #endif
+        #endif
+    #endif
+#endif  // !defined( wxVsnprintf_ ) && wxUSE_PRINTF_POS_PARAMS
 
 #ifndef wxSnprintf_
     /* no [v]snprintf(), cook our own */
index a87a6ddc1ee1bd6ae1372f5febe27cae235f595c..306348bfd370636b4a59aa5af07b9064785a19cd 100644 (file)
 
 #define wxUSE_AUI       0
 
+
 #define wxUSE_CONTROLS     0
 
 #define wxUSE_POPUPWIN     0
  * with 'char*' for the 3rd parameter instead of 'const char*' */
 #undef HAVE_BROKEN_SNPRINTF_DECL
 
+/* Define if you have a snprintf() which supports positional arguments
+   (defined in the unix98 standard) */
+#undef HAVE_UNIX98_PRINTF
+
 /* define if you have statfs function */
 #undef HAVE_STATFS