Blame m4/intl.m4

Packit 575503
# intl.m4 serial 28 (gettext-0.19)
Packit 575503
dnl Copyright (C) 1995-2014 Free Software Foundation, Inc.
Packit 575503
dnl This file is free software; the Free Software Foundation
Packit 575503
dnl gives unlimited permission to copy and/or distribute it,
Packit 575503
dnl with or without modifications, as long as this notice is preserved.
Packit 575503
dnl
Packit 575503
dnl This file can can be used in projects which are not available under
Packit 575503
dnl the GNU General Public License or the GNU Library General Public
Packit 575503
dnl License but which still want to provide support for the GNU gettext
Packit 575503
dnl functionality.
Packit 575503
dnl Please note that the actual code of the GNU gettext library is covered
Packit 575503
dnl by the GNU Library General Public License, and the rest of the GNU
Packit 575503
dnl gettext package package is covered by the GNU General Public License.
Packit 575503
dnl They are *not* in the public domain.
Packit 575503
Packit 575503
dnl Authors:
Packit 575503
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
Packit 575503
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2009.
Packit 575503
Packit 575503
AC_PREREQ([2.60])
Packit 575503
Packit 575503
dnl Checks for all prerequisites of the intl subdirectory,
Packit 575503
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
Packit 575503
dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
Packit 575503
AC_DEFUN([AM_INTL_SUBDIR],
Packit 575503
[
Packit 575503
  AC_REQUIRE([AC_PROG_INSTALL])dnl
Packit 575503
  AC_REQUIRE([AC_PROG_MKDIR_P])dnl
Packit 575503
  AC_REQUIRE([AC_PROG_CC])dnl
Packit 575503
  AC_REQUIRE([AC_CANONICAL_HOST])dnl
Packit 575503
  AC_REQUIRE([gt_GLIBC2])dnl
Packit 575503
  AC_REQUIRE([AC_PROG_RANLIB])dnl
Packit 575503
  AC_REQUIRE([gl_VISIBILITY])dnl
Packit 575503
  AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
Packit 575503
  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl
Packit 575503
  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
Packit 575503
  AC_REQUIRE([gt_TYPE_WINT_T])dnl
Packit 575503
  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
Packit 575503
  AC_REQUIRE([gt_TYPE_INTMAX_T])
Packit 575503
  AC_REQUIRE([gt_PRINTF_POSIX])
Packit 575503
  AC_REQUIRE([gl_GLIBC21])dnl
Packit 575503
  AC_REQUIRE([gl_XSIZE])dnl
Packit 575503
  AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl
Packit 575503
  AC_REQUIRE([gt_INTL_MACOSX])dnl
Packit 575503
  AC_REQUIRE([gl_EXTERN_INLINE])dnl
Packit 575503
  AC_REQUIRE([gt_GL_ATTRIBUTE])dnl
Packit 575503
Packit 575503
  dnl Support for automake's --enable-silent-rules.
Packit 575503
  case "$enable_silent_rules" in
Packit 575503
    yes) INTL_DEFAULT_VERBOSITY=0;;
Packit 575503
    no)  INTL_DEFAULT_VERBOSITY=1;;
Packit 575503
    *)   INTL_DEFAULT_VERBOSITY=1;;
Packit 575503
  esac
Packit 575503
  AC_SUBST([INTL_DEFAULT_VERBOSITY])
Packit 575503
Packit 575503
  AC_CHECK_TYPE([ptrdiff_t], ,
Packit 575503
    [AC_DEFINE([ptrdiff_t], [long],
Packit 575503
       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
Packit 575503
    ])
Packit 575503
  AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h])
Packit 575503
  AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
Packit 575503
    snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
Packit 575503
Packit 575503
  dnl Use the _snprintf function only if it is declared (because on NetBSD it
Packit 575503
  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
Packit 575503
  AC_CHECK_DECLS([_snprintf, _snwprintf], , , [#include <stdio.h>])
Packit 575503
Packit 575503
  dnl Use the *_unlocked functions only if they are declared.
Packit 575503
  dnl (because some of them were defined without being declared in Solaris
Packit 575503
  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
Packit 575503
  dnl on Solaris 2.5.1 to run on Solaris 2.6).
Packit 575503
  AC_CHECK_DECLS([getc_unlocked], , , [#include <stdio.h>])
Packit 575503
Packit 575503
  case $gt_cv_func_printf_posix in
Packit 575503
    *yes) HAVE_POSIX_PRINTF=1 ;;
Packit 575503
    *) HAVE_POSIX_PRINTF=0 ;;
Packit 575503
  esac
Packit 575503
  AC_SUBST([HAVE_POSIX_PRINTF])
Packit 575503
  if test "$ac_cv_func_asprintf" = yes; then
Packit 575503
    HAVE_ASPRINTF=1
Packit 575503
  else
Packit 575503
    HAVE_ASPRINTF=0
Packit 575503
  fi
Packit 575503
  AC_SUBST([HAVE_ASPRINTF])
Packit 575503
  if test "$ac_cv_func_snprintf" = yes; then
Packit 575503
    HAVE_SNPRINTF=1
Packit 575503
  else
Packit 575503
    HAVE_SNPRINTF=0
Packit 575503
  fi
Packit 575503
  AC_SUBST([HAVE_SNPRINTF])
Packit 575503
  if test "$ac_cv_func_newlocale" = yes; then
Packit 575503
    HAVE_NEWLOCALE=1
Packit 575503
  else
Packit 575503
    HAVE_NEWLOCALE=0
Packit 575503
  fi
Packit 575503
  AC_SUBST([HAVE_NEWLOCALE])
Packit 575503
  if test "$ac_cv_func_wprintf" = yes; then
Packit 575503
    HAVE_WPRINTF=1
Packit 575503
  else
Packit 575503
    HAVE_WPRINTF=0
Packit 575503
  fi
Packit 575503
  AC_SUBST([HAVE_WPRINTF])
Packit 575503
Packit 575503
  AM_LANGINFO_CODESET
Packit 575503
  gt_LC_MESSAGES
Packit 575503
Packit 575503
  dnl Compilation on mingw and Cygwin needs special Makefile rules, because
Packit 575503
  dnl 1. when we install a shared library, we must arrange to export
Packit 575503
  dnl    auxiliary pointer variables for every exported variable,
Packit 575503
  dnl 2. when we install a shared library and a static library simultaneously,
Packit 575503
  dnl    the include file specifies __declspec(dllimport) and therefore we
Packit 575503
  dnl    must arrange to define the auxiliary pointer variables for the
Packit 575503
  dnl    exported variables _also_ in the static library.
Packit 575503
  if test "$enable_shared" = yes; then
Packit 575503
    case "$host_os" in
Packit 575503
      mingw* | cygwin*) is_woe32dll=yes ;;
Packit 575503
      *) is_woe32dll=no ;;
Packit 575503
    esac
Packit 575503
  else
Packit 575503
    is_woe32dll=no
Packit 575503
  fi
Packit 575503
  WOE32DLL=$is_woe32dll
Packit 575503
  AC_SUBST([WOE32DLL])
Packit 575503
Packit 575503
  dnl On mingw and Cygwin, we can activate special Makefile rules which add
Packit 575503
  dnl version information to the shared libraries and executables.
Packit 575503
  case "$host_os" in
Packit 575503
    mingw* | cygwin*) is_woe32=yes ;;
Packit 575503
    *) is_woe32=no ;;
Packit 575503
  esac
Packit 575503
  WOE32=$is_woe32
Packit 575503
  AC_SUBST([WOE32])
Packit 575503
  if test $WOE32 = yes; then
Packit 575503
    dnl Check for a program that compiles Windows resource files.
Packit 575503
    AC_CHECK_TOOL([WINDRES], [windres])
Packit 575503
  fi
Packit 575503
Packit 575503
  dnl Determine whether when creating a library, "-lc" should be passed to
Packit 575503
  dnl libtool or not. On many platforms, it is required for the libtool option
Packit 575503
  dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool
Packit 575503
  dnl in the *.la files - makes it impossible to create multithreaded programs,
Packit 575503
  dnl because libtool also reorders the -lc to come before the -pthread, and
Packit 575503
  dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>.
Packit 575503
  case "$host_os" in
Packit 575503
    hpux*) LTLIBC="" ;;
Packit 575503
    *)     LTLIBC="-lc" ;;
Packit 575503
  esac
Packit 575503
  AC_SUBST([LTLIBC])
Packit 575503
Packit 575503
  dnl Rename some macros and functions used for locking.
Packit 575503
  AH_BOTTOM([
Packit 575503
#define __libc_lock_t                   gl_lock_t
Packit 575503
#define __libc_lock_define              gl_lock_define
Packit 575503
#define __libc_lock_define_initialized  gl_lock_define_initialized
Packit 575503
#define __libc_lock_init                gl_lock_init
Packit 575503
#define __libc_lock_lock                gl_lock_lock
Packit 575503
#define __libc_lock_unlock              gl_lock_unlock
Packit 575503
#define __libc_lock_recursive_t                   gl_recursive_lock_t
Packit 575503
#define __libc_lock_define_recursive              gl_recursive_lock_define
Packit 575503
#define __libc_lock_define_initialized_recursive  gl_recursive_lock_define_initialized
Packit 575503
#define __libc_lock_init_recursive                gl_recursive_lock_init
Packit 575503
#define __libc_lock_lock_recursive                gl_recursive_lock_lock
Packit 575503
#define __libc_lock_unlock_recursive              gl_recursive_lock_unlock
Packit 575503
#define glthread_in_use  libintl_thread_in_use
Packit 575503
#define glthread_lock_init_func     libintl_lock_init_func
Packit 575503
#define glthread_lock_lock_func     libintl_lock_lock_func
Packit 575503
#define glthread_lock_unlock_func   libintl_lock_unlock_func
Packit 575503
#define glthread_lock_destroy_func  libintl_lock_destroy_func
Packit 575503
#define glthread_rwlock_init_multithreaded     libintl_rwlock_init_multithreaded
Packit 575503
#define glthread_rwlock_init_func              libintl_rwlock_init_func
Packit 575503
#define glthread_rwlock_rdlock_multithreaded   libintl_rwlock_rdlock_multithreaded
Packit 575503
#define glthread_rwlock_rdlock_func            libintl_rwlock_rdlock_func
Packit 575503
#define glthread_rwlock_wrlock_multithreaded   libintl_rwlock_wrlock_multithreaded
Packit 575503
#define glthread_rwlock_wrlock_func            libintl_rwlock_wrlock_func
Packit 575503
#define glthread_rwlock_unlock_multithreaded   libintl_rwlock_unlock_multithreaded
Packit 575503
#define glthread_rwlock_unlock_func            libintl_rwlock_unlock_func
Packit 575503
#define glthread_rwlock_destroy_multithreaded  libintl_rwlock_destroy_multithreaded
Packit 575503
#define glthread_rwlock_destroy_func           libintl_rwlock_destroy_func
Packit 575503
#define glthread_recursive_lock_init_multithreaded     libintl_recursive_lock_init_multithreaded
Packit 575503
#define glthread_recursive_lock_init_func              libintl_recursive_lock_init_func
Packit 575503
#define glthread_recursive_lock_lock_multithreaded     libintl_recursive_lock_lock_multithreaded
Packit 575503
#define glthread_recursive_lock_lock_func              libintl_recursive_lock_lock_func
Packit 575503
#define glthread_recursive_lock_unlock_multithreaded   libintl_recursive_lock_unlock_multithreaded
Packit 575503
#define glthread_recursive_lock_unlock_func            libintl_recursive_lock_unlock_func
Packit 575503
#define glthread_recursive_lock_destroy_multithreaded  libintl_recursive_lock_destroy_multithreaded
Packit 575503
#define glthread_recursive_lock_destroy_func           libintl_recursive_lock_destroy_func
Packit 575503
#define glthread_once_func            libintl_once_func
Packit 575503
#define glthread_once_singlethreaded  libintl_once_singlethreaded
Packit 575503
#define glthread_once_multithreaded   libintl_once_multithreaded
Packit 575503
])
Packit 575503
])
Packit 575503
Packit 575503
Packit 575503
dnl Checks for the core files of the intl subdirectory:
Packit 575503
dnl   dcigettext.c
Packit 575503
dnl   eval-plural.h
Packit 575503
dnl   explodename.c
Packit 575503
dnl   finddomain.c
Packit 575503
dnl   gettextP.h
Packit 575503
dnl   gmo.h
Packit 575503
dnl   hash-string.h hash-string.c
Packit 575503
dnl   l10nflist.c
Packit 575503
dnl   libgnuintl.h.in (except the *printf stuff)
Packit 575503
dnl   loadinfo.h
Packit 575503
dnl   loadmsgcat.c
Packit 575503
dnl   localealias.c
Packit 575503
dnl   log.c
Packit 575503
dnl   plural-exp.h plural-exp.c
Packit 575503
dnl   plural.y
Packit 575503
dnl Used by libglocale.
Packit 575503
AC_DEFUN([gt_INTL_SUBDIR_CORE],
Packit 575503
[
Packit 575503
  AC_REQUIRE([AC_C_INLINE])dnl
Packit 575503
  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
Packit 575503
  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
Packit 575503
  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
Packit 575503
  AC_REQUIRE([AC_FUNC_MMAP])dnl
Packit 575503
  AC_REQUIRE([gt_INTDIV0])dnl
Packit 575503
  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
Packit 575503
  AC_REQUIRE([gt_INTTYPES_PRI])dnl
Packit 575503
  AC_REQUIRE([gl_LOCK])dnl
Packit 575503
Packit 575503
  AC_LINK_IFELSE(
Packit 575503
    [AC_LANG_PROGRAM(
Packit 575503
       [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]],
Packit 575503
       [[]])],
Packit 575503
    [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1],
Packit 575503
       [Define to 1 if the compiler understands __builtin_expect.])])
Packit 575503
Packit 575503
  AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h])
Packit 575503
  AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
Packit 575503
    stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \
Packit 575503
    argz_stringify argz_next __fsetlocking])
Packit 575503
Packit 575503
  dnl Use the *_unlocked functions only if they are declared.
Packit 575503
  dnl (because some of them were defined without being declared in Solaris
Packit 575503
  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
Packit 575503
  dnl on Solaris 2.5.1 to run on Solaris 2.6).
Packit 575503
  AC_CHECK_DECLS([feof_unlocked, fgets_unlocked], , , [#include <stdio.h>])
Packit 575503
Packit 575503
  AM_ICONV
Packit 575503
Packit 575503
  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
Packit 575503
  dnl because plural.y uses bison specific features. It requires at least
Packit 575503
  dnl bison-2.7 for %define api.pure.
Packit 575503
  dnl bison is only needed for the maintainer (who touches plural.y). But in
Packit 575503
  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
Packit 575503
  dnl the rule in general Makefile. Now, some people carelessly touch the
Packit 575503
  dnl files or have a broken "make" program, hence the plural.c rule will
Packit 575503
  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
Packit 575503
  dnl present or too old.
Packit 575503
  AC_CHECK_PROGS([INTLBISON], [bison])
Packit 575503
  if test -z "$INTLBISON"; then
Packit 575503
    ac_verc_fail=yes
Packit 575503
  else
Packit 575503
    dnl Found it, now check the version.
Packit 575503
    AC_MSG_CHECKING([version of bison])
Packit 575503
changequote(<<,>>)dnl
Packit 575503
    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
Packit 575503
    case $ac_prog_version in
Packit 575503
      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
Packit 575503
      2.[7-9]* | [3-9].*)
Packit 575503
changequote([,])dnl
Packit 575503
         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
Packit 575503
      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
Packit 575503
    esac
Packit 575503
    AC_MSG_RESULT([$ac_prog_version])
Packit 575503
  fi
Packit 575503
  if test $ac_verc_fail = yes; then
Packit 575503
    INTLBISON=:
Packit 575503
  fi
Packit 575503
])
Packit 575503
Packit 575503
dnl Copies _GL_UNUSED and _GL_ATTRIBUTE_PURE definitions from
Packit 575503
dnl gnulib-common.m4 as a fallback, if the project isn't using Gnulib.
Packit 575503
AC_DEFUN([gt_GL_ATTRIBUTE], [
Packit 575503
  m4_ifndef([gl_[]COMMON],
Packit 575503
    AH_VERBATIM([gt_gl_attribute],
Packit 575503
[/* Define as a marker that can be attached to declarations that might not
Packit 575503
    be used.  This helps to reduce warnings, such as from
Packit 575503
    GCC -Wunused-parameter.  */
Packit 575503
#ifndef _GL_UNUSED
Packit 575503
# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
Packit 575503
#  define _GL_UNUSED __attribute__ ((__unused__))
Packit 575503
# else
Packit 575503
#  define _GL_UNUSED
Packit 575503
# endif
Packit 575503
#endif
Packit 575503
Packit 575503
/* The __pure__ attribute was added in gcc 2.96.  */
Packit 575503
#ifndef _GL_ATTRIBUTE_PURE
Packit 575503
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
Packit 575503
#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
Packit 575503
# else
Packit 575503
#  define _GL_ATTRIBUTE_PURE /* empty */
Packit 575503
# endif
Packit 575503
#endif
Packit 575503
]))])