2004-09-14 Jeff Johnston <jjohnstn@redhat.com>

* configure.host: Add Cygwin sys directory.
        * configure.in: Do not set CRT0 for cygwin.
        * libc/configure.in: Ditto.
        * libc/sys/configure.in: Ditto.
        * configure: Regenerated.
        * libc/configure: Ditto.
        * libc/sys/configure: Ditto.
        * libc/include/sys/reent.h: Add __REENT_HAS_CXA_SUPPORT flag.
        * libc/stdlib/__atexit.c: Keep cxa support protected by new
        __REENT_HAS_CXA_SUPPORT flag.
        * libc/stdlib/__call_atexit.c: Ditto.
        * libc/stdlib/cxa_atexit.c: Ditto.
        * libc/stdlib/cxa_finalize.c: Ditto.
        * libc/sys/cygwin/Makefile.am: New file.
        * libc/sys/cygwin/Makefile.in: Ditto.
        * libc/sys/cygwin/aclocal.m4: Ditto.
        * libc/sys/cygwin/configure: Ditto.
        * libc/sys/cygwin/configure.in: Ditto.
        * libc/sys/cygwin/dummy.c: Ditto.
        * libc/sys/cygwin/sys/reent.h: Ditto.  This file is stabilized
        version of reent.h.
This commit is contained in:
Jeff Johnston 2004-09-14 18:12:53 +00:00
parent 272871abe4
commit 98650d2fa2
20 changed files with 3463 additions and 7 deletions

View File

@ -1,3 +1,27 @@
2004-09-14 Jeff Johnston <jjohnstn@redhat.com>
* configure.host: Add Cygwin sys directory.
* configure.in: Do not set CRT0 for cygwin.
* libc/configure.in: Ditto.
* libc/sys/configure.in: Ditto.
* configure: Regenerated.
* libc/configure: Ditto.
* libc/sys/configure: Ditto.
* libc/include/sys/reent.h: Add __REENT_HAS_CXA_SUPPORT flag.
* libc/stdlib/__atexit.c: Keep cxa support protected by new
__REENT_HAS_CXA_SUPPORT flag.
* libc/stdlib/__call_atexit.c: Ditto.
* libc/stdlib/cxa_atexit.c: Ditto.
* libc/stdlib/cxa_finalize.c: Ditto.
* libc/sys/cygwin/Makefile.am: New file.
* libc/sys/cygwin/Makefile.in: Ditto.
* libc/sys/cygwin/aclocal.m4: Ditto.
* libc/sys/cygwin/configure: Ditto.
* libc/sys/cygwin/configure.in: Ditto.
* libc/sys/cygwin/dummy.c: Ditto.
* libc/sys/cygwin/sys/reent.h: Ditto. This file is stabilized
version of reent.h.
2004-09-13 Artem B. Bityuckiy <dedekind@oktetlabs.ru>
* libc/iconv/iconv.tex: Updated with new content.

2
newlib/configure vendored
View File

@ -3205,7 +3205,7 @@ subdirs="${configdirs}"
CRT0=
CRT0_DIR=
if test -n "${sys_dir}"; then
if test x${sys_dir} != xcygwin && test -n "${sys_dir}"; then
CRT0=crt0.o
CRT0_DIR=libc/
fi

View File

@ -284,6 +284,7 @@ esac
case "${host}" in
*-*-cygwin*)
sys_dir=cygwin
posix_dir=posix
stdio64_dir=stdio64
;;

View File

@ -139,7 +139,7 @@ AC_CONFIG_SUBDIRS(${configdirs})
CRT0=
CRT0_DIR=
if test -n "${sys_dir}"; then
if test x${sys_dir} != xcygwin && test -n "${sys_dir}"; then
CRT0=crt0.o
CRT0_DIR=libc/
fi

View File

@ -3006,7 +3006,7 @@ subdirs="machine sys"
CRT0=
if test -n "${sys_dir}"; then
if test x${sys_dir} != xcygwin && test -n "${sys_dir}"; then
CRT0=crt0.o
fi

View File

@ -30,7 +30,7 @@ fi
AC_CONFIG_SUBDIRS(machine sys)
CRT0=
if test -n "${sys_dir}"; then
if test x${sys_dir} != xcygwin && test -n "${sys_dir}"; then
CRT0=crt0.o
fi
AC_SUBST(CRT0)

View File

@ -62,6 +62,7 @@ struct __tm
* atexit() support.
*/
#define __REENT_HAS_CXA_SUPPORT 1
#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
struct _on_exit_args {

View File

@ -8,6 +8,7 @@
#include <sys/lock.h>
#include "atexit.h"
/*
* Register a function to be performed at exit or on shared library unload.
*/
@ -47,7 +48,9 @@ _DEFUN (__register_exitproc,
_GLOBAL_REENT->_atexit = p;
#ifndef _REENT_SMALL
p->_on_exit_args._fntypes = 0;
#ifdef __REENT_HAS_CXA_SUPPORT
p->_on_exit_args._is_cxa = 0;
#endif
#endif
}
@ -67,16 +70,20 @@ _DEFUN (__register_exitproc,
}
args->_fntypes = 0;
args->_is_cxa = 0;
#ifdef __REENT_HAS_CXA_SUPPORT
p->_on_exit_args_ptr = args;
#endif
}
#else
args = &p->_on_exit_args;
#endif
args->_fnargs[p->_ind] = arg;
args->_dso_handle[p->_ind] = d;
args->_fntypes |= (1 << p->_ind);
#ifdef __REENT_HAS_CXA_SUPPORT
args->_dso_handle[p->_ind] = d;
if (type == __et_cxa)
args->_is_cxa |= (1 << p->_ind);
#endif
}
p->_fns[p->_ind++] = fn;
#ifndef __SINGLE_THREAD__

View File

@ -36,9 +36,11 @@ _DEFUN (__call_exitprocs, (code, d),
{
i = 1 << n;
#ifdef __REENT_HAS_CXA_SUPPORT
/* Skip functions not from this dso. */
if (d && (!args || args->_dso_handle[n] != d))
continue;
#endif
/* Remove the function now to protect against the
function calling exit recursively. */
@ -55,8 +57,10 @@ _DEFUN (__call_exitprocs, (code, d),
/* Call the function. */
if (!args || (args->_fntypes & i) == 0)
fn ();
#ifdef __REENT_HAS_CXA_SUPPORT
else if ((args->_is_cxa & i) == 0)
(*((void (*)(int, _PTR)) fn))(code, args->_fnargs[n]);
#endif
else
(*((void (*)(_PTR)) fn))(args->_fnargs[n]);
}

View File

@ -8,6 +8,7 @@
#include <sys/lock.h>
#include "atexit.h"
#ifdef __REENT_HAS_CXA_SUPPORT
/*
* Register a function to be performed at exit or DSO unload.
*/
@ -21,3 +22,5 @@ _DEFUN (__cxa_atexit,
{
return __register_exitproc (__et_cxa, (void (*)(void)) fn, arg, d);
}
#endif /* __REENT_HAS_CXA_SUPPORT */

View File

@ -7,6 +7,8 @@
#include <reent.h>
#include "atexit.h"
#ifdef __REENT_HAS_CXA_SUPPORT
/*
* Call registered exit handlers. If D is null then all handlers are called,
* otherwise only the handlers from that DSO are called.
@ -18,3 +20,5 @@ _DEFUN (__cxa_finalize, (d),
{
__call_exitprocs (0, d);
}
#endif /* __REENT_HAS_CXA_SUPPORT */

View File

@ -2977,7 +2977,7 @@ if test -n "${sys_dir}"; then
fi
CRT0=
if test -n "${sys_dir}"; then
if test x${sys_dir} != xcygwin && test -n "${sys_dir}"; then
CRT0=crt0.o
fi

View File

@ -22,7 +22,7 @@ if test -n "${sys_dir}"; then
fi
CRT0=
if test -n "${sys_dir}"; then
if test x${sys_dir} != xcygwin && test -n "${sys_dir}"; then
CRT0=crt0.o
fi
AC_SUBST(CRT0)

View File

@ -0,0 +1,12 @@
## Process this file with automake to generate Makefile.in
AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
lib_a_SOURCES = dummy.c
ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

View File

@ -0,0 +1,327 @@
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
CC = @CC@
CPP = @CPP@
EXEEXT = @EXEEXT@
LDFLAGS = @LDFLAGS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
aext = @aext@
libm_machine_dir = @libm_machine_dir@
machine_dir = @machine_dir@
newlib_basedir = @newlib_basedir@
oext = @oext@
sys_dir = @sys_dir@
AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
lib_a_SOURCES = dummy.c
ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
lib_a_LIBADD =
lib_a_OBJECTS = dummy.o
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = $(lib_a_SOURCES)
OBJECTS = $(lib_a_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \
../../../acinclude.m4 ../../../aclocal.m4 \
../../../libtool.m4
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
mostlyclean-noinstLIBRARIES:
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
-rm -f lib.a
$(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
$(RANLIB) lib.a
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am:
check: check-am
installcheck-am:
installcheck: installcheck-am
install-info-am:
install-info: install-info-am
install-exec-am:
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-tags distclean-generic clean-am
distclean: distclean-am
-rm -f config.status
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-rm -f config.status
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-info-am install-info \
install-exec-am install-exec install-data-am install-data install-am \
install uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

366
newlib/libc/sys/cygwin/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,366 @@
dnl aclocal.m4 generated automatically by aclocal 1.4-p6
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
dnl This provides configure definitions used by all the newlib
dnl configure.in files.
dnl Basic newlib configury. This calls basic introductory stuff,
dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
dnl configure.host. The only argument is the relative path to the top
dnl newlib directory.
AC_DEFUN(NEWLIB_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl Support --enable-target-optspace
AC_ARG_ENABLE(target-optspace,
[ --enable-target-optspace optimize for space],
[case "${enableval}" in
yes) target_optspace=yes ;;
no) target_optspace=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
esac], [target_optspace=])dnl
dnl Support --enable-malloc-debugging - currently only supported for Cygwin
AC_ARG_ENABLE(malloc-debugging,
[ --enable-malloc-debugging indicate malloc debugging requested],
[case "${enableval}" in
yes) malloc_debugging=yes ;;
no) malloc_debugging=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
esac], [malloc_debugging=])dnl
dnl Support --enable-newlib-multithread
AC_ARG_ENABLE(newlib-multithread,
[ --enable-newlib-multithread enable support for multiple threads],
[case "${enableval}" in
yes) newlib_multithread=yes ;;
no) newlib_multithread=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
esac], [newlib_multithread=yes])dnl
dnl Support --enable-newlib-iconv
AC_ARG_ENABLE(newlib-iconv,
[ --enable-newlib-iconv enable iconv library support],
[if test "${newlib_iconv+set}" != set; then
case "${enableval}" in
yes) newlib_iconv=yes ;;
no) newlib_iconv=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;;
esac
fi], [newlib_iconv=${newlib_iconv}])dnl
dnl Support --enable-newlib-elix-level
AC_ARG_ENABLE(newlib-elix-level,
[ --enable-newlib-elix-level supply desired elix library level (1-4)],
[case "${enableval}" in
0) newlib_elix_level=0 ;;
1) newlib_elix_level=1 ;;
2) newlib_elix_level=2 ;;
3) newlib_elix_level=3 ;;
4) newlib_elix_level=4 ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
esac], [newlib_elix_level=0])dnl
dnl Support --disable-newlib-io-float
AC_ARG_ENABLE(newlib-io-float,
[ --disable-newlib-io-float disable printf/scanf family float support],
[case "${enableval}" in
yes) newlib_io_float=yes ;;
no) newlib_io_float=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
esac], [newlib_io_float=yes])dnl
dnl Support --disable-newlib-supplied-syscalls
AC_ARG_ENABLE(newlib-supplied-syscalls,
[ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
[case "${enableval}" in
yes) newlib_may_supply_syscalls=yes ;;
no) newlib_may_supply_syscalls=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
esac], [newlib_may_supply_syscalls=yes])dnl
AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
dnl We may get other options which we don't document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
test -z "[$]{with_target_subdir}" && with_target_subdir=.
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
newlib_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(newlib_basedir)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(newlib, 1.12.0)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which can't create executables. So we include AC_EXEEXT to keep
# automake happy, but we don't execute it, since we don't care about
# the result.
if false; then
AC_EXEEXT
fi
. [$]{newlib_basedir}/configure.host
newlib_cflags="[$]{newlib_cflags} -fno-builtin"
NEWLIB_CFLAGS=${newlib_cflags}
AC_SUBST(NEWLIB_CFLAGS)
LDFLAGS=${ldflags}
AC_SUBST(LDFLAGS)
AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
# use oext, which is set in configure.host based on the target platform.
OBJEXT=${oext}
AC_SUBST(OBJEXT)
AC_SUBST(oext)
AC_SUBST(aext)
AC_SUBST(libm_machine_dir)
AC_SUBST(machine_dir)
AC_SUBST(sys_dir)
])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
# Copyright 2002 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.4-p6])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN([AM_MISSING_PROG],
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)

1880
newlib/libc/sys/cygwin/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
dnl This is the newlib/libc/sys/arm configure.in file.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)
AC_INIT(dummy.c)
dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
AC_CONFIG_AUX_DIR(../../../..)
NEWLIB_CONFIGURE(../../..)
AC_OUTPUT(Makefile)

View File

@ -0,0 +1 @@
/* Empty stub to allow Cygwin to build something in lib.a */

View File

@ -0,0 +1,814 @@
/* This header file provides the reentrancy. */
/* WARNING: All identifiers here must begin with an underscore. This file is
included by stdio.h and others and we therefore must only use identifiers
in the namespace allotted to us. */
#ifndef _SYS_REENT_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS_REENT_H_
#include <_ansi.h>
#include <sys/_types.h>
#ifndef __Long
#if __LONG_MAX__ == 2147483647L
#define __Long long
typedef unsigned __Long __ULong;
#elif __INT_MAX__ == 2147483647
#define __Long int
typedef unsigned __Long __ULong;
#endif
#endif
#if !defined( __Long)
#include <sys/types.h>
#endif
#ifndef __Long
#define __Long __int32_t
typedef __uint32_t __ULong;
#endif
/*
* If _REENT_SMALL is defined, we make struct _reent as small as possible,
* by having nearly everything possible allocated at first use.
*/
struct _Bigint
{
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
/* needed by reentrant structure */
struct __tm
{
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
/*
* atexit() support. For _REENT_SMALL, we limit to 32 max.
*/
#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
struct _on_exit_args {
void * _fnargs[_ATEXIT_SIZE]; /* fn args for on_exit */
__ULong _fntypes; /* type of exit routine -
Must have at least _ATEXIT_SIZE bits */
};
#ifdef _REENT_SMALL
struct _atexit {
int _ind; /* next index in this table */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args * _on_exit_args_ptr;
};
#else
struct _atexit {
struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args _on_exit_args;
};
#endif
/*
* Stdio buffers.
*
* This and __FILE are defined here because we need them for struct _reent,
* but we don't want stdio.h included when stdlib.h is.
*/
struct __sbuf {
unsigned char *_base;
int _size;
};
/*
* We need fpos_t for the following, but it doesn't have a leading "_",
* so we use _fpos_t instead.
*/
typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
/* (and must be `long' for now) */
#ifdef __LARGE64_FILES
typedef _off64_t _fpos64_t;
#endif
/*
* Stdio state variables.
*
* The following always hold:
*
* if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
* _lbfsize is -_bf._size, else _lbfsize is 0
* if _flags&__SRD, _w is 0
* if _flags&__SWR, _r is 0
*
* This ensures that the getc and putc macros (or inline functions) never
* try to write or read from a file that is in `read' or `write' mode.
* (Moreover, they can, and do, automatically switch from read mode to
* write mode, and back, on "r+" and "w+" files.)
*
* _lbfsize is used only to make the inline line-buffered output stream
* code as compact as possible.
*
* _ub, _up, and _ur are used when ungetc() pushes back more characters
* than fit in the current _bf, or when ungetc() pushes back a character
* that does not match the previous one in _bf. When this happens,
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
*/
#ifdef _REENT_SMALL
/*
* struct __sFILE_fake is the start of a struct __sFILE, with only the
* minimal fields allocated. In __sinit() we really allocate the 3
* standard streams, etc., and point away from this fake.
*/
struct __sFILE_fake {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
struct _reent *_data;
};
/* CHECK_INIT() comes from stdio/local.h; be sure to include that. */
# define _REENT_SMALL_CHECK_INIT(fp) CHECK_INIT(fp)
#else
# define _REENT_SMALL_CHECK_INIT(fp) /* nothing */
#endif
struct __sFILE {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
#ifdef _REENT_SMALL
struct _reent *_data;
#endif
/* operations */
_PTR _cookie; /* cookie passed to io functions */
_READ_WRITE_RETURN_TYPE _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n));
_READ_WRITE_RETURN_TYPE _EXFUN((*_write),(_PTR _cookie, const char *_buf,
int _n));
_fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence));
int _EXFUN((*_close),(_PTR _cookie));
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetline() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetline() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
int _offset; /* current lseek offset */
#ifndef _REENT_SMALL
struct _reent *_data; /* Here for binary compatibility? Remove? */
#endif
#ifndef __SINGLE_THREAD__
_flock_t _lock; /* for thread-safety locking */
#endif
};
#ifdef __LARGE64_FILES
struct __sFILE64 {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
struct _reent *_data;
/* operations */
_PTR _cookie; /* cookie passed to io functions */
_READ_WRITE_RETURN_TYPE _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n));
_READ_WRITE_RETURN_TYPE _EXFUN((*_write),(_PTR _cookie, const char *_buf,
int _n));
_fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence));
int _EXFUN((*_close),(_PTR _cookie));
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetline() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetline() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
int _flags2; /* for future use */
_off64_t _offset; /* current lseek offset */
_fpos64_t _EXFUN((*_seek64),(_PTR _cookie, _fpos64_t _offset, int _whence));
#ifndef __SINGLE_THREAD__
_flock_t _lock; /* for thread-safety locking */
#endif
};
typedef struct __sFILE64 __FILE;
#else
typedef struct __sFILE __FILE;
#endif /* __LARGE64_FILES */
struct _glue
{
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
/*
* rand48 family support
*
* Copyright (c) 1993 Martin Birgmeier
* All rights reserved.
*
* You may redistribute unmodified or modified versions of this source
* code provided that the above copyright notice and this and the
* following conditions are retained.
*
* This software is provided ``as is'', and comes with no warranties
* of any kind. I shall in no event be liable for anything that happens
* to anyone/anything when using this software.
*/
#define _RAND48_SEED_0 (0x330e)
#define _RAND48_SEED_1 (0xabcd)
#define _RAND48_SEED_2 (0x1234)
#define _RAND48_MULT_0 (0xe66d)
#define _RAND48_MULT_1 (0xdeec)
#define _RAND48_MULT_2 (0x0005)
#define _RAND48_ADD (0x000b)
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
#ifdef _REENT_SMALL
/* Put this in here as well, for good luck. */
__extension__ unsigned long long _rand_next;
#endif
};
/* How big the some arrays are. */
#define _REENT_EMERGENCY_SIZE 25
#define _REENT_ASCTIME_SIZE 26
#define _REENT_SIGNAL_SIZE 24
/*
* struct _reent
*
* This structure contains *all* globals needed by the library.
* It's raison d'etre is to facilitate threads by making all library routines
* reentrant. IE: All state information is contained here.
*/
#ifdef _REENT_SMALL
struct _mprec
{
/* used by mprec routines */
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
};
struct _misc_reent
{
/* miscellaneous reentrant data */
char *_strtok_last;
_mbstate_t _mblen_state;
_mbstate_t _wctomb_state;
_mbstate_t _mbtowc_state;
char _l64a_buf[8];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
};
/* This version of _reent is layed our with "int"s in pairs, to help
* ports with 16-bit int's but 32-bit pointers, align nicely. */
struct _reent
{
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
__FILE *_stdin, *_stdout, *_stderr; /* XXX */
int _errno; /* local copy of errno */
int _inc; /* used by tmpnam */
char *_emergency;
int __sdidinit; /* 1 means stdio has been init'd */
int _current_category; /* used by setlocale */
_CONST char *_current_locale;
struct _mprec *_mp;
void _EXFUN((*__cleanup),(struct _reent *));
int _gamma_signgam;
/* used by some fp conversion routines */
int _cvtlen; /* should be size_t */
char *_cvtbuf;
struct _rand48 *_r48;
struct __tm *_localtime_buf;
char *_asctime_buf;
/* signal info */
void (**(_sig_func))(int);
/* atexit stuff */
struct _atexit _atexit;
struct _glue __sglue; /* root of glue chain */
__FILE *__sf; /* file descriptors */
struct __sFILE_fake __sf_fake; /* fake initial stdin/out/err */
struct _misc_reent *_misc; /* strtok, multibyte states */
char *_signal_buf; /* strsignal */
};
#define _REENT_INIT(var) \
{ (__FILE *)&var.__sf_fake, \
(__FILE *)&var.__sf_fake, \
(__FILE *)&var.__sf_fake, \
0, \
0, \
_NULL, \
0, \
0, \
"C", \
_NULL, \
_NULL, \
0, \
0, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
{0, {_NULL}, _NULL}, \
{_NULL, 0, _NULL}, \
_NULL, \
{_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL}, \
_NULL, \
_NULL \
}
#define _REENT_INIT_PTR(var) \
{ var->_stdin = (__FILE *)&var->__sf_fake; \
var->_stdout = (__FILE *)&var->__sf_fake; \
var->_stderr = (__FILE *)&var->__sf_fake; \
var->_errno = 0; \
var->_inc = 0; \
var->_emergency = _NULL; \
var->__sdidinit = 0; \
var->_current_category = 0; \
var->_current_locale = "C"; \
var->_mp = _NULL; \
var->__cleanup = _NULL; \
var->_gamma_signgam = 0; \
var->_cvtlen = 0; \
var->_cvtbuf = _NULL; \
var->_r48 = _NULL; \
var->_localtime_buf = _NULL; \
var->_asctime_buf = _NULL; \
var->_sig_func = _NULL; \
var->_atexit._ind = 0; \
var->_atexit._fns[0] = _NULL; \
var->_atexit._on_exit_args = _NULL; \
var->__sglue._next = _NULL; \
var->__sglue._niobs = 0; \
var->__sglue._iobs = _NULL; \
var->__sf = 0; \
var->__sf_fake._p = _NULL; \
var->__sf_fake._r = 0; \
var->__sf_fake._w = 0; \
var->__sf_fake._flags = 0; \
var->__sf_fake._file = 0; \
var->__sf_fake._bf._base = _NULL; \
var->__sf_fake._bf._size = 0; \
var->__sf_fake._lbfsize = 0; \
var->__sf_fake._data = _NULL; \
var->_misc = _NULL; \
var->_signal_buf = _NULL; \
}
/* Only built the assert() calls if we are built with debugging. */
#if DEBUG
#include <assert.h>
#else
#define assert(x) ((void)0)
#endif
/* Generic _REENT check macro. */
#define _REENT_CHECK(var, what, type, size, init) do { \
struct _reent *_r = (var); \
if (_r->what == NULL) { \
_r->what = (type)malloc(size); \
assert(_r->what); \
init; \
} \
} while (0)
#define _REENT_CHECK_TM(var) \
_REENT_CHECK(var, _localtime_buf, struct __tm *, sizeof *((var)->_localtime_buf), \
/* nothing */)
#define _REENT_CHECK_ASCTIME_BUF(var) \
_REENT_CHECK(var, _asctime_buf, char *, _REENT_ASCTIME_SIZE, \
memset((var)->_asctime_buf, 0, _REENT_ASCTIME_SIZE))
/* Handle the dynamically allocated rand48 structure. */
#define _REENT_INIT_RAND48(var) do { \
struct _reent *_r = (var); \
_r->_r48->_seed[0] = _RAND48_SEED_0; \
_r->_r48->_seed[1] = _RAND48_SEED_1; \
_r->_r48->_seed[2] = _RAND48_SEED_2; \
_r->_r48->_mult[0] = _RAND48_MULT_0; \
_r->_r48->_mult[1] = _RAND48_MULT_1; \
_r->_r48->_mult[2] = _RAND48_MULT_2; \
_r->_r48->_add = _RAND48_ADD; \
} while (0)
#define _REENT_CHECK_RAND48(var) \
_REENT_CHECK(var, _r48, struct _rand48 *, sizeof *((var)->_r48), _REENT_INIT_RAND48((var)))
#define _REENT_INIT_MP(var) do { \
struct _reent *_r = (var); \
_r->_mp->_result_k = 0; \
_r->_mp->_result = _r->_mp->_p5s = _NULL; \
_r->_mp->_freelist = _NULL; \
} while (0)
#define _REENT_CHECK_MP(var) \
_REENT_CHECK(var, _mp, struct _mprec *, sizeof *((var)->_mp), _REENT_INIT_MP(var))
#define _REENT_CHECK_EMERGENCY(var) \
_REENT_CHECK(var, _emergency, char *, _REENT_EMERGENCY_SIZE, /* nothing */)
#define _REENT_INIT_MISC(var) do { \
struct _reent *_r = (var); \
_r->_misc->_strtok_last = _NULL; \
_r->_misc->_mblen_state.__count = 0; \
_r->_misc->_mblen_state.__value.__wch = 0; \
_r->_misc->_wctomb_state.__count = 0; \
_r->_misc->_wctomb_state.__value.__wch = 0; \
_r->_misc->_mbtowc_state.__count = 0; \
_r->_misc->_mbtowc_state.__value.__wch = 0; \
_r->_misc->_mbrlen_state.__count = 0; \
_r->_misc->_mbrlen_state.__value.__wch = 0; \
_r->_misc->_mbrtowc_state.__count = 0; \
_r->_misc->_mbrtowc_state.__value.__wch = 0; \
_r->_misc->_mbsrtowcs_state.__count = 0; \
_r->_misc->_mbsrtowcs_state.__value.__wch = 0; \
_r->_misc->_wcrtomb_state.__count = 0; \
_r->_misc->_wcrtomb_state.__value.__wch = 0; \
_r->_misc->_wcsrtombs_state.__count = 0; \
_r->_misc->_wcsrtombs_state.__value.__wch = 0; \
_r->_misc->_l64a_buf[0] = '\0'; \
_r->_misc->_getdate_err = 0; \
} while (0)
#define _REENT_CHECK_MISC(var) \
_REENT_CHECK(var, _misc, struct _misc_reent *, sizeof *((var)->_misc), _REENT_INIT_MISC(var))
#define _REENT_CHECK_SIGNAL_BUF(var) \
_REENT_CHECK(var, _signal_buf, char *, _REENT_SIGNAL_SIZE, /* nothing */)
#define _REENT_SIGNGAM(ptr) ((ptr)->_gamma_signgam)
#define _REENT_RAND_NEXT(ptr) ((ptr)->_r48->_rand_next)
#define _REENT_RAND48_SEED(ptr) ((ptr)->_r48->_seed)
#define _REENT_RAND48_MULT(ptr) ((ptr)->_r48->_mult)
#define _REENT_RAND48_ADD(ptr) ((ptr)->_r48->_add)
#define _REENT_MP_RESULT(ptr) ((ptr)->_mp->_result)
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_mp->_result_k)
#define _REENT_MP_P5S(ptr) ((ptr)->_mp->_p5s)
#define _REENT_MP_FREELIST(ptr) ((ptr)->_mp->_freelist)
#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_asctime_buf)
#define _REENT_TM(ptr) ((ptr)->_localtime_buf)
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
#define _REENT_STRTOK_LAST(ptr) ((ptr)->_misc->_strtok_last)
#define _REENT_MBLEN_STATE(ptr) ((ptr)->_misc->_mblen_state)
#define _REENT_MBTOWC_STATE(ptr)((ptr)->_misc->_mbtowc_state)
#define _REENT_WCTOMB_STATE(ptr)((ptr)->_misc->_wctomb_state)
#define _REENT_MBRLEN_STATE(ptr) ((ptr)->_misc->_mbrlen_state)
#define _REENT_MBRTOWC_STATE(ptr) ((ptr)->_misc->_mbrtowc_state)
#define _REENT_MBSRTOWCS_STATE(ptr) ((ptr)->_misc->_mbsrtowcs_state)
#define _REENT_WCRTOMB_STATE(ptr) ((ptr)->_misc->_wcrtomb_state)
#define _REENT_WCSRTOMBS_STATE(ptr) ((ptr)->_misc->_wcsrtombs_state)
#define _REENT_L64A_BUF(ptr) ((ptr)->_misc->_l64a_buf)
#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_misc->_getdate_err))
#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_signal_buf)
#else /* !_REENT_SMALL */
struct _reent
{
int _errno; /* local copy of errno */
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
__FILE *_stdin, *_stdout, *_stderr;
int _inc; /* used by tmpnam */
char _emergency[_REENT_EMERGENCY_SIZE];
int _current_category; /* used by setlocale */
_CONST char *_current_locale;
int __sdidinit; /* 1 means stdio has been init'd */
void _EXFUN((*__cleanup),(struct _reent *));
/* used by mprec routines */
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
/* used by some fp conversion routines */
int _cvtlen; /* should be size_t */
char *_cvtbuf;
union
{
struct
{
unsigned int _unused_rand;
char * _strtok_last;
char _asctime_buf[_REENT_ASCTIME_SIZE];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
_mbstate_t _mblen_state;
_mbstate_t _mbtowc_state;
_mbstate_t _wctomb_state;
char _l64a_buf[8];
char _signal_buf[_REENT_SIGNAL_SIZE];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
} _reent;
/* Two next two fields were once used by malloc. They are no longer
used. They are used to preserve the space used before so as to
allow addition of new reent fields and keep binary compatibility. */
struct
{
#define _N_LISTS 30
unsigned char * _nextf[_N_LISTS];
unsigned int _nmalloc[_N_LISTS];
} _unused;
} _new;
/* atexit stuff */
struct _atexit *_atexit; /* points to head of LIFO stack */
struct _atexit _atexit0; /* one guaranteed table, required by ANSI */
/* signal info */
void (**(_sig_func))(int);
/* These are here last so that __FILE can grow without changing the offsets
of the above members (on the off chance that future binary compatibility
would be broken otherwise). */
struct _glue __sglue; /* root of glue chain */
__FILE __sf[3]; /* first three file descriptors */
};
#define _REENT_INIT(var) \
{ 0, \
&var.__sf[0], \
&var.__sf[1], \
&var.__sf[2], \
0, \
"", \
0, \
"C", \
0, \
_NULL, \
_NULL, \
0, \
_NULL, \
_NULL, \
0, \
_NULL, \
{ \
{ \
0, \
_NULL, \
"", \
{0, 0, 0, 0, 0, 0, 0, 0, 0}, \
0, \
1, \
{ \
{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \
{_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, \
_RAND48_ADD \
}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
"", \
"", \
0, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}} \
} \
}, \
_NULL, \
{_NULL, 0, {_NULL}, {{_NULL}, 0}}, \
_NULL, \
{_NULL, 0, _NULL} \
}
#define _REENT_INIT_PTR(var) \
{ var->_errno = 0; \
var->_stdin = &var->__sf[0]; \
var->_stdout = &var->__sf[1]; \
var->_stderr = &var->__sf[2]; \
var->_inc = 0; \
memset(&var->_emergency, 0, sizeof(var->_emergency)); \
var->_current_category = 0; \
var->_current_locale = "C"; \
var->__sdidinit = 0; \
var->__cleanup = _NULL; \
var->_result = _NULL; \
var->_result_k = 0; \
var->_p5s = _NULL; \
var->_freelist = _NULL; \
var->_cvtlen = 0; \
var->_cvtbuf = _NULL; \
var->_new._reent._unused_rand = 0; \
var->_new._reent._strtok_last = _NULL; \
var->_new._reent._asctime_buf[0] = 0; \
memset(&var->_new._reent._localtime_buf, 0, sizeof(var->_new._reent._localtime_buf)); \
var->_new._reent._gamma_signgam = 0; \
var->_new._reent._rand_next = 1; \
var->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
var->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
var->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
var->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
var->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
var->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
var->_new._reent._r48._add = _RAND48_ADD; \
var->_new._reent._mblen_state.__count = 0; \
var->_new._reent._mblen_state.__value.__wch = 0; \
var->_new._reent._mbtowc_state.__count = 0; \
var->_new._reent._mbtowc_state.__value.__wch = 0; \
var->_new._reent._wctomb_state.__count = 0; \
var->_new._reent._wctomb_state.__value.__wch = 0; \
var->_new._reent._mbrlen_state.__count = 0; \
var->_new._reent._mbrlen_state.__value.__wch = 0; \
var->_new._reent._mbrtowc_state.__count = 0; \
var->_new._reent._mbrtowc_state.__value.__wch = 0; \
var->_new._reent._mbsrtowcs_state.__count = 0; \
var->_new._reent._mbsrtowcs_state.__value.__wch = 0; \
var->_new._reent._wcrtomb_state.__count = 0; \
var->_new._reent._wcrtomb_state.__value.__wch = 0; \
var->_new._reent._wcsrtombs_state.__count = 0; \
var->_new._reent._wcsrtombs_state.__value.__wch = 0; \
var->_new._reent._l64a_buf[0] = '\0'; \
var->_new._reent._signal_buf[0] = '\0'; \
var->_new._reent._getdate_err = 0; \
var->_atexit = _NULL; \
var->_atexit0._next = _NULL; \
var->_atexit0._ind = 0; \
var->_atexit0._fns[0] = _NULL; \
var->_atexit0._on_exit_args._fntypes = 0; \
var->_atexit0._on_exit_args._fnargs[0] = _NULL; \
var->_sig_func = _NULL; \
var->__sglue._next = _NULL; \
var->__sglue._niobs = 0; \
var->__sglue._iobs = _NULL; \
memset(&var->__sf, 0, sizeof(var->__sf)); \
}
#define _REENT_CHECK_RAND48(ptr) /* nothing */
#define _REENT_CHECK_MP(ptr) /* nothing */
#define _REENT_CHECK_TM(ptr) /* nothing */
#define _REENT_CHECK_ASCTIME_BUF(ptr) /* nothing */
#define _REENT_CHECK_EMERGENCY(ptr) /* nothing */
#define _REENT_CHECK_MISC(ptr) /* nothing */
#define _REENT_CHECK_SIGNAL_BUF(ptr) /* nothing */
#define _REENT_SIGNGAM(ptr) ((ptr)->_new._reent._gamma_signgam)
#define _REENT_RAND_NEXT(ptr) ((ptr)->_new._reent._rand_next)
#define _REENT_RAND48_SEED(ptr) ((ptr)->_new._reent._r48._seed)
#define _REENT_RAND48_MULT(ptr) ((ptr)->_new._reent._r48._mult)
#define _REENT_RAND48_ADD(ptr) ((ptr)->_new._reent._r48._add)
#define _REENT_MP_RESULT(ptr) ((ptr)->_result)
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_result_k)
#define _REENT_MP_P5S(ptr) ((ptr)->_p5s)
#define _REENT_MP_FREELIST(ptr) ((ptr)->_freelist)
#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_new._reent._asctime_buf)
#define _REENT_TM(ptr) (&(ptr)->_new._reent._localtime_buf)
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
#define _REENT_STRTOK_LAST(ptr) ((ptr)->_new._reent._strtok_last)
#define _REENT_MBLEN_STATE(ptr) ((ptr)->_new._reent._mblen_state)
#define _REENT_MBTOWC_STATE(ptr)((ptr)->_new._reent._mbtowc_state)
#define _REENT_WCTOMB_STATE(ptr)((ptr)->_new._reent._wctomb_state)
#define _REENT_MBRLEN_STATE(ptr)((ptr)->_new._reent._mbrlen_state)
#define _REENT_MBRTOWC_STATE(ptr)((ptr)->_new._reent._mbrtowc_state)
#define _REENT_MBSRTOWCS_STATE(ptr)((ptr)->_new._reent._mbsrtowcs_state)
#define _REENT_WCRTOMB_STATE(ptr)((ptr)->_new._reent._wcrtomb_state)
#define _REENT_WCSRTOMBS_STATE(ptr)((ptr)->_new._reent._wcsrtombs_state)
#define _REENT_L64A_BUF(ptr) ((ptr)->_new._reent._l64a_buf)
#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_new._reent._signal_buf)
#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_new._reent._getdate_err))
#endif /* !_REENT_SMALL */
#define _NULL 0
/*
* All references to struct _reent are via this pointer.
* Internally, newlib routines that need to reference it should use _REENT.
*/
#ifndef __ATTRIBUTE_IMPURE_PTR__
#define __ATTRIBUTE_IMPURE_PTR__
#endif
extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
extern struct _reent *_CONST _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
void _reclaim_reent _PARAMS ((struct _reent *));
/* #define _REENT_ONLY define this to get only reentrant routines */
#ifndef _REENT_ONLY
#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__)
#ifndef __getreent
struct _reent * _EXFUN(__getreent, (void));
#endif
# define _REENT (__getreent())
#else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
# define _REENT _impure_ptr
#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
#endif /* !_REENT_ONLY */
#define _GLOBAL_REENT _impure_ptr
#ifdef __cplusplus
}
#endif
#endif /* _SYS_REENT_H_ */