1# strerror.m4 serial 6 2dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc. 3dnl This file is free software; the Free Software Foundation 4dnl gives unlimited permission to copy and/or distribute it, 5dnl with or without modifications, as long as this notice is preserved. 6 7AC_DEFUN([gl_FUNC_STRERROR], 8[ 9 AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) 10 if test $gl_cv_func_working_strerror = no; then 11 AC_LIBOBJ([strerror]) 12 AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], 13 [Define this to 1 if strerror is broken.]) 14 fi 15]) 16 17# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ). 18AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], 19[ 20 AC_CACHE_CHECK([for working strerror function], 21 [gl_cv_func_working_strerror], 22 [AC_RUN_IFELSE( 23 [AC_LANG_PROGRAM( 24 [#include <string.h> 25 ], 26 [return !*strerror (-2);])], 27 [gl_cv_func_working_strerror=yes], 28 [gl_cv_func_working_strerror=no], 29 [dnl Assume crossbuild works if it compiles. 30 AC_COMPILE_IFELSE( 31 [AC_LANG_PROGRAM( 32 [#include <string.h> 33 ], 34 [return !*strerror (-2);])], 35 [gl_cv_func_working_strerror=yes], 36 [gl_cv_func_working_strerror=no])])]) 37 if test $gl_cv_func_working_strerror = no ; then 38 REPLACE_STRERROR=1 39 gl_PREREQ_STRERROR 40 fi 41]) 42 43# Prerequisites of lib/strerror.c. 44AC_DEFUN([gl_PREREQ_STRERROR], [ 45 AC_CHECK_DECLS([strerror]) 46]) 47