finished Discovery serialization stuff.
[mono.git] / eglib / src / gunicode.c
index 11dc508d9a047e4c97f50210716f03fd50456eee..7a98658a706675d23f79beb50fd433541ea2ac02 100644 (file)
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
+#include <config.h>
 #include <stdio.h>
 #include <glib.h>
 #include <unicode-data.h>
 #include <errno.h>
-#ifdef _MSC_VER
-/* FIXME */
-#define CODESET 1
-#include <Windows.h>
 
-typedef int iconv_t;
+#if defined(_MSC_VER) || defined(G_OS_WIN32)
+/* FIXME */
+#  define CODESET 1
+#  include <windows.h>
+#  ifdef _MSC_VER
+       typedef int iconv_t;
+#  endif
 #else
-#include <langinfo.h>
-#include <iconv.h>
+#    ifdef HAVE_LANGINFO_H
+#       include <langinfo.h>
+#    endif
+#    ifdef HAVE_ICONV_H
+#       include <iconv.h>
+#    endif
 #endif
 
 static char *my_charset;
@@ -200,7 +207,7 @@ g_convert (const gchar *str, gssize len,
 {
        char *result = NULL;
 #ifdef G_OS_WIN32
-#else
+#elif HAVE_ICONV_H
        iconv_t convertor;
        char *buffer, *output;
        const char *strptr = (const char *) str;
@@ -295,7 +302,11 @@ g_get_charset (G_CONST_RETURN char **charset)
        is_utf8 = FALSE;
 #else
        if (my_charset == NULL){
+#if HAVE_LANGINFO_H
                my_charset = g_strdup (nl_langinfo (CODESET));
+#else
+               my_charset = g_strdup ("UTF-8");
+#endif
                is_utf8 = strcmp (my_charset, "UTF-8") == 0;
        }