Search
lxdream.org :: lxdream/test/lib-arm/newlib-1.8.2-aica.patch
lxdream 0.9.1
released Jun 29
Download Now
filename test/lib-arm/newlib-1.8.2-aica.patch
changeset 831:677a887f3e06
author nkeynes
date Fri Dec 02 18:18:04 2011 +1000 (10 years ago)
permissions -rw-r--r--
last change SH4 shadow-mode tweaks
- Fix exceptions generated by the translator to account for the excepting
instruction(s) in the cycle counts.
- Compare floating point regs bitwise rather than with FP comparisons
(otherwise can fail due to nan != nan)
- Dump the translated block when we abort with an inconsistency
view annotate diff log raw
     1 diff -urN newlib-1.8.2/config.sub newlib-1.8.2-aica/config.sub
     2 --- newlib-1.8.2/config.sub	2008-08-15 12:02:09.000000000 +1000
     3 +++ newlib-1.8.2-aica/config.sub	2008-08-13 11:59:17.000000000 +1000
     4 @@ -956,7 +956,7 @@
     5  	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
     6  	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
     7  	      | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit* \
     8 -		  | -dreamcast* )
     9 +		  | -dreamcast* | -aica* )
    10  	# Remember, each alternative MUST END IN *, to match a version number.
    11  		;;
    12  	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
    13 diff -urN newlib-1.8.2/configure.in newlib-1.8.2-aica/configure.in
    14 --- newlib-1.8.2/configure.in	2008-08-15 12:02:09.000000000 +1000
    15 +++ newlib-1.8.2-aica/configure.in	2008-08-13 11:58:57.000000000 +1000
    16 @@ -606,6 +606,9 @@
    17  	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
    18      fi
    19      ;;
    20 +  arm-*-aica*)
    21 +    noconfigdirs="$noconfigdirs target-libgloss"
    22 +    ;;
    23    arm-*-oabi*)
    24      noconfigdirs="$noconfigdirs target-libgloss"
    25      ;;
    26 diff -urN newlib-1.8.2/newlib/configure.host newlib-1.8.2-aica/newlib/configure.host
    27 --- newlib-1.8.2/newlib/configure.host	2008-08-15 12:02:09.000000000 +1000
    28 +++ newlib-1.8.2-aica/newlib/configure.host	2008-08-13 20:01:25.000000000 +1000
    29 @@ -194,6 +194,10 @@
    30    *-*-dc* | *-*-dreamcast*)
    31  	sys_dir=dreamcast
    32  	;;
    33 +  *-*-aica*)
    34 +	sys_dir=aica
    35 +	newlib_cflags="${newlib_cflags} -mcpu=arm7tdmi"
    36 +	;;
    37    *-*-netware*)
    38  	signal_dir=
    39  	sys_dir=netware
    40 diff -urN newlib-1.8.2/newlib/libc/sys/aica/Makefile.am newlib-1.8.2-aica/newlib/libc/sys/aica/Makefile.am
    41 --- newlib-1.8.2/newlib/libc/sys/aica/Makefile.am	1970-01-01 10:00:00.000000000 +1000
    42 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/Makefile.am	2008-08-13 11:54:44.000000000 +1000
    43 @@ -0,0 +1,17 @@
    44 +## Process this file with automake to generate Makefile.in
    45 +
    46 +AUTOMAKE_OPTIONS = cygnus
    47 +
    48 +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
    49 +
    50 +noinst_LIBRARIES = lib.a
    51 +
    52 +lib_a_SOURCES = absolute_vfs.c chdir.c chmod.c close.c creat.c dcload_vfs.c dcload.S \
    53 +  exit.c fcntl.c fstat.c getpid.c gettimeofday.c ioctl.c isatty.c kill.c \
    54 +  link.c lseek.c mkdir.c open.c read.c rmdir.c sbrk.c scif.c stat.c \
    55 +  stdio_vfs.c times.c unlink.c vfs.c write.c dup.c
    56 +
    57 +all: crt0.o
    58 +
    59 +ACLOCAL_AMFLAGS = -I ../../..
    60 +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
    61 diff -urN newlib-1.8.2/newlib/libc/sys/aica/Makefile.in newlib-1.8.2-aica/newlib/libc/sys/aica/Makefile.in
    62 --- newlib-1.8.2/newlib/libc/sys/aica/Makefile.in	1970-01-01 10:00:00.000000000 +1000
    63 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/Makefile.in	2008-08-13 11:54:44.000000000 +1000
    64 @@ -0,0 +1,322 @@
    65 +# Makefile.in generated automatically by automake 1.4 from Makefile.am
    66 +
    67 +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
    68 +# This Makefile.in is free software; the Free Software Foundation
    69 +# gives unlimited permission to copy and/or distribute it,
    70 +# with or without modifications, as long as this notice is preserved.
    71 +
    72 +# This program is distributed in the hope that it will be useful,
    73 +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
    74 +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
    75 +# PARTICULAR PURPOSE.
    76 +
    77 +
    78 +SHELL = @SHELL@
    79 +
    80 +srcdir = @srcdir@
    81 +top_srcdir = @top_srcdir@
    82 +VPATH = @srcdir@
    83 +prefix = @prefix@
    84 +exec_prefix = @exec_prefix@
    85 +
    86 +bindir = @bindir@
    87 +sbindir = @sbindir@
    88 +libexecdir = @libexecdir@
    89 +datadir = @datadir@
    90 +sysconfdir = @sysconfdir@
    91 +sharedstatedir = @sharedstatedir@
    92 +localstatedir = @localstatedir@
    93 +libdir = @libdir@
    94 +infodir = @infodir@
    95 +mandir = @mandir@
    96 +includedir = @includedir@
    97 +oldincludedir = /usr/include
    98 +
    99 +DESTDIR =
   100 +
   101 +pkgdatadir = $(datadir)/@PACKAGE@
   102 +pkglibdir = $(libdir)/@PACKAGE@
   103 +pkgincludedir = $(includedir)/@PACKAGE@
   104 +
   105 +top_builddir = .
   106 +
   107 +ACLOCAL = @ACLOCAL@
   108 +AUTOCONF = @AUTOCONF@
   109 +AUTOMAKE = @AUTOMAKE@
   110 +AUTOHEADER = @AUTOHEADER@
   111 +
   112 +INSTALL = @INSTALL@
   113 +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
   114 +INSTALL_DATA = @INSTALL_DATA@
   115 +INSTALL_SCRIPT = @INSTALL_SCRIPT@
   116 +transform = @program_transform_name@
   117 +
   118 +NORMAL_INSTALL = :
   119 +PRE_INSTALL = :
   120 +POST_INSTALL = :
   121 +NORMAL_UNINSTALL = :
   122 +PRE_UNINSTALL = :
   123 +POST_UNINSTALL = :
   124 +host_alias = @host_alias@
   125 +host_triplet = @host@
   126 +AR = @AR@
   127 +AS = @AS@
   128 +CC = @CC@
   129 +CPP = @CPP@
   130 +EXEEXT = @EXEEXT@
   131 +MAKEINFO = @MAKEINFO@
   132 +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
   133 +PACKAGE = @PACKAGE@
   134 +RANLIB = @RANLIB@
   135 +VERSION = @VERSION@
   136 +machine_dir = @machine_dir@
   137 +newlib_basedir = @newlib_basedir@
   138 +sys_dir = @sys_dir@
   139 +
   140 +AUTOMAKE_OPTIONS = cygnus
   141 +
   142 +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
   143 +
   144 +noinst_LIBRARIES = lib.a
   145 +
   146 +lib_a_SOURCES = absolute_vfs.c chdir.c chmod.c close.c creat.c dcload_vfs.c dcload.S   exit.c fcntl.c fstat.c getpid.c gettimeofday.c ioctl.c isatty.c kill.c   link.c lseek.c mkdir.c open.c read.c rmdir.c sbrk.c scif.c stat.c   stdio_vfs.c times.c unlink.c vfs.c write.c dup.c
   147 +
   148 +
   149 +ACLOCAL_AMFLAGS = -I ../../..
   150 +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
   151 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
   152 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
   153 +CONFIG_CLEAN_FILES = 
   154 +LIBRARIES =  $(noinst_LIBRARIES)
   155 +
   156 +
   157 +DEFS = @DEFS@ -I. -I$(srcdir) 
   158 +CPPFLAGS = @CPPFLAGS@
   159 +LDFLAGS = @LDFLAGS@
   160 +LIBS = @LIBS@
   161 +lib_a_LIBADD = 
   162 +lib_a_OBJECTS =  absolute_vfs.o chdir.o chmod.o close.o creat.o \
   163 +dcload_vfs.o dcload.o exit.o fcntl.o fstat.o getpid.o gettimeofday.o ioctl.o \
   164 +isatty.o kill.o link.o lseek.o mkdir.o open.o read.o rmdir.o sbrk.o \
   165 +scif.o stat.o stdio_vfs.o times.o unlink.o vfs.o write.o dup.o
   166 +CFLAGS = @CFLAGS@
   167 +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
   168 +CCLD = $(CC)
   169 +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
   170 +DIST_COMMON =  Makefile.am Makefile.in aclocal.m4 configure configure.in
   171 +
   172 +
   173 +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
   174 +
   175 +TAR = tar
   176 +GZIP_ENV = --best
   177 +SOURCES = $(lib_a_SOURCES)
   178 +OBJECTS = $(lib_a_OBJECTS)
   179 +
   180 +all: all-redirect
   181 +.SUFFIXES:
   182 +.SUFFIXES: .S .c .o .s
   183 +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
   184 +	cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
   185 +
   186 +Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
   187 +	cd $(top_builddir) \
   188 +	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
   189 +
   190 +$(ACLOCAL_M4):  configure.in  ../../../acinclude.m4 ../../../aclocal.m4
   191 +	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
   192 +
   193 +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
   194 +	$(SHELL) ./config.status --recheck
   195 +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
   196 +	cd $(srcdir) && $(AUTOCONF)
   197 +
   198 +mostlyclean-noinstLIBRARIES:
   199 +
   200 +clean-noinstLIBRARIES:
   201 +	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
   202 +
   203 +distclean-noinstLIBRARIES:
   204 +
   205 +maintainer-clean-noinstLIBRARIES:
   206 +
   207 +.c.o:
   208 +	$(COMPILE) -c $<
   209 +
   210 +.s.o:
   211 +	$(COMPILE) -c $<
   212 +
   213 +.S.o:
   214 +	$(COMPILE) -c $<
   215 +
   216 +mostlyclean-compile:
   217 +	-rm -f *.o core *.core
   218 +
   219 +clean-compile:
   220 +
   221 +distclean-compile:
   222 +	-rm -f *.tab.c
   223 +
   224 +maintainer-clean-compile:
   225 +
   226 +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
   227 +	-rm -f lib.a
   228 +	$(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
   229 +	$(RANLIB) lib.a
   230 +
   231 +tags: TAGS
   232 +
   233 +ID: $(HEADERS) $(SOURCES) $(LISP)
   234 +	list='$(SOURCES) $(HEADERS)'; \
   235 +	unique=`for i in $$list; do echo $$i; done | \
   236 +	  awk '    { files[$$0] = 1; } \
   237 +	       END { for (i in files) print i; }'`; \
   238 +	here=`pwd` && cd $(srcdir) \
   239 +	  && mkid -f$$here/ID $$unique $(LISP)
   240 +
   241 +TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
   242 +	tags=; \
   243 +	here=`pwd`; \
   244 +	list='$(SOURCES) $(HEADERS)'; \
   245 +	unique=`for i in $$list; do echo $$i; done | \
   246 +	  awk '    { files[$$0] = 1; } \
   247 +	       END { for (i in files) print i; }'`; \
   248 +	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
   249 +	  || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $$unique $(LISP) -o $$here/TAGS)
   250 +
   251 +mostlyclean-tags:
   252 +
   253 +clean-tags:
   254 +
   255 +distclean-tags:
   256 +	-rm -f TAGS ID
   257 +
   258 +maintainer-clean-tags:
   259 +
   260 +distdir = $(PACKAGE)-$(VERSION)
   261 +top_distdir = $(distdir)
   262 +
   263 +# This target untars the dist file and tries a VPATH configuration.  Then
   264 +# it guarantees that the distribution is self-contained by making another
   265 +# tarfile.
   266 +distcheck: dist
   267 +	-rm -rf $(distdir)
   268 +	GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
   269 +	mkdir $(distdir)/=build
   270 +	mkdir $(distdir)/=inst
   271 +	dc_install_base=`cd $(distdir)/=inst && pwd`; \
   272 +	cd $(distdir)/=build \
   273 +	  && ../configure --srcdir=.. --prefix=$$dc_install_base \
   274 +	  && $(MAKE) $(AM_MAKEFLAGS) \
   275 +	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
   276 +	  && $(MAKE) $(AM_MAKEFLAGS) check \
   277 +	  && $(MAKE) $(AM_MAKEFLAGS) install \
   278 +	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
   279 +	  && $(MAKE) $(AM_MAKEFLAGS) dist
   280 +	-rm -rf $(distdir)
   281 +	@banner="$(distdir).tar.gz is ready for distribution"; \
   282 +	dashes=`echo "$$banner" | sed s/./=/g`; \
   283 +	echo "$$dashes"; \
   284 +	echo "$$banner"; \
   285 +	echo "$$dashes"
   286 +dist: distdir
   287 +	-chmod -R a+r $(distdir)
   288 +	GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
   289 +	-rm -rf $(distdir)
   290 +dist-all: distdir
   291 +	-chmod -R a+r $(distdir)
   292 +	GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
   293 +	-rm -rf $(distdir)
   294 +distdir: $(DISTFILES)
   295 +	-rm -rf $(distdir)
   296 +	mkdir $(distdir)
   297 +	-chmod 777 $(distdir)
   298 +	@for file in $(DISTFILES); do \
   299 +	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
   300 +	  if test -d $$d/$$file; then \
   301 +	    cp -pr $$d/$$file $(distdir)/$$file; \
   302 +	  else \
   303 +	    test -f $(distdir)/$$file \
   304 +	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
   305 +	    || cp -p $$d/$$file $(distdir)/$$file || :; \
   306 +	  fi; \
   307 +	done
   308 +info-am:
   309 +info: info-am
   310 +dvi-am:
   311 +dvi: dvi-am
   312 +check-am:
   313 +check: check-am
   314 +installcheck-am:
   315 +installcheck: installcheck-am
   316 +install-info-am: 
   317 +install-info: install-info-am
   318 +install-exec-am:
   319 +install-exec: install-exec-am
   320 +
   321 +install-data-am:
   322 +install-data: install-data-am
   323 +
   324 +install-am: all-am
   325 +	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
   326 +install: install-am
   327 +uninstall-am:
   328 +uninstall: uninstall-am
   329 +all-am: Makefile $(LIBRARIES)
   330 +all-redirect: all-am
   331 +install-strip:
   332 +	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
   333 +installdirs:
   334 +
   335 +
   336 +mostlyclean-generic:
   337 +
   338 +clean-generic:
   339 +
   340 +distclean-generic:
   341 +	-rm -f Makefile $(CONFIG_CLEAN_FILES)
   342 +	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
   343 +
   344 +maintainer-clean-generic:
   345 +mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
   346 +		mostlyclean-tags mostlyclean-generic
   347 +
   348 +mostlyclean: mostlyclean-am
   349 +
   350 +clean-am:  clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
   351 +		mostlyclean-am
   352 +
   353 +clean: clean-am
   354 +
   355 +distclean-am:  distclean-noinstLIBRARIES distclean-compile \
   356 +		distclean-tags distclean-generic clean-am
   357 +
   358 +distclean: distclean-am
   359 +	-rm -f config.status
   360 +
   361 +maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
   362 +		maintainer-clean-compile maintainer-clean-tags \
   363 +		maintainer-clean-generic distclean-am
   364 +	@echo "This command is intended for maintainers to use;"
   365 +	@echo "it deletes files that may require special tools to rebuild."
   366 +
   367 +maintainer-clean: maintainer-clean-am
   368 +	-rm -f config.status
   369 +
   370 +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
   371 +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
   372 +mostlyclean-compile distclean-compile clean-compile \
   373 +maintainer-clean-compile tags mostlyclean-tags distclean-tags \
   374 +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
   375 +check-am installcheck-am installcheck install-info-am install-info \
   376 +install-exec-am install-exec install-data-am install-data install-am \
   377 +install uninstall-am uninstall all-redirect all-am all installdirs \
   378 +mostlyclean-generic distclean-generic clean-generic \
   379 +maintainer-clean-generic clean mostlyclean distclean maintainer-clean
   380 +
   381 +
   382 +all: crt0.o
   383 +
   384 +# Tell versions [3.59,3.63) of GNU make to not export all variables.
   385 +# Otherwise a system limit (for SysV at least) may be exceeded.
   386 +.NOEXPORT:
   387 diff -urN newlib-1.8.2/newlib/libc/sys/aica/absolute_vfs.c newlib-1.8.2-aica/newlib/libc/sys/aica/absolute_vfs.c
   388 --- newlib-1.8.2/newlib/libc/sys/aica/absolute_vfs.c	1970-01-01 10:00:00.000000000 +1000
   389 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/absolute_vfs.c	2008-08-13 11:54:44.000000000 +1000
   390 @@ -0,0 +1,11 @@
   391 +#include "vfs.h"
   392 +
   393 +int _newlib_vfs_is_absolute (void)
   394 +{
   395 +  return 0;
   396 +}
   397 +
   398 +void _newlib_vfs_absolute_load (void)
   399 +{
   400 +  _newlib_vfs_initialized = VFS_LOADER_ABSOLUTE;
   401 +}
   402 diff -urN newlib-1.8.2/newlib/libc/sys/aica/aclocal.m4 newlib-1.8.2-aica/newlib/libc/sys/aica/aclocal.m4
   403 --- newlib-1.8.2/newlib/libc/sys/aica/aclocal.m4	1970-01-01 10:00:00.000000000 +1000
   404 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/aclocal.m4	2008-08-13 11:54:44.000000000 +1000
   405 @@ -0,0 +1,345 @@
   406 +dnl aclocal.m4 generated automatically by aclocal 1.3b
   407 +
   408 +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
   409 +dnl This file is free software; the Free Software Foundation
   410 +dnl gives unlimited permission to copy and/or distribute it,
   411 +dnl with or without modifications, as long as this notice is preserved.
   412 +
   413 +dnl This program is distributed in the hope that it will be useful,
   414 +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
   415 +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   416 +dnl PARTICULAR PURPOSE.
   417 +
   418 +dnl This provides configure definitions used by all the newlib
   419 +dnl configure.in files.
   420 +
   421 +dnl Basic newlib configury.  This calls basic introductory stuff,
   422 +dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST.  It also runs
   423 +dnl configure.host.  The only argument is the relative path to the top
   424 +dnl newlib directory.
   425 +
   426 +AC_DEFUN(NEWLIB_CONFIGURE,
   427 +[
   428 +dnl Default to --enable-multilib
   429 +AC_ARG_ENABLE(multilib,
   430 +[  --enable-multilib         build many library versions (default)],
   431 +[case "${enableval}" in
   432 +  yes) multilib=yes ;;
   433 +  no)  multilib=no ;;
   434 +  *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
   435 + esac], [multilib=yes])dnl
   436 +
   437 +dnl Support --enable-target-optspace
   438 +AC_ARG_ENABLE(target-optspace,
   439 +[  --enable-target-optspace  optimize for space],
   440 +[case "${enableval}" in
   441 +  yes) target_optspace=yes ;;
   442 +  no)  target_optspace=no ;;
   443 +  *)   AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
   444 + esac], [target_optspace=])dnl
   445 +
   446 +dnl Support --enable-newlib-mb
   447 +AC_ARG_ENABLE(newlib-mb,
   448 +[  --enable-newlib-mb        enable multibyte support],
   449 +[case "${enableval}" in
   450 +  yes) newlib_mb=yes ;;
   451 +  no)  newlib_mb=no ;;
   452 +  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
   453 + esac], [newlib_mb=no])dnl
   454 +
   455 +dnl We may get other options which we don't document:
   456 +dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
   457 +
   458 +test -z "[$]{with_target_subdir}" && with_target_subdir=.
   459 +
   460 +if test "[$]{srcdir}" = "."; then
   461 +  if test "[$]{with_target_subdir}" != "."; then
   462 +    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
   463 +  else
   464 +    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
   465 +  fi
   466 +else
   467 +  newlib_basedir="[$]{srcdir}/$1"
   468 +fi
   469 +AC_SUBST(newlib_basedir)
   470 +
   471 +AC_CANONICAL_HOST
   472 +
   473 +AM_INIT_AUTOMAKE(newlib, 1.8.1)
   474 +
   475 +# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
   476 +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
   477 +# are probably using a cross compiler, which will not be able to fully
   478 +# link an executable.  This should really be fixed in autoconf
   479 +# itself.
   480 +
   481 +AC_DEFUN(LIB_AC_PROG_CC,
   482 +[AC_BEFORE([$0], [AC_PROG_CPP])dnl
   483 +AC_CHECK_PROG(CC, gcc, gcc)
   484 +if test -z "$CC"; then
   485 +  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
   486 +  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
   487 +fi
   488 +
   489 +AC_PROG_CC_GNU
   490 +
   491 +if test $ac_cv_prog_gcc = yes; then
   492 +  GCC=yes
   493 +dnl Check whether -g works, even if CFLAGS is set, in case the package
   494 +dnl plays around with CFLAGS (such as to build both debugging and
   495 +dnl normal versions of a library), tasteless as that idea is.
   496 +  ac_test_CFLAGS="${CFLAGS+set}"
   497 +  ac_save_CFLAGS="$CFLAGS"
   498 +  CFLAGS=
   499 +  AC_PROG_CC_G
   500 +  if test "$ac_test_CFLAGS" = set; then
   501 +    CFLAGS="$ac_save_CFLAGS"
   502 +  elif test $ac_cv_prog_cc_g = yes; then
   503 +    CFLAGS="-g -O2"
   504 +  else
   505 +    CFLAGS="-O2"
   506 +  fi
   507 +else
   508 +  GCC=
   509 +  test "${CFLAGS+set}" = set || CFLAGS="-g"
   510 +fi
   511 +])
   512 +
   513 +LIB_AC_PROG_CC
   514 +
   515 +# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
   516 +# run it explicitly here, it will be run implicitly before
   517 +# NEWLIB_CONFIGURE, which doesn't work because that means that it will
   518 +# be run before AC_CANONICAL_HOST.
   519 +AC_CANONICAL_BUILD
   520 +
   521 +AC_CHECK_TOOL(AS, as)
   522 +AC_CHECK_TOOL(AR, ar)
   523 +AC_CHECK_TOOL(RANLIB, ranlib, :)
   524 +
   525 +AM_PROG_INSTALL
   526 +
   527 +#AM_MAINTAINER_MODE
   528 +
   529 +# We need AM_EXEEXT to keep automake happy in cygnus mode.  However,
   530 +# at least currently, we never actually build a program, so we never
   531 +# need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
   532 +# fails, because we are probably configuring with a cross compiler
   533 +# which can't create executables.  So we include AM_EXEEXT to keep
   534 +# automake happy, but we don't execute it, since we don't care about
   535 +# the result.
   536 +if false; then
   537 +  AM_EXEEXT
   538 +fi
   539 +
   540 +. [$]{newlib_basedir}/configure.host
   541 +
   542 +case [$]{newlib_basedir} in
   543 +/* | [A-Za-z]:[/\\]*) newlib_flagbasedir=[$]{newlib_basedir} ;;
   544 +*) newlib_flagbasedir='[$](top_builddir)/'[$]{newlib_basedir} ;;
   545 +esac
   546 +
   547 +newlib_cflags="[$]{newlib_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{newlib_flagbasedir}/libc/include"
   548 +case "${host}" in
   549 +  *-*-cygwin32*)
   550 +    newlib_cflags="[$]{newlib_cflags} -I[$]{newlib_flagbasedir}/../winsup/include"
   551 +    ;;
   552 +esac
   553 +
   554 +newlib_cflags="[$]{newlib_cflags} -fno-builtin"
   555 +
   556 +NEWLIB_CFLAGS=${newlib_cflags}
   557 +AC_SUBST(NEWLIB_CFLAGS)
   558 +
   559 +AC_SUBST(machine_dir)
   560 +AC_SUBST(sys_dir)
   561 +])
   562 +
   563 +# Do all the work for Automake.  This macro actually does too much --
   564 +# some checks are only needed if your package does certain things.
   565 +# But this isn't really a big deal.
   566 +
   567 +# serial 1
   568 +
   569 +dnl Usage:
   570 +dnl AM_INIT_AUTOMAKE(package,version, [no-define])
   571 +
   572 +AC_DEFUN(AM_INIT_AUTOMAKE,
   573 +[AC_REQUIRE([AM_PROG_INSTALL])
   574 +PACKAGE=[$1]
   575 +AC_SUBST(PACKAGE)
   576 +VERSION=[$2]
   577 +AC_SUBST(VERSION)
   578 +dnl test to see if srcdir already configured
   579 +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   580 +  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
   581 +fi
   582 +ifelse([$3],,
   583 +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
   584 +AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
   585 +AC_REQUIRE([AM_SANITY_CHECK])
   586 +AC_REQUIRE([AC_ARG_PROGRAM])
   587 +dnl FIXME This is truly gross.
   588 +missing_dir=`cd $ac_aux_dir && pwd`
   589 +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
   590 +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
   591 +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
   592 +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
   593 +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
   594 +AC_REQUIRE([AC_PROG_MAKE_SET])])
   595 +
   596 +
   597 +# serial 1
   598 +
   599 +AC_DEFUN(AM_PROG_INSTALL,
   600 +[AC_REQUIRE([AC_PROG_INSTALL])
   601 +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
   602 +AC_SUBST(INSTALL_SCRIPT)dnl
   603 +])
   604 +
   605 +#
   606 +# Check to make sure that the build environment is sane.
   607 +#
   608 +
   609 +AC_DEFUN(AM_SANITY_CHECK,
   610 +[AC_MSG_CHECKING([whether build environment is sane])
   611 +# Just in case
   612 +sleep 1
   613 +echo timestamp > conftestfile
   614 +# Do `set' in a subshell so we don't clobber the current shell's
   615 +# arguments.  Must try -L first in case configure is actually a
   616 +# symlink; some systems play weird games with the mod time of symlinks
   617 +# (eg FreeBSD returns the mod time of the symlink's containing
   618 +# directory).
   619 +if (
   620 +   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
   621 +   if test "[$]*" = "X"; then
   622 +      # -L didn't work.
   623 +      set X `ls -t $srcdir/configure conftestfile`
   624 +   fi
   625 +   if test "[$]*" != "X $srcdir/configure conftestfile" \
   626 +      && test "[$]*" != "X conftestfile $srcdir/configure"; then
   627 +
   628 +      # If neither matched, then we have a broken ls.  This can happen
   629 +      # if, for instance, CONFIG_SHELL is bash and it inherits a
   630 +      # broken ls alias from the environment.  This has actually
   631 +      # happened.  Such a system could not be considered "sane".
   632 +      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
   633 +alias in your environment])
   634 +   fi
   635 +
   636 +   test "[$]2" = conftestfile
   637 +   )
   638 +then
   639 +   # Ok.
   640 +   :
   641 +else
   642 +   AC_MSG_ERROR([newly created file is older than distributed files!
   643 +Check your system clock])
   644 +fi
   645 +rm -f conftest*
   646 +AC_MSG_RESULT(yes)])
   647 +
   648 +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
   649 +dnl The program must properly implement --version.
   650 +AC_DEFUN(AM_MISSING_PROG,
   651 +[AC_MSG_CHECKING(for working $2)
   652 +# Run test in a subshell; some versions of sh will print an error if
   653 +# an executable is not found, even if stderr is redirected.
   654 +# Redirect stdin to placate older versions of autoconf.  Sigh.
   655 +if ($2 --version) < /dev/null > /dev/null 2>&1; then
   656 +   $1=$2
   657 +   AC_MSG_RESULT(found)
   658 +else
   659 +   $1="$3/missing $2"
   660 +   AC_MSG_RESULT(missing)
   661 +fi
   662 +AC_SUBST($1)])
   663 +
   664 +# Add --enable-maintainer-mode option to configure.
   665 +# From Jim Meyering
   666 +
   667 +# serial 1
   668 +
   669 +AC_DEFUN(AM_MAINTAINER_MODE,
   670 +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   671 +  dnl maintainer-mode is disabled by default
   672 +  AC_ARG_ENABLE(maintainer-mode,
   673 +[  --enable-maintainer-mode enable make rules and dependencies not useful
   674 +                          (and sometimes confusing) to the casual installer],
   675 +      USE_MAINTAINER_MODE=$enableval,
   676 +      USE_MAINTAINER_MODE=no)
   677 +  AC_MSG_RESULT($USE_MAINTAINER_MODE)
   678 +  if test $USE_MAINTAINER_MODE = yes; then
   679 +    MAINT=
   680 +  else
   681 +    MAINT='#M#'
   682 +  fi
   683 +#  AC_SUBST(MAINT)dnl
   684 +]
   685 +)
   686 +
   687 +# Check to see if we're running under Win32, without using
   688 +# AC_CANONICAL_*.  If so, set output variable EXEEXT to ".exe".
   689 +# Otherwise set it to "".
   690 +
   691 +dnl AM_EXEEXT()
   692 +dnl This knows we add .exe if we're building in the Cygwin32
   693 +dnl environment. But if we're not, then it compiles a test program
   694 +dnl to see if there is a suffix for executables.
   695 +AC_DEFUN(AM_EXEEXT,
   696 +[AC_REQUIRE([AM_CYGWIN32])
   697 +AC_REQUIRE([AM_MINGW32])
   698 +AC_MSG_CHECKING([for executable suffix])
   699 +AC_CACHE_VAL(am_cv_exeext,
   700 +[if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
   701 +am_cv_exeext=.exe
   702 +else
   703 +cat > am_c_test.c << 'EOF'
   704 +int main() {
   705 +/* Nothing needed here */
   706 +}
   707 +EOF
   708 +${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
   709 +am_cv_exeext=
   710 +for file in am_c_test.*; do
   711 +   case $file in
   712 +    *.c) ;;
   713 +    *.o) ;;
   714 +    *) am_cv_exeext=`echo $file | sed -e s/am_c_test//` ;;
   715 +   esac
   716 +done
   717 +rm -f am_c_test*])
   718 +test x"${am_cv_exeext}" = x && am_cv_exeext=no
   719 +fi
   720 +EXEEXT=""
   721 +test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
   722 +AC_MSG_RESULT(${am_cv_exeext})
   723 +AC_SUBST(EXEEXT)])
   724 +
   725 +# Check to see if we're running under Cygwin32, without using
   726 +# AC_CANONICAL_*.  If so, set output variable CYGWIN32 to "yes".
   727 +# Otherwise set it to "no".
   728 +
   729 +dnl AM_CYGWIN32()
   730 +AC_DEFUN(AM_CYGWIN32,
   731 +[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
   732 +[AC_TRY_COMPILE(,[return __CYGWIN32__;],
   733 +am_cv_cygwin32=yes, am_cv_cygwin32=no)
   734 +rm -f conftest*])
   735 +CYGWIN32=
   736 +test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
   737 +
   738 +# Check to see if we're running under Mingw, without using
   739 +# AC_CANONICAL_*.  If so, set output variable MINGW32 to "yes".
   740 +# Otherwise set it to "no".
   741 +
   742 +dnl AM_MINGW32()
   743 +AC_DEFUN(AM_MINGW32,
   744 +[AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32,
   745 +[AC_TRY_COMPILE(,[return __MINGW32__;],
   746 +am_cv_mingw32=yes, am_cv_mingw32=no)
   747 +rm -f conftest*])
   748 +MINGW32=
   749 +test "$am_cv_mingw32" = yes && MINGW32=yes])
   750 +
   751 diff -urN newlib-1.8.2/newlib/libc/sys/aica/chdir.c newlib-1.8.2-aica/newlib/libc/sys/aica/chdir.c
   752 --- newlib-1.8.2/newlib/libc/sys/aica/chdir.c	1970-01-01 10:00:00.000000000 +1000
   753 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/chdir.c	2008-08-13 11:54:44.000000000 +1000
   754 @@ -0,0 +1,14 @@
   755 +#include "vfs.h"
   756 +
   757 +int
   758 +chdir (const char *path)
   759 +{
   760 +  char *obj = _newlib_vfs_new_string (path);
   761 +
   762 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
   763 +  int res = mops->chdir (obj);
   764 +
   765 +  _newlib_vfs_delete_string (obj);
   766 +
   767 +  return res;
   768 +}
   769 diff -urN newlib-1.8.2/newlib/libc/sys/aica/chmod.c newlib-1.8.2-aica/newlib/libc/sys/aica/chmod.c
   770 --- newlib-1.8.2/newlib/libc/sys/aica/chmod.c	1970-01-01 10:00:00.000000000 +1000
   771 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/chmod.c	2008-08-13 11:54:44.000000000 +1000
   772 @@ -0,0 +1,16 @@
   773 +#include <sys/types.h>
   774 +
   775 +#include "vfs.h"
   776 +
   777 +int
   778 +chmod (const char *path, mode_t mode)
   779 +{
   780 +  char *obj = _newlib_vfs_new_string (path);
   781 +
   782 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
   783 +  int res = mops->chmod (obj, mode);
   784 +
   785 +  _newlib_vfs_delete_string (obj);
   786 +
   787 +  return res;
   788 +}
   789 diff -urN newlib-1.8.2/newlib/libc/sys/aica/close.c newlib-1.8.2-aica/newlib/libc/sys/aica/close.c
   790 --- newlib-1.8.2/newlib/libc/sys/aica/close.c	1970-01-01 10:00:00.000000000 +1000
   791 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/close.c	2008-08-13 11:54:44.000000000 +1000
   792 @@ -0,0 +1,15 @@
   793 +#include "vfs.h"
   794 +
   795 +int
   796 +_close (int fd)
   797 +{
   798 +  struct file *pf = _newlib_vfs_get_file (fd);
   799 +  int res = pf->fops->close (pf);
   800 +
   801 +  if (res >= 0)
   802 +  {
   803 +    return _newlib_vfs_remove_file (pf);
   804 +  }
   805 +
   806 +  return res;
   807 +}
   808 diff -urN newlib-1.8.2/newlib/libc/sys/aica/configure newlib-1.8.2-aica/newlib/libc/sys/aica/configure
   809 --- newlib-1.8.2/newlib/libc/sys/aica/configure	1970-01-01 10:00:00.000000000 +1000
   810 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/configure	2008-08-13 11:54:44.000000000 +1000
   811 @@ -0,0 +1,1586 @@
   812 +#! /bin/sh
   813 +
   814 +# Guess values for system-dependent variables and create Makefiles.
   815 +# Generated automatically using autoconf version 2.13 
   816 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
   817 +#
   818 +# This configure script is free software; the Free Software Foundation
   819 +# gives unlimited permission to copy, distribute and modify it.
   820 +
   821 +# Defaults:
   822 +ac_help=
   823 +ac_default_prefix=/usr/local
   824 +# Any additions from configure.in:
   825 +ac_help="$ac_help
   826 +  --enable-multilib         build many library versions (default)"
   827 +ac_help="$ac_help
   828 +  --enable-target-optspace  optimize for space"
   829 +ac_help="$ac_help
   830 +  --enable-newlib-mb        enable multibyte support"
   831 +
   832 +# Initialize some variables set by options.
   833 +# The variables have the same names as the options, with
   834 +# dashes changed to underlines.
   835 +build=NONE
   836 +cache_file=./config.cache
   837 +exec_prefix=NONE
   838 +host=NONE
   839 +no_create=
   840 +nonopt=NONE
   841 +no_recursion=
   842 +prefix=NONE
   843 +program_prefix=NONE
   844 +program_suffix=NONE
   845 +program_transform_name=s,x,x,
   846 +silent=
   847 +site=
   848 +srcdir=
   849 +target=NONE
   850 +verbose=
   851 +x_includes=NONE
   852 +x_libraries=NONE
   853 +bindir='${exec_prefix}/bin'
   854 +sbindir='${exec_prefix}/sbin'
   855 +libexecdir='${exec_prefix}/libexec'
   856 +datadir='${prefix}/share'
   857 +sysconfdir='${prefix}/etc'
   858 +sharedstatedir='${prefix}/com'
   859 +localstatedir='${prefix}/var'
   860 +libdir='${exec_prefix}/lib'
   861 +includedir='${prefix}/include'
   862 +oldincludedir='/usr/include'
   863 +infodir='${prefix}/info'
   864 +mandir='${prefix}/man'
   865 +
   866 +# Initialize some other variables.
   867 +subdirs=
   868 +MFLAGS= MAKEFLAGS=
   869 +SHELL=${CONFIG_SHELL-/bin/sh}
   870 +# Maximum number of lines to put in a shell here document.
   871 +ac_max_here_lines=12
   872 +
   873 +ac_prev=
   874 +for ac_option
   875 +do
   876 +
   877 +  # If the previous option needs an argument, assign it.
   878 +  if test -n "$ac_prev"; then
   879 +    eval "$ac_prev=\$ac_option"
   880 +    ac_prev=
   881 +    continue
   882 +  fi
   883 +
   884 +  case "$ac_option" in
   885 +  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
   886 +  *) ac_optarg= ;;
   887 +  esac
   888 +
   889 +  # Accept the important Cygnus configure options, so we can diagnose typos.
   890 +
   891 +  case "$ac_option" in
   892 +
   893 +  -bindir | --bindir | --bindi | --bind | --bin | --bi)
   894 +    ac_prev=bindir ;;
   895 +  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
   896 +    bindir="$ac_optarg" ;;
   897 +
   898 +  -build | --build | --buil | --bui | --bu)
   899 +    ac_prev=build ;;
   900 +  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
   901 +    build="$ac_optarg" ;;
   902 +
   903 +  -cache-file | --cache-file | --cache-fil | --cache-fi \
   904 +  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
   905 +    ac_prev=cache_file ;;
   906 +  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
   907 +  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
   908 +    cache_file="$ac_optarg" ;;
   909 +
   910 +  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
   911 +    ac_prev=datadir ;;
   912 +  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
   913 +  | --da=*)
   914 +    datadir="$ac_optarg" ;;
   915 +
   916 +  -disable-* | --disable-*)
   917 +    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
   918 +    # Reject names that are not valid shell variable names.
   919 +    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
   920 +      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
   921 +    fi
   922 +    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
   923 +    eval "enable_${ac_feature}=no" ;;
   924 +
   925 +  -enable-* | --enable-*)
   926 +    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
   927 +    # Reject names that are not valid shell variable names.
   928 +    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
   929 +      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
   930 +    fi
   931 +    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
   932 +    case "$ac_option" in
   933 +      *=*) ;;
   934 +      *) ac_optarg=yes ;;
   935 +    esac
   936 +    eval "enable_${ac_feature}='$ac_optarg'" ;;
   937 +
   938 +  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   939 +  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
   940 +  | --exec | --exe | --ex)
   941 +    ac_prev=exec_prefix ;;
   942 +  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
   943 +  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
   944 +  | --exec=* | --exe=* | --ex=*)
   945 +    exec_prefix="$ac_optarg" ;;
   946 +
   947 +  -gas | --gas | --ga | --g)
   948 +    # Obsolete; use --with-gas.
   949 +    with_gas=yes ;;
   950 +
   951 +  -help | --help | --hel | --he)
   952 +    # Omit some internal or obsolete options to make the list less imposing.
   953 +    # This message is too long to be a string in the A/UX 3.1 sh.
   954 +    cat << EOF
   955 +Usage: configure [options] [host]
   956 +Options: [defaults in brackets after descriptions]
   957 +Configuration:
   958 +  --cache-file=FILE       cache test results in FILE
   959 +  --help                  print this message
   960 +  --no-create             do not create output files
   961 +  --quiet, --silent       do not print \`checking...' messages
   962 +  --version               print the version of autoconf that created configure
   963 +Directory and file names:
   964 +  --prefix=PREFIX         install architecture-independent files in PREFIX
   965 +                          [$ac_default_prefix]
   966 +  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
   967 +                          [same as prefix]
   968 +  --bindir=DIR            user executables in DIR [EPREFIX/bin]
   969 +  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
   970 +  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
   971 +  --datadir=DIR           read-only architecture-independent data in DIR
   972 +                          [PREFIX/share]
   973 +  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
   974 +  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
   975 +                          [PREFIX/com]
   976 +  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
   977 +  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
   978 +  --includedir=DIR        C header files in DIR [PREFIX/include]
   979 +  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
   980 +  --infodir=DIR           info documentation in DIR [PREFIX/info]
   981 +  --mandir=DIR            man documentation in DIR [PREFIX/man]
   982 +  --srcdir=DIR            find the sources in DIR [configure dir or ..]
   983 +  --program-prefix=PREFIX prepend PREFIX to installed program names
   984 +  --program-suffix=SUFFIX append SUFFIX to installed program names
   985 +  --program-transform-name=PROGRAM
   986 +                          run sed PROGRAM on installed program names
   987 +EOF
   988 +    cat << EOF
   989 +Host type:
   990 +  --build=BUILD           configure for building on BUILD [BUILD=HOST]
   991 +  --host=HOST             configure for HOST [guessed]
   992 +  --target=TARGET         configure for TARGET [TARGET=HOST]
   993 +Features and packages:
   994 +  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   995 +  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   996 +  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   997 +  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   998 +  --x-includes=DIR        X include files are in DIR
   999 +  --x-libraries=DIR       X library files are in DIR
  1000 +EOF
  1001 +    if test -n "$ac_help"; then
  1002 +      echo "--enable and --with options recognized:$ac_help"
  1003 +    fi
  1004 +    exit 0 ;;
  1006 +  -host | --host | --hos | --ho)
  1007 +    ac_prev=host ;;
  1008 +  -host=* | --host=* | --hos=* | --ho=*)
  1009 +    host="$ac_optarg" ;;
  1011 +  -includedir | --includedir | --includedi | --included | --include \
  1012 +  | --includ | --inclu | --incl | --inc)
  1013 +    ac_prev=includedir ;;
  1014 +  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
  1015 +  | --includ=* | --inclu=* | --incl=* | --inc=*)
  1016 +    includedir="$ac_optarg" ;;
  1018 +  -infodir | --infodir | --infodi | --infod | --info | --inf)
  1019 +    ac_prev=infodir ;;
  1020 +  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
  1021 +    infodir="$ac_optarg" ;;
  1023 +  -libdir | --libdir | --libdi | --libd)
  1024 +    ac_prev=libdir ;;
  1025 +  -libdir=* | --libdir=* | --libdi=* | --libd=*)
  1026 +    libdir="$ac_optarg" ;;
  1028 +  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
  1029 +  | --libexe | --libex | --libe)
  1030 +    ac_prev=libexecdir ;;
  1031 +  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
  1032 +  | --libexe=* | --libex=* | --libe=*)
  1033 +    libexecdir="$ac_optarg" ;;
  1035 +  -localstatedir | --localstatedir | --localstatedi | --localstated \
  1036 +  | --localstate | --localstat | --localsta | --localst \
  1037 +  | --locals | --local | --loca | --loc | --lo)
  1038 +    ac_prev=localstatedir ;;
  1039 +  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
  1040 +  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
  1041 +  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
  1042 +    localstatedir="$ac_optarg" ;;
  1044 +  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
  1045 +    ac_prev=mandir ;;
  1046 +  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
  1047 +    mandir="$ac_optarg" ;;
  1049 +  -nfp | --nfp | --nf)
  1050 +    # Obsolete; use --without-fp.
  1051 +    with_fp=no ;;
  1053 +  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  1054 +  | --no-cr | --no-c)
  1055 +    no_create=yes ;;
  1057 +  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  1058 +  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
  1059 +    no_recursion=yes ;;
  1061 +  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
  1062 +  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
  1063 +  | --oldin | --oldi | --old | --ol | --o)
  1064 +    ac_prev=oldincludedir ;;
  1065 +  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
  1066 +  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
  1067 +  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
  1068 +    oldincludedir="$ac_optarg" ;;
  1070 +  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  1071 +    ac_prev=prefix ;;
  1072 +  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  1073 +    prefix="$ac_optarg" ;;
  1075 +  -program-prefix | --program-prefix | --program-prefi | --program-pref \
  1076 +  | --program-pre | --program-pr | --program-p)
  1077 +    ac_prev=program_prefix ;;
  1078 +  -program-prefix=* | --program-prefix=* | --program-prefi=* \
  1079 +  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
  1080 +    program_prefix="$ac_optarg" ;;
  1082 +  -program-suffix | --program-suffix | --program-suffi | --program-suff \
  1083 +  | --program-suf | --program-su | --program-s)
  1084 +    ac_prev=program_suffix ;;
  1085 +  -program-suffix=* | --program-suffix=* | --program-suffi=* \
  1086 +  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
  1087 +    program_suffix="$ac_optarg" ;;
  1089 +  -program-transform-name | --program-transform-name \
  1090 +  | --program-transform-nam | --program-transform-na \
  1091 +  | --program-transform-n | --program-transform- \
  1092 +  | --program-transform | --program-transfor \
  1093 +  | --program-transfo | --program-transf \
  1094 +  | --program-trans | --program-tran \
  1095 +  | --progr-tra | --program-tr | --program-t)
  1096 +    ac_prev=program_transform_name ;;
  1097 +  -program-transform-name=* | --program-transform-name=* \
  1098 +  | --program-transform-nam=* | --program-transform-na=* \
  1099 +  | --program-transform-n=* | --program-transform-=* \
  1100 +  | --program-transform=* | --program-transfor=* \
  1101 +  | --program-transfo=* | --program-transf=* \
  1102 +  | --program-trans=* | --program-tran=* \
  1103 +  | --progr-tra=* | --program-tr=* | --program-t=*)
  1104 +    program_transform_name="$ac_optarg" ;;
  1106 +  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  1107 +  | -silent | --silent | --silen | --sile | --sil)
  1108 +    silent=yes ;;
  1110 +  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
  1111 +    ac_prev=sbindir ;;
  1112 +  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  1113 +  | --sbi=* | --sb=*)
  1114 +    sbindir="$ac_optarg" ;;
  1116 +  -sharedstatedir | --sharedstatedir | --sharedstatedi \
  1117 +  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
  1118 +  | --sharedst | --shareds | --shared | --share | --shar \
  1119 +  | --sha | --sh)
  1120 +    ac_prev=sharedstatedir ;;
  1121 +  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
  1122 +  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
  1123 +  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
  1124 +  | --sha=* | --sh=*)
  1125 +    sharedstatedir="$ac_optarg" ;;
  1127 +  -site | --site | --sit)
  1128 +    ac_prev=site ;;
  1129 +  -site=* | --site=* | --sit=*)
  1130 +    site="$ac_optarg" ;;
  1132 +  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  1133 +    ac_prev=srcdir ;;
  1134 +  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  1135 +    srcdir="$ac_optarg" ;;
  1137 +  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
  1138 +  | --syscon | --sysco | --sysc | --sys | --sy)
  1139 +    ac_prev=sysconfdir ;;
  1140 +  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
  1141 +  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
  1142 +    sysconfdir="$ac_optarg" ;;
  1144 +  -target | --target | --targe | --targ | --tar | --ta | --t)
  1145 +    ac_prev=target ;;
  1146 +  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
  1147 +    target="$ac_optarg" ;;
  1149 +  -v | -verbose | --verbose | --verbos | --verbo | --verb)
  1150 +    verbose=yes ;;
  1152 +  -version | --version | --versio | --versi | --vers)
  1153 +    echo "configure generated by autoconf version 2.13"
  1154 +    exit 0 ;;
  1156 +  -with-* | --with-*)
  1157 +    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
  1158 +    # Reject names that are not valid shell variable names.
  1159 +    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
  1160 +      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  1161 +    fi
  1162 +    ac_package=`echo $ac_package| sed 's/-/_/g'`
  1163 +    case "$ac_option" in
  1164 +      *=*) ;;
  1165 +      *) ac_optarg=yes ;;
  1166 +    esac
  1167 +    eval "with_${ac_package}='$ac_optarg'" ;;
  1169 +  -without-* | --without-*)
  1170 +    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
  1171 +    # Reject names that are not valid shell variable names.
  1172 +    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  1173 +      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  1174 +    fi
  1175 +    ac_package=`echo $ac_package| sed 's/-/_/g'`
  1176 +    eval "with_${ac_package}=no" ;;
  1178 +  --x)
  1179 +    # Obsolete; use --with-x.
  1180 +    with_x=yes ;;
  1182 +  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
  1183 +  | --x-incl | --x-inc | --x-in | --x-i)
  1184 +    ac_prev=x_includes ;;
  1185 +  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  1186 +  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
  1187 +    x_includes="$ac_optarg" ;;
  1189 +  -x-libraries | --x-libraries | --x-librarie | --x-librari \
  1190 +  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
  1191 +    ac_prev=x_libraries ;;
  1192 +  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  1193 +  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
  1194 +    x_libraries="$ac_optarg" ;;
  1196 +  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
  1197 +    ;;
  1199 +  *)
  1200 +    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
  1201 +      echo "configure: warning: $ac_option: invalid host type" 1>&2
  1202 +    fi
  1203 +    if test "x$nonopt" != xNONE; then
  1204 +      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
  1205 +    fi
  1206 +    nonopt="$ac_option"
  1207 +    ;;
  1209 +  esac
  1210 +done
  1212 +if test -n "$ac_prev"; then
  1213 +  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
  1214 +fi
  1216 +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
  1218 +# File descriptor usage:
  1219 +# 0 standard input
  1220 +# 1 file creation
  1221 +# 2 errors and warnings
  1222 +# 3 some systems may open it to /dev/tty
  1223 +# 4 used on the Kubota Titan
  1224 +# 6 checking for... messages and results
  1225 +# 5 compiler messages saved in config.log
  1226 +if test "$silent" = yes; then
  1227 +  exec 6>/dev/null
  1228 +else
  1229 +  exec 6>&1
  1230 +fi
  1231 +exec 5>./config.log
  1233 +echo "\
  1234 +This file contains any messages produced by compilers while
  1235 +running configure, to aid debugging if configure makes a mistake.
  1236 +" 1>&5
  1238 +# Strip out --no-create and --no-recursion so they do not pile up.
  1239 +# Also quote any args containing shell metacharacters.
  1240 +ac_configure_args=
  1241 +for ac_arg
  1242 +do
  1243 +  case "$ac_arg" in
  1244 +  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  1245 +  | --no-cr | --no-c) ;;
  1246 +  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  1247 +  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
  1248 +  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
  1249 +  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
  1250 +  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
  1251 +  esac
  1252 +done
  1254 +# NLS nuisances.
  1255 +# Only set these to C if already set.  These must not be set unconditionally
  1256 +# because not all systems understand e.g. LANG=C (notably SCO).
  1257 +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
  1258 +# Non-C LC_CTYPE values break the ctype check.
  1259 +if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
  1260 +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
  1261 +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
  1262 +if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
  1264 +# confdefs.h avoids OS command line length limits that DEFS can exceed.
  1265 +rm -rf conftest* confdefs.h
  1266 +# AIX cpp loses on an empty file, so make sure it contains at least a newline.
  1267 +echo > confdefs.h
  1269 +# A filename unique to this package, relative to the directory that
  1270 +# configure is in, which we can look for to find out if srcdir is correct.
  1271 +ac_unique_file=sbrk.c
  1273 +# Find the source files, if location was not specified.
  1274 +if test -z "$srcdir"; then
  1275 +  ac_srcdir_defaulted=yes
  1276 +  # Try the directory containing this script, then its parent.
  1277 +  ac_prog=$0
  1278 +  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  1279 +  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  1280 +  srcdir=$ac_confdir
  1281 +  if test ! -r $srcdir/$ac_unique_file; then
  1282 +    srcdir=..
  1283 +  fi
  1284 +else
  1285 +  ac_srcdir_defaulted=no
  1286 +fi
  1287 +if test ! -r $srcdir/$ac_unique_file; then
  1288 +  if test "$ac_srcdir_defaulted" = yes; then
  1289 +    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
  1290 +  else
  1291 +    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  1292 +  fi
  1293 +fi
  1294 +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
  1296 +# Prefer explicitly selected file to automatically selected ones.
  1297 +if test -z "$CONFIG_SITE"; then
  1298 +  if test "x$prefix" != xNONE; then
  1299 +    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
  1300 +  else
  1301 +    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
  1302 +  fi
  1303 +fi
  1304 +for ac_site_file in $CONFIG_SITE; do
  1305 +  if test -r "$ac_site_file"; then
  1306 +    echo "loading site script $ac_site_file"
  1307 +    . "$ac_site_file"
  1308 +  fi
  1309 +done
  1311 +if test -r "$cache_file"; then
  1312 +  echo "loading cache $cache_file"
  1313 +  . $cache_file
  1314 +else
  1315 +  echo "creating cache $cache_file"
  1316 +  > $cache_file
  1317 +fi
  1319 +ac_ext=c
  1320 +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  1321 +ac_cpp='$CPP $CPPFLAGS'
  1322 +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  1323 +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  1324 +cross_compiling=$ac_cv_prog_cc_cross
  1326 +ac_exeext=
  1327 +ac_objext=o
  1328 +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  1329 +  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  1330 +  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
  1331 +    ac_n= ac_c='
  1332 +' ac_t='	'
  1333 +  else
  1334 +    ac_n=-n ac_c= ac_t=
  1335 +  fi
  1336 +else
  1337 +  ac_n= ac_c='\c' ac_t=
  1338 +fi
  1342 +ac_aux_dir=
  1343 +for ac_dir in ../../../.. $srcdir/../../../..; do
  1344 +  if test -f $ac_dir/install-sh; then
  1345 +    ac_aux_dir=$ac_dir
  1346 +    ac_install_sh="$ac_aux_dir/install-sh -c"
  1347 +    break
  1348 +  elif test -f $ac_dir/install.sh; then
  1349 +    ac_aux_dir=$ac_dir
  1350 +    ac_install_sh="$ac_aux_dir/install.sh -c"
  1351 +    break
  1352 +  fi
  1353 +done
  1354 +if test -z "$ac_aux_dir"; then
  1355 +  { echo "configure: error: can not find install-sh or install.sh in ../../../.. $srcdir/../../../.." 1>&2; exit 1; }
  1356 +fi
  1357 +ac_config_guess=$ac_aux_dir/config.guess
  1358 +ac_config_sub=$ac_aux_dir/config.sub
  1359 +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
  1362 +# Find a good install program.  We prefer a C program (faster),
  1363 +# so one script is as good as another.  But avoid the broken or
  1364 +# incompatible versions:
  1365 +# SysV /etc/install, /usr/sbin/install
  1366 +# SunOS /usr/etc/install
  1367 +# IRIX /sbin/install
  1368 +# AIX /bin/install
  1369 +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
  1370 +# AFS /usr/afsws/bin/install, which mishandles nonexistent args
  1371 +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  1372 +# ./install, which can be erroneously created by make from ./install.sh.
  1373 +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
  1374 +echo "configure:564: checking for a BSD compatible install" >&5
  1375 +if test -z "$INSTALL"; then
  1376 +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
  1377 +  echo $ac_n "(cached) $ac_c" 1>&6
  1378 +else
  1379 +    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
  1380 +  for ac_dir in $PATH; do
  1381 +    # Account for people who put trailing slashes in PATH elements.
  1382 +    case "$ac_dir/" in
  1383 +    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
  1384 +    *)
  1385 +      # OSF1 and SCO ODT 3.0 have their own names for install.
  1386 +      # Don't use installbsd from OSF since it installs stuff as root
  1387 +      # by default.
  1388 +      for ac_prog in ginstall scoinst install; do
  1389 +        if test -f $ac_dir/$ac_prog; then
  1390 +	  if test $ac_prog = install &&
  1391 +            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  1392 +	    # AIX install.  It has an incompatible calling convention.
  1393 +	    :
  1394 +	  else
  1395 +	    ac_cv_path_install="$ac_dir/$ac_prog -c"
  1396 +	    break 2
  1397 +	  fi
  1398 +	fi
  1399 +      done
  1400 +      ;;
  1401 +    esac
  1402 +  done
  1403 +  IFS="$ac_save_IFS"
  1405 +fi
  1406 +  if test "${ac_cv_path_install+set}" = set; then
  1407 +    INSTALL="$ac_cv_path_install"
  1408 +  else
  1409 +    # As a last resort, use the slow shell script.  We don't cache a
  1410 +    # path for INSTALL within a source directory, because that will
  1411 +    # break other packages using the cache if that directory is
  1412 +    # removed, or if the path is relative.
  1413 +    INSTALL="$ac_install_sh"
  1414 +  fi
  1415 +fi
  1416 +echo "$ac_t""$INSTALL" 1>&6
  1418 +# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
  1419 +# It thinks the first close brace ends the variable substitution.
  1420 +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
  1422 +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
  1424 +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
  1427 +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
  1429 +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
  1430 +echo "configure:620: checking whether build environment is sane" >&5
  1431 +# Just in case
  1432 +sleep 1
  1433 +echo timestamp > conftestfile
  1434 +# Do `set' in a subshell so we don't clobber the current shell's
  1435 +# arguments.  Must try -L first in case configure is actually a
  1436 +# symlink; some systems play weird games with the mod time of symlinks
  1437 +# (eg FreeBSD returns the mod time of the symlink's containing
  1438 +# directory).
  1439 +if (
  1440 +   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
  1441 +   if test "$*" = "X"; then
  1442 +      # -L didn't work.
  1443 +      set X `ls -t $srcdir/configure conftestfile`
  1444 +   fi
  1445 +   if test "$*" != "X $srcdir/configure conftestfile" \
  1446 +      && test "$*" != "X conftestfile $srcdir/configure"; then
  1448 +      # If neither matched, then we have a broken ls.  This can happen
  1449 +      # if, for instance, CONFIG_SHELL is bash and it inherits a
  1450 +      # broken ls alias from the environment.  This has actually
  1451 +      # happened.  Such a system could not be considered "sane".
  1452 +      { echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
  1453 +alias in your environment" 1>&2; exit 1; }
  1454 +   fi
  1456 +   test "$2" = conftestfile
  1457 +   )
  1458 +then
  1459 +   # Ok.
  1460 +   :
  1461 +else
  1462 +   { echo "configure: error: newly created file is older than distributed files!
  1463 +Check your system clock" 1>&2; exit 1; }
  1464 +fi
  1465 +rm -f conftest*
  1466 +echo "$ac_t""yes" 1>&6
  1467 +if test "$program_transform_name" = s,x,x,; then
  1468 +  program_transform_name=
  1469 +else
  1470 +  # Double any \ or $.  echo might interpret backslashes.
  1471 +  cat <<\EOF_SED > conftestsed
  1472 +s,\\,\\\\,g; s,\$,$$,g
  1473 +EOF_SED
  1474 +  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
  1475 +  rm -f conftestsed
  1476 +fi
  1477 +test "$program_prefix" != NONE &&
  1478 +  program_transform_name="s,^,${program_prefix},; $program_transform_name"
  1479 +# Use a double $ so make ignores it.
  1480 +test "$program_suffix" != NONE &&
  1481 +  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
  1483 +# sed with no file args requires a program.
  1484 +test "$program_transform_name" = "" && program_transform_name="s,x,x,"
  1486 +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
  1487 +echo "configure:677: checking whether ${MAKE-make} sets \${MAKE}" >&5
  1488 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
  1489 +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
  1490 +  echo $ac_n "(cached) $ac_c" 1>&6
  1491 +else
  1492 +  cat > conftestmake <<\EOF
  1493 +all:
  1494 +	@echo 'ac_maketemp="${MAKE}"'
  1495 +EOF
  1496 +# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
  1497 +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
  1498 +if test -n "$ac_maketemp"; then
  1499 +  eval ac_cv_prog_make_${ac_make}_set=yes
  1500 +else
  1501 +  eval ac_cv_prog_make_${ac_make}_set=no
  1502 +fi
  1503 +rm -f conftestmake
  1504 +fi
  1505 +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
  1506 +  echo "$ac_t""yes" 1>&6
  1507 +  SET_MAKE=
  1508 +else
  1509 +  echo "$ac_t""no" 1>&6
  1510 +  SET_MAKE="MAKE=${MAKE-make}"
  1511 +fi
  1513 +if test $host != $build; then
  1514 +  ac_tool_prefix=${host_alias}-
  1515 +else
  1516 +  ac_tool_prefix=
  1517 +fi
  1519 +echo $ac_n "checking for Cygwin32 environment""... $ac_c" 1>&6
  1520 +echo "configure:710: checking for Cygwin32 environment" >&5
  1521 +if eval "test \"`echo '$''{'am_cv_cygwin32'+set}'`\" = set"; then
  1522 +  echo $ac_n "(cached) $ac_c" 1>&6
  1523 +else
  1524 +  cat > conftest.$ac_ext <<EOF
  1525 +#line 715 "configure"
  1526 +#include "confdefs.h"
  1528 +int main() {
  1529 +return __CYGWIN32__;
  1530 +; return 0; }
  1531 +EOF
  1532 +if { (eval echo configure:722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  1533 +  rm -rf conftest*
  1534 +  am_cv_cygwin32=yes
  1535 +else
  1536 +  echo "configure: failed program was:" >&5
  1537 +  cat conftest.$ac_ext >&5
  1538 +  rm -rf conftest*
  1539 +  am_cv_cygwin32=no
  1540 +fi
  1541 +rm -f conftest*
  1542 +rm -f conftest*
  1543 +fi
  1545 +echo "$ac_t""$am_cv_cygwin32" 1>&6
  1546 +CYGWIN32=
  1547 +test "$am_cv_cygwin32" = yes && CYGWIN32=yes
  1548 +echo $ac_n "checking for Mingw32 environment""... $ac_c" 1>&6
  1549 +echo "configure:739: checking for Mingw32 environment" >&5
  1550 +if eval "test \"`echo '$''{'am_cv_mingw32'+set}'`\" = set"; then
  1551 +  echo $ac_n "(cached) $ac_c" 1>&6
  1552 +else
  1553 +  cat > conftest.$ac_ext <<EOF
  1554 +#line 744 "configure"
  1555 +#include "confdefs.h"
  1557 +int main() {
  1558 +return __MINGW32__;
  1559 +; return 0; }
  1560 +EOF
  1561 +if { (eval echo configure:751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  1562 +  rm -rf conftest*
  1563 +  am_cv_mingw32=yes
  1564 +else
  1565 +  echo "configure: failed program was:" >&5
  1566 +  cat conftest.$ac_ext >&5
  1567 +  rm -rf conftest*
  1568 +  am_cv_mingw32=no
  1569 +fi
  1570 +rm -f conftest*
  1571 +rm -f conftest*
  1572 +fi
  1574 +echo "$ac_t""$am_cv_mingw32" 1>&6
  1575 +MINGW32=
  1576 +test "$am_cv_mingw32" = yes && MINGW32=yes
  1578 +# Check whether --enable-multilib or --disable-multilib was given.
  1579 +if test "${enable_multilib+set}" = set; then
  1580 +  enableval="$enable_multilib"
  1581 +  case "${enableval}" in
  1582 +  yes) multilib=yes ;;
  1583 +  no)  multilib=no ;;
  1584 +  *)   { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;;
  1585 + esac
  1586 +else
  1587 +  multilib=yes
  1588 +fi
  1590 +# Check whether --enable-target-optspace or --disable-target-optspace was given.
  1591 +if test "${enable_target_optspace+set}" = set; then
  1592 +  enableval="$enable_target_optspace"
  1593 +  case "${enableval}" in
  1594 +  yes) target_optspace=yes ;;
  1595 +  no)  target_optspace=no ;;
  1596 +  *)   { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;;
  1597 + esac
  1598 +else
  1599 +  target_optspace=
  1600 +fi
  1602 +# Check whether --enable-newlib-mb or --disable-newlib-mb was given.
  1603 +if test "${enable_newlib_mb+set}" = set; then
  1604 +  enableval="$enable_newlib_mb"
  1605 +  case "${enableval}" in
  1606 +  yes) newlib_mb=yes ;;
  1607 +  no)  newlib_mb=no ;;
  1608 +  *)   { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;;
  1609 + esac
  1610 +else
  1611 +  newlib_mb=no
  1612 +fi
  1615 +test -z "${with_target_subdir}" && with_target_subdir=.
  1617 +if test "${srcdir}" = "."; then
  1618 +  if test "${with_target_subdir}" != "."; then
  1619 +    newlib_basedir="${srcdir}/${with_multisrctop}../../../.."
  1620 +  else
  1621 +    newlib_basedir="${srcdir}/${with_multisrctop}../../.."
  1622 +  fi
  1623 +else
  1624 +  newlib_basedir="${srcdir}/../../.."
  1625 +fi
  1629 +# Make sure we can run config.sub.
  1630 +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
  1631 +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
  1632 +fi
  1634 +echo $ac_n "checking host system type""... $ac_c" 1>&6
  1635 +echo "configure:825: checking host system type" >&5
  1637 +host_alias=$host
  1638 +case "$host_alias" in
  1639 +NONE)
  1640 +  case $nonopt in
  1641 +  NONE)
  1642 +    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
  1643 +    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
  1644 +    fi ;;
  1645 +  *) host_alias=$nonopt ;;
  1646 +  esac ;;
  1647 +esac
  1649 +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
  1650 +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  1651 +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  1652 +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  1653 +echo "$ac_t""$host" 1>&6
  1657 +PACKAGE=newlib
  1659 +VERSION=1.8.1
  1661 +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  1662 +  { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
  1663 +fi
  1664 +cat >> confdefs.h <<EOF
  1665 +#define PACKAGE "$PACKAGE"
  1666 +EOF
  1668 +cat >> confdefs.h <<EOF
  1669 +#define VERSION "$VERSION"
  1670 +EOF
  1674 +missing_dir=`cd $ac_aux_dir && pwd`
  1675 +echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
  1676 +echo "configure:866: checking for working aclocal" >&5
  1677 +# Run test in a subshell; some versions of sh will print an error if
  1678 +# an executable is not found, even if stderr is redirected.
  1679 +# Redirect stdin to placate older versions of autoconf.  Sigh.
  1680 +if (aclocal --version) < /dev/null > /dev/null 2>&1; then
  1681 +   ACLOCAL=aclocal
  1682 +   echo "$ac_t""found" 1>&6
  1683 +else
  1684 +   ACLOCAL="$missing_dir/missing aclocal"
  1685 +   echo "$ac_t""missing" 1>&6
  1686 +fi
  1688 +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
  1689 +echo "configure:879: checking for working autoconf" >&5
  1690 +# Run test in a subshell; some versions of sh will print an error if
  1691 +# an executable is not found, even if stderr is redirected.
  1692 +# Redirect stdin to placate older versions of autoconf.  Sigh.
  1693 +if (autoconf --version) < /dev/null > /dev/null 2>&1; then
  1694 +   AUTOCONF=autoconf
  1695 +   echo "$ac_t""found" 1>&6
  1696 +else
  1697 +   AUTOCONF="$missing_dir/missing autoconf"
  1698 +   echo "$ac_t""missing" 1>&6
  1699 +fi
  1701 +echo $ac_n "checking for working automake""... $ac_c" 1>&6
  1702 +echo "configure:892: checking for working automake" >&5
  1703 +# Run test in a subshell; some versions of sh will print an error if
  1704 +# an executable is not found, even if stderr is redirected.
  1705 +# Redirect stdin to placate older versions of autoconf.  Sigh.
  1706 +if (automake --version) < /dev/null > /dev/null 2>&1; then
  1707 +   AUTOMAKE=automake
  1708 +   echo "$ac_t""found" 1>&6
  1709 +else
  1710 +   AUTOMAKE="$missing_dir/missing automake"
  1711 +   echo "$ac_t""missing" 1>&6
  1712 +fi
  1714 +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
  1715 +echo "configure:905: checking for working autoheader" >&5
  1716 +# Run test in a subshell; some versions of sh will print an error if
  1717 +# an executable is not found, even if stderr is redirected.
  1718 +# Redirect stdin to placate older versions of autoconf.  Sigh.
  1719 +if (autoheader --version) < /dev/null > /dev/null 2>&1; then
  1720 +   AUTOHEADER=autoheader
  1721 +   echo "$ac_t""found" 1>&6
  1722 +else
  1723 +   AUTOHEADER="$missing_dir/missing autoheader"
  1724 +   echo "$ac_t""missing" 1>&6
  1725 +fi
  1727 +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
  1728 +echo "configure:918: checking for working makeinfo" >&5
  1729 +# Run test in a subshell; some versions of sh will print an error if
  1730 +# an executable is not found, even if stderr is redirected.
  1731 +# Redirect stdin to placate older versions of autoconf.  Sigh.
  1732 +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
  1733 +   MAKEINFO=makeinfo
  1734 +   echo "$ac_t""found" 1>&6
  1735 +else
  1736 +   MAKEINFO="$missing_dir/missing makeinfo"
  1737 +   echo "$ac_t""missing" 1>&6
  1738 +fi
  1742 +# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
  1743 +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
  1744 +# are probably using a cross compiler, which will not be able to fully
  1745 +# link an executable.  This should really be fixed in autoconf
  1746 +# itself.
  1750 +# Extract the first word of "gcc", so it can be a program name with args.
  1751 +set dummy gcc; ac_word=$2
  1752 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  1753 +echo "configure:943: checking for $ac_word" >&5
  1754 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  1755 +  echo $ac_n "(cached) $ac_c" 1>&6
  1756 +else
  1757 +  if test -n "$CC"; then
  1758 +  ac_cv_prog_CC="$CC" # Let the user override the test.
  1759 +else
  1760 +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  1761 +  ac_dummy="$PATH"
  1762 +  for ac_dir in $ac_dummy; do
  1763 +    test -z "$ac_dir" && ac_dir=.
  1764 +    if test -f $ac_dir/$ac_word; then
  1765 +      ac_cv_prog_CC="gcc"
  1766 +      break
  1767 +    fi
  1768 +  done
  1769 +  IFS="$ac_save_ifs"
  1770 +fi
  1771 +fi
  1772 +CC="$ac_cv_prog_CC"
  1773 +if test -n "$CC"; then
  1774 +  echo "$ac_t""$CC" 1>&6
  1775 +else
  1776 +  echo "$ac_t""no" 1>&6
  1777 +fi
  1779 +if test -z "$CC"; then
  1780 +  # Extract the first word of "cc", so it can be a program name with args.
  1781 +set dummy cc; ac_word=$2
  1782 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  1783 +echo "configure:973: checking for $ac_word" >&5
  1784 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  1785 +  echo $ac_n "(cached) $ac_c" 1>&6
  1786 +else
  1787 +  if test -n "$CC"; then
  1788 +  ac_cv_prog_CC="$CC" # Let the user override the test.
  1789 +else
  1790 +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  1791 +  ac_prog_rejected=no
  1792 +  ac_dummy="$PATH"
  1793 +  for ac_dir in $ac_dummy; do
  1794 +    test -z "$ac_dir" && ac_dir=.
  1795 +    if test -f $ac_dir/$ac_word; then
  1796 +      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
  1797 +        ac_prog_rejected=yes
  1798 +	continue
  1799 +      fi
  1800 +      ac_cv_prog_CC="cc"
  1801 +      break
  1802 +    fi
  1803 +  done
  1804 +  IFS="$ac_save_ifs"
  1805 +if test $ac_prog_rejected = yes; then
  1806 +  # We found a bogon in the path, so make sure we never use it.
  1807 +  set dummy $ac_cv_prog_CC
  1808 +  shift
  1809 +  if test $# -gt 0; then
  1810 +    # We chose a different compiler from the bogus one.
  1811 +    # However, it has the same basename, so the bogon will be chosen
  1812 +    # first if we set CC to just the basename; use the full file name.
  1813 +    shift
  1814 +    set dummy "$ac_dir/$ac_word" "$@"
  1815 +    shift
  1816 +    ac_cv_prog_CC="$@"
  1817 +  fi
  1818 +fi
  1819 +fi
  1820 +fi
  1821 +CC="$ac_cv_prog_CC"
  1822 +if test -n "$CC"; then
  1823 +  echo "$ac_t""$CC" 1>&6
  1824 +else
  1825 +  echo "$ac_t""no" 1>&6
  1826 +fi
  1828 +  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
  1829 +fi
  1831 +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
  1832 +echo "configure:1022: checking whether we are using GNU C" >&5
  1833 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
  1834 +  echo $ac_n "(cached) $ac_c" 1>&6
  1835 +else
  1836 +  cat > conftest.c <<EOF
  1837 +#ifdef __GNUC__
  1838 +  yes;
  1839 +#endif
  1840 +EOF
  1841 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
  1842 +  ac_cv_prog_gcc=yes
  1843 +else
  1844 +  ac_cv_prog_gcc=no
  1845 +fi
  1846 +fi
  1848 +echo "$ac_t""$ac_cv_prog_gcc" 1>&6
  1850 +if test $ac_cv_prog_gcc = yes; then
  1851 +  GCC=yes
  1852 +  ac_test_CFLAGS="${CFLAGS+set}"
  1853 +  ac_save_CFLAGS="$CFLAGS"
  1854 +  CFLAGS=
  1855 +  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
  1856 +echo "configure:1046: checking whether ${CC-cc} accepts -g" >&5
  1857 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
  1858 +  echo $ac_n "(cached) $ac_c" 1>&6
  1859 +else
  1860 +  echo 'void f(){}' > conftest.c
  1861 +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
  1862 +  ac_cv_prog_cc_g=yes
  1863 +else
  1864 +  ac_cv_prog_cc_g=no
  1865 +fi
  1866 +rm -f conftest*
  1868 +fi
  1870 +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
  1871 +  if test "$ac_test_CFLAGS" = set; then
  1872 +    CFLAGS="$ac_save_CFLAGS"
  1873 +  elif test $ac_cv_prog_cc_g = yes; then
  1874 +    CFLAGS="-g -O2"
  1875 +  else
  1876 +    CFLAGS="-O2"
  1877 +  fi
  1878 +else
  1879 +  GCC=
  1880 +  test "${CFLAGS+set}" = set || CFLAGS="-g"
  1881 +fi
  1884 +# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
  1885 +# run it explicitly here, it will be run implicitly before
  1886 +# NEWLIB_CONFIGURE, which doesn't work because that means that it will
  1887 +# be run before AC_CANONICAL_HOST.
  1888 +echo $ac_n "checking build system type""... $ac_c" 1>&6
  1889 +echo "configure:1079: checking build system type" >&5
  1891 +build_alias=$build
  1892 +case "$build_alias" in
  1893 +NONE)
  1894 +  case $nonopt in
  1895 +  NONE) build_alias=$host_alias ;;
  1896 +  *) build_alias=$nonopt ;;
  1897 +  esac ;;
  1898 +esac
  1900 +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
  1901 +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  1902 +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  1903 +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  1904 +echo "$ac_t""$build" 1>&6
  1907 +# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
  1908 +set dummy ${ac_tool_prefix}as; ac_word=$2
  1909 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  1910 +echo "configure:1100: checking for $ac_word" >&5
  1911 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
  1912 +  echo $ac_n "(cached) $ac_c" 1>&6
  1913 +else
  1914 +  if test -n "$AS"; then
  1915 +  ac_cv_prog_AS="$AS" # Let the user override the test.
  1916 +else
  1917 +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  1918 +  ac_dummy="$PATH"
  1919 +  for ac_dir in $ac_dummy; do
  1920 +    test -z "$ac_dir" && ac_dir=.
  1921 +    if test -f $ac_dir/$ac_word; then
  1922 +      ac_cv_prog_AS="${ac_tool_prefix}as"
  1923 +      break
  1924 +    fi
  1925 +  done
  1926 +  IFS="$ac_save_ifs"
  1927 +  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
  1928 +fi
  1929 +fi
  1930 +AS="$ac_cv_prog_AS"
  1931 +if test -n "$AS"; then
  1932 +  echo "$ac_t""$AS" 1>&6
  1933 +else
  1934 +  echo "$ac_t""no" 1>&6
  1935 +fi
  1939 +# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
  1940 +set dummy ${ac_tool_prefix}ar; ac_word=$2
  1941 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  1942 +echo "configure:1132: checking for $ac_word" >&5
  1943 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
  1944 +  echo $ac_n "(cached) $ac_c" 1>&6
  1945 +else
  1946 +  if test -n "$AR"; then
  1947 +  ac_cv_prog_AR="$AR" # Let the user override the test.
  1948 +else
  1949 +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  1950 +  ac_dummy="$PATH"
  1951 +  for ac_dir in $ac_dummy; do
  1952 +    test -z "$ac_dir" && ac_dir=.
  1953 +    if test -f $ac_dir/$ac_word; then
  1954 +      ac_cv_prog_AR="${ac_tool_prefix}ar"
  1955 +      break
  1956 +    fi
  1957 +  done
  1958 +  IFS="$ac_save_ifs"
  1959 +  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
  1960 +fi
  1961 +fi
  1962 +AR="$ac_cv_prog_AR"
  1963 +if test -n "$AR"; then
  1964 +  echo "$ac_t""$AR" 1>&6
  1965 +else
  1966 +  echo "$ac_t""no" 1>&6
  1967 +fi
  1971 +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  1972 +set dummy ${ac_tool_prefix}ranlib; ac_word=$2
  1973 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  1974 +echo "configure:1164: checking for $ac_word" >&5
  1975 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  1976 +  echo $ac_n "(cached) $ac_c" 1>&6
  1977 +else
  1978 +  if test -n "$RANLIB"; then
  1979 +  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  1980 +else
  1981 +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  1982 +  ac_dummy="$PATH"
  1983 +  for ac_dir in $ac_dummy; do
  1984 +    test -z "$ac_dir" && ac_dir=.
  1985 +    if test -f $ac_dir/$ac_word; then
  1986 +      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
  1987 +      break
  1988 +    fi
  1989 +  done
  1990 +  IFS="$ac_save_ifs"
  1991 +fi
  1992 +fi
  1993 +RANLIB="$ac_cv_prog_RANLIB"
  1994 +if test -n "$RANLIB"; then
  1995 +  echo "$ac_t""$RANLIB" 1>&6
  1996 +else
  1997 +  echo "$ac_t""no" 1>&6
  1998 +fi
  2001 +if test -z "$ac_cv_prog_RANLIB"; then
  2002 +if test -n "$ac_tool_prefix"; then
  2003 +  # Extract the first word of "ranlib", so it can be a program name with args.
  2004 +set dummy ranlib; ac_word=$2
  2005 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  2006 +echo "configure:1196: checking for $ac_word" >&5
  2007 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  2008 +  echo $ac_n "(cached) $ac_c" 1>&6
  2009 +else
  2010 +  if test -n "$RANLIB"; then
  2011 +  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  2012 +else
  2013 +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  2014 +  ac_dummy="$PATH"
  2015 +  for ac_dir in $ac_dummy; do
  2016 +    test -z "$ac_dir" && ac_dir=.
  2017 +    if test -f $ac_dir/$ac_word; then
  2018 +      ac_cv_prog_RANLIB="ranlib"
  2019 +      break
  2020 +    fi
  2021 +  done
  2022 +  IFS="$ac_save_ifs"
  2023 +  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
  2024 +fi
  2025 +fi
  2026 +RANLIB="$ac_cv_prog_RANLIB"
  2027 +if test -n "$RANLIB"; then
  2028 +  echo "$ac_t""$RANLIB" 1>&6
  2029 +else
  2030 +  echo "$ac_t""no" 1>&6
  2031 +fi
  2033 +else
  2034 +  RANLIB=":"
  2035 +fi
  2036 +fi
  2040 +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
  2043 +#AM_MAINTAINER_MODE
  2045 +# We need AM_EXEEXT to keep automake happy in cygnus mode.  However,
  2046 +# at least currently, we never actually build a program, so we never
  2047 +# need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
  2048 +# fails, because we are probably configuring with a cross compiler
  2049 +# which can't create executables.  So we include AM_EXEEXT to keep
  2050 +# automake happy, but we don't execute it, since we don't care about
  2051 +# the result.
  2052 +if false; then
  2055 +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
  2056 +echo "configure:1246: checking for executable suffix" >&5
  2057 +if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then
  2058 +  echo $ac_n "(cached) $ac_c" 1>&6
  2059 +else
  2060 +  if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
  2061 +am_cv_exeext=.exe
  2062 +else
  2063 +cat > am_c_test.c << 'EOF'
  2064 +int main() {
  2065 +/* Nothing needed here */
  2066 +}
  2067 +EOF
  2068 +${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
  2069 +am_cv_exeext=
  2070 +for file in am_c_test.*; do
  2071 +   case $file in
  2072 +    *.c) ;;
  2073 +    *.o) ;;
  2074 +    *) am_cv_exeext=`echo $file | sed -e s/am_c_test//` ;;
  2075 +   esac
  2076 +done
  2077 +rm -f am_c_test*
  2078 +fi
  2080 +test x"${am_cv_exeext}" = x && am_cv_exeext=no
  2081 +fi
  2082 +EXEEXT=""
  2083 +test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
  2084 +echo "$ac_t""${am_cv_exeext}" 1>&6
  2086 +fi
  2088 +. ${newlib_basedir}/configure.host
  2090 +case ${newlib_basedir} in
  2091 +/* | A-Za-z:/\\*) newlib_flagbasedir=${newlib_basedir} ;;
  2092 +*) newlib_flagbasedir='$(top_builddir)/'${newlib_basedir} ;;
  2093 +esac
  2095 +newlib_cflags="${newlib_cflags} -I"'$(top_builddir)'"/../../../targ-include -I${newlib_flagbasedir}/libc/include"
  2096 +case "${host}" in
  2097 +  *-*-cygwin32*)
  2098 +    newlib_cflags="${newlib_cflags} -I${newlib_flagbasedir}/../winsup/include"
  2099 +    ;;
  2100 +esac
  2102 +newlib_cflags="${newlib_cflags} -fno-builtin"
  2104 +NEWLIB_CFLAGS=${newlib_cflags}
  2111 +trap '' 1 2 15
  2112 +cat > confcache <<\EOF
  2113 +# This file is a shell script that caches the results of configure
  2114 +# tests run on this system so they can be shared between configure
  2115 +# scripts and configure runs.  It is not useful on other systems.
  2116 +# If it contains results you don't want to keep, you may remove or edit it.
  2117 +#
  2118 +# By default, configure uses ./config.cache as the cache file,
  2119 +# creating it if it does not exist already.  You can give configure
  2120 +# the --cache-file=FILE option to use a different cache file; that is
  2121 +# what configure does when it calls configure scripts in
  2122 +# subdirectories, so they share the cache.
  2123 +# Giving --cache-file=/dev/null disables caching, for debugging configure.
  2124 +# config.status only pays attention to the cache file if you give it the
  2125 +# --recheck option to rerun configure.
  2126 +#
  2127 +EOF
  2128 +# The following way of writing the cache mishandles newlines in values,
  2129 +# but we know of no workaround that is simple, portable, and efficient.
  2130 +# So, don't put newlines in cache variables' values.
  2131 +# Ultrix sh set writes to stderr and can't be redirected directly,
  2132 +# and sets the high bit in the cache file unless we assign to the vars.
  2133 +(set) 2>&1 |
  2134 +  case `(ac_space=' '; set | grep ac_space) 2>&1` in
  2135 +  *ac_space=\ *)
  2136 +    # `set' does not quote correctly, so add quotes (double-quote substitution
  2137 +    # turns \\\\ into \\, and sed turns \\ into \).
  2138 +    sed -n \
  2139 +      -e "s/'/'\\\\''/g" \
  2140 +      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
  2141 +    ;;
  2142 +  *)
  2143 +    # `set' quotes correctly as required by POSIX, so do not add quotes.
  2144 +    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
  2145 +    ;;
  2146 +  esac >> confcache
  2147 +if cmp -s $cache_file confcache; then
  2148 +  :
  2149 +else
  2150 +  if test -w $cache_file; then
  2151 +    echo "updating cache $cache_file"
  2152 +    cat confcache > $cache_file
  2153 +  else
  2154 +    echo "not updating unwritable cache $cache_file"
  2155 +  fi
  2156 +fi
  2157 +rm -f confcache
  2159 +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
  2161 +test "x$prefix" = xNONE && prefix=$ac_default_prefix
  2162 +# Let make expand exec_prefix.
  2163 +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  2165 +# Any assignment to VPATH causes Sun make to only execute
  2166 +# the first set of double-colon rules, so remove it if not needed.
  2167 +# If there is a colon in the path, we need to keep it.
  2168 +if test "x$srcdir" = x.; then
  2169 +  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
  2170 +fi
  2172 +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
  2174 +# Transform confdefs.h into DEFS.
  2175 +# Protect against shell expansion while executing Makefile rules.
  2176 +# Protect against Makefile macro expansion.
  2177 +cat > conftest.defs <<\EOF
  2178 +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
  2179 +s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
  2180 +s%\[%\\&%g
  2181 +s%\]%\\&%g
  2182 +s%\$%$$%g
  2183 +EOF
  2184 +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
  2185 +rm -f conftest.defs
  2188 +# Without the "./", some shells look in PATH for config.status.
  2189 +: ${CONFIG_STATUS=./config.status}
  2191 +echo creating $CONFIG_STATUS
  2192 +rm -f $CONFIG_STATUS
  2193 +cat > $CONFIG_STATUS <<EOF
  2194 +#! /bin/sh
  2195 +# Generated automatically by configure.
  2196 +# Run this file to recreate the current configuration.
  2197 +# This directory was configured as follows,
  2198 +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  2199 +#
  2200 +# $0 $ac_configure_args
  2201 +#
  2202 +# Compiler output produced by configure, useful for debugging
  2203 +# configure, is in ./config.log if it exists.
  2205 +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
  2206 +for ac_option
  2207 +do
  2208 +  case "\$ac_option" in
  2209 +  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  2210 +    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
  2211 +    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
  2212 +  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
  2213 +    echo "$CONFIG_STATUS generated by autoconf version 2.13"
  2214 +    exit 0 ;;
  2215 +  -help | --help | --hel | --he | --h)
  2216 +    echo "\$ac_cs_usage"; exit 0 ;;
  2217 +  *) echo "\$ac_cs_usage"; exit 1 ;;
  2218 +  esac
  2219 +done
  2221 +ac_given_srcdir=$srcdir
  2222 +ac_given_INSTALL="$INSTALL"
  2224 +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
  2225 +EOF
  2226 +cat >> $CONFIG_STATUS <<EOF
  2228 +# Protect against being on the right side of a sed subst in config.status.
  2229 +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
  2230 + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
  2231 +$ac_vpsub
  2232 +$extrasub
  2233 +s%@SHELL@%$SHELL%g
  2234 +s%@CFLAGS@%$CFLAGS%g
  2235 +s%@CPPFLAGS@%$CPPFLAGS%g
  2236 +s%@CXXFLAGS@%$CXXFLAGS%g
  2237 +s%@FFLAGS@%$FFLAGS%g
  2238 +s%@DEFS@%$DEFS%g
  2239 +s%@LDFLAGS@%$LDFLAGS%g
  2240 +s%@LIBS@%$LIBS%g
  2241 +s%@exec_prefix@%$exec_prefix%g
  2242 +s%@prefix@%$prefix%g
  2243 +s%@program_transform_name@%$program_transform_name%g
  2244 +s%@bindir@%$bindir%g
  2245 +s%@sbindir@%$sbindir%g
  2246 +s%@libexecdir@%$libexecdir%g
  2247 +s%@datadir@%$datadir%g
  2248 +s%@sysconfdir@%$sysconfdir%g
  2249 +s%@sharedstatedir@%$sharedstatedir%g
  2250 +s%@localstatedir@%$localstatedir%g
  2251 +s%@libdir@%$libdir%g
  2252 +s%@includedir@%$includedir%g
  2253 +s%@oldincludedir@%$oldincludedir%g
  2254 +s%@infodir@%$infodir%g
  2255 +s%@mandir@%$mandir%g
  2256 +s%@newlib_basedir@%$newlib_basedir%g
  2257 +s%@host@%$host%g
  2258 +s%@host_alias@%$host_alias%g
  2259 +s%@host_cpu@%$host_cpu%g
  2260 +s%@host_vendor@%$host_vendor%g
  2261 +s%@host_os@%$host_os%g
  2262 +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  2263 +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
  2264 +s%@INSTALL_DATA@%$INSTALL_DATA%g
  2265 +s%@PACKAGE@%$PACKAGE%g
  2266 +s%@VERSION@%$VERSION%g
  2267 +s%@ACLOCAL@%$ACLOCAL%g
  2268 +s%@AUTOCONF@%$AUTOCONF%g
  2269 +s%@AUTOMAKE@%$AUTOMAKE%g
  2270 +s%@AUTOHEADER@%$AUTOHEADER%g
  2271 +s%@MAKEINFO@%$MAKEINFO%g
  2272 +s%@SET_MAKE@%$SET_MAKE%g
  2273 +s%@CC@%$CC%g
  2274 +s%@build@%$build%g
  2275 +s%@build_alias@%$build_alias%g
  2276 +s%@build_cpu@%$build_cpu%g
  2277 +s%@build_vendor@%$build_vendor%g
  2278 +s%@build_os@%$build_os%g
  2279 +s%@AS@%$AS%g
  2280 +s%@AR@%$AR%g
  2281 +s%@RANLIB@%$RANLIB%g
  2282 +s%@EXEEXT@%$EXEEXT%g
  2283 +s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g
  2284 +s%@machine_dir@%$machine_dir%g
  2285 +s%@sys_dir@%$sys_dir%g
  2287 +CEOF
  2288 +EOF
  2290 +cat >> $CONFIG_STATUS <<\EOF
  2292 +# Split the substitutions into bite-sized pieces for seds with
  2293 +# small command number limits, like on Digital OSF/1 and HP-UX.
  2294 +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
  2295 +ac_file=1 # Number of current file.
  2296 +ac_beg=1 # First line for current file.
  2297 +ac_end=$ac_max_sed_cmds # Line after last line for current file.
  2298 +ac_more_lines=:
  2299 +ac_sed_cmds=""
  2300 +while $ac_more_lines; do
  2301 +  if test $ac_beg -gt 1; then
  2302 +    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
  2303 +  else
  2304 +    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
  2305 +  fi
  2306 +  if test ! -s conftest.s$ac_file; then
  2307 +    ac_more_lines=false
  2308 +    rm -f conftest.s$ac_file
  2309 +  else
  2310 +    if test -z "$ac_sed_cmds"; then
  2311 +      ac_sed_cmds="sed -f conftest.s$ac_file"
  2312 +    else
  2313 +      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
  2314 +    fi
  2315 +    ac_file=`expr $ac_file + 1`
  2316 +    ac_beg=$ac_end
  2317 +    ac_end=`expr $ac_end + $ac_max_sed_cmds`
  2318 +  fi
  2319 +done
  2320 +if test -z "$ac_sed_cmds"; then
  2321 +  ac_sed_cmds=cat
  2322 +fi
  2323 +EOF
  2325 +cat >> $CONFIG_STATUS <<EOF
  2327 +CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
  2328 +EOF
  2329 +cat >> $CONFIG_STATUS <<\EOF
  2330 +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  2331 +  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
  2332 +  case "$ac_file" in
  2333 +  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
  2334 +       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  2335 +  *) ac_file_in="${ac_file}.in" ;;
  2336 +  esac
  2338 +  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
  2340 +  # Remove last slash and all that follows it.  Not all systems have dirname.
  2341 +  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  2342 +  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
  2343 +    # The file is in a subdirectory.
  2344 +    test ! -d "$ac_dir" && mkdir "$ac_dir"
  2345 +    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
  2346 +    # A "../" for each directory in $ac_dir_suffix.
  2347 +    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  2348 +  else
  2349 +    ac_dir_suffix= ac_dots=
  2350 +  fi
  2352 +  case "$ac_given_srcdir" in
  2353 +  .)  srcdir=.
  2354 +      if test -z "$ac_dots"; then top_srcdir=.
  2355 +      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
  2356 +  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  2357 +  *) # Relative path.
  2358 +    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
  2359 +    top_srcdir="$ac_dots$ac_given_srcdir" ;;
  2360 +  esac
  2362 +  case "$ac_given_INSTALL" in
  2363 +  [/$]*) INSTALL="$ac_given_INSTALL" ;;
  2364 +  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
  2365 +  esac
  2367 +  echo creating "$ac_file"
  2368 +  rm -f "$ac_file"
  2369 +  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
  2370 +  case "$ac_file" in
  2371 +  *Makefile*) ac_comsub="1i\\
  2372 +# $configure_input" ;;
  2373 +  *) ac_comsub= ;;
  2374 +  esac
  2376 +  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
  2377 +  sed -e "$ac_comsub
  2378 +s%@configure_input@%$configure_input%g
  2379 +s%@srcdir@%$srcdir%g
  2380 +s%@top_srcdir@%$top_srcdir%g
  2381 +s%@INSTALL@%$INSTALL%g
  2382 +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
  2383 +fi; done
  2384 +rm -f conftest.s*
  2386 +EOF
  2387 +cat >> $CONFIG_STATUS <<EOF
  2389 +EOF
  2390 +cat >> $CONFIG_STATUS <<\EOF
  2392 +exit 0
  2393 +EOF
  2394 +chmod +x $CONFIG_STATUS
  2395 +rm -fr confdefs* $ac_clean_files
  2396 +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
  2398 diff -urN newlib-1.8.2/newlib/libc/sys/aica/configure.in newlib-1.8.2-aica/newlib/libc/sys/aica/configure.in
  2399 --- newlib-1.8.2/newlib/libc/sys/aica/configure.in	1970-01-01 10:00:00.000000000 +1000
  2400 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/configure.in	2008-08-13 11:54:44.000000000 +1000
  2401 @@ -0,0 +1,12 @@
  2402 +dnl This is the newlib/libc/sys/sh configure.in file.
  2403 +dnl Process this file with autoconf to produce a configure script.
  2405 +AC_PREREQ(2.5)
  2406 +AC_INIT(sbrk.c)
  2408 +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. 
  2409 +AC_CONFIG_AUX_DIR(../../../..)
  2411 +NEWLIB_CONFIGURE(../../..)
  2413 +AC_OUTPUT(Makefile)
  2414 diff -urN newlib-1.8.2/newlib/libc/sys/aica/creat.c newlib-1.8.2-aica/newlib/libc/sys/aica/creat.c
  2415 --- newlib-1.8.2/newlib/libc/sys/aica/creat.c	1970-01-01 10:00:00.000000000 +1000
  2416 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/creat.c	2008-08-13 11:54:44.000000000 +1000
  2417 @@ -0,0 +1,22 @@
  2418 +#include <sys/types.h>
  2419 +#include <sys/fcntl.h>
  2421 +#include "vfs.h"
  2423 +int
  2424 +creat (const char *path, mode_t mode)
  2425 +{
  2426 +  char *obj = _newlib_vfs_new_string (path);
  2428 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
  2429 +  struct file *pf = mops->creat (obj, mode);
  2431 +  _newlib_vfs_delete_string (obj);
  2433 +  if (pf != NULL)
  2434 +  {
  2435 +    return _newlib_vfs_insert_file (pf);
  2436 +  }
  2438 +  return -1;
  2439 +}
  2440 diff -urN newlib-1.8.2/newlib/libc/sys/aica/crt0.S newlib-1.8.2-aica/newlib/libc/sys/aica/crt0.S
  2441 --- newlib-1.8.2/newlib/libc/sys/aica/crt0.S	1970-01-01 10:00:00.000000000 +1000
  2442 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/crt0.S	2008-08-13 13:08:13.000000000 +1000
  2443 @@ -0,0 +1,165 @@
  2444 +.section .text
  2445 +.code 32
  2446 +.align 	0
  2447 +.global	start
  2448 +.global ___exit
  2449 +.global _atexit
  2450 +start:
  2452 +/* Start by setting up a stack */
  2453 +	/*  Set up the stack pointer to a fixed value */
  2454 +	ldr	r3, .LC0
  2455 +	mov 	sp, r3
  2456 +	/* Setup a default stack-limit in-case the code has been
  2457 +	   compiled with "-mapcs-stack-check".  Hard-wiring this value
  2458 +	   is not ideal, since there is currently no support for
  2459 +	   checking that the heap and stack have not collided, or that
  2460 +	   this default 64k is enough for the program being executed.
  2461 +	   However, it ensures that this simple crt0 world will not
  2462 +	   immediately cause an overflow event:  */
  2463 +	sub	sl, sp, #64 << 10	/* Still assumes 256bytes below sl */
  2465 +	mov 	a2, #0			/* Second arg: fill value */
  2466 +	mov	fp, a2			/* Null frame pointer */
  2467 +	mov	r7, a2			/* Null frame pointer for Thumb */
  2469 +	ldr	a1, .LC1		/* First arg: start of memory block */
  2470 +	ldr	a3, .LC2	
  2471 +	sub	a3, a3, a1		/* Third arg: length of block */
  2474 +#ifdef __thumb__		/* Enter Thumb mode.... */
  2476 +	add	a4, pc, #1	/* Get the address of the Thumb block */
  2477 +	bx	a4		/* Go there and start Thumb decoding  */
  2479 +	.code 16
  2480 +	.global __change_mode
  2481 +	.thumb_func
  2482 +__change_mode:	
  2483 +#endif
  2485 +	bl	memset
  2486 +	mov	r0, #0		/*  no arguments  */
  2487 +	mov	r1, #0		/*  no argv either */
  2489 +	/*  Parse string at r1 */
  2490 +	mov	r0, #0		/*  count of arguments so far */
  2491 +.LC10:
  2492 +/*  Skip leading blanks */
  2493 +#ifdef __thumb__
  2494 +	ldrb	r3, [r1]
  2495 +	add	r1, #1
  2496 +#else
  2497 +	ldrb	r3, [r1], #1
  2498 +#endif
  2499 +	cmp	r3, #0
  2500 +	beq	.LC12
  2501 +	cmp	r3, #' '
  2502 +	beq	.LC10
  2504 +/*  See whether we are scanning a string */
  2505 +	cmp	r3, #'"'
  2506 +#ifdef __thumb__
  2507 +	beq	.LC20
  2508 +	cmp	r3, #'\''
  2509 +	bne	.LC21
  2510 +.LC20:
  2511 +	mov	r2, r3
  2512 +	b	.LC22
  2514 +.LC21:
  2515 +	mov	r2, #' '	/*  terminator type */
  2516 +	sub	r1, r1, #1	/*  adjust back to point at start char */
  2517 +.LC22:
  2518 +#else
  2519 +	cmpne	r3, #'\''
  2520 +	moveq	r2, r3
  2521 +	movne	r2, #' '	/*  terminator type */
  2522 +	subne	r1, r1, #1	/*  adjust back to point at start char */
  2523 +#endif
  2525 +/*  Stack a pointer to the current argument */
  2526 +#ifdef __thumb__
  2527 +	push	{r1}
  2528 +#else
  2529 +	stmfd	sp!, {r1}
  2530 +#endif
  2531 +	add	r0, r0, #1
  2532 +.LC11:
  2533 +#ifdef __thumb__
  2534 +	ldrb	r3, [r1]
  2535 +	add	r1, #1
  2536 +#else
  2537 +	ldrb	r3, [r1], #1
  2538 +#endif
  2539 +	cmp	r3, #0
  2540 +	beq	.LC12
  2541 +	cmp	r2, r3		/*  reached terminator? */
  2542 +	bne	.LC11
  2543 +	mov	r2, #0
  2544 +	sub	r3, r1, #1
  2545 +	strb	r2, [r3]	/*  terminate the arg string */
  2546 +	b	.LC10
  2548 +.LC12:
  2549 +	mov	r1, sp		/*  point at stacked arg pointers */
  2550 +	/* We've now got the stacked args in order reverse the */
  2551 +#ifdef __thumb__
  2552 +	mov	r2, r0
  2553 +	lsl	r2, #2
  2554 +	add	r2, sp
  2555 +	mov	r3, sp
  2556 +.LC15:	cmp	r2, r3
  2557 +	bls	.LC14
  2558 +	sub	r2, #4
  2559 +	ldr	r4, [r2]
  2560 +	ldr	r5, [r3]
  2561 +	str	r5, [r2]
  2562 +	str	r4, [r3]
  2563 +	add	r3, #4
  2564 +	b	.LC15
  2565 +.LC14:	
  2566 +#else
  2567 +	add	r2, sp, r0, LSL #2	/* End of args */
  2568 +	mov	r3, sp			/* Start of args */
  2569 +.LC13:	cmp	r2, r3
  2570 +	ldrhi	r4,[r2, #-4]		/* Reverse ends of list */
  2571 +	ldrhi	r5, [r3]
  2572 +	strhi	r5, [r2, #-4]!
  2573 +	strhi	r4, [r3], #4
  2574 +	bhi	.LC13
  2575 +#endif
  2577 +	bl	main
  2579 +	bl	exit		/* Should not return */
  2581 +#ifdef __thumb__
  2582 +	/* Come out of Thumb mode... This code should be redundant...   */
  2584 +	mov	a4, pc
  2585 +	bx	a4
  2587 +	.code 32
  2588 +	.global change_back
  2589 +change_back:
  2590 +	/* Halt the execution.  This code should never be executed.  */
  2591 +	/*
  2592 +	** With no debug monitor, this probably aborts (eventually).
  2593 +	** With a Demon debug monitor, this halts cleanly.
  2594 +	** With an Angel debug monitor, this will report 'Unknown SWI'.
  2595 +	*/
  2596 +	swi	0
  2597 +#endif
  2599 +	/* For Thumb, constants must be after the code since only 
  2600 +	positive offsets are supported for PC relative addresses. */
  2602 +	.align 0
  2603 +.LC0:
  2604 +.LC1:
  2605 +	.word	__bss_start__
  2606 +.LC2:
  2607 +	.word	__bss_end__
  2609 diff -urN newlib-1.8.2/newlib/libc/sys/aica/dcload.S newlib-1.8.2-aica/newlib/libc/sys/aica/dcload.S
  2610 --- newlib-1.8.2/newlib/libc/sys/aica/dcload.S	1970-01-01 10:00:00.000000000 +1000
  2611 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/dcload.S	2008-08-13 13:57:28.000000000 +1000
  2612 @@ -0,0 +1,21 @@
  2613 +.text
  2614 +.align	2
  2615 +.global	dcloadsyscall
  2616 +.type	dcloadsyscall, %function
  2617 +dcloadsyscall:
  2618 +	@ args = 0, pretend = 0, frame = 0
  2619 +	@ frame_needed = 0, uses_anonymous_args = 0
  2620 +	@ link register save eliminated.
  2621 +	mov	ip, #48
  2622 +	str	r1, [ip, #4]
  2623 +	str	r2, [ip, #8]
  2624 +	str	r3, [ip, #12]
  2625 +	str	r0, [ip, #0]
  2626 +	@ lr needed for prologue
  2627 +.L2:
  2628 +	ldr	r3, [ip, #0]
  2629 +	cmn	r3, #1
  2630 +	bne	.L2
  2631 +	ldr	r0, [ip, #4]
  2632 +	mov	pc, lr
  2633 +	.size	dcloadsyscall, .-dcloadsyscall
  2634 diff -urN newlib-1.8.2/newlib/libc/sys/aica/dcload.c newlib-1.8.2-aica/newlib/libc/sys/aica/dcload.c
  2635 --- newlib-1.8.2/newlib/libc/sys/aica/dcload.c	1970-01-01 10:00:00.000000000 +1000
  2636 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/dcload.c	2008-08-13 12:10:51.000000000 +1000
  2637 @@ -0,0 +1,17 @@
  2638 +#define SYSCALL_BASE 0x00000030
  2640 +struct syscall_struct {
  2641 +   unsigned int syscall;
  2642 +   unsigned int arg1, arg2, arg3;
  2643 +};
  2645 +unsigned int dcloadsyscall(unsigned int syscall, unsigned int arg1, unsigned int arg2, unsigned int arg3)
  2646 +{
  2647 +    volatile struct syscall_struct *p = (struct syscall_struct *)(SYSCALL_BASE);
  2648 +    p->arg1 = arg1;
  2649 +    p->arg2 = arg2;
  2650 +    p->arg3 = arg3;
  2651 +    p->syscall = syscall;
  2652 +    while( p->syscall != 0xFFFFFFFF );
  2653 +    return p->arg1;
  2654 +}
  2655 diff -urN newlib-1.8.2/newlib/libc/sys/aica/dcload_vfs.c newlib-1.8.2-aica/newlib/libc/sys/aica/dcload_vfs.c
  2656 --- newlib-1.8.2/newlib/libc/sys/aica/dcload_vfs.c	1970-01-01 10:00:00.000000000 +1000
  2657 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/dcload_vfs.c	2008-08-13 18:19:05.000000000 +1000
  2658 @@ -0,0 +1,225 @@
  2659 +/* Support routines for host access via Andrew K's dcload.  dcload offers
  2660 + full host file-system access along with a few POSIX-like functions. */
  2662 +/* FIXME: If the host is returning negative values (error codes), then
  2663 + we need to assign the proper value to errno and return -1 as per newlib's
  2664 + conventions. */
  2666 +/* FIXME: Split some of this off into a separate file, dcload.c.  This will
  2667 + contain public functions that coincide with the prototypes in
  2668 + include/dcload.h */
  2670 +#include <sys/types.h>
  2671 +#include <sys/stat.h>
  2672 +#include <errno.h>
  2673 +#include <stdlib.h>
  2675 +#include "vfs.h"
  2677 +static struct media_ops dcload_host_media_ops;
  2678 +static struct file_ops dcload_host_file_ops;
  2680 +/* True if we have console/file-system access on the host */
  2681 +static int host_enabled = 1;
  2683 +/* Determine whether we're loaded under dcload and if so, whether or not
  2684 + the console/file-server is enabled.  If the console/file-server isn't
  2685 + enabled, then we won't have anything meaningful to do in the host access
  2686 + routines, so they'll be replaced with invalid media/file ops in our init
  2687 + routine. */
  2689 +int _newlib_vfs_is_dcload (void)
  2690 +{
  2691 +    return 1;
  2692 +}
  2694 +void _newlib_vfs_dcload_init (void)
  2695 +{
  2696 +  _newlib_vfs_initialized = VFS_LOADER_DCLOAD_NOHOST;
  2698 +  if (host_enabled)
  2699 +  {
  2700 +    /* FIXME: Rework this... */
  2701 +    struct file * stdin_file  = _newlib_vfs_first_file;
  2702 +    struct file * stdout_file = stdin_file->next;
  2703 +    struct file * stderr_file = stdout_file->next;
  2705 +    _newlib_vfs_initialized = VFS_LOADER_DCLOAD_HOST;
  2706 +	  _newlib_vfs_host_media_ops = &dcload_host_media_ops;
  2708 +    /* Reroute stdin, stdout, and stderr through dcload's host console. */
  2709 +    stdin_file->fops  = &dcload_host_file_ops;
  2710 +    stdout_file->fops = &dcload_host_file_ops;
  2711 +    stderr_file->fops = &dcload_host_file_ops;
  2712 +  }
  2714 +  /* All media ops are initially set to invalid so our work is done. */
  2715 +}
  2717 +extern int dcloadsyscall (int func, ...);
  2719 +/* dcload host media operations */
  2721 +/* Perform the open/creat syscall and allocate space for a new file if
  2722 + we get a valid fd.  Otherwise return the errno and NULL on errror. */
  2723 +static struct file *do_open_media_op (int func, const char *obj, int arg, ...)
  2724 +{
  2725 +  struct file *pf;
  2726 +  int res = dcloadsyscall (func, obj, arg);
  2727 +  if (res >= 0)
  2728 +  {
  2729 +    pf = (struct file *) malloc (sizeof (struct file));
  2731 +    if (pf)
  2732 +    {
  2733 +      /* The library fd is set in _newlib_vfs_insert_file */
  2734 +      pf->next = NULL;
  2735 +			pf->fd = 0;
  2736 +      pf->media_fd = res;
  2737 +      pf->fops = &dcload_host_file_ops;
  2738 +      pf->specifics = NULL;
  2739 +      return pf;
  2740 +    }
  2741 +  }
  2743 +  return NULL;
  2744 +}
  2746 +#define OPEN_NR 2
  2747 +static struct file *dcload_open_media_op (const char *obj, int flags,
  2748 +                                          mode_t mode)
  2749 +{
  2750 +  return do_open_media_op (OPEN_NR, obj, flags, mode);
  2751 +}
  2753 +#define CREAT_NR 4
  2754 +static struct file *dcload_creat_media_op (const char *obj, mode_t mode)
  2755 +{
  2756 +  return do_open_media_op (CREAT_NR, obj, mode);
  2757 +}
  2759 +#define LINK_NR 5
  2760 +static int dcload_link_media_op (const char *old_obj, const char *new_obj)
  2761 +{
  2762 +  return dcloadsyscall (LINK_NR, old_obj, new_obj);
  2763 +}
  2765 +#define UNLINK_NR 6
  2766 +static int dcload_unlink_media_op (const char *obj)
  2767 +{
  2768 +  return dcloadsyscall (UNLINK_NR, obj);
  2769 +}
  2771 +#define STAT_NR 12
  2772 +static int dcload_stat_media_op (const char *obj, struct stat *pstat)
  2773 +{
  2774 +  return dcloadsyscall (STAT_NR, obj, pstat);
  2775 +}
  2777 +#define CHMOD_NR 8
  2778 +static int dcload_chmod_media_op (const char *obj, mode_t mode)
  2779 +{
  2780 +  return dcloadsyscall (CHMOD_NR, obj, mode);
  2781 +}
  2783 +#define CHDIR_NR 7
  2784 +static int dcload_chdir_media_op (const char *obj)
  2785 +{
  2786 +  return dcloadsyscall (CHDIR_NR, obj);
  2787 +}
  2789 +/* dcload host file operations */
  2791 +static size_t do_rw_file_op (int func, struct file *pf, void *buf, size_t cnt)
  2792 +{
  2793 +  return dcloadsyscall (func, pf->media_fd, buf, cnt);
  2794 +}
  2796 +#define READ_NR 0
  2797 +static size_t dcload_read_file_op (struct file *pf, void *buf, size_t cnt)
  2798 +{
  2799 +  return do_rw_file_op (READ_NR, pf, buf, cnt);
  2800 +}
  2802 +#define WRITE_NR 1
  2803 +static size_t dcload_write_file_op (struct file *pf, void *buf, size_t cnt)
  2804 +{
  2805 +  return do_rw_file_op (WRITE_NR, pf, buf, cnt);
  2806 +}
  2808 +#define LSEEK_NR 9
  2809 +static off_t dcload_lseek_file_op (struct file *pf, off_t pos, int whence)
  2810 +{
  2811 +  return dcloadsyscall (LSEEK_NR, pf->media_fd, pos, whence);
  2812 +}
  2814 +#define CLOSE_NR 3
  2815 +static int dcload_close_file_op (struct file *pf)
  2816 +{
  2817 +  return dcloadsyscall (CLOSE_NR, pf->media_fd);
  2818 +}
  2820 +#define FSTAT_NR 10
  2821 +static int dcload_fstat_file_op (struct file *pf, struct stat *pstat)
  2822 +{
  2823 +  return dcloadsyscall (FSTAT_NR, pf->media_fd, pstat);
  2824 +}
  2826 +#define EXIT_NR 15
  2827 +void _newlib_vfs_dcload_exit (int n)
  2828 +{
  2829 +  dcloadsyscall (EXIT_NR, n);
  2830 +}
  2832 +#define ASSIGN_WRKMEM_NR 14
  2833 +void dcload_assign_wrkmem (void *buf)
  2834 +{
  2835 +  dcloadsyscall (ASSIGN_WRKMEM_NR, buf);
  2836 +}
  2838 +/* media_ops for host file-system access */
  2840 +int dcload_mkdir_media_op( const char *c, mode_t mode )
  2841 +{
  2842 +  errno = ENOSYS;
  2843 +  return -1;
  2844 +}
  2846 +int dcload_rmdir_media_op( const char *c )
  2847 +{
  2848 +  errno = ENOSYS;
  2849 +  return -1;
  2850 +}
  2852 +int dcload_ioctl_file_op( )
  2853 +{
  2854 +  errno = ENOSYS;
  2855 +  return -1;
  2856 +}
  2858 +static struct media_ops dcload_host_media_ops =
  2859 +{
  2860 +  open:                dcload_open_media_op,
  2861 +  creat:               dcload_creat_media_op,
  2862 +  link:                dcload_link_media_op,
  2863 +  unlink:              dcload_unlink_media_op,
  2864 +  stat:                dcload_stat_media_op,
  2865 +  chmod:               dcload_chmod_media_op,
  2866 +  mkdir:               dcload_mkdir_media_op,
  2867 +  rmdir:               dcload_rmdir_media_op,
  2868 +  chdir:               dcload_chdir_media_op
  2869 +};
  2871 +/* file_ops for a host file */
  2873 +static struct file_ops dcload_host_file_ops =
  2874 +{
  2875 +  lseek:               dcload_lseek_file_op,
  2876 +  close:               dcload_close_file_op,
  2877 +  read:                dcload_read_file_op,
  2878 +  write:               dcload_write_file_op,
  2879 +  ioctl:               dcload_ioctl_file_op,
  2880 +  fstat:               dcload_fstat_file_op
  2881 +};
  2884 diff -urN newlib-1.8.2/newlib/libc/sys/aica/dup.c newlib-1.8.2-aica/newlib/libc/sys/aica/dup.c
  2885 --- newlib-1.8.2/newlib/libc/sys/aica/dup.c	1970-01-01 10:00:00.000000000 +1000
  2886 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/dup.c	2008-08-13 11:54:44.000000000 +1000
  2887 @@ -0,0 +1,2 @@
  2888 +/* This hack is required for libstdc++ to work properly */
  2889 +int dup(int fd) { return fd; }
  2890 diff -urN newlib-1.8.2/newlib/libc/sys/aica/exit.c newlib-1.8.2-aica/newlib/libc/sys/aica/exit.c
  2891 --- newlib-1.8.2/newlib/libc/sys/aica/exit.c	1970-01-01 10:00:00.000000000 +1000
  2892 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/exit.c	2008-08-13 11:54:44.000000000 +1000
  2893 @@ -0,0 +1,18 @@
  2894 +/* TODO: Do different things depending on the loader present, e.g. dcload
  2895 + has an exit() call, gdbstubs can tell gdb "W00", etc. */
  2897 +#include "vfs.h"
  2899 +void _exit(int n);
  2901 +void exit (int n) { _exit (n); }
  2903 +extern void _newlib_vfs_dcload_exit (int);
  2905 +void
  2906 +_exit (int n)
  2907 +{
  2908 +  if( _newlib_vfs_is_dcload() ) {
  2909 +    _newlib_vfs_dcload_exit (n);
  2910 +  }
  2911 +}
  2912 diff -urN newlib-1.8.2/newlib/libc/sys/aica/fcntl.c newlib-1.8.2-aica/newlib/libc/sys/aica/fcntl.c
  2913 --- newlib-1.8.2/newlib/libc/sys/aica/fcntl.c	1970-01-01 10:00:00.000000000 +1000
  2914 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/fcntl.c	2008-08-13 11:54:44.000000000 +1000
  2915 @@ -0,0 +1,21 @@
  2916 +#include <sys/fcntl.h>
  2918 +/* Minimal fcntl support is necessary for C++ console streams cin, cout, and
  2919 +   cerr. */
  2920 +int
  2921 +_fcntl (int fd, int flag, ...)
  2922 +{
  2923 +  switch (flag) {
  2924 +     case F_GETFL:
  2925 +        switch (fd) {
  2926 +           case 0: return O_RDONLY;
  2927 +           case 1: return O_WRONLY;
  2928 +           case 2: return O_WRONLY;
  2929 +           default: return -1;
  2930 +        }
  2931 +     default:
  2932 +        return -1;
  2933 +  }
  2935 +  return -1;
  2936 +}
  2937 diff -urN newlib-1.8.2/newlib/libc/sys/aica/fstat.c newlib-1.8.2-aica/newlib/libc/sys/aica/fstat.c
  2938 --- newlib-1.8.2/newlib/libc/sys/aica/fstat.c	1970-01-01 10:00:00.000000000 +1000
  2939 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/fstat.c	2008-08-13 11:54:44.000000000 +1000
  2940 @@ -0,0 +1,12 @@
  2941 +#include <sys/types.h>
  2942 +#include <sys/stat.h>
  2944 +#include "vfs.h"
  2946 +int
  2947 +_fstat (int fd, struct stat *pstat)
  2948 +{
  2949 +  struct file *pf = _newlib_vfs_get_file (fd);
  2951 +  return pf->fops->fstat (pf, pstat);
  2952 +}
  2953 diff -urN newlib-1.8.2/newlib/libc/sys/aica/getpid.c newlib-1.8.2-aica/newlib/libc/sys/aica/getpid.c
  2954 --- newlib-1.8.2/newlib/libc/sys/aica/getpid.c	1970-01-01 10:00:00.000000000 +1000
  2955 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/getpid.c	2008-08-13 11:54:44.000000000 +1000
  2956 @@ -0,0 +1,5 @@
  2957 +int
  2958 +_getpid ()
  2959 +{
  2960 +  return 1;
  2961 +}
  2962 diff -urN newlib-1.8.2/newlib/libc/sys/aica/gettimeofday.c newlib-1.8.2-aica/newlib/libc/sys/aica/gettimeofday.c
  2963 --- newlib-1.8.2/newlib/libc/sys/aica/gettimeofday.c	1970-01-01 10:00:00.000000000 +1000
  2964 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/gettimeofday.c	2008-08-13 11:54:44.000000000 +1000
  2965 @@ -0,0 +1,30 @@
  2966 +#include <time.h>
  2967 +#include <sys/time.h>
  2969 +/* Returns the number of seconds elapsed from the Unix epoch, January 1st,
  2970 + 1970.  Note that the Dreamcast counts time from January 1st, 1950, so we
  2971 + need to subtract 20 years (and 5 leap days) from the Dreamcast RTC to
  2972 + get valid values for libc's time functions. */
  2974 +#define TWENTY_YEARS ((20 * 365LU + 5) * 86400)
  2976 +int
  2977 +_gettimeofday (struct timeval *tp, struct timezone *tzp)
  2978 +{
  2979 +  if (tp)
  2980 +  {
  2981 +    unsigned long rtc_h = *(volatile unsigned long*)0x00810000;
  2982 +    unsigned long rtc_l = *(volatile unsigned long*)0x00810004;
  2983 +    unsigned long secs = ((rtc_h & 0xffff) << 16) | (rtc_l & 0xffff);
  2985 +    tp->tv_sec = secs - TWENTY_YEARS;
  2986 +    tp->tv_usec = 0;
  2987 +  }
  2988 +  if (tzp)
  2989 +  {
  2990 +    tzp->tz_minuteswest = 0;
  2991 +    tzp->tz_dsttime = 0;
  2992 +  }
  2994 +  return 0;
  2995 +}
  2996 diff -urN newlib-1.8.2/newlib/libc/sys/aica/ioctl.c newlib-1.8.2-aica/newlib/libc/sys/aica/ioctl.c
  2997 --- newlib-1.8.2/newlib/libc/sys/aica/ioctl.c	1970-01-01 10:00:00.000000000 +1000
  2998 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/ioctl.c	2008-08-13 11:54:44.000000000 +1000
  2999 @@ -0,0 +1,9 @@
  3000 +#include "vfs.h"
  3002 +int
  3003 +ioctl (int fd, int func, long arg)
  3004 +{
  3005 +  struct file *pf = _newlib_vfs_get_file (fd);
  3007 +  return pf->fops->ioctl (pf, func, arg);
  3008 +}
  3009 diff -urN newlib-1.8.2/newlib/libc/sys/aica/isatty.c newlib-1.8.2-aica/newlib/libc/sys/aica/isatty.c
  3010 --- newlib-1.8.2/newlib/libc/sys/aica/isatty.c	1970-01-01 10:00:00.000000000 +1000
  3011 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/isatty.c	2008-08-13 11:54:44.000000000 +1000
  3012 @@ -0,0 +1,10 @@
  3013 +/* Since file descriptors 0, 1, and 2 are always mapped to stdin, stdout,
  3014 + and stderr, we assume these are the only fds that permit interactive I/O. */
  3016 +int
  3017 +isatty (int fd)
  3018 +{
  3019 +  if (fd >= 0 && fd < 3)
  3020 +    return 1;
  3021 +  return 0;
  3022 +}
  3023 diff -urN newlib-1.8.2/newlib/libc/sys/aica/kill.c newlib-1.8.2-aica/newlib/libc/sys/aica/kill.c
  3024 --- newlib-1.8.2/newlib/libc/sys/aica/kill.c	1970-01-01 10:00:00.000000000 +1000
  3025 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/kill.c	2008-08-13 11:54:44.000000000 +1000
  3026 @@ -0,0 +1,8 @@
  3027 +#include <stdlib.h>
  3029 +int
  3030 +_kill ()
  3031 +{
  3032 +  abort ();
  3033 +  return 0;
  3034 +}
  3035 diff -urN newlib-1.8.2/newlib/libc/sys/aica/link.c newlib-1.8.2-aica/newlib/libc/sys/aica/link.c
  3036 --- newlib-1.8.2/newlib/libc/sys/aica/link.c	1970-01-01 10:00:00.000000000 +1000
  3037 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/link.c	2008-08-13 11:54:44.000000000 +1000
  3038 @@ -0,0 +1,16 @@
  3039 +#include "vfs.h"
  3041 +int
  3042 +_link (const char *old_path, const char *new_path)
  3043 +{
  3044 +  char *old_obj = _newlib_vfs_new_string (old_path);
  3045 +  char *new_obj = _newlib_vfs_new_string (new_path);
  3047 +  struct media_ops *mops = _newlib_vfs_get_media_ops (old_path);
  3048 +  int res = mops->link (old_obj, new_obj);
  3050 +  _newlib_vfs_delete_string (old_obj);
  3051 +  _newlib_vfs_delete_string (new_obj);
  3053 +  return res;
  3054 +}
  3055 diff -urN newlib-1.8.2/newlib/libc/sys/aica/lseek.c newlib-1.8.2-aica/newlib/libc/sys/aica/lseek.c
  3056 --- newlib-1.8.2/newlib/libc/sys/aica/lseek.c	1970-01-01 10:00:00.000000000 +1000
  3057 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/lseek.c	2008-08-13 11:54:44.000000000 +1000
  3058 @@ -0,0 +1,11 @@
  3059 +#include <sys/types.h>
  3061 +#include "vfs.h"
  3063 +off_t
  3064 +_lseek (int fd, off_t pos, int whence)
  3065 +{
  3066 +  struct file *pf = _newlib_vfs_get_file (fd);
  3068 +  return pf->fops->lseek (pf, pos, whence);
  3069 +}
  3070 diff -urN newlib-1.8.2/newlib/libc/sys/aica/mkdir.c newlib-1.8.2-aica/newlib/libc/sys/aica/mkdir.c
  3071 --- newlib-1.8.2/newlib/libc/sys/aica/mkdir.c	1970-01-01 10:00:00.000000000 +1000
  3072 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/mkdir.c	2008-08-13 11:54:44.000000000 +1000
  3073 @@ -0,0 +1,16 @@
  3074 +#include <sys/types.h>
  3076 +#include "vfs.h"
  3078 +int
  3079 +mkdir (const char *path, mode_t mode)
  3080 +{
  3081 +  char *obj = _newlib_vfs_new_string (path);
  3083 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
  3084 +  int res = mops->mkdir (obj, mode);
  3086 +  _newlib_vfs_delete_string (obj);
  3088 +  return res;
  3089 +}
  3090 diff -urN newlib-1.8.2/newlib/libc/sys/aica/open.c newlib-1.8.2-aica/newlib/libc/sys/aica/open.c
  3091 --- newlib-1.8.2/newlib/libc/sys/aica/open.c	1970-01-01 10:00:00.000000000 +1000
  3092 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/open.c	2008-08-13 11:54:44.000000000 +1000
  3093 @@ -0,0 +1,23 @@
  3094 +#include <sys/types.h>
  3096 +#include <stdio.h>
  3098 +#include "vfs.h"
  3100 +int
  3101 +_open (const char *path, int flags, mode_t mode)
  3102 +{
  3103 +  char *obj = _newlib_vfs_new_string (path);
  3105 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
  3106 +  struct file *pf = mops->open (obj, flags, mode);
  3108 +  _newlib_vfs_delete_string (obj);
  3110 +  if (pf != NULL)
  3111 +  {
  3112 +    return _newlib_vfs_insert_file (pf);
  3113 +  }
  3115 +  return -1;
  3116 +}
  3117 diff -urN newlib-1.8.2/newlib/libc/sys/aica/read.c newlib-1.8.2-aica/newlib/libc/sys/aica/read.c
  3118 --- newlib-1.8.2/newlib/libc/sys/aica/read.c	1970-01-01 10:00:00.000000000 +1000
  3119 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/read.c	2008-08-13 11:54:44.000000000 +1000
  3120 @@ -0,0 +1,11 @@
  3121 +#include <sys/types.h>
  3123 +#include "vfs.h"
  3125 +size_t
  3126 +_read (int fd, void *buf, size_t cnt)
  3127 +{
  3128 +  struct file *pf = _newlib_vfs_get_file (fd);
  3130 +  return pf->fops->read (pf, buf, cnt);
  3131 +}
  3132 diff -urN newlib-1.8.2/newlib/libc/sys/aica/rmdir.c newlib-1.8.2-aica/newlib/libc/sys/aica/rmdir.c
  3133 --- newlib-1.8.2/newlib/libc/sys/aica/rmdir.c	1970-01-01 10:00:00.000000000 +1000
  3134 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/rmdir.c	2008-08-13 11:54:44.000000000 +1000
  3135 @@ -0,0 +1,14 @@
  3136 +#include "vfs.h"
  3138 +int
  3139 +rmdir (const char *path)
  3140 +{
  3141 +  char *obj = _newlib_vfs_new_string (path);
  3143 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
  3144 +  int res = mops->rmdir (obj);
  3146 +  _newlib_vfs_delete_string (obj);
  3148 +  return res;
  3149 +}
  3150 diff -urN newlib-1.8.2/newlib/libc/sys/aica/sbrk.c newlib-1.8.2-aica/newlib/libc/sys/aica/sbrk.c
  3151 --- newlib-1.8.2/newlib/libc/sys/aica/sbrk.c	1970-01-01 10:00:00.000000000 +1000
  3152 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/sbrk.c	2008-08-13 11:54:44.000000000 +1000
  3153 @@ -0,0 +1,27 @@
  3154 +#include <_ansi.h>
  3155 +#include <errno.h>
  3156 +#include <sys/types.h>
  3158 +extern char end;		/* The end of the program (BSS section). */
  3160 +register char *stack_ptr asm ("r15");
  3162 +caddr_t
  3163 +_sbrk (int incr)
  3164 +{
  3165 +  static char *heap_end;
  3166 +  char *prev_heap_end;
  3168 +  if (!heap_end)
  3169 +    heap_end = &end;
  3171 +  prev_heap_end = heap_end;
  3172 +  if (heap_end + incr > stack_ptr)
  3173 +  {
  3174 +    errno = ENOMEM;
  3175 +	return (caddr_t)-1;
  3176 +  }
  3178 +  heap_end += incr;
  3179 +  return (caddr_t) prev_heap_end;
  3180 +}
  3181 diff -urN newlib-1.8.2/newlib/libc/sys/aica/scif.c newlib-1.8.2-aica/newlib/libc/sys/aica/scif.c
  3182 --- newlib-1.8.2/newlib/libc/sys/aica/scif.c	1970-01-01 10:00:00.000000000 +1000
  3183 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/scif.c	2008-08-13 11:54:44.000000000 +1000
  3184 @@ -0,0 +1,46 @@
  3185 +/* Blatantly stolen from libdream, others...
  3186 + * Please fix this :) */
  3187 +#include <sys/types.h>
  3189 +/*#include "scif.h"*/
  3191 +#define ACK  (volatile unsigned short *)0xffe80010
  3192 +#define WR_FIFO (volatile unsigned char *)0xffe8000c
  3193 +#define RD_FIFO (volatile unsigned char *)0xffe80014
  3194 +#define STATUS  (volatile unsigned short *)0xffe8001c
  3196 +static void scif_flush ()
  3197 +{
  3198 +  *ACK &= 0xbf;
  3200 +  while (!(*ACK & 0x40)) ;
  3202 +  *ACK &= 0xbf;
  3203 +}
  3205 +size_t _newlib_vfs_scif_write (void *buf, size_t cnt)
  3206 +{
  3207 +  while (cnt-- > 0)
  3208 +  {
  3209 +    while (!(*ACK & 0x20)) ;
  3211 +    *WR_FIFO = *(unsigned char *)buf++;
  3213 +    *ACK &= 0x9f;
  3214 +  }
  3215 +  scif_flush ();
  3216 +  return cnt;
  3217 +}
  3219 +size_t _newlib_vfs_scif_read (void *buf, size_t cnt)
  3220 +{
  3221 +  while (cnt -- > 0)
  3222 +  {
  3223 +    while (*STATUS & 0x1f) ;
  3225 +    *(unsigned char *)buf++ = *RD_FIFO;
  3227 +    *ACK &= 0x6d;
  3228 +  }
  3229 +  return cnt;
  3230 +}
  3231 diff -urN newlib-1.8.2/newlib/libc/sys/aica/stat.c newlib-1.8.2-aica/newlib/libc/sys/aica/stat.c
  3232 --- newlib-1.8.2/newlib/libc/sys/aica/stat.c	1970-01-01 10:00:00.000000000 +1000
  3233 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/stat.c	2008-08-13 11:54:44.000000000 +1000
  3234 @@ -0,0 +1,26 @@
  3235 +#include <sys/types.h>
  3236 +#include <sys/stat.h>
  3238 +#include "vfs.h"
  3240 +/* Clunky, but remember we're "namespace clean" and library routines also
  3241 + use _stat as a syscall... */
  3243 +int
  3244 +stat (const char *path, struct stat *pstat)
  3245 +{
  3246 +  return _stat (path, pstat);
  3247 +}
  3249 +int
  3250 +_stat (const char *path, struct stat *pstat)
  3251 +{
  3252 +  char *obj = _newlib_vfs_new_string (path);
  3254 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
  3255 +  int res = mops->stat (obj, pstat);
  3257 +  _newlib_vfs_delete_string (obj);
  3259 +  return res;
  3260 +}
  3261 diff -urN newlib-1.8.2/newlib/libc/sys/aica/stdio_vfs.c newlib-1.8.2-aica/newlib/libc/sys/aica/stdio_vfs.c
  3262 --- newlib-1.8.2/newlib/libc/sys/aica/stdio_vfs.c	1970-01-01 10:00:00.000000000 +1000
  3263 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/stdio_vfs.c	2008-08-13 18:19:58.000000000 +1000
  3264 @@ -0,0 +1,96 @@
  3265 +/* Support for Marcus Comstedt's serial slave and gdbstubs, e.g. generic
  3266 + serial console I/O. */
  3268 +#include "vfs.h"
  3270 +/* Only read and write are supported for stdio_file_ops, so these are
  3271 + used for stdin, stdout, and stderr which are already "open" when the
  3272 + program is started. */
  3274 +static size_t stdio_read_file_op (struct file *, void *, size_t);
  3275 +static size_t stdio_write_file_op (struct file *, void *, size_t);
  3277 +static struct file_ops stdio_file_ops =
  3278 +{
  3279 +  lseek:       _newlib_vfs_invalid_file_op,
  3280 +  close:       _newlib_vfs_invalid_file_op,
  3281 +  read:        stdio_read_file_op,
  3282 +  write:       stdio_write_file_op,
  3283 +  ioctl:       _newlib_vfs_invalid_file_op,
  3284 +  fstat:       _newlib_vfs_invalid_file_op
  3285 +};
  3287 +/* dcload or absolute may override these to go through their own console
  3288 + output routines. */
  3290 +static struct file stdout_file;
  3291 +static struct file stderr_file;
  3293 +static struct file stdin_file =
  3294 +{
  3295 +  &stdout_file,
  3296 +  0, 0,
  3297 +  &stdio_file_ops,
  3298 +  NULL,
  3299 +};
  3301 +static struct file stdout_file =
  3302 +{
  3303 +  &stderr_file,
  3304 +  1, 1,
  3305 +  &stdio_file_ops,
  3306 +  NULL,
  3307 +};
  3309 +static struct file stderr_file =
  3310 +{
  3311 +  NULL,
  3312 +  2, 2,
  3313 +  &stdio_file_ops,
  3314 +  NULL,
  3315 +};
  3317 +struct file * _newlib_vfs_first_file = &stdin_file;
  3318 +struct file * _newlib_vfs_last_file  = &stderr_file;
  3320 +int _newlib_vfs_is_sslave (void)
  3321 +{
  3322 +    return 0;
  3323 +}
  3325 +void _newlib_vfs_sslave_init (void)
  3326 +{
  3327 +  /* Initialize serial console to a known state.  We already assume that
  3328 +   we connected to the host, we just make sure the SCIF is setup the way
  3329 +   we need it. */
  3330 +  _newlib_vfs_initialized = VFS_LOADER_SERIAL_SLAVE;
  3331 +}
  3334 +/* Detect gdbstubs.  gdbstubs sets the border color to green to indicate that
  3335 + it's active.  While this can't reliably be used to detect it, we also look
  3336 + for gdbstubs start code at two separate addresses (gdbstub can load itself
  3337 + at either address). */
  3339 +int _newlib_vfs_is_gdbstubs (void)
  3340 +{
  3341 +  return 0;
  3342 +}
  3344 +void _newlib_vfs_gdbstubs_init (void)
  3345 +{
  3346 +  _newlib_vfs_initialized = VFS_LOADER_GDBSTUBS;
  3347 +}
  3349 +extern size_t _newlib_vfs_scif_write (void *, size_t);
  3350 +extern size_t _newlib_vfs_scif_read (void *, size_t);
  3352 +static size_t stdio_read_file_op (struct file *pf, void *buf, size_t cnt)
  3353 +{
  3354 +  return _newlib_vfs_scif_read (buf, cnt);
  3355 +}
  3357 +static size_t stdio_write_file_op (struct file *pf, void *buf, size_t cnt)
  3358 +{
  3359 +  return _newlib_vfs_scif_write (buf, cnt);
  3360 +}
  3361 diff -urN newlib-1.8.2/newlib/libc/sys/aica/times.c newlib-1.8.2-aica/newlib/libc/sys/aica/times.c
  3362 --- newlib-1.8.2/newlib/libc/sys/aica/times.c	1970-01-01 10:00:00.000000000 +1000
  3363 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/times.c	2008-08-13 11:54:44.000000000 +1000
  3364 @@ -0,0 +1,35 @@
  3365 +#include <time.h>
  3366 +#include <sys/times.h>
  3368 +/* crt.S stores program startup time (Dreamcast-relative, epoch at 1/1/1950)
  3369 + in the global variable _newlib_dreamcast_utime.  We can use this variable to
  3370 + determine the total amount of time that the program has been running. */
  3372 +/* This is raw seconds of program usage, we don't need to worry about
  3373 + converting epochs or anything like that... */
  3375 +extern unsigned long _newlib_dreamcast_utime;
  3377 +clock_t
  3378 +_times (struct tms *buf)
  3379 +{
  3380 +  if (_newlib_dreamcast_utime)
  3381 +  {
  3382 +    unsigned long rtc_h = *(volatile unsigned long*)0x00810000;
  3383 +    unsigned long rtc_l = *(volatile unsigned long*)0x00810004;
  3384 +    unsigned long secs = ((rtc_h & 0xffff) << 16) | (rtc_l & 0xffff);
  3386 +    clock_t utime = secs - _newlib_dreamcast_utime;
  3388 +    if (buf) {
  3389 +      buf->tms_utime = utime;
  3390 +      buf->tms_stime = 0;
  3391 +      buf->tms_cutime = 0;
  3392 +      buf->tms_cstime = 0;
  3393 +     }
  3395 +     return utime;
  3396 +  }
  3398 +  return (clock_t)-1;
  3399 +}
  3400 diff -urN newlib-1.8.2/newlib/libc/sys/aica/unlink.c newlib-1.8.2-aica/newlib/libc/sys/aica/unlink.c
  3401 --- newlib-1.8.2/newlib/libc/sys/aica/unlink.c	1970-01-01 10:00:00.000000000 +1000
  3402 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/unlink.c	2008-08-13 11:54:44.000000000 +1000
  3403 @@ -0,0 +1,14 @@
  3404 +#include "vfs.h"
  3406 +int
  3407 +_unlink (const char *path)
  3408 +{
  3409 +  char *obj = _newlib_vfs_new_string (path);
  3411 +  struct media_ops *mops = _newlib_vfs_get_media_ops (path);
  3412 +  int res = mops->unlink (obj);
  3414 +  _newlib_vfs_delete_string (obj);
  3416 +  return res;
  3417 +}
  3418 diff -urN newlib-1.8.2/newlib/libc/sys/aica/vfs.c newlib-1.8.2-aica/newlib/libc/sys/aica/vfs.c
  3419 --- newlib-1.8.2/newlib/libc/sys/aica/vfs.c	1970-01-01 10:00:00.000000000 +1000
  3420 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/vfs.c	2008-08-13 11:54:44.000000000 +1000
  3421 @@ -0,0 +1,246 @@
  3422 +#include <sys/types.h>
  3423 +#include <errno.h>
  3424 +#include <stdlib.h>
  3425 +#include <string.h>
  3427 +#include "vfs.h"
  3429 +static struct file * invalid_open_media_op (void);
  3431 +static struct media_ops invalid_media_ops =
  3432 +{
  3433 +  open:                invalid_open_media_op,
  3434 +  creat:               invalid_open_media_op,
  3435 +  link:                _newlib_vfs_invalid_media_op,
  3436 +  unlink:              _newlib_vfs_invalid_media_op,
  3437 +  stat:                _newlib_vfs_invalid_media_op,
  3438 +  chmod:               _newlib_vfs_invalid_media_op,
  3439 +  mkdir:               _newlib_vfs_invalid_media_op,
  3440 +  rmdir:               _newlib_vfs_invalid_media_op,
  3441 +  chdir:               _newlib_vfs_invalid_media_op
  3442 +};
  3444 +struct media_ops * _newlib_vfs_host_media_ops = &invalid_media_ops;
  3445 +struct media_ops * _newlib_vfs_cd_media_ops   = &invalid_media_ops;
  3446 +struct media_ops * _newlib_vfs_vmu_media_ops  = &invalid_media_ops;
  3448 +/* This is where we detect the loader and initialize the relevant *_ops
  3449 + variables. */
  3451 +enum _newlib_vfs_loader _newlib_vfs_initialized = VFS_LOADER_NONE;
  3453 +extern int _newlib_vfs_is_sslave (void);
  3454 +extern void _newlib_vfs_sslave_init (void);
  3456 +extern int _newlib_vfs_is_gdbstubs (void);
  3457 +extern void _newlib_vfs_gdbstubs_init (void);
  3459 +extern int _newlib_vfs_is_dcload (void);
  3460 +extern void _newlib_vfs_dcload_init (void);
  3462 +extern int _newlib_vfs_is_absolute (void);
  3463 +extern void _newlib_vfs_absolute_load (void);
  3465 +static void vfs_init (void)
  3466 +{
  3467 +  _newlib_vfs_initialized = VFS_LOADER_UNKNOWN;
  3469 +  if (_newlib_vfs_is_sslave ())  /* Marcus Comstedt's serial slave */
  3470 +  {
  3471 +    _newlib_vfs_sslave_init ();
  3472 +  }
  3473 +  else if (_newlib_vfs_is_gdbstubs ())  /* Benoit Miller's port of gdbstubs */
  3474 +  {
  3475 +    _newlib_vfs_gdbstubs_init ();
  3476 +  }
  3477 +  else if (_newlib_vfs_is_dcload ())  /* Andrew K's dcload */
  3478 +  {
  3479 +    _newlib_vfs_dcload_init ();
  3480 +  }
  3481 +  else if (_newlib_vfs_is_absolute ())  /* my own absolute */
  3482 +  {
  3483 +    _newlib_vfs_absolute_load ();
  3484 +  }
  3485 +}
  3487 +#define VFS_INIT { if (!_newlib_vfs_initialized) vfs_init (); }
  3489 +/* Each prefix, "/pc/", "/cd", and "/vmu" in little-endian. */
  3490 +#define PREFIX_HOST 0x2f63702f
  3491 +#define PREFIX_CD   0x2f64632f
  3492 +#define PREFIX_VMU  0x756d762f
  3494 +char *_newlib_vfs_new_string (const char *s)
  3495 +{
  3496 +  VFS_INIT;
  3498 +  {
  3499 +    char *obj = NULL;
  3500 +    unsigned long prefix = *(unsigned long *)s;
  3501 +		int len;
  3503 +    if (prefix == PREFIX_HOST || prefix == PREFIX_CD ||
  3504 +        prefix == PREFIX_VMU)
  3505 +    {
  3506 +      /* We snatch the prefix, accounting for the null byte (since we're
  3507 +       using memcpy; this could be changed to a simple copy loop... */
  3508 +      len = strlen (s) - 3;
  3509 +      obj = malloc (len);
  3510 +			if (!obj) return obj;
  3512 +      memcpy (obj, s + 4, len);
  3513 +    }
  3514 +    else /* Just return a copy of the string if no path given */
  3515 +    {
  3516 +      len = strlen (s) + 1;
  3517 +      obj = malloc (len);
  3518 +      if (!obj) return obj;
  3520 +      memcpy (obj, s, len);
  3521 +    }
  3522 +    return obj;
  3523 +  }
  3524 +}
  3526 +void _newlib_vfs_delete_string (char *s)
  3527 +{
  3528 +  if (s) free (s);
  3529 +}
  3531 +/* When each media op calls this, it's already got a copy of the stripped
  3532 + path so we just do simple comparisons on the path prefix here. */
  3533 +struct media_ops *_newlib_vfs_get_media_ops (const char *path)
  3534 +{
  3535 +	unsigned long prefix = *(unsigned long *)path;
  3537 +  if (prefix == PREFIX_HOST)
  3538 +  {
  3539 +    return _newlib_vfs_host_media_ops;
  3540 +  }
  3541 +  else if (prefix == PREFIX_CD)
  3542 +  {
  3543 +    return _newlib_vfs_cd_media_ops;
  3544 +  }
  3545 +  else if (prefix == PREFIX_VMU)
  3546 +  {
  3547 +    return _newlib_vfs_vmu_media_ops;
  3548 +  }
  3550 +  return _newlib_vfs_host_media_ops;
  3551 +}
  3553 +static struct file_ops invalid_file_ops =
  3554 +{
  3555 +  lseek:       _newlib_vfs_invalid_file_op,
  3556 +  close:       _newlib_vfs_invalid_file_op,
  3557 +  read:        _newlib_vfs_invalid_file_op,
  3558 +  write:       _newlib_vfs_invalid_file_op,
  3559 +  ioctl:       _newlib_vfs_invalid_file_op,
  3560 +  fstat:       _newlib_vfs_invalid_file_op
  3561 +};
  3563 +static struct file invalid_file =
  3564 +{
  3565 +  NULL,
  3566 +  -1, -1,
  3567 +  &invalid_file_ops,
  3568 +  NULL
  3569 +};
  3571 +/* FIXME: A lookup for each fd could get expensive...find a better way to
  3572 + "cache" frequently used fds */
  3574 +static struct file *cached_file = NULL;
  3576 +/* Find the file matching fd and return a pointer to its contents.  If the
  3577 + file isn't found, return a pointer to invalid_file, which represents a
  3578 + non-existent file (all operations on it will fail). */
  3579 +struct file *_newlib_vfs_get_file (int fd)
  3580 +{
  3581 +  VFS_INIT;
  3583 +  {
  3584 +    struct file *next_file = _newlib_vfs_first_file;
  3586 +    if ((cached_file != NULL) && (cached_file->fd == fd))
  3587 +    {
  3588 +      return cached_file;
  3589 +    }
  3591 +    while (next_file)
  3592 +    {
  3593 +      if (next_file->fd == fd)
  3594 +      {
  3595 +        cached_file = next_file;
  3596 +        return next_file;
  3597 +      }
  3598 +      next_file = next_file->next;
  3599 +    }
  3600 +    return &invalid_file;
  3601 +  }
  3602 +}
  3604 +static int last_fd = -1;
  3606 +/* Just insert the file at the end of the list, as it's already been
  3607 + allocated by open/creat.  Increase the library's fd by using the last
  3608 + file's fd. */
  3609 +int _newlib_vfs_insert_file (struct file *pf)
  3610 +{
  3611 +  if (last_fd < 0)
  3612 +  {
  3613 +    last_fd = _newlib_vfs_last_file->fd;
  3614 +  }
  3615 +/*	++last_fd; */
  3616 +  pf->fd = ++last_fd;
  3617 +  _newlib_vfs_last_file->next = pf;
  3618 +  _newlib_vfs_last_file = pf;
  3619 +  return last_fd;
  3620 +}
  3622 +int _newlib_vfs_remove_file (struct file *pf)
  3623 +{
  3624 +  if (pf)
  3625 +  {
  3626 +    struct file *prev_file = _newlib_vfs_first_file;
  3627 +		struct file *next_file = NULL;
  3629 +    while (prev_file)
  3630 +    {
  3631 +      if (prev_file->next == pf)
  3632 +      {
  3633 +        prev_file->next = pf->next;
  3634 +				next_file = prev_file->next;
  3635 +				while (next_file)
  3636 +				{
  3637 +					prev_file = next_file;
  3638 +					next_file = next_file->next;
  3639 +				}
  3640 +				_newlib_vfs_last_file = prev_file;
  3641 +        free (pf);
  3642 +        return 0;
  3643 +      }
  3644 +			prev_file = prev_file->next;
  3645 +    }
  3646 +  }
  3647 +  errno = ENOSYS;
  3648 +	return -1;
  3649 +}
  3651 +int _newlib_vfs_invalid_file_op (void)
  3652 +{
  3653 +  errno = ENOSYS;
  3654 +  return -1;
  3655 +}
  3657 +static struct file *invalid_open_media_op (void)
  3658 +{
  3659 +  errno = ENOSYS;
  3660 +  return NULL;
  3661 +}
  3663 +int _newlib_vfs_invalid_media_op (void)
  3664 +{
  3665 +  errno = ENOSYS;
  3666 +  return -1;
  3667 +}
  3668 diff -urN newlib-1.8.2/newlib/libc/sys/aica/vfs.h newlib-1.8.2-aica/newlib/libc/sys/aica/vfs.h
  3669 --- newlib-1.8.2/newlib/libc/sys/aica/vfs.h	1970-01-01 10:00:00.000000000 +1000
  3670 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/vfs.h	2008-08-13 11:54:44.000000000 +1000
  3671 @@ -0,0 +1,100 @@
  3672 +#ifndef __VFS_H__
  3673 +#define __VFS_H__
  3675 +#include <sys/types.h>
  3676 +#include <sys/stat.h>
  3678 +/* Defines all of the operations that can be performed on a particular media
  3679 + type.  These are independent of file access routines. */
  3681 +struct media_ops {
  3682 +  struct file * (*open) (const char *, int, mode_t);
  3683 +  struct file * (*creat) (const char *, mode_t);
  3684 +  int (*link) (const char *, const char *);
  3685 +  int (*unlink) (const char *);
  3686 +  int (*stat) (const char *, struct stat *);
  3687 +  int (*chmod) (const char *, mode_t);
  3688 +  int (*mkdir) (const char*, mode_t);
  3689 +  int (*rmdir) (const char *);
  3690 +  int (*chdir) (const char *);
  3691 +};
  3693 +/* These are the operations that can be done to a file.  Each media and stub
  3694 + has it's own combination of routines (e.g. Absolute + VMU, dcload + host). */
  3696 +struct file_ops {
  3697 +  off_t (*lseek) (struct file *, off_t, int);
  3698 +  int (*close) (struct file *);
  3699 +  size_t (*read) (struct file *, void *, size_t);
  3700 +  size_t (*write) (struct file *, void *, size_t);
  3701 +  /* Hmm, what to do with this one? */
  3702 +  int (*ioctl) (struct file *, int, long);
  3703 +  int (*fstat) (struct file *, struct stat *);
  3704 +};
  3706 +/* We maintain a linked list of files so that we can remove and add files
  3707 + to/from the list easier.  Each file contains an fd, the "real" fd of whatever
  3708 + media it resides upon, a pointer to the file_ops for the file, and a pointer
  3709 + to media/stub specific data. */
  3711 +struct file {
  3712 +  struct file *next;
  3713 +  int fd;
  3714 +  int media_fd;
  3715 +  struct file_ops *fops;
  3716 +  void *specifics;
  3717 +};
  3720 +/* Each load initializes the media_ops for each type based on the media it
  3721 + supports.  If a media type isn't supported, then it's ops points to
  3722 + _newlib_vfs_invalid_media_ops. */
  3723 +extern struct media_ops * _newlib_vfs_host_media_ops;
  3724 +extern struct media_ops * _newlib_vfs_cd_media_ops;
  3725 +extern struct media_ops * _newlib_vfs_vmu_media_ops;
  3727 +/* Pointers to the first and last file in the list */
  3728 +extern struct file * _newlib_vfs_first_file;
  3729 +extern struct file * _newlib_vfs_last_file;
  3731 +/* Each loader initializer gives this a distinct value so that programs
  3732 + can determine which loader they're being loaded under. */
  3733 +enum _newlib_vfs_loader
  3734 +{
  3735 +  VFS_LOADER_NONE,
  3736 +  VFS_LOADER_UNKNOWN,
  3737 +  VFS_LOADER_SERIAL_SLAVE,
  3738 +  VFS_LOADER_GDBSTUBS,
  3739 +  VFS_LOADER_DCLOAD_HOST,
  3740 +  VFS_LOADER_DCLOAD_NOHOST,
  3741 +  VFS_LOADER_ABSOLUTE
  3742 +};
  3744 +extern enum _newlib_vfs_loader _newlib_vfs_initialized;
  3746 +/* Generic media/file_ops that return ENOSYS */
  3747 +int _newlib_vfs_invalid_media_op (void);
  3748 +int _newlib_vfs_invalid_file_op (void);
  3750 +/* Using the path prefix, return the media_ops that handles it */
  3751 +struct media_ops *_newlib_vfs_get_media_ops (const char *path);
  3753 +/* Returns the file that matches the given fd */
  3754 +struct file *_newlib_vfs_get_file (int fd);
  3756 +/* Insert a new file into the list.  Returns -1 and sets errno if the file
  3757 + can't be inserted, otherewise returns 0 */
  3758 +int _newlib_vfs_insert_file (struct file *);
  3760 +/* Removes a file from the list.  Returns -1 and sets errno if there was
  3761 + a problem (e.g. invalid fd passed to close, etc.) */
  3762 +int _newlib_vfs_remove_file (struct file *);
  3764 +/* Copy the given string into a new buffer, while stripping the vfs prefix
  3765 + at the same time. */
  3766 +char *_newlib_vfs_new_string (const char *s);
  3768 +/* Free the buffer previously allocated with *_new_string */
  3769 +void _newlib_vfs_delete_string (char *s);
  3771 +#endif /* __VFS_H__ */
  3772 diff -urN newlib-1.8.2/newlib/libc/sys/aica/write.c newlib-1.8.2-aica/newlib/libc/sys/aica/write.c
  3773 --- newlib-1.8.2/newlib/libc/sys/aica/write.c	1970-01-01 10:00:00.000000000 +1000
  3774 +++ newlib-1.8.2-aica/newlib/libc/sys/aica/write.c	2008-08-13 11:54:44.000000000 +1000
  3775 @@ -0,0 +1,11 @@
  3776 +#include <sys/types.h>
  3778 +#include "vfs.h"
  3780 +int
  3781 +_write (int fd, const void *buf, size_t cnt)
  3782 +{
  3783 +  struct file *pf = _newlib_vfs_get_file (fd);
  3785 +  return pf->fops->write (pf, buf, cnt);
  3786 +}
.