Peter Kümmel wrote:

> +     conf.Message('Check if size of whar_t  is 4 ... ')
> +    ret = conf.TryLink(check_whar_t_4, '.cpp')

Will this not give an error?



-- 
Peter Kümmel
Index: SConstruct
===================================================================
--- SConstruct  (revision 14991)
+++ SConstruct  (working copy)
@@ -653,6 +653,8 @@
         'CheckCXXGlobalCstd' : utils.checkCXXGlobalCstd,
         'CheckLC_MESSAGES' : utils.checkLC_MESSAGES,
         'CheckIconvConst' : utils.checkIconvConst,
+        'CheckWhar2' : utils.checkWhar_t_2
+        'CheckWhar4' : utils.checkWhar_t_4
     }
 )
 
@@ -1077,6 +1079,14 @@
                 '#define ICONV_CONST const',
                 '#define ICONV_CONST',
             ),
+           (conf.CheckWhar2(),
+                'SIZEOF_WCHAR_T_IS_2',
+                'Define if size of whar_t is 2'
+            ),
+           (conf.CheckWhar4(),
+                'SIZEOF_WCHAR_T_IS_4',
+                'Define if size of whar_t is 4'
+            ),
             (conf.CheckLC_MESSAGES(),
                 'HAVE_LC_MESSAGES',
                 'Define if your <locale.h> file defines LC_MESSAGES.'
@@ -1170,6 +1180,14 @@
 
 #include <../boost/config.h>
 
+#ifdef SIZEOF_WCHAR_T_IS_2 
+#  define SIZEOF_WCHAR_T 2 
+#else 
+#  ifdef SIZEOF_WCHAR_T_IS_4 
+#    define SIZEOF_WCHAR_T 4 
+#  endif 
+#endif 
+
 #endif
 '''
     )
@@ -1270,6 +1288,14 @@
                     '#define ICONV_CONST const',
                     '#define ICONV_CONST',
                 ),
+                (conf.CheckWhar2(),
+                    'SIZEOF_WCHAR_T_IS_2',
+                    'Define if size of whar_t is 2'
+                ),
+                (conf.CheckWhar4(),
+                    'SIZEOF_WCHAR_T_IS_4',
+                    'Define if size of whar_t is 4'
+                ),
                 (conf.CheckType('intmax_t', includes='#include <stdint.h>') or 
\
                 conf.CheckType('intmax_t', includes='#include <inttypes.h>'),
                     'HAVE_INTMAX_T',
Index: scons_utils.py
===================================================================
--- scons_utils.py      (revision 14991)
+++ scons_utils.py      (working copy)
@@ -254,7 +254,28 @@
     conf.Result(ret)
     return ret
 
+def checkWhar_t_2(conf):
+    ''' check if size of whar_t is 2 '''
+    check_whar_t_2 = '''
+int i[ ( sizeof(wchar_t)==2 ? 1 : -1 ) ]; 
+int main(){return 0;} 
+'''
+    conf.Message('Check if size of whar_t  is 2 ... ')
+    ret = conf.TryLink(check_whar_t_2, '.cpp')
+    conf.Result(ret)
+    return ret
 
+def checkWhar_t_4(conf):
+    ''' check if size of whar_t is 4 '''
+    check_whar_t_4 = '''
+int i[ ( sizeof(wchar_t)==4 ? 1 : -1 ) ]; 
+int main(){return 0;} 
+'''
+    conf.Message('Check if size of whar_t  is 4 ... ')
+    ret = conf.TryLink(check_whar_t_4, '.cpp')
+    conf.Result(ret)
+    return ret
+        
 def createConfigFile(conf, config_file,
     config_pre = '', config_post = '',
     headers = [], functions = [], types = [], libs = [],

Reply via email to