From: Bruno Haible Date: Fri, 27 Jun 2003 12:24:42 +0000 (+0000) Subject: Avoid using *_unlocked functions on Solaris 2.5.1. X-Git-Tag: v0.13~403 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4cea922676f9dc22fc4849cd40f816eee0679fb;p=thirdparty%2Fgettext.git Avoid using *_unlocked functions on Solaris 2.5.1. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index fba628669..076bf19c0 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,10 @@ +2003-06-27 Bruno Haible + + Avoid use of *_unlocked functions on Solaris 2.5.1. + * localcharset.c: Test HAVE_DECL_GETC_UNLOCKED, not HAVE_GETC_UNLOCKED. + * localealias.c: Test HAVE_DECL_*_UNLOCKED, not HAVE_*_UNLOCKED. + Reported by Eric Botcazou . + 2003-06-22 Bruno Haible Portability to mingw32. diff --git a/gettext-runtime/intl/localcharset.c b/gettext-runtime/intl/localcharset.c index d04d05368..4865f1037 100644 --- a/gettext-runtime/intl/localcharset.c +++ b/gettext-runtime/intl/localcharset.c @@ -86,7 +86,7 @@ # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) #endif -#ifdef HAVE_GETC_UNLOCKED +#if HAVE_DECL_GETC_UNLOCKED # undef getc # define getc getc_unlocked #endif diff --git a/gettext-runtime/intl/localealias.c b/gettext-runtime/intl/localealias.c index 7c4ce58f2..bef434f1f 100644 --- a/gettext-runtime/intl/localealias.c +++ b/gettext-runtime/intl/localealias.c @@ -110,11 +110,11 @@ __libc_lock_define_initialized (static, lock); # define freea(p) free (p) #endif -#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED +#if defined _LIBC_REENTRANT || HAVE_DECL_FGETS_UNLOCKED # undef fgets # define fgets(buf, len, s) fgets_unlocked (buf, len, s) #endif -#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED +#if defined _LIBC_REENTRANT || HAVE_DECL_FEOF_UNLOCKED # undef feof # define feof(s) feof_unlocked (s) #endif diff --git a/gettext-runtime/m4/ChangeLog b/gettext-runtime/m4/ChangeLog index 3ef0b9c5a..09ef09725 100644 --- a/gettext-runtime/m4/ChangeLog +++ b/gettext-runtime/m4/ChangeLog @@ -1,3 +1,12 @@ +2003-06-27 Bruno Haible + + Avoid use of *_unlocked functions on Solaris 2.5.1. + * gettext.m4 (AM_INTL_SUBDIR): Don't test for the functions + feof_unlocked, fgets_unlocked, getc_unlocked. Test for their + declaration instead. + (gt_CHECK_DECL): New macro. + Reported by Eric Botcazou . + 2003-06-19 Bruno Haible * printf-posix.m4: New file. diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4 index 1bf54ff0d..5af807ec8 100644 --- a/gettext-runtime/m4/gettext.m4 +++ b/gettext-runtime/m4/gettext.m4 @@ -1,4 +1,4 @@ -# gettext.m4 serial 21 (gettext-0.12.2) +# gettext.m4 serial 22 (gettext-0.12.2) dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -377,10 +377,18 @@ AC_DEFUN([AM_INTL_SUBDIR], AC_CHECK_TYPES([ptrdiff_t]) AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([asprintf feof_unlocked fgets_unlocked getc_unlocked getcwd \ -getegid geteuid getgid getuid mempcpy munmap putenv setenv setlocale snprintf \ -stpcpy strcasecmp strdup strtoul tsearch wprintf __argz_count \ -__argz_stringify __argz_next __fsetlocking]) + AC_CHECK_FUNCS([asprintf getcwd getegid geteuid getgid getuid mempcpy \ +munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup strtoul \ +tsearch wprintf __argz_count __argz_stringify __argz_next __fsetlocking]) + + dnl Use the *_unlocked functions only if they are declared. + dnl (because some of them were declared in Solaris 2.5.1 but were removed + dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run + dnl on Solaris 2.6). + dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. + gt_CHECK_DECL(feof_unlocked, [#include ]) + gt_CHECK_DECL(fgets_unlocked, [#include ]) + gt_CHECK_DECL(getc_unlocked, [#include ]) case $gt_cv_func_printf_posix in *yes) HAVE_POSIX_PRINTF=1 ;; @@ -445,5 +453,25 @@ changequote([,])dnl ]) +dnl gt_CHECK_DECL(FUNC, INCLUDES) +dnl Check whether a function is declared. +AC_DEFUN([gt_CHECK_DECL], +[ + AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, + [AC_TRY_COMPILE([$2], [ +#ifndef $1 + char *p = (char *) $1; +#endif +], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) + if test $ac_cv_have_decl_$1 = yes; then + gt_value=1 + else + gt_value=0 + fi + AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], + [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) +]) + + dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])