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