+
+# `widechar' tests for gdki18n.h
+AC_MSG_CHECKING(for wchar.h)
+AC_TRY_CPP([#include <wchar.h>], gdk_wchar_h=yes, gdk_wchar_h=no)
+if test $gdk_wchar_h = yes; then
+ AC_DEFINE(HAVE_WCHAR_H,1,[Have wchar.h include file])
+fi
+AC_MSG_RESULT($gdk_wchar_h)
+
+# Check for wctype.h (for iswalnum)
+AC_MSG_CHECKING(for wctype.h)
+AC_TRY_CPP([#include <wctype.h>], gdk_wctype_h=yes, gdk_wctype_h=no)
+if test $gdk_wctype_h = yes; then
+ AC_DEFINE(HAVE_WCTYPE_H,1,[Have wctype.h include file])
+fi
+AC_MSG_RESULT($gdk_wctype_h)
+
+# in Solaris 2.5, `iswalnum' is in -lw
+GDK_WLIBS=
+AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
+
+oLIBS="$LIBS"
+LIBS="$LIBS $GDK_WLIBS"
+# The following is necessary for Linux libc-5.4.38
+AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
+AC_TRY_LINK([#include <stdlib.h>],[
+#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
+# ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+# else
+# ifdef HAVE_WCHAR_H
+# include <wchar.h>
+# endif
+# endif
+#else
+# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
+#endif
+iswalnum((wchar_t) 0);
+], gdk_working_wctype=yes, gdk_working_wctype=no)
+LIBS="$oLIBS"
+
+if test $gdk_working_wctype = no; then
+ AC_DEFINE(HAVE_BROKEN_WCTYPE,1,[Is the wctype implementation broken])
+ GDK_WLIBS=
+fi
+AC_MSG_RESULT($gdk_working_wctype)
+AC_SUBST(GDK_WLIBS)
+
+AC_SUBST(GTK_DEBUG_FLAGS)
+AC_SUBST(GTK_XIM_FLAGS)
+AC_SUBST(GTK_LOCALE_FLAGS)
+
+AC_OUTPUT_COMMANDS([
+
+## Generate `gdk/gdkconfig.h' in two cases
+## 1. `config.status' is run either explicitly, or via configure.
+## Esp. not when it is run in `Makefile' to generate makefiles and
+## config.h
+## 2. CONFIG_OTHER is set explicitly
+##
+## Case 1 is difficult. We know that `automake' sets one of
+## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works
+## only when AM_CONFIG_HEADER is set, however.
+
+if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
+ # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
+ CONFIG_OTHER=${CONFIG_OTHER:-gdk/gdkconfig.h}
+fi
+case "$CONFIG_OTHER" in
+*gdk/gdkconfig.h*)
+ echo creating gdk/gdkconfig.h
+ outfile=gdkconfig.h-tmp
+ cat > $outfile <<\_______EOF
+/* gdkconfig.h
+ *
+ * This is a generated file. Please modify `configure.in'
+ */
+
+#ifndef GDKCONFIG_H
+#define GDKCONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+_______EOF
+
+ cat >>$outfile <<_______EOF
+$gdk_windowing
+$gdk_wc
+_______EOF
+
+ cat >>$outfile <<_______EOF
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GDKCONFIG_H */
+_______EOF
+
+
+ if cmp -s $outfile gdk/gdkconfig.h; then
+ echo gdk/gdkconfig.h is unchanged
+ rm -f $outfile
+ else
+ mv $outfile gdk/gdkconfig.h
+ fi ;;
+esac
+],[
+# Currently we always use X11 on those systems where we run configure...
+gdk_windowing='
+#define GDK_WINDOWING GDK_WINDOWING_X11'
+if test x$gdk_wchar_h = xyes; then
+ gdk_wc='
+#define GDK_HAVE_WCHAR_H 1'