re PR libfortran/53444 (Accommodate non-compliant strerror_r() on VxWorks.)
2012-05-23 Tobias Burnus <burnus@net-b.de> PR libfortran/53444 * acinclude.m4 (LIBGFOR_CHECK_STRERROR_R): Add configure checks * for two- and three-argument versions of strerror_r. * configure.ac (LIBGFOR_CHECK_STRERROR_R): Use it. * runtime/error.c (gf_strerror): Handle two-argument version of strerror_r. * config.h.in: Regenerate. * configure: Regenerate. From-SVN: r187796
This commit is contained in:
parent
f883872b10
commit
4179e59afa
6 changed files with 98 additions and 5 deletions
|
@ -1,3 +1,14 @@
|
|||
2012-05-23 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR libfortran/53444
|
||||
* acinclude.m4 (LIBGFOR_CHECK_STRERROR_R): Add configure checks for
|
||||
two- and three-argument versions of strerror_r.
|
||||
* configure.ac (LIBGFOR_CHECK_STRERROR_R): Use it.
|
||||
* runtime/error.c (gf_strerror): Handle two-argument version
|
||||
of strerror_r.
|
||||
* config.h.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
|
||||
2012-05-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* configure: Regenerated.
|
||||
|
|
|
@ -362,3 +362,29 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
|
|||
dnl We need a conditional for the Makefile
|
||||
AM_CONDITIONAL(LIBGFOR_BUILD_QUAD, [test "x$libgfor_cv_have_float128" = xyes])
|
||||
])
|
||||
|
||||
|
||||
dnl Check whether we have strerror_r
|
||||
AC_DEFUN([LIBGFOR_CHECK_STRERROR_R], [
|
||||
dnl Check for three-argument POSIX version of strerror_r
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-Wimplicit-function-declaration -Werror"
|
||||
AC_TRY_COMPILE([#define _GNU_SOURCE 1
|
||||
#include <string.h>
|
||||
#include <locale.h>],
|
||||
[char s[128]; strerror_r(5, s, 128);],
|
||||
AC_DEFINE(HAVE_STRERROR_R, 1,
|
||||
[Define if strerror_r is available in <string.h>.]),)
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
|
||||
dnl Check for two-argument version of strerror_r (e.g. for VxWorks)
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-Wimplicit-function-declaration -Werror"
|
||||
AC_TRY_COMPILE([#define _GNU_SOURCE 1
|
||||
#include <string.h>
|
||||
#include <locale.h>],
|
||||
[char s[128]; strerror_r(5, s);],
|
||||
AC_DEFINE(HAVE_STRERROR_R_2ARGS, 1,
|
||||
[Define if strerror_r takes two arguments and is available in <string.h>.]),)
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
])
|
||||
|
|
|
@ -696,9 +696,12 @@
|
|||
/* Define to 1 if you have the `strcasestr' function. */
|
||||
#undef HAVE_STRCASESTR
|
||||
|
||||
/* Define to 1 if you have the `strerror_r' function. */
|
||||
/* Define if strerror_r is available in <string.h>. */
|
||||
#undef HAVE_STRERROR_R
|
||||
|
||||
/* Define if strerror_r takes two arguments and is available in <string.h>. */
|
||||
#undef HAVE_STRERROR_R_2ARGS
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
|
|
52
libgfortran/configure
vendored
52
libgfortran/configure
vendored
|
@ -2581,7 +2581,6 @@ as_fn_append ac_func_list " dup"
|
|||
as_fn_append ac_func_list " getcwd"
|
||||
as_fn_append ac_func_list " localtime_r"
|
||||
as_fn_append ac_func_list " gmtime_r"
|
||||
as_fn_append ac_func_list " strerror_r"
|
||||
as_fn_append ac_func_list " getpwuid_r"
|
||||
as_fn_append ac_func_list " ttyname_r"
|
||||
as_fn_append ac_func_list " clock_gettime"
|
||||
|
@ -12328,7 +12327,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12331 "configure"
|
||||
#line 12330 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -12434,7 +12433,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12437 "configure"
|
||||
#line 12436 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -16547,6 +16546,53 @@ done
|
|||
|
||||
|
||||
|
||||
# Check strerror_r, cannot be above as versions with two and three arguments exist
|
||||
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-Wimplicit-function-declaration -Werror"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#define _GNU_SOURCE 1
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char s[128]; strerror_r(5, s, 128);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
$as_echo "#define HAVE_STRERROR_R 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-Wimplicit-function-declaration -Werror"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#define _GNU_SOURCE 1
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char s[128]; strerror_r(5, s);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
$as_echo "#define HAVE_STRERROR_R_2ARGS 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
|
||||
|
||||
# Check for C99 (and other IEEE) math functions
|
||||
|
|
|
@ -265,9 +265,12 @@ AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
|
|||
ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \
|
||||
alarm access fork execl wait setmode execve pipe dup2 close \
|
||||
strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
|
||||
getcwd localtime_r gmtime_r strerror_r getpwuid_r ttyname_r clock_gettime \
|
||||
getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
|
||||
readlink getgid getpid getppid getuid geteuid umask getegid __secure_getenv)
|
||||
|
||||
# Check strerror_r, cannot be above as versions with two and three arguments exist
|
||||
LIBGFOR_CHECK_STRERROR_R
|
||||
|
||||
# Check for C99 (and other IEEE) math functions
|
||||
GCC_CHECK_MATH_FUNC([acosf])
|
||||
GCC_CHECK_MATH_FUNC([acos])
|
||||
|
|
|
@ -212,6 +212,7 @@ gf_strerror (int errnum,
|
|||
size_t buflen __attribute__((unused)))
|
||||
{
|
||||
#ifdef HAVE_STRERROR_R
|
||||
/* POSIX returns an "int", GNU a "char*". */
|
||||
return
|
||||
__builtin_choose_expr (__builtin_classify_type (strerror_r (0, buf, 0))
|
||||
== 5,
|
||||
|
@ -219,6 +220,9 @@ gf_strerror (int errnum,
|
|||
strerror_r (errnum, buf, buflen),
|
||||
/* POSIX strerror_r () */
|
||||
(strerror_r (errnum, buf, buflen), buf));
|
||||
#elif defined(HAVE_STRERROR_R_2ARGS)
|
||||
strerror_r (errnum, buf);
|
||||
return buf;
|
||||
#else
|
||||
/* strerror () is not necessarily thread-safe, but should at least
|
||||
be available everywhere. */
|
||||
|
|
Loading…
Add table
Reference in a new issue