Commit 3b58c099 by Michael Sokolov Committed by Jeff Law

aclocal.m4 (libiberty_AC_DECLARE_ERRNO): New macro.

	* aclocal.m4 (libiberty_AC_DECLARE_ERRNO): New macro.
	* configure.in (libiberty_AC_DECLARE_ERRNO): Add check.
	* configure, config.in: Regenerate.
	* pexecute.c, strtol.c, strtoul.c: Declare errno if necessary.

From-SVN: r35199
parent 8502a100
2000-07-23 Michael Sokolov <msokolov@ivan.Harhan.ORG>
* aclocal.m4 (libiberty_AC_DECLARE_ERRNO): New macro.
* configure.in (libiberty_AC_DECLARE_ERRNO): Add check.
* configure, config.in: Regenerate.
* pexecute.c, strtol.c, strtoul.c: Declare errno if necessary.
* cp-demangle.c, mkstemps.c: #include <sys/types.h>.
2000-07-21 Mike Stump <mrs@wrs.com>
......
......@@ -69,3 +69,17 @@ if test $ac_cv_func_strncmp_works = no ; then
LIBOBJS="$LIBOBJS strncmp.o"
fi
])
dnl See if errno must be declared even when <errno.h> is included.
AC_DEFUN(libiberty_AC_DECLARE_ERRNO,
[AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno,
[AC_TRY_COMPILE(
[#include <errno.h>],
[int x = errno;],
libiberty_cv_declare_errno=no,
libiberty_cv_declare_errno=yes)])
if test $libiberty_cv_declare_errno = yes
then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
[Define if errno must be declared even when <errno.h> is included.])
fi
])
......@@ -231,3 +231,7 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if errno must be declared even when <errno.h> is included. */
#undef NEED_DECLARATION_ERRNO
......@@ -112,6 +112,8 @@ AC_SUBST_FILE(host_makefile_frag)
AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h)
AC_HEADER_SYS_WAIT
libiberty_AC_DECLARE_ERRNO
# This is the list of functions which libiberty will provide if they
# are not available on the host.
......
......@@ -29,6 +29,9 @@ Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <errno.h>
#ifdef NEED_DECLARATION_ERRNO
extern int errno;
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
......
......@@ -31,6 +31,9 @@
#include <limits.h>
#include <ctype.h>
#include <errno.h>
#ifdef NEED_DECLARATION_ERRNO
extern int errno;
#endif
#if 0
#include <stdlib.h>
#endif
......
......@@ -31,6 +31,9 @@
#include <limits.h>
#include <ctype.h>
#include <errno.h>
#ifdef NEED_DECLARATION_ERRNO
extern int errno;
#endif
#if 0
#include <stdlib.h>
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment