add unsafeLocalState from Haskell 2010, and docs
[ghc-base.git] / configure.ac
index 91c72a5..e4ab28b 100644 (file)
@@ -32,6 +32,25 @@ AC_CHECK_FUNCS([lstat])
 AC_CHECK_FUNCS([getclock getrusage times])
 AC_CHECK_FUNCS([_chsize ftruncate])
 
+dnl--------------------------------------------------------------------
+dnl * Deal with arguments telling us iconv is somewhere odd
+dnl--------------------------------------------------------------------
+
+AC_ARG_WITH([iconv-includes],
+  [AC_HELP_STRING([--with-iconv-includes],
+    [directory containing iconv.h])],
+    [ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval"],
+    [ICONV_INCLUDE_DIRS=])
+
+AC_ARG_WITH([iconv-libraries],
+  [AC_HELP_STRING([--with-iconv-libraries],
+    [directory containing iconv library])],
+    [ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval"],
+    [ICONV_LIB_DIRS=])
+
+AC_SUBST(ICONV_INCLUDE_DIRS)
+AC_SUBST(ICONV_LIB_DIRS)
+
 # map standard C types and ISO types to Haskell types
 FPTOOLS_CHECK_HTYPE(char)
 FPTOOLS_CHECK_HTYPE(signed char)
@@ -117,6 +136,17 @@ FP_SEARCH_LIBS_PROTO(iconv,
                              AC_MSG_ERROR([iconv is required on non-Windows platforms]);;
                       esac])
 
+# If possible, we use libcharset instead of nl_langinfo(CODESET) to
+# determine the current locale's character encoding.
+FP_SEARCH_LIBS_PROTO(
+    [locale_charset],
+    [#include <libcharset.h>],
+    [const char* charset = locale_charset();],
+    [charset],
+    [AC_DEFINE([HAVE_LIBCHARSET], [1], [Define to 1 if you have libcharset.])
+     EXTRA_LIBS="$EXTRA_LIBS $ac_lib"])
+
+
 AC_SUBST(EXTRA_LIBS)
 AC_CONFIG_FILES([base.buildinfo])