#st = os.stat(str(source[0]))
#os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
-
-#
-# glob filenames
-#
-def globSource(dir, pattern, build_dir = None, exclude = [], include = []):
- ''' glob files, in dir and use build_dir as returned path name '''
- # exclude 'exclude+include' to avoid duplicate items in files
- files = include + filter(lambda x: x not in exclude + include, glob.glob1(dir, pattern))
- if build_dir is None:
- return files
- else:
- return ['%s/%s' % (build_dir, x) for x in files]
-
#
# autoconf tests
#
def checkIconvConst(conf):
''' check the declaration of iconv '''
check_iconv_const = '''
-#include <stdlib.h>
#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-#ifndef LIBICONV_DLL_EXPORTED
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#endif
-#else
-size_t iconv();
-#endif
-
-int main()
-{
- return 1;
+// this declaration will fail when there already exists a non const char**
+// version which returns size_t
+double iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
+int main() {
+ return 0;
}
'''
conf.Message('Check if the declaration of iconv needs const... ')
return ret
+def checkSizeOfWChar(conf):
+ ''' check the size of wchar '''
+ check_sizeof_wchar = '''
+int i[ ( sizeof(wchar_t)==%d ? 1 : -1 ) ];
+int main()
+{
+ return 0;
+}
+'''
+ conf.Message('Check the size of wchar_t... ')
+ if conf.TryLink(check_sizeof_wchar % 2, '.cpp'):
+ ret = 2
+ elif conf.TryLink(check_sizeof_wchar % 4, '.cpp'):
+ ret = 4
+ else:
+ ret = 0
+ conf.Result(str(ret))
+ return ret
+
+
def createConfigFile(conf, config_file,
config_pre = '', config_post = '',
headers = [], functions = [], types = [], libs = [],