Blame m4/intl.m4

Packit Service 963350
# intl.m4 serial 8 (gettext-0.17)
Packit Service 963350
dnl Copyright (C) 1995-2007 Free Software Foundation, Inc.
Packit Service 963350
dnl This file is free software; the Free Software Foundation
Packit Service 963350
dnl gives unlimited permission to copy and/or distribute it,
Packit Service 963350
dnl with or without modifications, as long as this notice is preserved.
Packit Service 963350
dnl
Packit Service 963350
dnl This file can can be used in projects which are not available under
Packit Service 963350
dnl the GNU General Public License or the GNU Library General Public
Packit Service 963350
dnl License but which still want to provide support for the GNU gettext
Packit Service 963350
dnl functionality.
Packit Service 963350
dnl Please note that the actual code of the GNU gettext library is covered
Packit Service 963350
dnl by the GNU Library General Public License, and the rest of the GNU
Packit Service 963350
dnl gettext package package is covered by the GNU General Public License.
Packit Service 963350
dnl They are *not* in the public domain.
Packit Service 963350
Packit Service 963350
dnl Authors:
Packit Service 963350
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
Packit Service 963350
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006.
Packit Service 963350
Packit Service 963350
AC_PREREQ(2.52)
Packit Service 963350
Packit Service 963350
dnl Checks for all prerequisites of the intl subdirectory,
Packit Service 963350
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
Packit Service 963350
dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
Packit Service 963350
AC_DEFUN([AM_INTL_SUBDIR],
Packit Service 963350
[
Packit Service 963350
  AC_REQUIRE([AC_PROG_INSTALL])dnl
Packit Service 963350
  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
Packit Service 963350
  AC_REQUIRE([AC_PROG_CC])dnl
Packit Service 963350
  AC_REQUIRE([AC_CANONICAL_HOST])dnl
Packit Service 963350
  AC_REQUIRE([gt_GLIBC2])dnl
Packit Service 963350
  AC_REQUIRE([AC_PROG_RANLIB])dnl
Packit Service 963350
  AC_REQUIRE([gl_VISIBILITY])dnl
Packit Service 963350
  AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
Packit Service 963350
  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl
Packit Service 963350
  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
Packit Service 963350
  AC_REQUIRE([gt_TYPE_WINT_T])dnl
Packit Service 963350
  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
Packit Service 963350
  AC_REQUIRE([gt_TYPE_INTMAX_T])
Packit Service 963350
  AC_REQUIRE([gt_PRINTF_POSIX])
Packit Service 963350
  AC_REQUIRE([gl_GLIBC21])dnl
Packit Service 963350
  AC_REQUIRE([gl_XSIZE])dnl
Packit Service 963350
  AC_REQUIRE([gt_INTL_MACOSX])dnl
Packit Service 963350
Packit Service 963350
  AC_CHECK_TYPE([ptrdiff_t], ,
Packit Service 963350
    [AC_DEFINE([ptrdiff_t], [long],
Packit Service 963350
       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
Packit Service 963350
    ])
Packit Service 963350
  AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
Packit Service 963350
  AC_CHECK_FUNCS([asprintf fwprintf putenv setenv setlocale snprintf wcslen])
Packit Service 963350
Packit Service 963350
  dnl Use the _snprintf function only if it is declared (because on NetBSD it
Packit Service 963350
  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
Packit Service 963350
  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
Packit Service 963350
  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
Packit Service 963350
Packit Service 963350
  dnl Use the *_unlocked functions only if they are declared.
Packit Service 963350
  dnl (because some of them were defined without being declared in Solaris
Packit Service 963350
  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
Packit Service 963350
  dnl on Solaris 2.5.1 to run on Solaris 2.6).
Packit Service 963350
  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
Packit Service 963350
  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
Packit Service 963350
Packit Service 963350
  case $gt_cv_func_printf_posix in
Packit Service 963350
    *yes) HAVE_POSIX_PRINTF=1 ;;
Packit Service 963350
    *) HAVE_POSIX_PRINTF=0 ;;
Packit Service 963350
  esac
Packit Service 963350
  AC_SUBST([HAVE_POSIX_PRINTF])
Packit Service 963350
  if test "$ac_cv_func_asprintf" = yes; then
Packit Service 963350
    HAVE_ASPRINTF=1
Packit Service 963350
  else
Packit Service 963350
    HAVE_ASPRINTF=0
Packit Service 963350
  fi
Packit Service 963350
  AC_SUBST([HAVE_ASPRINTF])
Packit Service 963350
  if test "$ac_cv_func_snprintf" = yes; then
Packit Service 963350
    HAVE_SNPRINTF=1
Packit Service 963350
  else
Packit Service 963350
    HAVE_SNPRINTF=0
Packit Service 963350
  fi
Packit Service 963350
  AC_SUBST([HAVE_SNPRINTF])
Packit Service 963350
  if test "$ac_cv_func_wprintf" = yes; then
Packit Service 963350
    HAVE_WPRINTF=1
Packit Service 963350
  else
Packit Service 963350
    HAVE_WPRINTF=0
Packit Service 963350
  fi
Packit Service 963350
  AC_SUBST([HAVE_WPRINTF])
Packit Service 963350
Packit Service 963350
  AM_LANGINFO_CODESET
Packit Service 963350
  gt_LC_MESSAGES
Packit Service 963350
Packit Service 963350
  dnl Compilation on mingw and Cygwin needs special Makefile rules, because
Packit Service 963350
  dnl 1. when we install a shared library, we must arrange to export
Packit Service 963350
  dnl    auxiliary pointer variables for every exported variable,
Packit Service 963350
  dnl 2. when we install a shared library and a static library simultaneously,
Packit Service 963350
  dnl    the include file specifies __declspec(dllimport) and therefore we
Packit Service 963350
  dnl    must arrange to define the auxiliary pointer variables for the
Packit Service 963350
  dnl    exported variables _also_ in the static library.
Packit Service 963350
  if test "$enable_shared" = yes; then
Packit Service 963350
    case "$host_os" in
Packit Service 963350
      mingw* | cygwin*) is_woe32dll=yes ;;
Packit Service 963350
      *) is_woe32dll=no ;;
Packit Service 963350
    esac
Packit Service 963350
  else
Packit Service 963350
    is_woe32dll=no
Packit Service 963350
  fi
Packit Service 963350
  WOE32DLL=$is_woe32dll
Packit Service 963350
  AC_SUBST([WOE32DLL])
Packit Service 963350
Packit Service 963350
  dnl On mingw and Cygwin, we can activate special Makefile rules which add
Packit Service 963350
  dnl version information to the shared libraries and executables.
Packit Service 963350
  case "$host_os" in
Packit Service 963350
    mingw* | cygwin*) is_woe32=yes ;;
Packit Service 963350
    *) is_woe32=no ;;
Packit Service 963350
  esac
Packit Service 963350
  WOE32=$is_woe32
Packit Service 963350
  AC_SUBST([WOE32])
Packit Service 963350
  if test $WOE32 = yes; then
Packit Service 963350
    dnl Check for a program that compiles Windows resource files.
Packit Service 963350
    AC_CHECK_TOOL([WINDRES], [windres])
Packit Service 963350
  fi
Packit Service 963350
Packit Service 963350
  dnl Determine whether when creating a library, "-lc" should be passed to
Packit Service 963350
  dnl libtool or not. On many platforms, it is required for the libtool option
Packit Service 963350
  dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool
Packit Service 963350
  dnl in the *.la files - makes it impossible to create multithreaded programs,
Packit Service 963350
  dnl because libtool also reorders the -lc to come before the -pthread, and
Packit Service 963350
  dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>.
Packit Service 963350
  case "$host_os" in
Packit Service 963350
    hpux*) LTLIBC="" ;;
Packit Service 963350
    *)     LTLIBC="-lc" ;;
Packit Service 963350
  esac
Packit Service 963350
  AC_SUBST([LTLIBC])
Packit Service 963350
Packit Service 963350
  dnl Rename some macros and functions used for locking.
Packit Service 963350
  AH_BOTTOM([
Packit Service 963350
#define __libc_lock_t                   gl_lock_t
Packit Service 963350
#define __libc_lock_define              gl_lock_define
Packit Service 963350
#define __libc_lock_define_initialized  gl_lock_define_initialized
Packit Service 963350
#define __libc_lock_init                gl_lock_init
Packit Service 963350
#define __libc_lock_lock                gl_lock_lock
Packit Service 963350
#define __libc_lock_unlock              gl_lock_unlock
Packit Service 963350
#define __libc_lock_recursive_t                   gl_recursive_lock_t
Packit Service 963350
#define __libc_lock_define_recursive              gl_recursive_lock_define
Packit Service 963350
#define __libc_lock_define_initialized_recursive  gl_recursive_lock_define_initialized
Packit Service 963350
#define __libc_lock_init_recursive                gl_recursive_lock_init
Packit Service 963350
#define __libc_lock_lock_recursive                gl_recursive_lock_lock
Packit Service 963350
#define __libc_lock_unlock_recursive              gl_recursive_lock_unlock
Packit Service 963350
#define glthread_in_use  libintl_thread_in_use
Packit Service 963350
#define glthread_lock_init     libintl_lock_init
Packit Service 963350
#define glthread_lock_lock     libintl_lock_lock
Packit Service 963350
#define glthread_lock_unlock   libintl_lock_unlock
Packit Service 963350
#define glthread_lock_destroy  libintl_lock_destroy
Packit Service 963350
#define glthread_rwlock_init     libintl_rwlock_init
Packit Service 963350
#define glthread_rwlock_rdlock   libintl_rwlock_rdlock
Packit Service 963350
#define glthread_rwlock_wrlock   libintl_rwlock_wrlock
Packit Service 963350
#define glthread_rwlock_unlock   libintl_rwlock_unlock
Packit Service 963350
#define glthread_rwlock_destroy  libintl_rwlock_destroy
Packit Service 963350
#define glthread_recursive_lock_init     libintl_recursive_lock_init
Packit Service 963350
#define glthread_recursive_lock_lock     libintl_recursive_lock_lock
Packit Service 963350
#define glthread_recursive_lock_unlock   libintl_recursive_lock_unlock
Packit Service 963350
#define glthread_recursive_lock_destroy  libintl_recursive_lock_destroy
Packit Service 963350
#define glthread_once                 libintl_once
Packit Service 963350
#define glthread_once_call            libintl_once_call
Packit Service 963350
#define glthread_once_singlethreaded  libintl_once_singlethreaded
Packit Service 963350
])
Packit Service 963350
])
Packit Service 963350
Packit Service 963350
Packit Service 963350
dnl Checks for the core files of the intl subdirectory:
Packit Service 963350
dnl   dcigettext.c
Packit Service 963350
dnl   eval-plural.h
Packit Service 963350
dnl   explodename.c
Packit Service 963350
dnl   finddomain.c
Packit Service 963350
dnl   gettextP.h
Packit Service 963350
dnl   gmo.h
Packit Service 963350
dnl   hash-string.h hash-string.c
Packit Service 963350
dnl   l10nflist.c
Packit Service 963350
dnl   libgnuintl.h.in (except the *printf stuff)
Packit Service 963350
dnl   loadinfo.h
Packit Service 963350
dnl   loadmsgcat.c
Packit Service 963350
dnl   localealias.c
Packit Service 963350
dnl   log.c
Packit Service 963350
dnl   plural-exp.h plural-exp.c
Packit Service 963350
dnl   plural.y
Packit Service 963350
dnl Used by libglocale.
Packit Service 963350
AC_DEFUN([gt_INTL_SUBDIR_CORE],
Packit Service 963350
[
Packit Service 963350
  AC_REQUIRE([AC_C_INLINE])dnl
Packit Service 963350
  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
Packit Service 963350
  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
Packit Service 963350
  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
Packit Service 963350
  AC_REQUIRE([AC_FUNC_MMAP])dnl
Packit Service 963350
  AC_REQUIRE([gt_INTDIV0])dnl
Packit Service 963350
  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
Packit Service 963350
  AC_REQUIRE([gt_INTTYPES_PRI])dnl
Packit Service 963350
  AC_REQUIRE([gl_LOCK])dnl
Packit Service 963350
Packit Service 963350
  AC_TRY_LINK(
Packit Service 963350
    [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
Packit Service 963350
    [],
Packit Service 963350
    [AC_DEFINE([HAVE_BUILTIN_EXPECT], 1,
Packit Service 963350
       [Define to 1 if the compiler understands __builtin_expect.])])
Packit Service 963350
Packit Service 963350
  AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h])
Packit Service 963350
  AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
Packit Service 963350
    stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \
Packit Service 963350
    argz_next __fsetlocking])
Packit Service 963350
Packit Service 963350
  dnl Use the *_unlocked functions only if they are declared.
Packit Service 963350
  dnl (because some of them were defined without being declared in Solaris
Packit Service 963350
  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
Packit Service 963350
  dnl on Solaris 2.5.1 to run on Solaris 2.6).
Packit Service 963350
  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
Packit Service 963350
  gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
Packit Service 963350
  gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
Packit Service 963350
Packit Service 963350
  AM_ICONV
Packit Service 963350
Packit Service 963350
  dnl glibc >= 2.4 has a NL_LOCALE_NAME macro when _GNU_SOURCE is defined,
Packit Service 963350
  dnl and a _NL_LOCALE_NAME macro always.
Packit Service 963350
  AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name,
Packit Service 963350
    [AC_TRY_LINK([#include <langinfo.h>
Packit Service 963350
#include <locale.h>],
Packit Service 963350
      [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));
Packit Service 963350
       return !cs;
Packit Service 963350
      ],
Packit Service 963350
      gt_cv_nl_locale_name=yes,
Packit Service 963350
      gt_cv_nl_locale_name=no)
Packit Service 963350
    ])
Packit Service 963350
  if test $gt_cv_nl_locale_name = yes; then
Packit Service 963350
    AC_DEFINE(HAVE_NL_LOCALE_NAME, 1,
Packit Service 963350
      [Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if _GNU_SOURCE is defined.])
Packit Service 963350
  fi
Packit Service 963350
Packit Service 963350
  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
Packit Service 963350
  dnl because plural.y uses bison specific features. It requires at least
Packit Service 963350
  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
Packit Service 963350
  dnl compile.
Packit Service 963350
  dnl bison is only needed for the maintainer (who touches plural.y). But in
Packit Service 963350
  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
Packit Service 963350
  dnl the rule in general Makefile. Now, some people carelessly touch the
Packit Service 963350
  dnl files or have a broken "make" program, hence the plural.c rule will
Packit Service 963350
  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
Packit Service 963350
  dnl present or too old.
Packit Service 963350
  AC_CHECK_PROGS([INTLBISON], [bison])
Packit Service 963350
  if test -z "$INTLBISON"; then
Packit Service 963350
    ac_verc_fail=yes
Packit Service 963350
  else
Packit Service 963350
    dnl Found it, now check the version.
Packit Service 963350
    AC_MSG_CHECKING([version of bison])
Packit Service 963350
changequote(<<,>>)dnl
Packit Service 963350
    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
Packit Service 963350
    case $ac_prog_version in
Packit Service 963350
      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
Packit Service 963350
      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
Packit Service 963350
changequote([,])dnl
Packit Service 963350
         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
Packit Service 963350
      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
Packit Service 963350
    esac
Packit Service 963350
    AC_MSG_RESULT([$ac_prog_version])
Packit Service 963350
  fi
Packit Service 963350
  if test $ac_verc_fail = yes; then
Packit Service 963350
    INTLBISON=:
Packit Service 963350
  fi
Packit Service 963350
])
Packit Service 963350
Packit Service 963350
Packit Service 963350
dnl gt_CHECK_DECL(FUNC, INCLUDES)
Packit Service 963350
dnl Check whether a function is declared.
Packit Service 963350
AC_DEFUN([gt_CHECK_DECL],
Packit Service 963350
[
Packit Service 963350
  AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
Packit Service 963350
    [AC_TRY_COMPILE([$2], [
Packit Service 963350
#ifndef $1
Packit Service 963350
  char *p = (char *) $1;
Packit Service 963350
#endif
Packit Service 963350
], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
Packit Service 963350
  if test $ac_cv_have_decl_$1 = yes; then
Packit Service 963350
    gt_value=1
Packit Service 963350
  else
Packit Service 963350
    gt_value=0
Packit Service 963350
  fi
Packit Service 963350
  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
Packit Service 963350
    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
Packit Service 963350
])