From 507c87642d8a1a9327464e010beebcabe2da7a5d Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Fri, 12 May 2000 08:38:29 +0000 Subject: [PATCH] Improve the HP/UX check for the -Ae command line parameter. From albert chin (china@thewrittenword.com). --- configure.in | 89 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 7 deletions(-) diff --git a/configure.in b/configure.in index 904391dc..c6fc283c 100644 --- a/configure.in +++ b/configure.in @@ -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 +#include +#ifdef HAVE_WCHAR_H +#include +#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 +#include +#ifdef HAVE_WCHAR_H +#include +#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 +#include +#ifdef HAVE_WCHAR_H +#include +#endif +#include +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 -- 2.40.0