Bo Peng wrote: >> > Hum, it does not work here Bo. common/config.h has: > > My apologies. A long while ago, I post the .m4 code of ICONV_CONST > test and ask if someone who knows m4 could explain it to me. Abdel > provided a patch that seemed to work and I applied it. > > Now, what exactly is this test doing? Of course I can swap the > resulting #define and hope for the best, but it is better to really > understand this test. > > Bo > >
Please test attached patch. It does work with cmake and msvc. Peter
Index: development/scons/scons_utils.py =================================================================== --- development/scons/scons_utils.py (revision 14676) +++ development/scons/scons_utils.py (working copy) @@ -241,24 +241,10 @@ 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... ') ret = conf.TryLink(check_iconv_const, '.c')