AC_ISC_POSIX
AC_PROG_RANLIB
-case "$host" in
-*-*-hpux*)
- if test -z "$GCC" ; then
- CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
- fi
- ;;
-esac
+dnl The HP-UX 10.20 C compiler needs -Ae for grok ANSI. -Ae
+dnl automatically includes -D_HPUX_SOURCE.
+if test -z "$GCC"; then
+ AC_MSG_CHECKING([if compiler needs -Ae for ANSI source])
+ AC_TRY_COMPILE([int foo (void);], [int num],
+ [AC_MSG_RESULT(no)], [CFLAGS="$CFLAGS -Ae"
+ AC_MSG_RESULT(yes)])
+fi
AC_C_INLINE
AC_C_CONST
AC_SUBST(MUTTLOCALEDIR)
AC_DEFINE_UNQUOTED(MUTTLOCALEDIR, "$MUTTLOCALEDIR")
+AC_CHECK_HEADERS(wchar.h)
+
+AC_CACHE_CHECK([for wchar_t], mutt_cv_wchar_t,
+ AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdlib.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+int main() { wchar_t wc; return 0; }
+ ],
+ mutt_cv_wchar_t=yes,
+ mutt_cv_wchar_t=no))
+
+if test "$mutt_cv_wchar_t" = no; then
+ AC_DEFINE(wchar_t, int)
+fi
+
+AC_CACHE_CHECK([for mbstate_t], mutt_cv_mbstate_t,
+ AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdlib.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+int main() { mbstate_t wc; return 0; }
+ ],
+ mutt_cv_mbstate_t=yes,
+ mutt_cv_mbstate_t=no))
+
+if test "$mutt_cv_mbstate_t" = no; then
+ AC_DEFINE(mbstate_t, int)
+fi
+
+wc_funcs=maybe
+AC_ARG_WITH(wc-funcs, [ --without-wc-funcs Do not use the system's wchar_t functions],
+ wc_funcs=$withval)
+
+if test "$wc_funcs" != yes -a "$wc_funcs" != no; then
+ AC_CACHE_CHECK([for working wchar_t functions], mutt_cv_wc_funcs,
+ AC_TRY_RUN([
+#include <stddef.h>
+#include <stdlib.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#include <locale.h>
+int main()
+{
+ wchar_t wc = 123;
+ mbstate_t state;
+ const char *s = "\304\211";
+ int tb;
+ char *t = (char *)&tb;
+ setlocale(LC_ALL, "eo.UTF-8");
+ memset(&state, 0, sizeof(mbstate_t));
+ *(t+2) = 'x';
+ exit(!(mbrtowc(0, 0, 0, &state) == 0 &&
+ mbrtowc(&wc, s, 1, &state) == -2 && wc == 123 &&
+ mbrtowc(&wc, s+1, 2, &state) == 1 &&
+ wctomb(t, wc) == 2 && !memcmp(s, t, 2) && *(t+2) == 'x' &&
+ wcwidth(0) == 0 && wcwidth(wc) == 1 && wcwidth(127) == -1));
+}
+ ],
+ mutt_cv_wc_funcs=yes,
+ mutt_cv_wc_funcs=no,
+ mutt_cv_wc_funcs=yes))
+ wc_funcs=$mutt_cv_wc_funcs
+fi
+
+if test $wc_funcs = yes; then
+ AC_DEFINE(HAVE_WC_FUNCS)
+fi
+
AC_OUTPUT(Makefile intl/Makefile m4/Makefile dnl
po/Makefile.in doc/Makefile contrib/Makefile dnl
muttbug.sh dnl