File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libiconv / srcm4 / intl.m4
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 13:38:46 2021 UTC (3 years, 9 months ago) by misho
Branches: libiconv, MAIN
CVS tags: v1_16p0, HEAD
libiconv 1.16

    1: # intl.m4 serial 34 (gettext-0.20)
    2: dnl Copyright (C) 1995-2014, 2016-2019 Free Software Foundation, Inc.
    3: dnl This file is free software; the Free Software Foundation
    4: dnl gives unlimited permission to copy and/or distribute it,
    5: dnl with or without modifications, as long as this notice is preserved.
    6: dnl
    7: dnl This file can be used in projects which are not available under
    8: dnl the GNU General Public License or the GNU Library General Public
    9: dnl License but which still want to provide support for the GNU gettext
   10: dnl functionality.
   11: dnl Please note that the actual code of the GNU gettext library is covered
   12: dnl by the GNU Library General Public License, and the rest of the GNU
   13: dnl gettext package is covered by the GNU General Public License.
   14: dnl They are *not* in the public domain.
   15: 
   16: dnl Authors:
   17: dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
   18: dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2009.
   19: 
   20: AC_PREREQ([2.60])
   21: 
   22: dnl Checks for all prerequisites of the intl subdirectory,
   23: dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
   24: dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
   25: AC_DEFUN([AM_INTL_SUBDIR],
   26: [
   27:   AC_REQUIRE([AC_PROG_INSTALL])dnl
   28:   AC_REQUIRE([AC_PROG_MKDIR_P])dnl
   29:   AC_REQUIRE([AC_PROG_CC])dnl
   30:   AC_REQUIRE([AC_CANONICAL_HOST])dnl
   31:   AC_REQUIRE([gt_GLIBC2])dnl
   32:   AC_REQUIRE([gl_VISIBILITY])dnl
   33:   AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
   34:   AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl
   35:   AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
   36:   AC_REQUIRE([gt_TYPE_WINT_T])dnl
   37:   AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
   38:   AC_REQUIRE([gt_TYPE_INTMAX_T])
   39:   AC_REQUIRE([gt_PRINTF_POSIX])
   40:   AC_REQUIRE([gl_GLIBC21])dnl
   41:   AC_REQUIRE([gl_XSIZE])dnl
   42:   AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl
   43:   AC_REQUIRE([gt_INTL_THREAD_LOCALE_NAME])
   44:   AC_REQUIRE([gt_INTL_MACOSX])dnl
   45:   AC_REQUIRE([gl_EXTERN_INLINE])dnl
   46:   AC_REQUIRE([gt_GL_ATTRIBUTE])dnl
   47:   AC_REQUIRE([AC_C_FLEXIBLE_ARRAY_MEMBER])dnl
   48: 
   49:   dnl In projects that use gnulib, use gl_PROG_AR_RANLIB.
   50:   dnl The '][' hides this use from 'aclocal'.
   51:   m4_ifdef([g][l_PROG_AR_RANLIB],
   52:     [AC_REQUIRE([g][l_PROG_AR_RANLIB])],
   53:     [AC_REQUIRE([AC_PROG_RANLIB])
   54:      dnl Use Automake-documented default values for AR and ARFLAGS, but prefer
   55:      dnl ${host}-ar over ar (useful for cross-compiling).
   56:      AC_CHECK_TOOL([AR], [ar], [ar])
   57:      if test -z "$ARFLAGS"; then
   58:        ARFLAGS='cr'
   59:      fi
   60:      AC_SUBST([AR])
   61:      AC_SUBST([ARFLAGS])
   62:     ])
   63: 
   64:   dnl Support for automake's --enable-silent-rules.
   65:   case "$enable_silent_rules" in
   66:     yes) INTL_DEFAULT_VERBOSITY=0;;
   67:     no)  INTL_DEFAULT_VERBOSITY=1;;
   68:     *)   INTL_DEFAULT_VERBOSITY=1;;
   69:   esac
   70:   AC_SUBST([INTL_DEFAULT_VERBOSITY])
   71: 
   72:   AC_CHECK_TYPE([ptrdiff_t], ,
   73:     [AC_DEFINE([ptrdiff_t], [long],
   74:        [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
   75:     ])
   76:   AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h])
   77:   AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
   78:     snprintf strnlen uselocale wcslen wcsnlen mbrtowc wcrtomb])
   79: 
   80:   dnl Use the _snprintf function only if it is declared (because on NetBSD it
   81:   dnl is defined as a weak alias of snprintf; we prefer to use the latter).
   82:   AC_CHECK_DECLS([_snprintf, _snwprintf], , , [#include <stdio.h>])
   83: 
   84:   dnl Use the *_unlocked functions only if they are declared.
   85:   dnl (because some of them were defined without being declared in Solaris
   86:   dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
   87:   dnl on Solaris 2.5.1 to run on Solaris 2.6).
   88:   AC_CHECK_DECLS([getc_unlocked], , , [#include <stdio.h>])
   89: 
   90:   case $gt_cv_func_printf_posix in
   91:     *yes) HAVE_POSIX_PRINTF=1 ;;
   92:     *) HAVE_POSIX_PRINTF=0 ;;
   93:   esac
   94:   AC_SUBST([HAVE_POSIX_PRINTF])
   95:   if test "$ac_cv_func_asprintf" = yes; then
   96:     HAVE_ASPRINTF=1
   97:   else
   98:     HAVE_ASPRINTF=0
   99:   fi
  100:   AC_SUBST([HAVE_ASPRINTF])
  101:   if test "$ac_cv_func_snprintf" = yes; then
  102:     HAVE_SNPRINTF=1
  103:   else
  104:     HAVE_SNPRINTF=0
  105:   fi
  106:   AC_SUBST([HAVE_SNPRINTF])
  107:   if test "$ac_cv_func_newlocale" = yes; then
  108:     HAVE_NEWLOCALE=1
  109:   else
  110:     HAVE_NEWLOCALE=0
  111:   fi
  112:   AC_SUBST([HAVE_NEWLOCALE])
  113:   if test "$ac_cv_func_wprintf" = yes; then
  114:     HAVE_WPRINTF=1
  115:   else
  116:     HAVE_WPRINTF=0
  117:   fi
  118:   AC_SUBST([HAVE_WPRINTF])
  119: 
  120:   AM_LANGINFO_CODESET
  121:   gt_LC_MESSAGES
  122: 
  123:   if test $gt_nameless_locales = yes; then
  124:     HAVE_NAMELESS_LOCALES=1
  125:   else
  126:     HAVE_NAMELESS_LOCALES=0
  127:   fi
  128:   AC_SUBST([HAVE_NAMELESS_LOCALES])
  129: 
  130:   dnl Compilation on mingw and Cygwin needs special Makefile rules, because
  131:   dnl 1. when we install a shared library, we must arrange to export
  132:   dnl    auxiliary pointer variables for every exported variable,
  133:   dnl 2. when we install a shared library and a static library simultaneously,
  134:   dnl    the include file specifies __declspec(dllimport) and therefore we
  135:   dnl    must arrange to define the auxiliary pointer variables for the
  136:   dnl    exported variables _also_ in the static library.
  137:   if test "$enable_shared" = yes; then
  138:     case "$host_os" in
  139:       mingw* | cygwin*) is_woe32dll=yes ;;
  140:       *) is_woe32dll=no ;;
  141:     esac
  142:   else
  143:     is_woe32dll=no
  144:   fi
  145:   WOE32DLL=$is_woe32dll
  146:   AC_SUBST([WOE32DLL])
  147: 
  148:   dnl On mingw and Cygwin, we can activate special Makefile rules which add
  149:   dnl version information to the shared libraries and executables.
  150:   case "$host_os" in
  151:     mingw* | cygwin*) is_woe32=yes ;;
  152:     *) is_woe32=no ;;
  153:   esac
  154:   WOE32=$is_woe32
  155:   AC_SUBST([WOE32])
  156:   if test $WOE32 = yes; then
  157:     dnl Check for a program that compiles Windows resource files.
  158:     AC_CHECK_TOOL([WINDRES], [windres])
  159:   fi
  160: 
  161:   dnl Rename some macros and functions used for locking.
  162:   AH_BOTTOM([
  163: #define __libc_lock_t                   gl_lock_t
  164: #define __libc_lock_define              gl_lock_define
  165: #define __libc_lock_define_initialized  gl_lock_define_initialized
  166: #define __libc_lock_init                gl_lock_init
  167: #define __libc_lock_lock                gl_lock_lock
  168: #define __libc_lock_unlock              gl_lock_unlock
  169: #define __libc_lock_recursive_t                   gl_recursive_lock_t
  170: #define __libc_lock_define_recursive              gl_recursive_lock_define
  171: #define __libc_lock_define_initialized_recursive  gl_recursive_lock_define_initialized
  172: #define __libc_lock_init_recursive                gl_recursive_lock_init
  173: #define __libc_lock_lock_recursive                gl_recursive_lock_lock
  174: #define __libc_lock_unlock_recursive              gl_recursive_lock_unlock
  175: #define glthread_in_use  libintl_thread_in_use
  176: #define glthread_lock_init_func     libintl_lock_init_func
  177: #define glthread_lock_lock_func     libintl_lock_lock_func
  178: #define glthread_lock_unlock_func   libintl_lock_unlock_func
  179: #define glthread_lock_destroy_func  libintl_lock_destroy_func
  180: #define glthread_rwlock_init_multithreaded     libintl_rwlock_init_multithreaded
  181: #define glthread_rwlock_init_func              libintl_rwlock_init_func
  182: #define glthread_rwlock_rdlock_multithreaded   libintl_rwlock_rdlock_multithreaded
  183: #define glthread_rwlock_rdlock_func            libintl_rwlock_rdlock_func
  184: #define glthread_rwlock_wrlock_multithreaded   libintl_rwlock_wrlock_multithreaded
  185: #define glthread_rwlock_wrlock_func            libintl_rwlock_wrlock_func
  186: #define glthread_rwlock_unlock_multithreaded   libintl_rwlock_unlock_multithreaded
  187: #define glthread_rwlock_unlock_func            libintl_rwlock_unlock_func
  188: #define glthread_rwlock_destroy_multithreaded  libintl_rwlock_destroy_multithreaded
  189: #define glthread_rwlock_destroy_func           libintl_rwlock_destroy_func
  190: #define glthread_recursive_lock_init_multithreaded     libintl_recursive_lock_init_multithreaded
  191: #define glthread_recursive_lock_init_func              libintl_recursive_lock_init_func
  192: #define glthread_recursive_lock_lock_multithreaded     libintl_recursive_lock_lock_multithreaded
  193: #define glthread_recursive_lock_lock_func              libintl_recursive_lock_lock_func
  194: #define glthread_recursive_lock_unlock_multithreaded   libintl_recursive_lock_unlock_multithreaded
  195: #define glthread_recursive_lock_unlock_func            libintl_recursive_lock_unlock_func
  196: #define glthread_recursive_lock_destroy_multithreaded  libintl_recursive_lock_destroy_multithreaded
  197: #define glthread_recursive_lock_destroy_func           libintl_recursive_lock_destroy_func
  198: #define glthread_once_func            libintl_once_func
  199: #define glthread_once_singlethreaded  libintl_once_singlethreaded
  200: #define glthread_once_multithreaded   libintl_once_multithreaded
  201: ])
  202: ])
  203: 
  204: 
  205: dnl Checks for the core files of the intl subdirectory:
  206: dnl   dcigettext.c
  207: dnl   eval-plural.h
  208: dnl   explodename.c
  209: dnl   finddomain.c
  210: dnl   gettextP.h
  211: dnl   gmo.h
  212: dnl   hash-string.h hash-string.c
  213: dnl   l10nflist.c
  214: dnl   libgnuintl.h.in (except the *printf stuff)
  215: dnl   loadinfo.h
  216: dnl   loadmsgcat.c
  217: dnl   localealias.c
  218: dnl   log.c
  219: dnl   plural-exp.h plural-exp.c
  220: dnl   plural.y
  221: dnl Used by libglocale.
  222: AC_DEFUN([gt_INTL_SUBDIR_CORE],
  223: [
  224:   AC_REQUIRE([AC_C_INLINE])dnl
  225:   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  226:   AC_REQUIRE([gl_AC_HEADER_STDINT_H])
  227:   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  228:   AC_REQUIRE([AC_FUNC_MMAP])dnl
  229:   AC_REQUIRE([gt_INTDIV0])dnl
  230:   AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
  231:   AC_REQUIRE([gt_INTTYPES_PRI])dnl
  232:   AC_REQUIRE([gl_LOCK])dnl
  233: 
  234:   AC_LINK_IFELSE(
  235:     [AC_LANG_PROGRAM(
  236:        [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]],
  237:        [[]])],
  238:     [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1],
  239:        [Define to 1 if the compiler understands __builtin_expect.])])
  240: 
  241:   AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h])
  242:   AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
  243:     stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \
  244:     argz_next __fsetlocking])
  245: 
  246:   dnl Use the *_unlocked functions only if they are declared.
  247:   dnl (because some of them were defined without being declared in Solaris
  248:   dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
  249:   dnl on Solaris 2.5.1 to run on Solaris 2.6).
  250:   AC_CHECK_DECLS([feof_unlocked, fgets_unlocked], , , [#include <stdio.h>])
  251: 
  252:   AM_ICONV
  253: 
  254:   dnl intl/plural.c is generated from intl/plural.y. It requires bison,
  255:   dnl because plural.y uses bison specific features. It requires at least
  256:   dnl bison-2.7 for %define api.pure.
  257:   dnl bison is only needed for the maintainer (who touches plural.y). But in
  258:   dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
  259:   dnl the rule in general Makefile. Now, some people carelessly touch the
  260:   dnl files or have a broken "make" program, hence the plural.c rule will
  261:   dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
  262:   dnl present or too old.
  263:   AC_CHECK_PROGS([INTLBISON], [bison])
  264:   if test -z "$INTLBISON"; then
  265:     ac_verc_fail=yes
  266:   else
  267:     dnl Found it, now check the version.
  268:     AC_MSG_CHECKING([version of bison])
  269: changequote(<<,>>)dnl
  270:     ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
  271:     case $ac_prog_version in
  272:       '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  273:       2.[7-9]* | [3-9].*)
  274: changequote([,])dnl
  275:          ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  276:       *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  277:     esac
  278:     AC_MSG_RESULT([$ac_prog_version])
  279:   fi
  280:   if test $ac_verc_fail = yes; then
  281:     INTLBISON=:
  282:   fi
  283: ])
  284: 
  285: dnl Copies _GL_UNUSED and _GL_ATTRIBUTE_PURE definitions from
  286: dnl gnulib-common.m4 as a fallback, if the project isn't using Gnulib.
  287: AC_DEFUN([gt_GL_ATTRIBUTE], [
  288:   m4_ifndef([gl_[]COMMON],
  289:     AH_VERBATIM([gt_gl_attribute],
  290: [/* Define as a marker that can be attached to declarations that might not
  291:     be used.  This helps to reduce warnings, such as from
  292:     GCC -Wunused-parameter.  */
  293: #ifndef _GL_UNUSED
  294: # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
  295: #  define _GL_UNUSED __attribute__ ((__unused__))
  296: # else
  297: #  define _GL_UNUSED
  298: # endif
  299: #endif
  300: 
  301: /* The __pure__ attribute was added in gcc 2.96.  */
  302: #ifndef _GL_ATTRIBUTE_PURE
  303: # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
  304: #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
  305: # else
  306: #  define _GL_ATTRIBUTE_PURE /* empty */
  307: # endif
  308: #endif
  309: ]))])

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