Annotation of embedaddon/libiconv/m4/eilseq.m4, revision 1.1.1.1

1.1       misho       1: #serial 1
                      2: 
                      3: AC_PREREQ(2.50)
                      4: 
                      5: # The EILSEQ errno value ought to be defined in <errno.h>, according to
                      6: # ISO C 99 and POSIX.  But some systems (like SunOS 4) don't define it,
                      7: # and some systems (like BSD/OS) define it in <wchar.h> not <errno.h>.
                      8: 
                      9: # Define EILSEQ as a C macro and as a substituted macro in such a way that
                     10: # 1. on all systems, after inclusion of <errno.h>, EILSEQ is usable,
                     11: # 2. on systems where EILSEQ is defined elsewhere, we use the same numeric
                     12: #    value.
                     13: 
                     14: AC_DEFUN([AC_EILSEQ],
                     15: [
                     16:   AC_REQUIRE([AC_PROG_CC])dnl
                     17: 
                     18:   dnl Check for any extra headers that could define EILSEQ.
                     19:   AC_CHECK_HEADERS(wchar.h)
                     20: 
                     21:   AC_CACHE_CHECK([for EILSEQ], ac_cv_decl_EILSEQ, [
                     22:     AC_EGREP_CPP(yes,[
                     23: #include <errno.h>
                     24: #ifdef EILSEQ
                     25: yes
                     26: #endif
                     27:       ], have_eilseq=1)
                     28:     if test -n "$have_eilseq"; then
                     29:       dnl EILSEQ exists in <errno.h>. Don't need to define EILSEQ ourselves.
                     30:       ac_cv_decl_EILSEQ=yes
                     31:     else
                     32:       AC_EGREP_CPP(yes,[
                     33: #include <errno.h>
                     34: #if HAVE_WCHAR_H
                     35: #include <wchar.h>
                     36: #endif
                     37: #ifdef EILSEQ
                     38: yes
                     39: #endif
                     40:         ], have_eilseq=1)
                     41:       if test -n "$have_eilseq"; then
                     42:         dnl EILSEQ exists in some other system header.
                     43:         dnl Define it to the same value.
                     44:         _AC_COMPUTE_INT([EILSEQ], ac_cv_decl_EILSEQ, [
                     45: #include <errno.h>
                     46: #if HAVE_WCHAR_H
                     47: #include <wchar.h>
                     48: #endif
                     49: /* The following two lines are a workaround against an autoconf-2.52 bug.  */
                     50: #include <stdio.h>
                     51: #include <stdlib.h>
                     52: ])
                     53:       else
                     54:         dnl EILSEQ isn't defined by the system. Define EILSEQ ourselves, but
                     55:         dnl don't define it as EINVAL, because iconv() callers want to
                     56:         dnl distinguish EINVAL and EILSEQ.
                     57:         ac_cv_decl_EILSEQ=ENOENT
                     58:       fi
                     59:     fi
                     60:   ])
                     61:   if test "$ac_cv_decl_EILSEQ" != yes; then
                     62:     AC_DEFINE_UNQUOTED([EILSEQ], [$ac_cv_decl_EILSEQ],
                     63:                        [Define as good substitute value for EILSEQ.])
                     64:     EILSEQ="$ac_cv_decl_EILSEQ"
                     65:     AC_SUBST(EILSEQ)
                     66:   fi
                     67: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>