]> granicus.if.org Git - mutt/commitdiff
Improve the HP/UX check for the -Ae command line parameter. From
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 12 May 2000 08:38:29 +0000 (08:38 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 12 May 2000 08:38:29 +0000 (08:38 +0000)
albert chin (china@thewrittenword.com).

configure.in

index 904391dcd7ce0e338a9651f4272aab5fc57fce05..c6fc283c1efcab1970ba6e2459200d1a664713a7 100644 (file)
@@ -27,13 +27,14 @@ AC_PROG_INSTALL
 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
@@ -689,6 +690,80 @@ MUTTLOCALEDIR=$mutt_cv_prefix/$DATADIRNAME/locale
 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