+AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48])
+
+#
+# Checks for iconv
+#
+AC_MSG_CHECKING([for a usable iconv])
+ICONV_LIBS=""
+AC_TRY_LINK([#include <iconv.h>],
+ [iconv_open ("from", "to");],
+ [use_iconv=1],
+ [use_iconv=0])
+if test x$use_iconv = x1; then
+ AC_MSG_RESULT([libc])
+else
+ # try using libiconv
+ fontconfig_save_libs="$LIBS"
+ LIBS="$LIBS -liconv"
+
+ AC_TRY_LINK([#include <iconv.h>],
+ [iconv_open ("from", "to");],
+ [use_iconv=1],
+ [use_iconv=0])
+
+ if test x$use_iconv = x1; then
+ ICONV_LIBS="-liconv"
+ AC_MSG_RESULT([libiconv])
+ else
+ AC_MSG_RESULT([no])
+ fi
+
+ LIBS="$fontconfig_save_libs"
+fi
+AC_SUBST(ICONV_LIBS)
+AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])