add psp-gcc 13.2.0 patch
[rofl0r-mmix-cross.git] / patches / newlib-1.20.0-psp.diff
blob59f03dd301271c6c71e39259448550aeddd0f6c8
1 diff --git a/config.guess b/config.guess
2 index b02565c7b..282b83ece 100755
3 --- a/config.guess
4 +++ b/config.guess
5 @@ -140,6 +140,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
6 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
7 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
9 +case "${UNAME_SYSTEM}" in
10 +Linux|GNU|GNU/*)
11 + # If the system lacks a compiler, then just pick glibc.
12 + # We could probably try harder.
13 + LIBC=gnu
15 + eval $set_cc_for_build
16 + cat <<-EOF > $dummy.c
17 + #include <features.h>
18 + #if defined(__UCLIBC__)
19 + LIBC=uclibc
20 + #elif defined(__dietlibc__)
21 + LIBC=dietlibc
22 + #else
23 + LIBC=gnu
24 + #endif
25 + EOF
26 + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
27 + ;;
28 +esac
30 # Note: order is significant - the case branches are not exclusive.
32 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
33 @@ -861,6 +882,13 @@ EOF
34 i*86:Minix:*:*)
35 echo ${UNAME_MACHINE}-pc-minix
36 exit ;;
37 + aarch64:Linux:*:*)
38 + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
39 + exit ;;
40 + aarch64_be:Linux:*:*)
41 + UNAME_MACHINE=aarch64_be
42 + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
43 + exit ;;
44 alpha:Linux:*:*)
45 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
46 EV5) UNAME_MACHINE=alphaev5 ;;
47 diff --git a/config.sub b/config.sub
48 index 78176a440..e9c17e007 100755
49 --- a/config.sub
50 +++ b/config.sub
51 @@ -283,6 +283,7 @@ case $basic_machine in
52 | mipsisa64sb1 | mipsisa64sb1el \
53 | mipsisa64sr71k | mipsisa64sr71kel \
54 | mipstx39 | mipstx39el \
55 + | mipsallegrex | mipsallegrexel \
56 | mn10200 | mn10300 \
57 | moxie \
58 | mt \
59 @@ -396,6 +397,7 @@ case $basic_machine in
60 | mipsisa64sb1-* | mipsisa64sb1el-* \
61 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
62 | mipstx39-* | mipstx39el-* \
63 + | mipsallegrex-* | mipsallegrexel-* \
64 | mmix-* \
65 | mt-* \
66 | msp430-* \
67 @@ -795,6 +797,10 @@ case $basic_machine in
68 basic_machine=m68k-atari
69 os=-mint
71 + psp)
72 + basic_machine=mipsallegrexel-psp
73 + os=-elf
74 + ;;
75 mips3*-*)
76 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
78 @@ -1344,7 +1350,7 @@ case $os in
79 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
80 | -chorusos* | -chorusrdb* | -cegcc* \
81 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
82 - | -mingw32* | -linux-gnu* | -linux-android* \
83 + | -mingw32* | -msys* | -linux-gnu* | -linux-android* \
84 | -linux-newlib* | -linux-uclibc* \
85 | -uxpv* | -beos* | -mpeix* | -udk* \
86 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
87 diff --git a/configure b/configure
88 index 2579c9f75..f237d256b 100755
89 --- a/configure
90 +++ b/configure
91 @@ -3598,6 +3598,10 @@ case "${target}" in
93 mips*-*-linux*)
95 + mipsallegrex*-*-*)
96 + noconfigdirs="$noconfigdirs target-libgloss"
97 + CFLAGS="${CFLAGS} -I${PWD}/newlib/psp/include"
98 + ;;
99 mips*-*-*)
100 noconfigdirs="$noconfigdirs gprof"
102 diff --git a/configure.ac b/configure.ac
103 index 9d48e904e..34452e032 100644
104 --- a/configure.ac
105 +++ b/configure.ac
106 @@ -1024,6 +1024,9 @@ case "${target}" in
108 mips*-*-linux*)
110 + mipsallegrex*-*-*)
111 + noconfigdirs="$noconfigdirs target-libgloss"
112 + ;;
113 mips*-*-*)
114 noconfigdirs="$noconfigdirs gprof"
116 diff --git a/newlib/Makefile.am b/newlib/Makefile.am
117 index 41de26f25..958a13e30 100644
118 --- a/newlib/Makefile.am
119 +++ b/newlib/Makefile.am
120 @@ -283,6 +283,18 @@ endif
121 for i in $(srcdir)/libc/include/rpc/*.h; do \
122 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \
123 done; \
124 + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \
125 + for i in $(srcdir)/libc/sys/$(sys_dir)/netinet/*.h; do \
126 + if [ -f $$i ]; then \
127 + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \
128 + else true; fi ; \
129 + done ; \
130 + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \
131 + for i in $(srcdir)/libc/sys/$(sys_dir)/arpa/*.h; do \
132 + if [ -f $$i ]; then \
133 + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \
134 + else true; fi ; \
135 + done ; \
136 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \
137 for i in $(srcdir)/libc/include/sys/*.h; do \
138 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
139 diff --git a/newlib/Makefile.in b/newlib/Makefile.in
140 index 9b013e624..20132b97d 100644
141 --- a/newlib/Makefile.in
142 +++ b/newlib/Makefile.in
143 @@ -990,6 +990,18 @@ install-data-local: install-toollibLIBRARIES
144 for i in $(srcdir)/libc/include/rpc/*.h; do \
145 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \
146 done; \
147 + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \
148 + for i in $(srcdir)/libc/sys/$(sys_dir)/netinet/*.h; do \
149 + if [ -f $$i ]; then \
150 + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \
151 + else true; fi ; \
152 + done ; \
153 + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \
154 + for i in $(srcdir)/libc/sys/$(sys_dir)/arpa/*.h; do \
155 + if [ -f $$i ]; then \
156 + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \
157 + else true; fi ; \
158 + done ; \
159 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \
160 for i in $(srcdir)/libc/include/sys/*.h; do \
161 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
162 diff --git a/newlib/configure.host b/newlib/configure.host
163 index ef73fd0ad..eb295f5ca 100644
164 --- a/newlib/configure.host
165 +++ b/newlib/configure.host
166 @@ -535,7 +535,7 @@ case "${host}" in
167 default_newlib_io_long_long="yes"
168 default_newlib_io_c99_formats="yes"
169 newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
170 - newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
171 + newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC -DHAVE_RENAME"
172 # turn off unsupported items in posix directory
173 newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN"
175 @@ -665,6 +665,12 @@ case "${host}" in
176 default_newlib_io_long_long="yes"
177 newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
179 + mipsallegrex*-psp-*)
180 + default_newlib_io_long_long="yes"
181 + sys_dir=psp
182 + syscall_dir=syscalls
183 + newlib_cflags="${newlib_cflags} -G0 -mno-explicit-relocs -DCOMPACT_CTYPE -DCLOCK_PROVIDED -DHAVE_FCNTL -DHAVE_RENAME -DMALLOC_ALIGNMENT=16 -I${prefix}/psp/sdk/include"
184 + ;;
185 mips*-*-elf*)
186 default_newlib_io_long_long="yes"
187 newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
188 diff --git a/newlib/libc/include/machine/time.h b/newlib/libc/include/machine/time.h
189 index a296857d4..034c69015 100644
190 --- a/newlib/libc/include/machine/time.h
191 +++ b/newlib/libc/include/machine/time.h
192 @@ -9,6 +9,10 @@
193 #endif
194 #endif /* !__rtems__ */
196 +#if defined(__psp__)
197 +#define _CLOCKS_PER_SEC_ 1000000
198 +#endif
200 #ifdef __SPU__
201 #include <sys/types.h>
202 int nanosleep (const struct timespec *, struct timespec *);
203 diff --git a/newlib/libc/include/memory.h b/newlib/libc/include/memory.h
204 new file mode 100644
205 index 000000000..041b34f7b
206 --- /dev/null
207 +++ b/newlib/libc/include/memory.h
208 @@ -0,0 +1,11 @@
210 + * memory.h
212 + */
214 +#ifndef _MEMORY_H_
215 +#define _MEMORY_H_
217 +#include <string.h>
219 +#endif /* _MEMORY_H_ */
220 diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
221 index 94759e969..a29fcecce 100644
222 --- a/newlib/libc/include/stdint.h
223 +++ b/newlib/libc/include/stdint.h
224 @@ -30,11 +30,9 @@ extern "C" {
225 #define __have_longlong64 1
226 #endif
228 -/* Check if "long" is 64bit or 32bit wide */
229 +/* Check if "long" is 64bit */
230 #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
231 #define __have_long64 1
232 -#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
233 -#define __have_long32 1
234 #endif
236 #if __STDINT_EXP(SCHAR_MAX) == 0x7f
237 diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
238 index 0bd2c7d7f..ee0c74c9e 100644
239 --- a/newlib/libc/include/stdlib.h
240 +++ b/newlib/libc/include/stdlib.h
241 @@ -122,6 +122,7 @@ _PTR _EXFUN_NOTHROW(realloc,(_PTR __r, size_t __size));
242 #ifndef __STRICT_ANSI__
243 _PTR _EXFUN(reallocf,(_PTR __r, size_t __size));
244 #endif
245 +char * _EXFUN(realpath,(const char *, char *));
246 _VOID _EXFUN(srand,(unsigned __seed));
247 double _EXFUN(strtod,(const char *__n, char **__end_PTR));
248 double _EXFUN(_strtod_r,(struct _reent *,const char *__n, char **__end_PTR));
249 diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
250 index 49c81f915..85aed2683 100644
251 --- a/newlib/libc/include/sys/config.h
252 +++ b/newlib/libc/include/sys/config.h
253 @@ -130,6 +130,12 @@
254 #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
255 #endif
257 +/* We compile newlib with -G0 for PSP, but if we're compiling an app with $gp enabled,
258 + then _impure_ptr is expected to live in .sdata. */
259 +#if defined(__psp__)
260 +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
261 +#endif
263 #ifdef __xstormy16__
264 #define __SMALL_BITFIELDS
265 #undef INT_MAX
266 diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
267 index 9723d92d3..a0cd36203 100644
268 --- a/newlib/libc/include/sys/types.h
269 +++ b/newlib/libc/include/sys/types.h
270 @@ -200,6 +200,7 @@ typedef unsigned int mode_t _ST_INT32;
272 typedef unsigned short nlink_t;
274 +#if !defined(__psp__)
275 /* We don't define fd_set and friends if we are compiling POSIX
276 source, or if we have included (or may include as indicated
277 by __USE_W32_SOCKETS) the W32api winsock[2].h header which
278 @@ -245,6 +246,7 @@ typedef struct _types_fd_set {
281 # endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) */
282 +#endif /* !defined(__psp__) */
284 #undef __MS_types__
285 #undef _ST_INT32
286 diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
287 index 900faa7bf..91671548c 100644
288 --- a/newlib/libc/include/sys/unistd.h
289 +++ b/newlib/libc/include/sys/unistd.h
290 @@ -241,6 +241,7 @@ char * _EXFUN(mktemp, (char *));
291 void _EXFUN(sync, (void));
292 #endif
294 +#if !defined(__psp__)
295 ssize_t _EXFUN(readlink, (const char *__path, char *__buf, size_t __buflen));
296 #if defined(__CYGWIN__)
297 ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__path, char *__buf, size_t __buflen));
298 @@ -250,6 +251,7 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2));
299 int _EXFUN(symlinkat, (const char *, int, const char *));
300 int _EXFUN(unlinkat, (int, const char *, int));
301 #endif
302 +#endif
304 #define F_OK 0
305 #define R_OK 4
306 diff --git a/newlib/libc/sys/configure b/newlib/libc/sys/configure
307 index f1635daba..145ef1b38 100755
308 --- a/newlib/libc/sys/configure
309 +++ b/newlib/libc/sys/configure
310 @@ -796,6 +796,7 @@ m88kbug
311 mmixware
312 netware
313 rdos
314 +psp
315 rtems
317 sparc64
318 @@ -11807,6 +11808,8 @@ subdirs="$subdirs a29khif"
319 netware) subdirs="$subdirs netware"
321 rdos) subdirs="$subdirs rdos"
322 + ;;
323 + psp) subdirs="$subdirs psp"
325 rtems) subdirs="$subdirs rtems"
327 diff --git a/newlib/libc/sys/configure.in b/newlib/libc/sys/configure.in
328 index 5a2b121ba..ec3a58013 100644
329 --- a/newlib/libc/sys/configure.in
330 +++ b/newlib/libc/sys/configure.in
331 @@ -34,6 +34,7 @@ if test -n "${sys_dir}"; then
332 mmixware) AC_CONFIG_SUBDIRS(mmixware) ;;
333 netware) AC_CONFIG_SUBDIRS(netware) ;;
334 rdos) AC_CONFIG_SUBDIRS(rdos) ;;
335 + psp) AC_CONFIG_SUBDIRS(psp) ;;
336 rtems) AC_CONFIG_SUBDIRS(rtems) ;;
337 sh) AC_CONFIG_SUBDIRS(sh) ;;
338 sparc64) AC_CONFIG_SUBDIRS(sparc64) ;;
339 diff --git a/newlib/libc/sys/psp/Makefile.am b/newlib/libc/sys/psp/Makefile.am
340 new file mode 100644
341 index 000000000..702aa5911
342 --- /dev/null
343 +++ b/newlib/libc/sys/psp/Makefile.am
344 @@ -0,0 +1,71 @@
345 +## Process this file with automake to generate Makefile.in
347 +AUTOMAKE_OPTIONS = cygnus
349 +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
351 +AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)
353 +noinst_LIBRARIES = lib.a
355 +LIBCGLUE_MULT_OBJS = _close.o _exit.o _fork.o _fstat.o _getpid.o \
356 + _gettimeofday.o _kill.o _lseek.o _open.o _read.o \
357 + _sbrk.o _wait.o _write.o clock.o isatty.o _isatty.o \
358 + time.o _link.o _unlink.o sleep.o opendir.o readdir.o \
359 + closedir.o getcwd.o chdir.o mkdir.o rmdir.o \
360 + realpath.o _stat.o truncate.o access.o tzset.o \
361 + __psp_set_errno.o mlock.o _fcntl.o _rename.o nanosleep.o
363 +SOCKET_MULT_OBJS = socket.o accept.o bind.o connect.o getsockopt.o \
364 + listen.o recv.o recvfrom.o send.o sendto.o \
365 + setsockopt.o shutdown.o getsockname.o getpeername.o \
366 + inet_ntoa.o
368 +PE_OBJS = pipe.o
370 +FDMAN_OBJS = fdman.o
372 +SELECT_OBJS = select.o
374 +INTERRUPT_OBJS = interrupt.o
376 +XPRINTF_MULT_OBJS = vxprintf.o _xprintf.o __sout.o vsnprintf.o snprintf.o \
377 + vsprintf.o sprintf.o __mout.o mprintf.o vmprintf.o asprintf.o \
378 + vasprintf.o __fout.o fprintf.o vfprintf.o printf.o vprintf.o \
379 + _sprintf_r.o
381 +NETDB_MULT_OBJS = h_errno.o gethostbyaddr.o gethostbyname.o
384 +lib_a_SOURCES = libcglue.c socket.c pspcwd.c xprintf.c netdb.c pipe.c fdman.c select.c syscalls.c interrupt.S
385 +lib_a_LIBADD = $(LIBCGLUE_MULT_OBJS) $(SOCKET_MULT_OBJS) $(XPRINTF_MULT_OBJS) \
386 + $(NETDB_MULT_OBJS) $(PIPE_OBJS) $(FDMAN_OBJS) $(SELECT_OBJS) $(INTERRUPT_OBJS)
388 +all: crt0.o
390 +$(LIBCGLUE_MULT_OBJS): libcglue.c
391 + $(COMPILE) -DF_$* $< -c -o $@
393 +$(SOCKET_MULT_OBJS): socket.c
394 + $(COMPILE) -DF_$* $< -c -o $@
396 +$(XPRINTF_MULT_OBJS): xprintf.c
397 + $(COMPILE) -DF_$* $< -c -o $@
399 +$(NETDB_MULT_OBJS): netdb.c
400 + $(COMPILE) -DF_$* $< -c -o $@
402 +$(PIPE_OBJS): pipe.c
403 + $(COMPILE) -DF_$* $< -c -o $@
405 +$(FDMAN_OBJS): fdman.c
406 + $(COMPILE) -DF_$* $< -c -o $@
408 +$(SELECT_OBJS): select.c
409 + $(COMPILE) -DF_$* $< -c -o $@
411 +$(INTERRUPT_OBJS): interrupt.S
412 + $(COMPILE) -DF_$* $< -c -o $@
414 +ACLOCAL_AMFLAGS = -I ../../..
415 +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
416 diff --git a/newlib/libc/sys/psp/Makefile.in b/newlib/libc/sys/psp/Makefile.in
417 new file mode 100644
418 index 000000000..4cdb185d0
419 --- /dev/null
420 +++ b/newlib/libc/sys/psp/Makefile.in
421 @@ -0,0 +1,468 @@
422 +# Makefile.in generated by automake 1.11.1 from Makefile.am.
423 +# @configure_input@
425 +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
426 +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
427 +# Inc.
428 +# This Makefile.in is free software; the Free Software Foundation
429 +# gives unlimited permission to copy and/or distribute it,
430 +# with or without modifications, as long as this notice is preserved.
432 +# This program is distributed in the hope that it will be useful,
433 +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
434 +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
435 +# PARTICULAR PURPOSE.
437 +@SET_MAKE@
439 +VPATH = @srcdir@
440 +pkgdatadir = $(datadir)/@PACKAGE@
441 +pkgincludedir = $(includedir)/@PACKAGE@
442 +pkglibdir = $(libdir)/@PACKAGE@
443 +pkglibexecdir = $(libexecdir)/@PACKAGE@
444 +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
445 +install_sh_DATA = $(install_sh) -c -m 644
446 +install_sh_PROGRAM = $(install_sh) -c
447 +install_sh_SCRIPT = $(install_sh) -c
448 +INSTALL_HEADER = $(INSTALL_DATA)
449 +transform = $(program_transform_name)
450 +NORMAL_INSTALL = :
451 +PRE_INSTALL = :
452 +POST_INSTALL = :
453 +NORMAL_UNINSTALL = :
454 +PRE_UNINSTALL = :
455 +POST_UNINSTALL = :
456 +build_triplet = @build@
457 +host_triplet = @host@
458 +subdir = .
459 +DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
460 + $(top_srcdir)/configure $(am__configure_deps) \
461 + $(srcdir)/../../../../mkinstalldirs
462 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
463 +am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \
464 + $(top_srcdir)/configure.in
465 +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
466 + $(ACLOCAL_M4)
467 +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
468 + configure.lineno config.status.lineno
469 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
470 +CONFIG_CLEAN_FILES =
471 +CONFIG_CLEAN_VPATH_FILES =
472 +LIBRARIES = $(noinst_LIBRARIES)
473 +ARFLAGS = cru
474 +lib_a_AR = $(AR) $(ARFLAGS)
475 +lib_a_DEPENDENCIES = $(LIBCGLUE_MULT_OBJS) $(SOCKET_MULT_OBJS) \
476 + $(XPRINTF_MULT_OBJS) $(NETDB_MULT_OBJS) $(FDMAN_OBJS) \
477 + $(SELECT_OBJS) $(INTERRUPT_OBJS)
478 +am_lib_a_OBJECTS = libcglue.$(OBJEXT) socket.$(OBJEXT) \
479 + pspcwd.$(OBJEXT) xprintf.$(OBJEXT) netdb.$(OBJEXT) \
480 + pipe.$(OBJEXT) fdman.$(OBJEXT) select.$(OBJEXT) \
481 + syscalls.$(OBJEXT) interrupt.$(OBJEXT)
482 +lib_a_OBJECTS = $(am_lib_a_OBJECTS)
483 +DEFAULT_INCLUDES = -I.@am__isrc@
484 +depcomp =
485 +am__depfiles_maybe =
486 +CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
487 + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
488 +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
489 + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
490 +CCLD = $(CC)
491 +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
492 +SOURCES = $(lib_a_SOURCES)
493 +ETAGS = etags
494 +CTAGS = ctags
495 +ACLOCAL = @ACLOCAL@
496 +AMTAR = @AMTAR@
497 +AR = @AR@
498 +AS = @AS@
499 +AUTOCONF = @AUTOCONF@
500 +AUTOHEADER = @AUTOHEADER@
501 +AUTOMAKE = @AUTOMAKE@
502 +AWK = @AWK@
503 +CC = @CC@
504 +CCAS = @CCAS@
505 +CCASFLAGS = @CCASFLAGS@
506 +CCDEPMODE = @CCDEPMODE@
507 +CYGPATH_W = @CYGPATH_W@
508 +DEFS = @DEFS@
509 +DEPDIR = @DEPDIR@
510 +ECHO_C = @ECHO_C@
511 +ECHO_N = @ECHO_N@
512 +ECHO_T = @ECHO_T@
513 +INSTALL = @INSTALL@
514 +INSTALL_DATA = @INSTALL_DATA@
515 +INSTALL_PROGRAM = @INSTALL_PROGRAM@
516 +INSTALL_SCRIPT = @INSTALL_SCRIPT@
517 +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
518 +LDFLAGS = @LDFLAGS@
519 +LIBOBJS = @LIBOBJS@
520 +LIBS = @LIBS@
521 +LTLIBOBJS = @LTLIBOBJS@
522 +MAINT = @MAINT@
523 +MAKEINFO = @MAKEINFO@
524 +MKDIR_P = @MKDIR_P@
525 +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
526 +NO_INCLUDE_LIST = @NO_INCLUDE_LIST@
527 +OBJEXT = @OBJEXT@
528 +PACKAGE = @PACKAGE@
529 +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
530 +PACKAGE_NAME = @PACKAGE_NAME@
531 +PACKAGE_STRING = @PACKAGE_STRING@
532 +PACKAGE_TARNAME = @PACKAGE_TARNAME@
533 +PACKAGE_URL = @PACKAGE_URL@
534 +PACKAGE_VERSION = @PACKAGE_VERSION@
535 +PATH_SEPARATOR = @PATH_SEPARATOR@
536 +RANLIB = @RANLIB@
537 +READELF = @READELF@
538 +SET_MAKE = @SET_MAKE@
539 +SHELL = @SHELL@
540 +STRIP = @STRIP@
541 +VERSION = @VERSION@
542 +abs_builddir = @abs_builddir@
543 +abs_srcdir = @abs_srcdir@
544 +abs_top_builddir = @abs_top_builddir@
545 +abs_top_srcdir = @abs_top_srcdir@
546 +aext = @aext@
547 +am__include = @am__include@
548 +am__leading_dot = @am__leading_dot@
549 +am__quote = @am__quote@
550 +am__tar = @am__tar@
551 +am__untar = @am__untar@
552 +bindir = @bindir@
553 +build = @build@
554 +build_alias = @build_alias@
555 +build_cpu = @build_cpu@
556 +build_os = @build_os@
557 +build_vendor = @build_vendor@
558 +builddir = @builddir@
559 +datadir = @datadir@
560 +datarootdir = @datarootdir@
561 +docdir = @docdir@
562 +dvidir = @dvidir@
563 +exec_prefix = @exec_prefix@
564 +host = @host@
565 +host_alias = @host_alias@
566 +host_cpu = @host_cpu@
567 +host_os = @host_os@
568 +host_vendor = @host_vendor@
569 +htmldir = @htmldir@
570 +includedir = @includedir@
571 +infodir = @infodir@
572 +install_sh = @install_sh@
573 +libdir = @libdir@
574 +libexecdir = @libexecdir@
575 +libm_machine_dir = @libm_machine_dir@
576 +localedir = @localedir@
577 +localstatedir = @localstatedir@
578 +lpfx = @lpfx@
579 +machine_dir = @machine_dir@
580 +mandir = @mandir@
581 +mkdir_p = @mkdir_p@
582 +newlib_basedir = @newlib_basedir@
583 +oext = @oext@
584 +oldincludedir = @oldincludedir@
585 +pdfdir = @pdfdir@
586 +prefix = @prefix@
587 +program_transform_name = @program_transform_name@
588 +psdir = @psdir@
589 +sbindir = @sbindir@
590 +sharedstatedir = @sharedstatedir@
591 +srcdir = @srcdir@
592 +sys_dir = @sys_dir@
593 +sysconfdir = @sysconfdir@
594 +target_alias = @target_alias@
595 +top_build_prefix = @top_build_prefix@
596 +top_builddir = @top_builddir@
597 +top_srcdir = @top_srcdir@
598 +AUTOMAKE_OPTIONS = cygnus
599 +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
600 +AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)
601 +noinst_LIBRARIES = lib.a
602 +LIBCGLUE_MULT_OBJS = _close.o _exit.o _fork.o _fstat.o _getpid.o \
603 + _gettimeofday.o _kill.o _lseek.o _open.o _read.o \
604 + _sbrk.o _wait.o _write.o clock.o isatty.o _isatty.o \
605 + time.o _link.o _unlink.o sleep.o opendir.o readdir.o \
606 + closedir.o getcwd.o chdir.o mkdir.o rmdir.o \
607 + realpath.o _stat.o truncate.o access.o tzset.o \
608 + __psp_set_errno.o mlock.o _fcntl.o _rename.o nanosleep.o
610 +SOCKET_MULT_OBJS = socket.o accept.o bind.o connect.o getsockopt.o \
611 + listen.o recv.o recvfrom.o send.o sendto.o \
612 + setsockopt.o shutdown.o getsockname.o getpeername.o \
613 + inet_ntoa.o
615 +PE_OBJS = pipe.o
616 +FDMAN_OBJS = fdman.o
617 +SELECT_OBJS = select.o
618 +INTERRUPT_OBJS = interrupt.o
619 +XPRINTF_MULT_OBJS = vxprintf.o _xprintf.o __sout.o vsnprintf.o snprintf.o \
620 + vsprintf.o sprintf.o __mout.o mprintf.o vmprintf.o asprintf.o \
621 + vasprintf.o __fout.o fprintf.o vfprintf.o printf.o vprintf.o \
622 + _sprintf_r.o
624 +NETDB_MULT_OBJS = h_errno.o gethostbyaddr.o gethostbyname.o
625 +lib_a_SOURCES = libcglue.c socket.c pspcwd.c xprintf.c netdb.c pipe.c fdman.c select.c syscalls.c interrupt.S
626 +lib_a_LIBADD = $(LIBCGLUE_MULT_OBJS) $(SOCKET_MULT_OBJS) $(XPRINTF_MULT_OBJS) \
627 + $(NETDB_MULT_OBJS) $(PIPE_OBJS) $(FDMAN_OBJS) $(SELECT_OBJS) $(INTERRUPT_OBJS)
629 +ACLOCAL_AMFLAGS = -I ../../..
630 +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
631 +all: all-am
633 +.SUFFIXES:
634 +.SUFFIXES: .S .c .o .obj
635 +am--refresh:
636 + @:
637 +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
638 + @for dep in $?; do \
639 + case '$(am__configure_deps)' in \
640 + *$$dep*) \
641 + echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus'; \
642 + $(am__cd) $(srcdir) && $(AUTOMAKE) --cygnus \
643 + && exit 0; \
644 + exit 1;; \
645 + esac; \
646 + done; \
647 + echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \
648 + $(am__cd) $(top_srcdir) && \
649 + $(AUTOMAKE) --cygnus Makefile
650 +.PRECIOUS: Makefile
651 +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
652 + @case '$?' in \
653 + *config.status*) \
654 + echo ' $(SHELL) ./config.status'; \
655 + $(SHELL) ./config.status;; \
656 + *) \
657 + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
658 + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
659 + esac;
661 +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
662 + $(SHELL) ./config.status --recheck
664 +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
665 + $(am__cd) $(srcdir) && $(AUTOCONF)
666 +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
667 + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
668 +$(am__aclocal_m4_deps):
670 +clean-noinstLIBRARIES:
671 + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
672 +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
673 + -rm -f lib.a
674 + $(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
675 + $(RANLIB) lib.a
677 +mostlyclean-compile:
678 + -rm -f *.$(OBJEXT)
680 +distclean-compile:
681 + -rm -f *.tab.c
683 +.S.o:
684 + $(CPPASCOMPILE) -c -o $@ $<
686 +.S.obj:
687 + $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
689 +.c.o:
690 + $(COMPILE) -c $<
692 +.c.obj:
693 + $(COMPILE) -c `$(CYGPATH_W) '$<'`
695 +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
696 + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
697 + unique=`for i in $$list; do \
698 + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
699 + done | \
700 + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
701 + END { if (nonempty) { for (i in files) print i; }; }'`; \
702 + mkid -fID $$unique
703 +tags: TAGS
705 +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
706 + $(TAGS_FILES) $(LISP)
707 + set x; \
708 + here=`pwd`; \
709 + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
710 + unique=`for i in $$list; do \
711 + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
712 + done | \
713 + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
714 + END { if (nonempty) { for (i in files) print i; }; }'`; \
715 + shift; \
716 + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
717 + test -n "$$unique" || unique=$$empty_fix; \
718 + if test $$# -gt 0; then \
719 + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
720 + "$$@" $$unique; \
721 + else \
722 + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
723 + $$unique; \
724 + fi; \
725 + fi
726 +ctags: CTAGS
727 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
728 + $(TAGS_FILES) $(LISP)
729 + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
730 + unique=`for i in $$list; do \
731 + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
732 + done | \
733 + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
734 + END { if (nonempty) { for (i in files) print i; }; }'`; \
735 + test -z "$(CTAGS_ARGS)$$unique" \
736 + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
737 + $$unique
739 +GTAGS:
740 + here=`$(am__cd) $(top_builddir) && pwd` \
741 + && $(am__cd) $(top_srcdir) \
742 + && gtags -i $(GTAGS_ARGS) "$$here"
744 +distclean-tags:
745 + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
746 +check-am:
747 +check: check-am
748 +all-am: Makefile $(LIBRARIES)
749 +installdirs:
750 +install: install-am
751 +install-exec: install-exec-am
752 +install-data: install-data-am
753 +uninstall: uninstall-am
755 +install-am: all-am
756 + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
758 +installcheck: installcheck-am
759 +install-strip:
760 + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
761 + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
762 + `test -z '$(STRIP)' || \
763 + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
764 +mostlyclean-generic:
766 +clean-generic:
768 +distclean-generic:
769 + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
770 + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
772 +maintainer-clean-generic:
773 + @echo "This command is intended for maintainers to use"
774 + @echo "it deletes files that may require special tools to rebuild."
775 +clean: clean-am
777 +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
779 +distclean: distclean-am
780 + -rm -f $(am__CONFIG_DISTCLEAN_FILES)
781 + -rm -f Makefile
782 +distclean-am: clean-am distclean-compile distclean-generic \
783 + distclean-tags
785 +dvi: dvi-am
787 +dvi-am:
789 +html: html-am
791 +html-am:
793 +info: info-am
795 +info-am:
797 +install-data-am:
799 +install-dvi: install-dvi-am
801 +install-dvi-am:
803 +install-exec-am:
805 +install-html: install-html-am
807 +install-html-am:
809 +install-info: install-info-am
811 +install-info-am:
813 +install-man:
815 +install-pdf: install-pdf-am
817 +install-pdf-am:
819 +install-ps: install-ps-am
821 +install-ps-am:
823 +installcheck-am:
825 +maintainer-clean: maintainer-clean-am
826 + -rm -f $(am__CONFIG_DISTCLEAN_FILES)
827 + -rm -rf $(top_srcdir)/autom4te.cache
828 + -rm -f Makefile
829 +maintainer-clean-am: distclean-am maintainer-clean-generic
831 +mostlyclean: mostlyclean-am
833 +mostlyclean-am: mostlyclean-compile mostlyclean-generic
835 +pdf: pdf-am
837 +pdf-am:
839 +ps: ps-am
841 +ps-am:
843 +uninstall-am:
845 +.MAKE: install-am install-strip
847 +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
848 + clean-generic clean-noinstLIBRARIES ctags distclean \
849 + distclean-compile distclean-generic distclean-tags dvi dvi-am \
850 + html html-am info info-am install install-am install-data \
851 + install-data-am install-dvi install-dvi-am install-exec \
852 + install-exec-am install-html install-html-am install-info \
853 + install-info-am install-man install-pdf install-pdf-am \
854 + install-ps install-ps-am install-strip installcheck \
855 + installcheck-am installdirs maintainer-clean \
856 + maintainer-clean-generic mostlyclean mostlyclean-compile \
857 + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
858 + uninstall-am
861 +all: crt0.o
863 +$(LIBCGLUE_MULT_OBJS): libcglue.c
864 + $(COMPILE) -DF_$* $< -c -o $@
866 +$(SOCKET_MULT_OBJS): socket.c
867 + $(COMPILE) -DF_$* $< -c -o $@
869 +$(XPRINTF_MULT_OBJS): xprintf.c
870 + $(COMPILE) -DF_$* $< -c -o $@
872 +$(NETDB_MULT_OBJS): netdb.c
873 + $(COMPILE) -DF_$* $< -c -o $@
875 +$(PIPE_OBJS): pipe.c
876 + $(COMPILE) -DF_$* $< -c -o $@
878 +$(FDMAN_OBJS): fdman.c
879 + $(COMPILE) -DF_$* $< -c -o $@
881 +$(SELECT_OBJS): select.c
882 + $(COMPILE) -DF_$* $< -c -o $@
884 +$(INTERRUPT_OBJS): interrupt.S
885 + $(COMPILE) -DF_$* $< -c -o $@
887 +# Tell versions [3.59,3.63) of GNU make to not export all variables.
888 +# Otherwise a system limit (for SysV at least) may be exceeded.
889 +.NOEXPORT:
890 diff --git a/newlib/libc/sys/psp/README b/newlib/libc/sys/psp/README
891 new file mode 100644
892 index 000000000..d78ac463b
893 --- /dev/null
894 +++ b/newlib/libc/sys/psp/README
895 @@ -0,0 +1,15 @@
896 +Newlib for PSP
899 +This sys/psp directory depends on PSPSDK headers. It expects them to live in
900 +${prefix}/psp/sdk/include (see newlib/configure.host).
902 +I used the autotools to generate aclocal.m4, Makefile.in and configure using:
904 + aclocal -I ../../..
905 + automake --cygnus
906 + autoconf
909 +Originally by Marcus R. Brown <mrbrown@ocgnet.org>
910 +Updated by artart78 <arthur.blot78@gmail.com>
911 diff --git a/newlib/libc/sys/psp/aclocal.m4 b/newlib/libc/sys/psp/aclocal.m4
912 new file mode 100644
913 index 000000000..f4337cf8d
914 --- /dev/null
915 +++ b/newlib/libc/sys/psp/aclocal.m4
916 @@ -0,0 +1,992 @@
917 +# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
919 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
920 +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
921 +# This file is free software; the Free Software Foundation
922 +# gives unlimited permission to copy and/or distribute it,
923 +# with or without modifications, as long as this notice is preserved.
925 +# This program is distributed in the hope that it will be useful,
926 +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
927 +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
928 +# PARTICULAR PURPOSE.
930 +m4_ifndef([AC_AUTOCONF_VERSION],
931 + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
932 +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
933 +[m4_warning([this file was generated for autoconf 2.68.
934 +You have another version of autoconf. It may work, but is not guaranteed to.
935 +If you have problems, you may need to regenerate the build system entirely.
936 +To do so, use the procedure documented by the package, typically `autoreconf'.])])
938 +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
940 +# This file is free software; the Free Software Foundation
941 +# gives unlimited permission to copy and/or distribute it,
942 +# with or without modifications, as long as this notice is preserved.
944 +# AM_AUTOMAKE_VERSION(VERSION)
945 +# ----------------------------
946 +# Automake X.Y traces this macro to ensure aclocal.m4 has been
947 +# generated from the m4 files accompanying Automake X.Y.
948 +# (This private macro should not be called outside this file.)
949 +AC_DEFUN([AM_AUTOMAKE_VERSION],
950 +[am__api_version='1.11'
951 +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
952 +dnl require some minimum version. Point them to the right macro.
953 +m4_if([$1], [1.11.1], [],
954 + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
957 +# _AM_AUTOCONF_VERSION(VERSION)
958 +# -----------------------------
959 +# aclocal traces this macro to find the Autoconf version.
960 +# This is a private macro too. Using m4_define simplifies
961 +# the logic in aclocal, which can simply ignore this definition.
962 +m4_define([_AM_AUTOCONF_VERSION], [])
964 +# AM_SET_CURRENT_AUTOMAKE_VERSION
965 +# -------------------------------
966 +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
967 +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
968 +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
969 +[AM_AUTOMAKE_VERSION([1.11.1])dnl
970 +m4_ifndef([AC_AUTOCONF_VERSION],
971 + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
972 +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
974 +# AM_AUX_DIR_EXPAND -*- Autoconf -*-
976 +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
978 +# This file is free software; the Free Software Foundation
979 +# gives unlimited permission to copy and/or distribute it,
980 +# with or without modifications, as long as this notice is preserved.
982 +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
983 +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
984 +# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
986 +# Of course, Automake must honor this variable whenever it calls a
987 +# tool from the auxiliary directory. The problem is that $srcdir (and
988 +# therefore $ac_aux_dir as well) can be either absolute or relative,
989 +# depending on how configure is run. This is pretty annoying, since
990 +# it makes $ac_aux_dir quite unusable in subdirectories: in the top
991 +# source directory, any form will work fine, but in subdirectories a
992 +# relative path needs to be adjusted first.
994 +# $ac_aux_dir/missing
995 +# fails when called from a subdirectory if $ac_aux_dir is relative
996 +# $top_srcdir/$ac_aux_dir/missing
997 +# fails if $ac_aux_dir is absolute,
998 +# fails when called from a subdirectory in a VPATH build with
999 +# a relative $ac_aux_dir
1001 +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
1002 +# are both prefixed by $srcdir. In an in-source build this is usually
1003 +# harmless because $srcdir is `.', but things will broke when you
1004 +# start a VPATH build or use an absolute $srcdir.
1006 +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
1007 +# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
1008 +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
1009 +# and then we would define $MISSING as
1010 +# MISSING="\${SHELL} $am_aux_dir/missing"
1011 +# This will work as long as MISSING is not called from configure, because
1012 +# unfortunately $(top_srcdir) has no meaning in configure.
1013 +# However there are other variables, like CC, which are often used in
1014 +# configure, and could therefore not use this "fixed" $ac_aux_dir.
1016 +# Another solution, used here, is to always expand $ac_aux_dir to an
1017 +# absolute PATH. The drawback is that using absolute paths prevent a
1018 +# configured tree to be moved without reconfiguration.
1020 +AC_DEFUN([AM_AUX_DIR_EXPAND],
1021 +[dnl Rely on autoconf to set up CDPATH properly.
1022 +AC_PREREQ([2.50])dnl
1023 +# expand $ac_aux_dir to an absolute path
1024 +am_aux_dir=`cd $ac_aux_dir && pwd`
1027 +# AM_CONDITIONAL -*- Autoconf -*-
1029 +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1030 +# Free Software Foundation, Inc.
1032 +# This file is free software; the Free Software Foundation
1033 +# gives unlimited permission to copy and/or distribute it,
1034 +# with or without modifications, as long as this notice is preserved.
1036 +# serial 9
1038 +# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1039 +# -------------------------------------
1040 +# Define a conditional.
1041 +AC_DEFUN([AM_CONDITIONAL],
1042 +[AC_PREREQ(2.52)dnl
1043 + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
1044 + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1045 +AC_SUBST([$1_TRUE])dnl
1046 +AC_SUBST([$1_FALSE])dnl
1047 +_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1048 +_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1049 +m4_define([_AM_COND_VALUE_$1], [$2])dnl
1050 +if $2; then
1051 + $1_TRUE=
1052 + $1_FALSE='#'
1053 +else
1054 + $1_TRUE='#'
1055 + $1_FALSE=
1057 +AC_CONFIG_COMMANDS_PRE(
1058 +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1059 + AC_MSG_ERROR([[conditional "$1" was never defined.
1060 +Usually this means the macro was only invoked conditionally.]])
1061 +fi])])
1063 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1064 +# Free Software Foundation, Inc.
1066 +# This file is free software; the Free Software Foundation
1067 +# gives unlimited permission to copy and/or distribute it,
1068 +# with or without modifications, as long as this notice is preserved.
1070 +# serial 10
1072 +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1073 +# written in clear, in which case automake, when reading aclocal.m4,
1074 +# will think it sees a *use*, and therefore will trigger all it's
1075 +# C support machinery. Also note that it means that autoscan, seeing
1076 +# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1079 +# _AM_DEPENDENCIES(NAME)
1080 +# ----------------------
1081 +# See how the compiler implements dependency checking.
1082 +# NAME is "CC", "CXX", "GCJ", or "OBJC".
1083 +# We try a few techniques and use that to set a single cache variable.
1085 +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1086 +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1087 +# dependency, and given that the user is not expected to run this macro,
1088 +# just rely on AC_PROG_CC.
1089 +AC_DEFUN([_AM_DEPENDENCIES],
1090 +[AC_REQUIRE([AM_SET_DEPDIR])dnl
1091 +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1092 +AC_REQUIRE([AM_MAKE_INCLUDE])dnl
1093 +AC_REQUIRE([AM_DEP_TRACK])dnl
1095 +ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
1096 + [$1], CXX, [depcc="$CXX" am_compiler_list=],
1097 + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1098 + [$1], UPC, [depcc="$UPC" am_compiler_list=],
1099 + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
1100 + [depcc="$$1" am_compiler_list=])
1102 +AC_CACHE_CHECK([dependency style of $depcc],
1103 + [am_cv_$1_dependencies_compiler_type],
1104 +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1105 + # We make a subdir and do the tests there. Otherwise we can end up
1106 + # making bogus files that we don't know about and never remove. For
1107 + # instance it was reported that on HP-UX the gcc test will end up
1108 + # making a dummy file named `D' -- because `-MD' means `put the output
1109 + # in D'.
1110 + mkdir conftest.dir
1111 + # Copy depcomp to subdir because otherwise we won't find it if we're
1112 + # using a relative directory.
1113 + cp "$am_depcomp" conftest.dir
1114 + cd conftest.dir
1115 + # We will build objects and dependencies in a subdirectory because
1116 + # it helps to detect inapplicable dependency modes. For instance
1117 + # both Tru64's cc and ICC support -MD to output dependencies as a
1118 + # side effect of compilation, but ICC will put the dependencies in
1119 + # the current directory while Tru64 will put them in the object
1120 + # directory.
1121 + mkdir sub
1123 + am_cv_$1_dependencies_compiler_type=none
1124 + if test "$am_compiler_list" = ""; then
1125 + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
1126 + fi
1127 + am__universal=false
1128 + m4_case([$1], [CC],
1129 + [case " $depcc " in #(
1130 + *\ -arch\ *\ -arch\ *) am__universal=true ;;
1131 + esac],
1132 + [CXX],
1133 + [case " $depcc " in #(
1134 + *\ -arch\ *\ -arch\ *) am__universal=true ;;
1135 + esac])
1137 + for depmode in $am_compiler_list; do
1138 + # Setup a source with many dependencies, because some compilers
1139 + # like to wrap large dependency lists on column 80 (with \), and
1140 + # we should not choose a depcomp mode which is confused by this.
1142 + # We need to recreate these files for each test, as the compiler may
1143 + # overwrite some of them when testing with obscure command lines.
1144 + # This happens at least with the AIX C compiler.
1145 + : > sub/conftest.c
1146 + for i in 1 2 3 4 5 6; do
1147 + echo '#include "conftst'$i'.h"' >> sub/conftest.c
1148 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
1149 + # Solaris 8's {/usr,}/bin/sh.
1150 + touch sub/conftst$i.h
1151 + done
1152 + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
1154 + # We check with `-c' and `-o' for the sake of the "dashmstdout"
1155 + # mode. It turns out that the SunPro C++ compiler does not properly
1156 + # handle `-M -o', and we need to detect this. Also, some Intel
1157 + # versions had trouble with output in subdirs
1158 + am__obj=sub/conftest.${OBJEXT-o}
1159 + am__minus_obj="-o $am__obj"
1160 + case $depmode in
1161 + gcc)
1162 + # This depmode causes a compiler race in universal mode.
1163 + test "$am__universal" = false || continue
1164 + ;;
1165 + nosideeffect)
1166 + # after this tag, mechanisms are not by side-effect, so they'll
1167 + # only be used when explicitly requested
1168 + if test "x$enable_dependency_tracking" = xyes; then
1169 + continue
1170 + else
1171 + break
1172 + fi
1173 + ;;
1174 + msvisualcpp | msvcmsys)
1175 + # This compiler won't grok `-c -o', but also, the minuso test has
1176 + # not run yet. These depmodes are late enough in the game, and
1177 + # so weak that their functioning should not be impacted.
1178 + am__obj=conftest.${OBJEXT-o}
1179 + am__minus_obj=
1180 + ;;
1181 + none) break ;;
1182 + esac
1183 + if depmode=$depmode \
1184 + source=sub/conftest.c object=$am__obj \
1185 + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
1186 + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
1187 + >/dev/null 2>conftest.err &&
1188 + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
1189 + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
1190 + grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
1191 + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
1192 + # icc doesn't choke on unknown options, it will just issue warnings
1193 + # or remarks (even with -Werror). So we grep stderr for any message
1194 + # that says an option was ignored or not supported.
1195 + # When given -MP, icc 7.0 and 7.1 complain thusly:
1196 + # icc: Command line warning: ignoring option '-M'; no argument required
1197 + # The diagnosis changed in icc 8.0:
1198 + # icc: Command line remark: option '-MP' not supported
1199 + if (grep 'ignoring option' conftest.err ||
1200 + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
1201 + am_cv_$1_dependencies_compiler_type=$depmode
1202 + break
1203 + fi
1204 + fi
1205 + done
1207 + cd ..
1208 + rm -rf conftest.dir
1209 +else
1210 + am_cv_$1_dependencies_compiler_type=none
1213 +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
1214 +AM_CONDITIONAL([am__fastdep$1], [
1215 + test "x$enable_dependency_tracking" != xno \
1216 + && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
1220 +# AM_SET_DEPDIR
1221 +# -------------
1222 +# Choose a directory name for dependency files.
1223 +# This macro is AC_REQUIREd in _AM_DEPENDENCIES
1224 +AC_DEFUN([AM_SET_DEPDIR],
1225 +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
1226 +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
1230 +# AM_DEP_TRACK
1231 +# ------------
1232 +AC_DEFUN([AM_DEP_TRACK],
1233 +[AC_ARG_ENABLE(dependency-tracking,
1234 +[ --disable-dependency-tracking speeds up one-time build
1235 + --enable-dependency-tracking do not reject slow dependency extractors])
1236 +if test "x$enable_dependency_tracking" != xno; then
1237 + am_depcomp="$ac_aux_dir/depcomp"
1238 + AMDEPBACKSLASH='\'
1240 +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
1241 +AC_SUBST([AMDEPBACKSLASH])dnl
1242 +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
1245 +# Generate code to set up dependency tracking. -*- Autoconf -*-
1247 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
1248 +# Free Software Foundation, Inc.
1250 +# This file is free software; the Free Software Foundation
1251 +# gives unlimited permission to copy and/or distribute it,
1252 +# with or without modifications, as long as this notice is preserved.
1254 +#serial 5
1256 +# _AM_OUTPUT_DEPENDENCY_COMMANDS
1257 +# ------------------------------
1258 +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
1260 + # Autoconf 2.62 quotes --file arguments for eval, but not when files
1261 + # are listed without --file. Let's play safe and only enable the eval
1262 + # if we detect the quoting.
1263 + case $CONFIG_FILES in
1264 + *\'*) eval set x "$CONFIG_FILES" ;;
1265 + *) set x $CONFIG_FILES ;;
1266 + esac
1267 + shift
1268 + for mf
1269 + do
1270 + # Strip MF so we end up with the name of the file.
1271 + mf=`echo "$mf" | sed -e 's/:.*$//'`
1272 + # Check whether this is an Automake generated Makefile or not.
1273 + # We used to match only the files named `Makefile.in', but
1274 + # some people rename them; so instead we look at the file content.
1275 + # Grep'ing the first line is not enough: some people post-process
1276 + # each Makefile.in and add a new line on top of each file to say so.
1277 + # Grep'ing the whole file is not good either: AIX grep has a line
1278 + # limit of 2048, but all sed's we know have understand at least 4000.
1279 + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
1280 + dirpart=`AS_DIRNAME("$mf")`
1281 + else
1282 + continue
1283 + fi
1284 + # Extract the definition of DEPDIR, am__include, and am__quote
1285 + # from the Makefile without running `make'.
1286 + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
1287 + test -z "$DEPDIR" && continue
1288 + am__include=`sed -n 's/^am__include = //p' < "$mf"`
1289 + test -z "am__include" && continue
1290 + am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
1291 + # When using ansi2knr, U may be empty or an underscore; expand it
1292 + U=`sed -n 's/^U = //p' < "$mf"`
1293 + # Find all dependency output files, they are included files with
1294 + # $(DEPDIR) in their names. We invoke sed twice because it is the
1295 + # simplest approach to changing $(DEPDIR) to its actual value in the
1296 + # expansion.
1297 + for file in `sed -n "
1298 + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
1299 + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
1300 + # Make sure the directory exists.
1301 + test -f "$dirpart/$file" && continue
1302 + fdir=`AS_DIRNAME(["$file"])`
1303 + AS_MKDIR_P([$dirpart/$fdir])
1304 + # echo "creating $dirpart/$file"
1305 + echo '# dummy' > "$dirpart/$file"
1306 + done
1307 + done
1309 +])# _AM_OUTPUT_DEPENDENCY_COMMANDS
1312 +# AM_OUTPUT_DEPENDENCY_COMMANDS
1313 +# -----------------------------
1314 +# This macro should only be invoked once -- use via AC_REQUIRE.
1316 +# This code is only required when automatic dependency tracking
1317 +# is enabled. FIXME. This creates each `.P' file that we will
1318 +# need in order to bootstrap the dependency handling code.
1319 +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
1320 +[AC_CONFIG_COMMANDS([depfiles],
1321 + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
1322 + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
1325 +# Do all the work for Automake. -*- Autoconf -*-
1327 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
1328 +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
1330 +# This file is free software; the Free Software Foundation
1331 +# gives unlimited permission to copy and/or distribute it,
1332 +# with or without modifications, as long as this notice is preserved.
1334 +# serial 16
1336 +# This macro actually does too much. Some checks are only needed if
1337 +# your package does certain things. But this isn't really a big deal.
1339 +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1340 +# AM_INIT_AUTOMAKE([OPTIONS])
1341 +# -----------------------------------------------
1342 +# The call with PACKAGE and VERSION arguments is the old style
1343 +# call (pre autoconf-2.50), which is being phased out. PACKAGE
1344 +# and VERSION should now be passed to AC_INIT and removed from
1345 +# the call to AM_INIT_AUTOMAKE.
1346 +# We support both call styles for the transition. After
1347 +# the next Automake release, Autoconf can make the AC_INIT
1348 +# arguments mandatory, and then we can depend on a new Autoconf
1349 +# release and drop the old call support.
1350 +AC_DEFUN([AM_INIT_AUTOMAKE],
1351 +[AC_PREREQ([2.62])dnl
1352 +dnl Autoconf wants to disallow AM_ names. We explicitly allow
1353 +dnl the ones we care about.
1354 +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1355 +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1356 +AC_REQUIRE([AC_PROG_INSTALL])dnl
1357 +if test "`cd $srcdir && pwd`" != "`pwd`"; then
1358 + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1359 + # is not polluted with repeated "-I."
1360 + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1361 + # test to see if srcdir already configured
1362 + if test -f $srcdir/config.status; then
1363 + AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1364 + fi
1367 +# test whether we have cygpath
1368 +if test -z "$CYGPATH_W"; then
1369 + if (cygpath --version) >/dev/null 2>/dev/null; then
1370 + CYGPATH_W='cygpath -w'
1371 + else
1372 + CYGPATH_W=echo
1373 + fi
1375 +AC_SUBST([CYGPATH_W])
1377 +# Define the identity of the package.
1378 +dnl Distinguish between old-style and new-style calls.
1379 +m4_ifval([$2],
1380 +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
1381 + AC_SUBST([PACKAGE], [$1])dnl
1382 + AC_SUBST([VERSION], [$2])],
1383 +[_AM_SET_OPTIONS([$1])dnl
1384 +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
1385 +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
1386 + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
1387 + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
1388 + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
1390 +_AM_IF_OPTION([no-define],,
1391 +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1392 + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
1394 +# Some tools Automake needs.
1395 +AC_REQUIRE([AM_SANITY_CHECK])dnl
1396 +AC_REQUIRE([AC_ARG_PROGRAM])dnl
1397 +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
1398 +AM_MISSING_PROG(AUTOCONF, autoconf)
1399 +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
1400 +AM_MISSING_PROG(AUTOHEADER, autoheader)
1401 +AM_MISSING_PROG(MAKEINFO, makeinfo)
1402 +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1403 +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
1404 +AC_REQUIRE([AM_PROG_MKDIR_P])dnl
1405 +# We need awk for the "check" target. The system "awk" is bad on
1406 +# some platforms.
1407 +AC_REQUIRE([AC_PROG_AWK])dnl
1408 +AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1409 +AC_REQUIRE([AM_SET_LEADING_DOT])dnl
1410 +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
1411 + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
1412 + [_AM_PROG_TAR([v7])])])
1413 +_AM_IF_OPTION([no-dependencies],,
1414 +[AC_PROVIDE_IFELSE([AC_PROG_CC],
1415 + [_AM_DEPENDENCIES(CC)],
1416 + [define([AC_PROG_CC],
1417 + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
1418 +AC_PROVIDE_IFELSE([AC_PROG_CXX],
1419 + [_AM_DEPENDENCIES(CXX)],
1420 + [define([AC_PROG_CXX],
1421 + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
1422 +AC_PROVIDE_IFELSE([AC_PROG_OBJC],
1423 + [_AM_DEPENDENCIES(OBJC)],
1424 + [define([AC_PROG_OBJC],
1425 + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
1427 +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
1428 +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
1429 +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
1430 +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
1431 +AC_CONFIG_COMMANDS_PRE(dnl
1432 +[m4_provide_if([_AM_COMPILER_EXEEXT],
1433 + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
1436 +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
1437 +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
1438 +dnl mangled by Autoconf and run in a shell conditional statement.
1439 +m4_define([_AC_COMPILER_EXEEXT],
1440 +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
1443 +# When config.status generates a header, we must update the stamp-h file.
1444 +# This file resides in the same directory as the config header
1445 +# that is generated. The stamp files are numbered to have different names.
1447 +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
1448 +# loop where config.status creates the headers, so we can generate
1449 +# our stamp files there.
1450 +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
1451 +[# Compute $1's index in $config_headers.
1452 +_am_arg=$1
1453 +_am_stamp_count=1
1454 +for _am_header in $config_headers :; do
1455 + case $_am_header in
1456 + $_am_arg | $_am_arg:* )
1457 + break ;;
1458 + * )
1459 + _am_stamp_count=`expr $_am_stamp_count + 1` ;;
1460 + esac
1461 +done
1462 +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
1464 +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
1466 +# This file is free software; the Free Software Foundation
1467 +# gives unlimited permission to copy and/or distribute it,
1468 +# with or without modifications, as long as this notice is preserved.
1470 +# AM_PROG_INSTALL_SH
1471 +# ------------------
1472 +# Define $install_sh.
1473 +AC_DEFUN([AM_PROG_INSTALL_SH],
1474 +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1475 +if test x"${install_sh}" != xset; then
1476 + case $am_aux_dir in
1477 + *\ * | *\ *)
1478 + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
1479 + *)
1480 + install_sh="\${SHELL} $am_aux_dir/install-sh"
1481 + esac
1483 +AC_SUBST(install_sh)])
1485 +# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
1487 +# This file is free software; the Free Software Foundation
1488 +# gives unlimited permission to copy and/or distribute it,
1489 +# with or without modifications, as long as this notice is preserved.
1491 +# serial 2
1493 +# Check whether the underlying file-system supports filenames
1494 +# with a leading dot. For instance MS-DOS doesn't.
1495 +AC_DEFUN([AM_SET_LEADING_DOT],
1496 +[rm -rf .tst 2>/dev/null
1497 +mkdir .tst 2>/dev/null
1498 +if test -d .tst; then
1499 + am__leading_dot=.
1500 +else
1501 + am__leading_dot=_
1503 +rmdir .tst 2>/dev/null
1504 +AC_SUBST([am__leading_dot])])
1506 +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
1507 +# From Jim Meyering
1509 +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
1510 +# Free Software Foundation, Inc.
1512 +# This file is free software; the Free Software Foundation
1513 +# gives unlimited permission to copy and/or distribute it,
1514 +# with or without modifications, as long as this notice is preserved.
1516 +# serial 5
1518 +# AM_MAINTAINER_MODE([DEFAULT-MODE])
1519 +# ----------------------------------
1520 +# Control maintainer-specific portions of Makefiles.
1521 +# Default is to disable them, unless `enable' is passed literally.
1522 +# For symmetry, `disable' may be passed as well. Anyway, the user
1523 +# can override the default with the --enable/--disable switch.
1524 +AC_DEFUN([AM_MAINTAINER_MODE],
1525 +[m4_case(m4_default([$1], [disable]),
1526 + [enable], [m4_define([am_maintainer_other], [disable])],
1527 + [disable], [m4_define([am_maintainer_other], [enable])],
1528 + [m4_define([am_maintainer_other], [enable])
1529 + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
1530 +AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
1531 + dnl maintainer-mode's default is 'disable' unless 'enable' is passed
1532 + AC_ARG_ENABLE([maintainer-mode],
1533 +[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
1534 + (and sometimes confusing) to the casual installer],
1535 + [USE_MAINTAINER_MODE=$enableval],
1536 + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
1537 + AC_MSG_RESULT([$USE_MAINTAINER_MODE])
1538 + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
1539 + MAINT=$MAINTAINER_MODE_TRUE
1540 + AC_SUBST([MAINT])dnl
1544 +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
1546 +# Check to see how 'make' treats includes. -*- Autoconf -*-
1548 +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
1550 +# This file is free software; the Free Software Foundation
1551 +# gives unlimited permission to copy and/or distribute it,
1552 +# with or without modifications, as long as this notice is preserved.
1554 +# serial 4
1556 +# AM_MAKE_INCLUDE()
1557 +# -----------------
1558 +# Check to see how make treats includes.
1559 +AC_DEFUN([AM_MAKE_INCLUDE],
1560 +[am_make=${MAKE-make}
1561 +cat > confinc << 'END'
1562 +am__doit:
1563 + @echo this is the am__doit target
1564 +.PHONY: am__doit
1565 +END
1566 +# If we don't find an include directive, just comment out the code.
1567 +AC_MSG_CHECKING([for style of include used by $am_make])
1568 +am__include="#"
1569 +am__quote=
1570 +_am_result=none
1571 +# First try GNU make style include.
1572 +echo "include confinc" > confmf
1573 +# Ignore all kinds of additional output from `make'.
1574 +case `$am_make -s -f confmf 2> /dev/null` in #(
1575 +*the\ am__doit\ target*)
1576 + am__include=include
1577 + am__quote=
1578 + _am_result=GNU
1579 + ;;
1580 +esac
1581 +# Now try BSD make style include.
1582 +if test "$am__include" = "#"; then
1583 + echo '.include "confinc"' > confmf
1584 + case `$am_make -s -f confmf 2> /dev/null` in #(
1585 + *the\ am__doit\ target*)
1586 + am__include=.include
1587 + am__quote="\""
1588 + _am_result=BSD
1589 + ;;
1590 + esac
1592 +AC_SUBST([am__include])
1593 +AC_SUBST([am__quote])
1594 +AC_MSG_RESULT([$_am_result])
1595 +rm -f confinc confmf
1598 +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
1600 +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
1601 +# Free Software Foundation, Inc.
1603 +# This file is free software; the Free Software Foundation
1604 +# gives unlimited permission to copy and/or distribute it,
1605 +# with or without modifications, as long as this notice is preserved.
1607 +# serial 6
1609 +# AM_MISSING_PROG(NAME, PROGRAM)
1610 +# ------------------------------
1611 +AC_DEFUN([AM_MISSING_PROG],
1612 +[AC_REQUIRE([AM_MISSING_HAS_RUN])
1613 +$1=${$1-"${am_missing_run}$2"}
1614 +AC_SUBST($1)])
1617 +# AM_MISSING_HAS_RUN
1618 +# ------------------
1619 +# Define MISSING if not defined so far and test if it supports --run.
1620 +# If it does, set am_missing_run to use it, otherwise, to nothing.
1621 +AC_DEFUN([AM_MISSING_HAS_RUN],
1622 +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1623 +AC_REQUIRE_AUX_FILE([missing])dnl
1624 +if test x"${MISSING+set}" != xset; then
1625 + case $am_aux_dir in
1626 + *\ * | *\ *)
1627 + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
1628 + *)
1629 + MISSING="\${SHELL} $am_aux_dir/missing" ;;
1630 + esac
1632 +# Use eval to expand $SHELL
1633 +if eval "$MISSING --run true"; then
1634 + am_missing_run="$MISSING --run "
1635 +else
1636 + am_missing_run=
1637 + AC_MSG_WARN([`missing' script is too old or missing])
1641 +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
1643 +# This file is free software; the Free Software Foundation
1644 +# gives unlimited permission to copy and/or distribute it,
1645 +# with or without modifications, as long as this notice is preserved.
1647 +# AM_PROG_MKDIR_P
1648 +# ---------------
1649 +# Check for `mkdir -p'.
1650 +AC_DEFUN([AM_PROG_MKDIR_P],
1651 +[AC_PREREQ([2.60])dnl
1652 +AC_REQUIRE([AC_PROG_MKDIR_P])dnl
1653 +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
1654 +dnl while keeping a definition of mkdir_p for backward compatibility.
1655 +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
1656 +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
1657 +dnl Makefile.ins that do not define MKDIR_P, so we do our own
1658 +dnl adjustment using top_builddir (which is defined more often than
1659 +dnl MKDIR_P).
1660 +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
1661 +case $mkdir_p in
1662 + [[\\/$]]* | ?:[[\\/]]*) ;;
1663 + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
1664 +esac
1667 +# Helper functions for option handling. -*- Autoconf -*-
1669 +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
1671 +# This file is free software; the Free Software Foundation
1672 +# gives unlimited permission to copy and/or distribute it,
1673 +# with or without modifications, as long as this notice is preserved.
1675 +# serial 4
1677 +# _AM_MANGLE_OPTION(NAME)
1678 +# -----------------------
1679 +AC_DEFUN([_AM_MANGLE_OPTION],
1680 +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
1682 +# _AM_SET_OPTION(NAME)
1683 +# ------------------------------
1684 +# Set option NAME. Presently that only means defining a flag for this option.
1685 +AC_DEFUN([_AM_SET_OPTION],
1686 +[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
1688 +# _AM_SET_OPTIONS(OPTIONS)
1689 +# ----------------------------------
1690 +# OPTIONS is a space-separated list of Automake options.
1691 +AC_DEFUN([_AM_SET_OPTIONS],
1692 +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
1694 +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
1695 +# -------------------------------------------
1696 +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
1697 +AC_DEFUN([_AM_IF_OPTION],
1698 +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
1700 +# Check to make sure that the build environment is sane. -*- Autoconf -*-
1702 +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
1703 +# Free Software Foundation, Inc.
1705 +# This file is free software; the Free Software Foundation
1706 +# gives unlimited permission to copy and/or distribute it,
1707 +# with or without modifications, as long as this notice is preserved.
1709 +# serial 5
1711 +# AM_SANITY_CHECK
1712 +# ---------------
1713 +AC_DEFUN([AM_SANITY_CHECK],
1714 +[AC_MSG_CHECKING([whether build environment is sane])
1715 +# Just in case
1716 +sleep 1
1717 +echo timestamp > conftest.file
1718 +# Reject unsafe characters in $srcdir or the absolute working directory
1719 +# name. Accept space and tab only in the latter.
1720 +am_lf='
1722 +case `pwd` in
1723 + *[[\\\"\#\$\&\'\`$am_lf]]*)
1724 + AC_MSG_ERROR([unsafe absolute working directory name]);;
1725 +esac
1726 +case $srcdir in
1727 + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
1728 + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
1729 +esac
1731 +# Do `set' in a subshell so we don't clobber the current shell's
1732 +# arguments. Must try -L first in case configure is actually a
1733 +# symlink; some systems play weird games with the mod time of symlinks
1734 +# (eg FreeBSD returns the mod time of the symlink's containing
1735 +# directory).
1736 +if (
1737 + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
1738 + if test "$[*]" = "X"; then
1739 + # -L didn't work.
1740 + set X `ls -t "$srcdir/configure" conftest.file`
1741 + fi
1742 + rm -f conftest.file
1743 + if test "$[*]" != "X $srcdir/configure conftest.file" \
1744 + && test "$[*]" != "X conftest.file $srcdir/configure"; then
1746 + # If neither matched, then we have a broken ls. This can happen
1747 + # if, for instance, CONFIG_SHELL is bash and it inherits a
1748 + # broken ls alias from the environment. This has actually
1749 + # happened. Such a system could not be considered "sane".
1750 + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1751 +alias in your environment])
1752 + fi
1754 + test "$[2]" = conftest.file
1756 +then
1757 + # Ok.
1759 +else
1760 + AC_MSG_ERROR([newly created file is older than distributed files!
1761 +Check your system clock])
1763 +AC_MSG_RESULT(yes)])
1765 +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
1767 +# This file is free software; the Free Software Foundation
1768 +# gives unlimited permission to copy and/or distribute it,
1769 +# with or without modifications, as long as this notice is preserved.
1771 +# AM_PROG_INSTALL_STRIP
1772 +# ---------------------
1773 +# One issue with vendor `install' (even GNU) is that you can't
1774 +# specify the program used to strip binaries. This is especially
1775 +# annoying in cross-compiling environments, where the build's strip
1776 +# is unlikely to handle the host's binaries.
1777 +# Fortunately install-sh will honor a STRIPPROG variable, so we
1778 +# always use install-sh in `make install-strip', and initialize
1779 +# STRIPPROG with the value of the STRIP variable (set by the user).
1780 +AC_DEFUN([AM_PROG_INSTALL_STRIP],
1781 +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1782 +# Installed binaries are usually stripped using `strip' when the user
1783 +# run `make install-strip'. However `strip' might not be the right
1784 +# tool to use in cross-compilation environments, therefore Automake
1785 +# will honor the `STRIP' environment variable to overrule this program.
1786 +dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
1787 +if test "$cross_compiling" != no; then
1788 + AC_CHECK_TOOL([STRIP], [strip], :)
1790 +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1791 +AC_SUBST([INSTALL_STRIP_PROGRAM])])
1793 +# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
1795 +# This file is free software; the Free Software Foundation
1796 +# gives unlimited permission to copy and/or distribute it,
1797 +# with or without modifications, as long as this notice is preserved.
1799 +# serial 2
1801 +# _AM_SUBST_NOTMAKE(VARIABLE)
1802 +# ---------------------------
1803 +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1804 +# This macro is traced by Automake.
1805 +AC_DEFUN([_AM_SUBST_NOTMAKE])
1807 +# AM_SUBST_NOTMAKE(VARIABLE)
1808 +# ---------------------------
1809 +# Public sister of _AM_SUBST_NOTMAKE.
1810 +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1812 +# Check how to create a tarball. -*- Autoconf -*-
1814 +# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
1816 +# This file is free software; the Free Software Foundation
1817 +# gives unlimited permission to copy and/or distribute it,
1818 +# with or without modifications, as long as this notice is preserved.
1820 +# serial 2
1822 +# _AM_PROG_TAR(FORMAT)
1823 +# --------------------
1824 +# Check how to create a tarball in format FORMAT.
1825 +# FORMAT should be one of `v7', `ustar', or `pax'.
1827 +# Substitute a variable $(am__tar) that is a command
1828 +# writing to stdout a FORMAT-tarball containing the directory
1829 +# $tardir.
1830 +# tardir=directory && $(am__tar) > result.tar
1832 +# Substitute a variable $(am__untar) that extract such
1833 +# a tarball read from stdin.
1834 +# $(am__untar) < result.tar
1835 +AC_DEFUN([_AM_PROG_TAR],
1836 +[# Always define AMTAR for backward compatibility.
1837 +AM_MISSING_PROG([AMTAR], [tar])
1838 +m4_if([$1], [v7],
1839 + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
1840 + [m4_case([$1], [ustar],, [pax],,
1841 + [m4_fatal([Unknown tar format])])
1842 +AC_MSG_CHECKING([how to create a $1 tar archive])
1843 +# Loop over all known methods to create a tar archive until one works.
1844 +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1845 +_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1846 +# Do not fold the above two line into one, because Tru64 sh and
1847 +# Solaris sh will not grok spaces in the rhs of `-'.
1848 +for _am_tool in $_am_tools
1850 + case $_am_tool in
1851 + gnutar)
1852 + for _am_tar in tar gnutar gtar;
1853 + do
1854 + AM_RUN_LOG([$_am_tar --version]) && break
1855 + done
1856 + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1857 + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1858 + am__untar="$_am_tar -xf -"
1859 + ;;
1860 + plaintar)
1861 + # Must skip GNU tar: if it does not support --format= it doesn't create
1862 + # ustar tarball either.
1863 + (tar --version) >/dev/null 2>&1 && continue
1864 + am__tar='tar chf - "$$tardir"'
1865 + am__tar_='tar chf - "$tardir"'
1866 + am__untar='tar xf -'
1867 + ;;
1868 + pax)
1869 + am__tar='pax -L -x $1 -w "$$tardir"'
1870 + am__tar_='pax -L -x $1 -w "$tardir"'
1871 + am__untar='pax -r'
1872 + ;;
1873 + cpio)
1874 + am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1875 + am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1876 + am__untar='cpio -i -H $1 -d'
1877 + ;;
1878 + none)
1879 + am__tar=false
1880 + am__tar_=false
1881 + am__untar=false
1882 + ;;
1883 + esac
1885 + # If the value was cached, stop now. We just wanted to have am__tar
1886 + # and am__untar set.
1887 + test -n "${am_cv_prog_tar_$1}" && break
1889 + # tar/untar a dummy directory, and stop if the command works
1890 + rm -rf conftest.dir
1891 + mkdir conftest.dir
1892 + echo GrepMe > conftest.dir/file
1893 + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1894 + rm -rf conftest.dir
1895 + if test -s conftest.tar; then
1896 + AM_RUN_LOG([$am__untar <conftest.tar])
1897 + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1898 + fi
1899 +done
1900 +rm -rf conftest.dir
1902 +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1903 +AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1904 +AC_SUBST([am__tar])
1905 +AC_SUBST([am__untar])
1906 +]) # _AM_PROG_TAR
1908 +m4_include([../../../acinclude.m4])
1909 diff --git a/newlib/libc/sys/psp/arpa/inet.h b/newlib/libc/sys/psp/arpa/inet.h
1910 new file mode 100644
1911 index 000000000..f441b9cb4
1912 --- /dev/null
1913 +++ b/newlib/libc/sys/psp/arpa/inet.h
1914 @@ -0,0 +1,26 @@
1915 +/* arpa/inet.h - Functions for converting IP addresses between strings and numbers */
1917 +#ifndef _ARPA_INET_H_
1918 +#define _ARPA_INET_H_
1920 +#ifdef __cplusplus
1921 +extern "C" {
1922 +#endif
1924 +#include <netinet/in.h>
1926 +in_addr_t sceNetInetInetAddr(const char *ip);
1927 +int sceNetInetInetAton(const char *ip, struct in_addr *in);
1928 +const char* sceNetInetInetNtop(int af, const void *src, char *dst, socklen_t cnt);
1929 +int sceNetInetInetPton(int af, const char *src, void *dst);
1931 +char *inet_ntoa(struct in_addr in);
1932 +#define inet_addr sceNetInetInetAddr
1933 +#define inet_aton sceNetInetInetAton
1934 +#define inet_ntop sceNetInetInetNtop
1935 +#define inet_pton sceNetInetInetPton
1937 +#ifdef __cplusplus
1939 +#endif
1940 +#endif /* _ARPA_INET_H_ */
1941 diff --git a/newlib/libc/sys/psp/confdefs.h b/newlib/libc/sys/psp/confdefs.h
1942 new file mode 100644
1943 index 000000000..8b1378917
1944 --- /dev/null
1945 +++ b/newlib/libc/sys/psp/confdefs.h
1946 @@ -0,0 +1 @@
1948 diff --git a/newlib/libc/sys/psp/configure b/newlib/libc/sys/psp/configure
1949 new file mode 100644
1950 index 000000000..8b3a0f9c7
1951 --- /dev/null
1952 +++ b/newlib/libc/sys/psp/configure
1953 @@ -0,0 +1,4745 @@
1954 +#! /bin/sh
1955 +# Guess values for system-dependent variables and create Makefiles.
1956 +# Generated by GNU Autoconf 2.68 for newlib 1.20.0.
1959 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
1960 +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
1961 +# Foundation, Inc.
1964 +# This configure script is free software; the Free Software Foundation
1965 +# gives unlimited permission to copy, distribute and modify it.
1966 +## -------------------- ##
1967 +## M4sh Initialization. ##
1968 +## -------------------- ##
1970 +# Be more Bourne compatible
1971 +DUALCASE=1; export DUALCASE # for MKS sh
1972 +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
1973 + emulate sh
1974 + NULLCMD=:
1975 + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
1976 + # is contrary to our usage. Disable this feature.
1977 + alias -g '${1+"$@"}'='"$@"'
1978 + setopt NO_GLOB_SUBST
1979 +else
1980 + case `(set -o) 2>/dev/null` in #(
1981 + *posix*) :
1982 + set -o posix ;; #(
1983 + *) :
1984 + ;;
1985 +esac
1989 +as_nl='
1991 +export as_nl
1992 +# Printing a long string crashes Solaris 7 /usr/bin/printf.
1993 +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
1994 +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
1995 +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
1996 +# Prefer a ksh shell builtin over an external printf program on Solaris,
1997 +# but without wasting forks for bash or zsh.
1998 +if test -z "$BASH_VERSION$ZSH_VERSION" \
1999 + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
2000 + as_echo='print -r --'
2001 + as_echo_n='print -rn --'
2002 +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
2003 + as_echo='printf %s\n'
2004 + as_echo_n='printf %s'
2005 +else
2006 + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
2007 + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
2008 + as_echo_n='/usr/ucb/echo -n'
2009 + else
2010 + as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
2011 + as_echo_n_body='eval
2012 + arg=$1;
2013 + case $arg in #(
2014 + *"$as_nl"*)
2015 + expr "X$arg" : "X\\(.*\\)$as_nl";
2016 + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
2017 + esac;
2018 + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
2020 + export as_echo_n_body
2021 + as_echo_n='sh -c $as_echo_n_body as_echo'
2022 + fi
2023 + export as_echo_body
2024 + as_echo='sh -c $as_echo_body as_echo'
2027 +# The user is always right.
2028 +if test "${PATH_SEPARATOR+set}" != set; then
2029 + PATH_SEPARATOR=:
2030 + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
2031 + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
2032 + PATH_SEPARATOR=';'
2037 +# IFS
2038 +# We need space, tab and new line, in precisely that order. Quoting is
2039 +# there to prevent editors from complaining about space-tab.
2040 +# (If _AS_PATH_WALK were called with IFS unset, it would disable word
2041 +# splitting by setting IFS to empty value.)
2042 +IFS=" "" $as_nl"
2044 +# Find who we are. Look in the path if we contain no directory separator.
2045 +as_myself=
2046 +case $0 in #((
2047 + *[\\/]* ) as_myself=$0 ;;
2048 + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2049 +for as_dir in $PATH
2051 + IFS=$as_save_IFS
2052 + test -z "$as_dir" && as_dir=.
2053 + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
2054 + done
2055 +IFS=$as_save_IFS
2057 + ;;
2058 +esac
2059 +# We did not find ourselves, most probably we were run as `sh COMMAND'
2060 +# in which case we are not to be found in the path.
2061 +if test "x$as_myself" = x; then
2062 + as_myself=$0
2064 +if test ! -f "$as_myself"; then
2065 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
2066 + exit 1
2069 +# Unset variables that we do not need and which cause bugs (e.g. in
2070 +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
2071 +# suppresses any "Segmentation fault" message there. '((' could
2072 +# trigger a bug in pdksh 5.2.14.
2073 +for as_var in BASH_ENV ENV MAIL MAILPATH
2074 +do eval test x\${$as_var+set} = xset \
2075 + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
2076 +done
2077 +PS1='$ '
2078 +PS2='> '
2079 +PS4='+ '
2081 +# NLS nuisances.
2082 +LC_ALL=C
2083 +export LC_ALL
2084 +LANGUAGE=C
2085 +export LANGUAGE
2087 +# CDPATH.
2088 +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2090 +if test "x$CONFIG_SHELL" = x; then
2091 + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
2092 + emulate sh
2093 + NULLCMD=:
2094 + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
2095 + # is contrary to our usage. Disable this feature.
2096 + alias -g '\${1+\"\$@\"}'='\"\$@\"'
2097 + setopt NO_GLOB_SUBST
2098 +else
2099 + case \`(set -o) 2>/dev/null\` in #(
2100 + *posix*) :
2101 + set -o posix ;; #(
2102 + *) :
2103 + ;;
2104 +esac
2107 + as_required="as_fn_return () { (exit \$1); }
2108 +as_fn_success () { as_fn_return 0; }
2109 +as_fn_failure () { as_fn_return 1; }
2110 +as_fn_ret_success () { return 0; }
2111 +as_fn_ret_failure () { return 1; }
2113 +exitcode=0
2114 +as_fn_success || { exitcode=1; echo as_fn_success failed.; }
2115 +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
2116 +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
2117 +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
2118 +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
2120 +else
2121 + exitcode=1; echo positional parameters were not saved.
2123 +test x\$exitcode = x0 || exit 1"
2124 + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
2125 + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
2126 + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
2127 + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
2128 + if (eval "$as_required") 2>/dev/null; then :
2129 + as_have_required=yes
2130 +else
2131 + as_have_required=no
2133 + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
2135 +else
2136 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2137 +as_found=false
2138 +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
2140 + IFS=$as_save_IFS
2141 + test -z "$as_dir" && as_dir=.
2142 + as_found=:
2143 + case $as_dir in #(
2144 + /*)
2145 + for as_base in sh bash ksh sh5; do
2146 + # Try only shells that exist, to save several forks.
2147 + as_shell=$as_dir/$as_base
2148 + if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
2149 + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
2150 + CONFIG_SHELL=$as_shell as_have_required=yes
2151 + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
2152 + break 2
2155 + done;;
2156 + esac
2157 + as_found=false
2158 +done
2159 +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
2160 + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
2161 + CONFIG_SHELL=$SHELL as_have_required=yes
2162 +fi; }
2163 +IFS=$as_save_IFS
2166 + if test "x$CONFIG_SHELL" != x; then :
2167 + # We cannot yet assume a decent shell, so we have to provide a
2168 + # neutralization value for shells without unset; and this also
2169 + # works around shells that cannot unset nonexistent variables.
2170 + # Preserve -v and -x to the replacement shell.
2171 + BASH_ENV=/dev/null
2172 + ENV=/dev/null
2173 + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
2174 + export CONFIG_SHELL
2175 + case $- in # ((((
2176 + *v*x* | *x*v* ) as_opts=-vx ;;
2177 + *v* ) as_opts=-v ;;
2178 + *x* ) as_opts=-x ;;
2179 + * ) as_opts= ;;
2180 + esac
2181 + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
2184 + if test x$as_have_required = xno; then :
2185 + $as_echo "$0: This script requires a shell more modern than all"
2186 + $as_echo "$0: the shells that I found on your system."
2187 + if test x${ZSH_VERSION+set} = xset ; then
2188 + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
2189 + $as_echo "$0: be upgraded to zsh 4.3.4 or later."
2190 + else
2191 + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
2192 +$0: including any error possibly output before this
2193 +$0: message. Then install a modern shell, or manually run
2194 +$0: the script under such a shell if you do have one."
2195 + fi
2196 + exit 1
2200 +SHELL=${CONFIG_SHELL-/bin/sh}
2201 +export SHELL
2202 +# Unset more variables known to interfere with behavior of common tools.
2203 +CLICOLOR_FORCE= GREP_OPTIONS=
2204 +unset CLICOLOR_FORCE GREP_OPTIONS
2206 +## --------------------- ##
2207 +## M4sh Shell Functions. ##
2208 +## --------------------- ##
2209 +# as_fn_unset VAR
2210 +# ---------------
2211 +# Portably unset VAR.
2212 +as_fn_unset ()
2214 + { eval $1=; unset $1;}
2216 +as_unset=as_fn_unset
2218 +# as_fn_set_status STATUS
2219 +# -----------------------
2220 +# Set $? to STATUS, without forking.
2221 +as_fn_set_status ()
2223 + return $1
2224 +} # as_fn_set_status
2226 +# as_fn_exit STATUS
2227 +# -----------------
2228 +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
2229 +as_fn_exit ()
2231 + set +e
2232 + as_fn_set_status $1
2233 + exit $1
2234 +} # as_fn_exit
2236 +# as_fn_mkdir_p
2237 +# -------------
2238 +# Create "$as_dir" as a directory, including parents if necessary.
2239 +as_fn_mkdir_p ()
2242 + case $as_dir in #(
2243 + -*) as_dir=./$as_dir;;
2244 + esac
2245 + test -d "$as_dir" || eval $as_mkdir_p || {
2246 + as_dirs=
2247 + while :; do
2248 + case $as_dir in #(
2249 + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
2250 + *) as_qdir=$as_dir;;
2251 + esac
2252 + as_dirs="'$as_qdir' $as_dirs"
2253 + as_dir=`$as_dirname -- "$as_dir" ||
2254 +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
2255 + X"$as_dir" : 'X\(//\)[^/]' \| \
2256 + X"$as_dir" : 'X\(//\)$' \| \
2257 + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
2258 +$as_echo X"$as_dir" |
2259 + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
2260 + s//\1/
2263 + /^X\(\/\/\)[^/].*/{
2264 + s//\1/
2267 + /^X\(\/\/\)$/{
2268 + s//\1/
2271 + /^X\(\/\).*/{
2272 + s//\1/
2275 + s/.*/./; q'`
2276 + test -d "$as_dir" && break
2277 + done
2278 + test -z "$as_dirs" || eval "mkdir $as_dirs"
2279 + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
2282 +} # as_fn_mkdir_p
2283 +# as_fn_append VAR VALUE
2284 +# ----------------------
2285 +# Append the text in VALUE to the end of the definition contained in VAR. Take
2286 +# advantage of any shell optimizations that allow amortized linear growth over
2287 +# repeated appends, instead of the typical quadratic growth present in naive
2288 +# implementations.
2289 +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
2290 + eval 'as_fn_append ()
2292 + eval $1+=\$2
2293 + }'
2294 +else
2295 + as_fn_append ()
2297 + eval $1=\$$1\$2
2299 +fi # as_fn_append
2301 +# as_fn_arith ARG...
2302 +# ------------------
2303 +# Perform arithmetic evaluation on the ARGs, and store the result in the
2304 +# global $as_val. Take advantage of shells that can avoid forks. The arguments
2305 +# must be portable across $(()) and expr.
2306 +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
2307 + eval 'as_fn_arith ()
2309 + as_val=$(( $* ))
2310 + }'
2311 +else
2312 + as_fn_arith ()
2314 + as_val=`expr "$@" || test $? -eq 1`
2316 +fi # as_fn_arith
2319 +# as_fn_error STATUS ERROR [LINENO LOG_FD]
2320 +# ----------------------------------------
2321 +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
2322 +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
2323 +# script with STATUS, using 1 if that was 0.
2324 +as_fn_error ()
2326 + as_status=$1; test $as_status -eq 0 && as_status=1
2327 + if test "$4"; then
2328 + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
2329 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
2330 + fi
2331 + $as_echo "$as_me: error: $2" >&2
2332 + as_fn_exit $as_status
2333 +} # as_fn_error
2335 +if expr a : '\(a\)' >/dev/null 2>&1 &&
2336 + test "X`expr 00001 : '.*\(...\)'`" = X001; then
2337 + as_expr=expr
2338 +else
2339 + as_expr=false
2342 +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
2343 + as_basename=basename
2344 +else
2345 + as_basename=false
2348 +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
2349 + as_dirname=dirname
2350 +else
2351 + as_dirname=false
2354 +as_me=`$as_basename -- "$0" ||
2355 +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
2356 + X"$0" : 'X\(//\)$' \| \
2357 + X"$0" : 'X\(/\)' \| . 2>/dev/null ||
2358 +$as_echo X/"$0" |
2359 + sed '/^.*\/\([^/][^/]*\)\/*$/{
2360 + s//\1/
2363 + /^X\/\(\/\/\)$/{
2364 + s//\1/
2367 + /^X\/\(\/\).*/{
2368 + s//\1/
2371 + s/.*/./; q'`
2373 +# Avoid depending upon Character Ranges.
2374 +as_cr_letters='abcdefghijklmnopqrstuvwxyz'
2375 +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
2376 +as_cr_Letters=$as_cr_letters$as_cr_LETTERS
2377 +as_cr_digits='0123456789'
2378 +as_cr_alnum=$as_cr_Letters$as_cr_digits
2381 + as_lineno_1=$LINENO as_lineno_1a=$LINENO
2382 + as_lineno_2=$LINENO as_lineno_2a=$LINENO
2383 + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
2384 + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
2385 + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
2386 + sed -n '
2388 + /[$]LINENO/=
2389 + ' <$as_myself |
2390 + sed '
2391 + s/[$]LINENO.*/&-/
2392 + t lineno
2394 + :lineno
2396 + :loop
2397 + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
2398 + t loop
2399 + s/-\n.*//
2400 + ' >$as_me.lineno &&
2401 + chmod +x "$as_me.lineno" ||
2402 + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
2404 + # Don't try to exec as it changes $[0], causing all sort of problems
2405 + # (the dirname of $[0] is not the place where we might find the
2406 + # original and so on. Autoconf is especially sensitive to this).
2407 + . "./$as_me.lineno"
2408 + # Exit status is that of the last command.
2409 + exit
2412 +ECHO_C= ECHO_N= ECHO_T=
2413 +case `echo -n x` in #(((((
2414 +-n*)
2415 + case `echo 'xy\c'` in
2416 + *c*) ECHO_T=' ';; # ECHO_T is single tab character.
2417 + xy) ECHO_C='\c';;
2418 + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
2419 + ECHO_T=' ';;
2420 + esac;;
2422 + ECHO_N='-n';;
2423 +esac
2425 +rm -f conf$$ conf$$.exe conf$$.file
2426 +if test -d conf$$.dir; then
2427 + rm -f conf$$.dir/conf$$.file
2428 +else
2429 + rm -f conf$$.dir
2430 + mkdir conf$$.dir 2>/dev/null
2432 +if (echo >conf$$.file) 2>/dev/null; then
2433 + if ln -s conf$$.file conf$$ 2>/dev/null; then
2434 + as_ln_s='ln -s'
2435 + # ... but there are two gotchas:
2436 + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
2437 + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
2438 + # In both cases, we have to default to `cp -p'.
2439 + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
2440 + as_ln_s='cp -p'
2441 + elif ln conf$$.file conf$$ 2>/dev/null; then
2442 + as_ln_s=ln
2443 + else
2444 + as_ln_s='cp -p'
2445 + fi
2446 +else
2447 + as_ln_s='cp -p'
2449 +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
2450 +rmdir conf$$.dir 2>/dev/null
2452 +if mkdir -p . 2>/dev/null; then
2453 + as_mkdir_p='mkdir -p "$as_dir"'
2454 +else
2455 + test -d ./-p && rmdir ./-p
2456 + as_mkdir_p=false
2459 +if test -x / >/dev/null 2>&1; then
2460 + as_test_x='test -x'
2461 +else
2462 + if ls -dL / >/dev/null 2>&1; then
2463 + as_ls_L_option=L
2464 + else
2465 + as_ls_L_option=
2466 + fi
2467 + as_test_x='
2468 + eval sh -c '\''
2469 + if test -d "$1"; then
2470 + test -d "$1/.";
2471 + else
2472 + case $1 in #(
2473 + -*)set "./$1";;
2474 + esac;
2475 + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
2476 + ???[sx]*):;;*)false;;esac;fi
2477 + '\'' sh
2480 +as_executable_p=$as_test_x
2482 +# Sed expression to map a string onto a valid CPP name.
2483 +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
2485 +# Sed expression to map a string onto a valid variable name.
2486 +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
2489 +test -n "$DJDIR" || exec 7<&0 </dev/null
2490 +exec 6>&1
2492 +# Name of the host.
2493 +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
2494 +# so uname gets run too.
2495 +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
2498 +# Initializations.
2500 +ac_default_prefix=/usr/local
2501 +ac_clean_files=
2502 +ac_config_libobj_dir=.
2503 +LIBOBJS=
2504 +cross_compiling=no
2505 +subdirs=
2506 +MFLAGS=
2507 +MAKEFLAGS=
2509 +# Identity of this package.
2510 +PACKAGE_NAME='newlib'
2511 +PACKAGE_TARNAME='newlib'
2512 +PACKAGE_VERSION='1.20.0'
2513 +PACKAGE_STRING='newlib 1.20.0'
2514 +PACKAGE_BUGREPORT=''
2515 +PACKAGE_URL=''
2517 +ac_unique_file="libcglue.c"
2518 +ac_subst_vars='LTLIBOBJS
2519 +LIBOBJS
2520 +sys_dir
2521 +machine_dir
2522 +libm_machine_dir
2523 +lpfx
2524 +aext
2525 +oext
2526 +OBJEXT
2527 +USE_LIBTOOL_FALSE
2528 +USE_LIBTOOL_TRUE
2529 +ELIX_LEVEL_4_FALSE
2530 +ELIX_LEVEL_4_TRUE
2531 +ELIX_LEVEL_3_FALSE
2532 +ELIX_LEVEL_3_TRUE
2533 +ELIX_LEVEL_2_FALSE
2534 +ELIX_LEVEL_2_TRUE
2535 +ELIX_LEVEL_1_FALSE
2536 +ELIX_LEVEL_1_TRUE
2537 +ELIX_LEVEL_0_FALSE
2538 +ELIX_LEVEL_0_TRUE
2539 +LDFLAGS
2540 +NO_INCLUDE_LIST
2541 +NEWLIB_CFLAGS
2542 +CCASFLAGS
2543 +CCAS
2544 +MAINT
2545 +MAINTAINER_MODE_FALSE
2546 +MAINTAINER_MODE_TRUE
2547 +READELF
2548 +RANLIB
2551 +am__fastdepCC_FALSE
2552 +am__fastdepCC_TRUE
2553 +CCDEPMODE
2554 +AMDEPBACKSLASH
2555 +AMDEP_FALSE
2556 +AMDEP_TRUE
2557 +am__quote
2558 +am__include
2559 +DEPDIR
2561 +am__untar
2562 +am__tar
2563 +AMTAR
2564 +am__leading_dot
2565 +SET_MAKE
2566 +AWK
2567 +mkdir_p
2568 +MKDIR_P
2569 +INSTALL_STRIP_PROGRAM
2570 +STRIP
2571 +install_sh
2572 +MAKEINFO
2573 +AUTOHEADER
2574 +AUTOMAKE
2575 +AUTOCONF
2576 +ACLOCAL
2577 +VERSION
2578 +PACKAGE
2579 +CYGPATH_W
2580 +am__isrc
2581 +INSTALL_DATA
2582 +INSTALL_SCRIPT
2583 +INSTALL_PROGRAM
2584 +host_os
2585 +host_vendor
2586 +host_cpu
2587 +host
2588 +build_os
2589 +build_vendor
2590 +build_cpu
2591 +build
2592 +newlib_basedir
2593 +MAY_SUPPLY_SYSCALLS_FALSE
2594 +MAY_SUPPLY_SYSCALLS_TRUE
2595 +target_alias
2596 +host_alias
2597 +build_alias
2598 +LIBS
2599 +ECHO_T
2600 +ECHO_N
2601 +ECHO_C
2602 +DEFS
2603 +mandir
2604 +localedir
2605 +libdir
2606 +psdir
2607 +pdfdir
2608 +dvidir
2609 +htmldir
2610 +infodir
2611 +docdir
2612 +oldincludedir
2613 +includedir
2614 +localstatedir
2615 +sharedstatedir
2616 +sysconfdir
2617 +datadir
2618 +datarootdir
2619 +libexecdir
2620 +sbindir
2621 +bindir
2622 +program_transform_name
2623 +prefix
2624 +exec_prefix
2625 +PACKAGE_URL
2626 +PACKAGE_BUGREPORT
2627 +PACKAGE_STRING
2628 +PACKAGE_VERSION
2629 +PACKAGE_TARNAME
2630 +PACKAGE_NAME
2631 +PATH_SEPARATOR
2632 +SHELL'
2633 +ac_subst_files=''
2634 +ac_user_opts='
2635 +enable_option_checking
2636 +enable_multilib
2637 +enable_target_optspace
2638 +enable_malloc_debugging
2639 +enable_newlib_multithread
2640 +enable_newlib_iconv
2641 +enable_newlib_elix_level
2642 +enable_newlib_io_float
2643 +enable_newlib_supplied_syscalls
2644 +enable_dependency_tracking
2645 +enable_maintainer_mode
2647 + ac_precious_vars='build_alias
2648 +host_alias
2649 +target_alias
2650 +CCAS
2651 +CCASFLAGS'
2654 +# Initialize some variables set by options.
2655 +ac_init_help=
2656 +ac_init_version=false
2657 +ac_unrecognized_opts=
2658 +ac_unrecognized_sep=
2659 +# The variables have the same names as the options, with
2660 +# dashes changed to underlines.
2661 +cache_file=/dev/null
2662 +exec_prefix=NONE
2663 +no_create=
2664 +no_recursion=
2665 +prefix=NONE
2666 +program_prefix=NONE
2667 +program_suffix=NONE
2668 +program_transform_name=s,x,x,
2669 +silent=
2670 +site=
2671 +srcdir=
2672 +verbose=
2673 +x_includes=NONE
2674 +x_libraries=NONE
2676 +# Installation directory options.
2677 +# These are left unexpanded so users can "make install exec_prefix=/foo"
2678 +# and all the variables that are supposed to be based on exec_prefix
2679 +# by default will actually change.
2680 +# Use braces instead of parens because sh, perl, etc. also accept them.
2681 +# (The list follows the same order as the GNU Coding Standards.)
2682 +bindir='${exec_prefix}/bin'
2683 +sbindir='${exec_prefix}/sbin'
2684 +libexecdir='${exec_prefix}/libexec'
2685 +datarootdir='${prefix}/share'
2686 +datadir='${datarootdir}'
2687 +sysconfdir='${prefix}/etc'
2688 +sharedstatedir='${prefix}/com'
2689 +localstatedir='${prefix}/var'
2690 +includedir='${prefix}/include'
2691 +oldincludedir='/usr/include'
2692 +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
2693 +infodir='${datarootdir}/info'
2694 +htmldir='${docdir}'
2695 +dvidir='${docdir}'
2696 +pdfdir='${docdir}'
2697 +psdir='${docdir}'
2698 +libdir='${exec_prefix}/lib'
2699 +localedir='${datarootdir}/locale'
2700 +mandir='${datarootdir}/man'
2702 +ac_prev=
2703 +ac_dashdash=
2704 +for ac_option
2706 + # If the previous option needs an argument, assign it.
2707 + if test -n "$ac_prev"; then
2708 + eval $ac_prev=\$ac_option
2709 + ac_prev=
2710 + continue
2711 + fi
2713 + case $ac_option in
2714 + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
2715 + *=) ac_optarg= ;;
2716 + *) ac_optarg=yes ;;
2717 + esac
2719 + # Accept the important Cygnus configure options, so we can diagnose typos.
2721 + case $ac_dashdash$ac_option in
2722 + --)
2723 + ac_dashdash=yes ;;
2725 + -bindir | --bindir | --bindi | --bind | --bin | --bi)
2726 + ac_prev=bindir ;;
2727 + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
2728 + bindir=$ac_optarg ;;
2730 + -build | --build | --buil | --bui | --bu)
2731 + ac_prev=build_alias ;;
2732 + -build=* | --build=* | --buil=* | --bui=* | --bu=*)
2733 + build_alias=$ac_optarg ;;
2735 + -cache-file | --cache-file | --cache-fil | --cache-fi \
2736 + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
2737 + ac_prev=cache_file ;;
2738 + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
2739 + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
2740 + cache_file=$ac_optarg ;;
2742 + --config-cache | -C)
2743 + cache_file=config.cache ;;
2745 + -datadir | --datadir | --datadi | --datad)
2746 + ac_prev=datadir ;;
2747 + -datadir=* | --datadir=* | --datadi=* | --datad=*)
2748 + datadir=$ac_optarg ;;
2750 + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
2751 + | --dataroo | --dataro | --datar)
2752 + ac_prev=datarootdir ;;
2753 + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
2754 + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
2755 + datarootdir=$ac_optarg ;;
2757 + -disable-* | --disable-*)
2758 + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
2759 + # Reject names that are not valid shell variable names.
2760 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
2761 + as_fn_error $? "invalid feature name: $ac_useropt"
2762 + ac_useropt_orig=$ac_useropt
2763 + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
2764 + case $ac_user_opts in
2765 + *"
2766 +"enable_$ac_useropt"
2767 +"*) ;;
2768 + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
2769 + ac_unrecognized_sep=', ';;
2770 + esac
2771 + eval enable_$ac_useropt=no ;;
2773 + -docdir | --docdir | --docdi | --doc | --do)
2774 + ac_prev=docdir ;;
2775 + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
2776 + docdir=$ac_optarg ;;
2778 + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
2779 + ac_prev=dvidir ;;
2780 + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
2781 + dvidir=$ac_optarg ;;
2783 + -enable-* | --enable-*)
2784 + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
2785 + # Reject names that are not valid shell variable names.
2786 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
2787 + as_fn_error $? "invalid feature name: $ac_useropt"
2788 + ac_useropt_orig=$ac_useropt
2789 + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
2790 + case $ac_user_opts in
2791 + *"
2792 +"enable_$ac_useropt"
2793 +"*) ;;
2794 + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
2795 + ac_unrecognized_sep=', ';;
2796 + esac
2797 + eval enable_$ac_useropt=\$ac_optarg ;;
2799 + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
2800 + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
2801 + | --exec | --exe | --ex)
2802 + ac_prev=exec_prefix ;;
2803 + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
2804 + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
2805 + | --exec=* | --exe=* | --ex=*)
2806 + exec_prefix=$ac_optarg ;;
2808 + -gas | --gas | --ga | --g)
2809 + # Obsolete; use --with-gas.
2810 + with_gas=yes ;;
2812 + -help | --help | --hel | --he | -h)
2813 + ac_init_help=long ;;
2814 + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
2815 + ac_init_help=recursive ;;
2816 + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
2817 + ac_init_help=short ;;
2819 + -host | --host | --hos | --ho)
2820 + ac_prev=host_alias ;;
2821 + -host=* | --host=* | --hos=* | --ho=*)
2822 + host_alias=$ac_optarg ;;
2824 + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
2825 + ac_prev=htmldir ;;
2826 + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
2827 + | --ht=*)
2828 + htmldir=$ac_optarg ;;
2830 + -includedir | --includedir | --includedi | --included | --include \
2831 + | --includ | --inclu | --incl | --inc)
2832 + ac_prev=includedir ;;
2833 + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
2834 + | --includ=* | --inclu=* | --incl=* | --inc=*)
2835 + includedir=$ac_optarg ;;
2837 + -infodir | --infodir | --infodi | --infod | --info | --inf)
2838 + ac_prev=infodir ;;
2839 + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
2840 + infodir=$ac_optarg ;;
2842 + -libdir | --libdir | --libdi | --libd)
2843 + ac_prev=libdir ;;
2844 + -libdir=* | --libdir=* | --libdi=* | --libd=*)
2845 + libdir=$ac_optarg ;;
2847 + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
2848 + | --libexe | --libex | --libe)
2849 + ac_prev=libexecdir ;;
2850 + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
2851 + | --libexe=* | --libex=* | --libe=*)
2852 + libexecdir=$ac_optarg ;;
2854 + -localedir | --localedir | --localedi | --localed | --locale)
2855 + ac_prev=localedir ;;
2856 + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
2857 + localedir=$ac_optarg ;;
2859 + -localstatedir | --localstatedir | --localstatedi | --localstated \
2860 + | --localstate | --localstat | --localsta | --localst | --locals)
2861 + ac_prev=localstatedir ;;
2862 + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
2863 + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
2864 + localstatedir=$ac_optarg ;;
2866 + -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
2867 + ac_prev=mandir ;;
2868 + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
2869 + mandir=$ac_optarg ;;
2871 + -nfp | --nfp | --nf)
2872 + # Obsolete; use --without-fp.
2873 + with_fp=no ;;
2875 + -no-create | --no-create | --no-creat | --no-crea | --no-cre \
2876 + | --no-cr | --no-c | -n)
2877 + no_create=yes ;;
2879 + -no-recursion | --no-recursion | --no-recursio | --no-recursi \
2880 + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
2881 + no_recursion=yes ;;
2883 + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
2884 + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
2885 + | --oldin | --oldi | --old | --ol | --o)
2886 + ac_prev=oldincludedir ;;
2887 + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
2888 + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
2889 + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
2890 + oldincludedir=$ac_optarg ;;
2892 + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
2893 + ac_prev=prefix ;;
2894 + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
2895 + prefix=$ac_optarg ;;
2897 + -program-prefix | --program-prefix | --program-prefi | --program-pref \
2898 + | --program-pre | --program-pr | --program-p)
2899 + ac_prev=program_prefix ;;
2900 + -program-prefix=* | --program-prefix=* | --program-prefi=* \
2901 + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
2902 + program_prefix=$ac_optarg ;;
2904 + -program-suffix | --program-suffix | --program-suffi | --program-suff \
2905 + | --program-suf | --program-su | --program-s)
2906 + ac_prev=program_suffix ;;
2907 + -program-suffix=* | --program-suffix=* | --program-suffi=* \
2908 + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
2909 + program_suffix=$ac_optarg ;;
2911 + -program-transform-name | --program-transform-name \
2912 + | --program-transform-nam | --program-transform-na \
2913 + | --program-transform-n | --program-transform- \
2914 + | --program-transform | --program-transfor \
2915 + | --program-transfo | --program-transf \
2916 + | --program-trans | --program-tran \
2917 + | --progr-tra | --program-tr | --program-t)
2918 + ac_prev=program_transform_name ;;
2919 + -program-transform-name=* | --program-transform-name=* \
2920 + | --program-transform-nam=* | --program-transform-na=* \
2921 + | --program-transform-n=* | --program-transform-=* \
2922 + | --program-transform=* | --program-transfor=* \
2923 + | --program-transfo=* | --program-transf=* \
2924 + | --program-trans=* | --program-tran=* \
2925 + | --progr-tra=* | --program-tr=* | --program-t=*)
2926 + program_transform_name=$ac_optarg ;;
2928 + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
2929 + ac_prev=pdfdir ;;
2930 + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
2931 + pdfdir=$ac_optarg ;;
2933 + -psdir | --psdir | --psdi | --psd | --ps)
2934 + ac_prev=psdir ;;
2935 + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
2936 + psdir=$ac_optarg ;;
2938 + -q | -quiet | --quiet | --quie | --qui | --qu | --q \
2939 + | -silent | --silent | --silen | --sile | --sil)
2940 + silent=yes ;;
2942 + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
2943 + ac_prev=sbindir ;;
2944 + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
2945 + | --sbi=* | --sb=*)
2946 + sbindir=$ac_optarg ;;
2948 + -sharedstatedir | --sharedstatedir | --sharedstatedi \
2949 + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
2950 + | --sharedst | --shareds | --shared | --share | --shar \
2951 + | --sha | --sh)
2952 + ac_prev=sharedstatedir ;;
2953 + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
2954 + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
2955 + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
2956 + | --sha=* | --sh=*)
2957 + sharedstatedir=$ac_optarg ;;
2959 + -site | --site | --sit)
2960 + ac_prev=site ;;
2961 + -site=* | --site=* | --sit=*)
2962 + site=$ac_optarg ;;
2964 + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
2965 + ac_prev=srcdir ;;
2966 + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
2967 + srcdir=$ac_optarg ;;
2969 + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
2970 + | --syscon | --sysco | --sysc | --sys | --sy)
2971 + ac_prev=sysconfdir ;;
2972 + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
2973 + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
2974 + sysconfdir=$ac_optarg ;;
2976 + -target | --target | --targe | --targ | --tar | --ta | --t)
2977 + ac_prev=target_alias ;;
2978 + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
2979 + target_alias=$ac_optarg ;;
2981 + -v | -verbose | --verbose | --verbos | --verbo | --verb)
2982 + verbose=yes ;;
2984 + -version | --version | --versio | --versi | --vers | -V)
2985 + ac_init_version=: ;;
2987 + -with-* | --with-*)
2988 + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
2989 + # Reject names that are not valid shell variable names.
2990 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
2991 + as_fn_error $? "invalid package name: $ac_useropt"
2992 + ac_useropt_orig=$ac_useropt
2993 + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
2994 + case $ac_user_opts in
2995 + *"
2996 +"with_$ac_useropt"
2997 +"*) ;;
2998 + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
2999 + ac_unrecognized_sep=', ';;
3000 + esac
3001 + eval with_$ac_useropt=\$ac_optarg ;;
3003 + -without-* | --without-*)
3004 + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
3005 + # Reject names that are not valid shell variable names.
3006 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
3007 + as_fn_error $? "invalid package name: $ac_useropt"
3008 + ac_useropt_orig=$ac_useropt
3009 + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
3010 + case $ac_user_opts in
3011 + *"
3012 +"with_$ac_useropt"
3013 +"*) ;;
3014 + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
3015 + ac_unrecognized_sep=', ';;
3016 + esac
3017 + eval with_$ac_useropt=no ;;
3019 + --x)
3020 + # Obsolete; use --with-x.
3021 + with_x=yes ;;
3023 + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
3024 + | --x-incl | --x-inc | --x-in | --x-i)
3025 + ac_prev=x_includes ;;
3026 + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
3027 + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
3028 + x_includes=$ac_optarg ;;
3030 + -x-libraries | --x-libraries | --x-librarie | --x-librari \
3031 + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
3032 + ac_prev=x_libraries ;;
3033 + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
3034 + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
3035 + x_libraries=$ac_optarg ;;
3037 + -*) as_fn_error $? "unrecognized option: \`$ac_option'
3038 +Try \`$0 --help' for more information"
3039 + ;;
3041 + *=*)
3042 + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
3043 + # Reject names that are not valid shell variable names.
3044 + case $ac_envvar in #(
3045 + '' | [0-9]* | *[!_$as_cr_alnum]* )
3046 + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
3047 + esac
3048 + eval $ac_envvar=\$ac_optarg
3049 + export $ac_envvar ;;
3051 + *)
3052 + # FIXME: should be removed in autoconf 3.0.
3053 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
3054 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
3055 + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
3056 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
3057 + ;;
3059 + esac
3060 +done
3062 +if test -n "$ac_prev"; then
3063 + ac_option=--`echo $ac_prev | sed 's/_/-/g'`
3064 + as_fn_error $? "missing argument to $ac_option"
3067 +if test -n "$ac_unrecognized_opts"; then
3068 + case $enable_option_checking in
3069 + no) ;;
3070 + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
3071 + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
3072 + esac
3075 +# Check all directory arguments for consistency.
3076 +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
3077 + datadir sysconfdir sharedstatedir localstatedir includedir \
3078 + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
3079 + libdir localedir mandir
3081 + eval ac_val=\$$ac_var
3082 + # Remove trailing slashes.
3083 + case $ac_val in
3084 + */ )
3085 + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
3086 + eval $ac_var=\$ac_val;;
3087 + esac
3088 + # Be sure to have absolute directory names.
3089 + case $ac_val in
3090 + [\\/$]* | ?:[\\/]* ) continue;;
3091 + NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
3092 + esac
3093 + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
3094 +done
3096 +# There might be people who depend on the old broken behavior: `$host'
3097 +# used to hold the argument of --host etc.
3098 +# FIXME: To remove some day.
3099 +build=$build_alias
3100 +host=$host_alias
3101 +target=$target_alias
3103 +# FIXME: To remove some day.
3104 +if test "x$host_alias" != x; then
3105 + if test "x$build_alias" = x; then
3106 + cross_compiling=maybe
3107 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
3108 + If a cross compiler is detected then cross compile mode will be used" >&2
3109 + elif test "x$build_alias" != "x$host_alias"; then
3110 + cross_compiling=yes
3111 + fi
3114 +ac_tool_prefix=
3115 +test -n "$host_alias" && ac_tool_prefix=$host_alias-
3117 +test "$silent" = yes && exec 6>/dev/null
3120 +ac_pwd=`pwd` && test -n "$ac_pwd" &&
3121 +ac_ls_di=`ls -di .` &&
3122 +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
3123 + as_fn_error $? "working directory cannot be determined"
3124 +test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
3125 + as_fn_error $? "pwd does not report name of working directory"
3128 +# Find the source files, if location was not specified.
3129 +if test -z "$srcdir"; then
3130 + ac_srcdir_defaulted=yes
3131 + # Try the directory containing this script, then the parent directory.
3132 + ac_confdir=`$as_dirname -- "$as_myself" ||
3133 +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
3134 + X"$as_myself" : 'X\(//\)[^/]' \| \
3135 + X"$as_myself" : 'X\(//\)$' \| \
3136 + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
3137 +$as_echo X"$as_myself" |
3138 + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
3139 + s//\1/
3142 + /^X\(\/\/\)[^/].*/{
3143 + s//\1/
3146 + /^X\(\/\/\)$/{
3147 + s//\1/
3150 + /^X\(\/\).*/{
3151 + s//\1/
3154 + s/.*/./; q'`
3155 + srcdir=$ac_confdir
3156 + if test ! -r "$srcdir/$ac_unique_file"; then
3157 + srcdir=..
3158 + fi
3159 +else
3160 + ac_srcdir_defaulted=no
3162 +if test ! -r "$srcdir/$ac_unique_file"; then
3163 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
3164 + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
3166 +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
3167 +ac_abs_confdir=`(
3168 + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
3169 + pwd)`
3170 +# When building in place, set srcdir=.
3171 +if test "$ac_abs_confdir" = "$ac_pwd"; then
3172 + srcdir=.
3174 +# Remove unnecessary trailing slashes from srcdir.
3175 +# Double slashes in file names in object file debugging info
3176 +# mess up M-x gdb in Emacs.
3177 +case $srcdir in
3178 +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
3179 +esac
3180 +for ac_var in $ac_precious_vars; do
3181 + eval ac_env_${ac_var}_set=\${${ac_var}+set}
3182 + eval ac_env_${ac_var}_value=\$${ac_var}
3183 + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
3184 + eval ac_cv_env_${ac_var}_value=\$${ac_var}
3185 +done
3188 +# Report the --help message.
3190 +if test "$ac_init_help" = "long"; then
3191 + # Omit some internal or obsolete options to make the list less imposing.
3192 + # This message is too long to be a string in the A/UX 3.1 sh.
3193 + cat <<_ACEOF
3194 +\`configure' configures newlib 1.20.0 to adapt to many kinds of systems.
3196 +Usage: $0 [OPTION]... [VAR=VALUE]...
3198 +To assign environment variables (e.g., CC, CFLAGS...), specify them as
3199 +VAR=VALUE. See below for descriptions of some of the useful variables.
3201 +Defaults for the options are specified in brackets.
3203 +Configuration:
3204 + -h, --help display this help and exit
3205 + --help=short display options specific to this package
3206 + --help=recursive display the short help of all the included packages
3207 + -V, --version display version information and exit
3208 + -q, --quiet, --silent do not print \`checking ...' messages
3209 + --cache-file=FILE cache test results in FILE [disabled]
3210 + -C, --config-cache alias for \`--cache-file=config.cache'
3211 + -n, --no-create do not create output files
3212 + --srcdir=DIR find the sources in DIR [configure dir or \`..']
3214 +Installation directories:
3215 + --prefix=PREFIX install architecture-independent files in PREFIX
3216 + [$ac_default_prefix]
3217 + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
3218 + [PREFIX]
3220 +By default, \`make install' will install all the files in
3221 +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
3222 +an installation prefix other than \`$ac_default_prefix' using \`--prefix',
3223 +for instance \`--prefix=\$HOME'.
3225 +For better control, use the options below.
3227 +Fine tuning of the installation directories:
3228 + --bindir=DIR user executables [EPREFIX/bin]
3229 + --sbindir=DIR system admin executables [EPREFIX/sbin]
3230 + --libexecdir=DIR program executables [EPREFIX/libexec]
3231 + --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
3232 + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
3233 + --localstatedir=DIR modifiable single-machine data [PREFIX/var]
3234 + --libdir=DIR object code libraries [EPREFIX/lib]
3235 + --includedir=DIR C header files [PREFIX/include]
3236 + --oldincludedir=DIR C header files for non-gcc [/usr/include]
3237 + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
3238 + --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
3239 + --infodir=DIR info documentation [DATAROOTDIR/info]
3240 + --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
3241 + --mandir=DIR man documentation [DATAROOTDIR/man]
3242 + --docdir=DIR documentation root [DATAROOTDIR/doc/newlib]
3243 + --htmldir=DIR html documentation [DOCDIR]
3244 + --dvidir=DIR dvi documentation [DOCDIR]
3245 + --pdfdir=DIR pdf documentation [DOCDIR]
3246 + --psdir=DIR ps documentation [DOCDIR]
3247 +_ACEOF
3249 + cat <<\_ACEOF
3251 +Program names:
3252 + --program-prefix=PREFIX prepend PREFIX to installed program names
3253 + --program-suffix=SUFFIX append SUFFIX to installed program names
3254 + --program-transform-name=PROGRAM run sed PROGRAM on installed program names
3256 +System types:
3257 + --build=BUILD configure for building on BUILD [guessed]
3258 + --host=HOST cross-compile to build programs to run on HOST [BUILD]
3259 +_ACEOF
3262 +if test -n "$ac_init_help"; then
3263 + case $ac_init_help in
3264 + short | recursive ) echo "Configuration of newlib 1.20.0:";;
3265 + esac
3266 + cat <<\_ACEOF
3268 +Optional Features:
3269 + --disable-option-checking ignore unrecognized --enable/--with options
3270 + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
3271 + --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
3272 + --enable-multilib build many library versions (default)
3273 + --enable-target-optspace optimize for space
3274 + --enable-malloc-debugging indicate malloc debugging requested
3275 + --enable-newlib-multithread enable support for multiple threads
3276 + --enable-newlib-iconv enable iconv library support
3277 + --enable-newlib-elix-level supply desired elix library level (1-4)
3278 + --disable-newlib-io-float disable printf/scanf family float support
3279 + --disable-newlib-supplied-syscalls disable newlib from supplying syscalls
3280 + --disable-dependency-tracking speeds up one-time build
3281 + --enable-dependency-tracking do not reject slow dependency extractors
3282 + --enable-maintainer-mode enable make rules and dependencies not useful
3283 + (and sometimes confusing) to the casual installer
3285 +Some influential environment variables:
3286 + CCAS assembler compiler command (defaults to CC)
3287 + CCASFLAGS assembler compiler flags (defaults to CFLAGS)
3289 +Use these variables to override the choices made by `configure' or to help
3290 +it to find libraries and programs with nonstandard names/locations.
3292 +Report bugs to the package provider.
3293 +_ACEOF
3294 +ac_status=$?
3297 +if test "$ac_init_help" = "recursive"; then
3298 + # If there are subdirs, report their specific --help.
3299 + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
3300 + test -d "$ac_dir" ||
3301 + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
3302 + continue
3303 + ac_builddir=.
3305 +case "$ac_dir" in
3306 +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
3308 + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
3309 + # A ".." for each directory in $ac_dir_suffix.
3310 + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
3311 + case $ac_top_builddir_sub in
3312 + "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
3313 + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
3314 + esac ;;
3315 +esac
3316 +ac_abs_top_builddir=$ac_pwd
3317 +ac_abs_builddir=$ac_pwd$ac_dir_suffix
3318 +# for backward compatibility:
3319 +ac_top_builddir=$ac_top_build_prefix
3321 +case $srcdir in
3322 + .) # We are building in place.
3323 + ac_srcdir=.
3324 + ac_top_srcdir=$ac_top_builddir_sub
3325 + ac_abs_top_srcdir=$ac_pwd ;;
3326 + [\\/]* | ?:[\\/]* ) # Absolute name.
3327 + ac_srcdir=$srcdir$ac_dir_suffix;
3328 + ac_top_srcdir=$srcdir
3329 + ac_abs_top_srcdir=$srcdir ;;
3330 + *) # Relative name.
3331 + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
3332 + ac_top_srcdir=$ac_top_build_prefix$srcdir
3333 + ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
3334 +esac
3335 +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
3337 + cd "$ac_dir" || { ac_status=$?; continue; }
3338 + # Check for guested configure.
3339 + if test -f "$ac_srcdir/configure.gnu"; then
3340 + echo &&
3341 + $SHELL "$ac_srcdir/configure.gnu" --help=recursive
3342 + elif test -f "$ac_srcdir/configure"; then
3343 + echo &&
3344 + $SHELL "$ac_srcdir/configure" --help=recursive
3345 + else
3346 + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
3347 + fi || ac_status=$?
3348 + cd "$ac_pwd" || { ac_status=$?; break; }
3349 + done
3352 +test -n "$ac_init_help" && exit $ac_status
3353 +if $ac_init_version; then
3354 + cat <<\_ACEOF
3355 +newlib configure 1.20.0
3356 +generated by GNU Autoconf 2.68
3358 +Copyright (C) 2010 Free Software Foundation, Inc.
3359 +This configure script is free software; the Free Software Foundation
3360 +gives unlimited permission to copy, distribute and modify it.
3361 +_ACEOF
3362 + exit
3365 +## ------------------------ ##
3366 +## Autoconf initialization. ##
3367 +## ------------------------ ##
3369 +# ac_fn_c_try_compile LINENO
3370 +# --------------------------
3371 +# Try to compile conftest.$ac_ext, and return whether this succeeded.
3372 +ac_fn_c_try_compile ()
3374 + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
3375 + rm -f conftest.$ac_objext
3376 + if { { ac_try="$ac_compile"
3377 +case "(($ac_try" in
3378 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3379 + *) ac_try_echo=$ac_try;;
3380 +esac
3381 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3382 +$as_echo "$ac_try_echo"; } >&5
3383 + (eval "$ac_compile") 2>conftest.err
3384 + ac_status=$?
3385 + if test -s conftest.err; then
3386 + grep -v '^ *+' conftest.err >conftest.er1
3387 + cat conftest.er1 >&5
3388 + mv -f conftest.er1 conftest.err
3389 + fi
3390 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3391 + test $ac_status = 0; } && {
3392 + test -z "$ac_c_werror_flag" ||
3393 + test ! -s conftest.err
3394 + } && test -s conftest.$ac_objext; then :
3395 + ac_retval=0
3396 +else
3397 + $as_echo "$as_me: failed program was:" >&5
3398 +sed 's/^/| /' conftest.$ac_ext >&5
3400 + ac_retval=1
3402 + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
3403 + as_fn_set_status $ac_retval
3405 +} # ac_fn_c_try_compile
3406 +cat >config.log <<_ACEOF
3407 +This file contains any messages produced by compilers while
3408 +running configure, to aid debugging if configure makes a mistake.
3410 +It was created by newlib $as_me 1.20.0, which was
3411 +generated by GNU Autoconf 2.68. Invocation command line was
3413 + $ $0 $@
3415 +_ACEOF
3416 +exec 5>>config.log
3418 +cat <<_ASUNAME
3419 +## --------- ##
3420 +## Platform. ##
3421 +## --------- ##
3423 +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
3424 +uname -m = `(uname -m) 2>/dev/null || echo unknown`
3425 +uname -r = `(uname -r) 2>/dev/null || echo unknown`
3426 +uname -s = `(uname -s) 2>/dev/null || echo unknown`
3427 +uname -v = `(uname -v) 2>/dev/null || echo unknown`
3429 +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
3430 +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
3432 +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
3433 +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
3434 +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
3435 +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
3436 +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
3437 +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
3438 +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
3440 +_ASUNAME
3442 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3443 +for as_dir in $PATH
3445 + IFS=$as_save_IFS
3446 + test -z "$as_dir" && as_dir=.
3447 + $as_echo "PATH: $as_dir"
3448 + done
3449 +IFS=$as_save_IFS
3451 +} >&5
3453 +cat >&5 <<_ACEOF
3456 +## ----------- ##
3457 +## Core tests. ##
3458 +## ----------- ##
3460 +_ACEOF
3463 +# Keep a trace of the command line.
3464 +# Strip out --no-create and --no-recursion so they do not pile up.
3465 +# Strip out --silent because we don't want to record it for future runs.
3466 +# Also quote any args containing shell meta-characters.
3467 +# Make two passes to allow for proper duplicate-argument suppression.
3468 +ac_configure_args=
3469 +ac_configure_args0=
3470 +ac_configure_args1=
3471 +ac_must_keep_next=false
3472 +for ac_pass in 1 2
3474 + for ac_arg
3475 + do
3476 + case $ac_arg in
3477 + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
3478 + -q | -quiet | --quiet | --quie | --qui | --qu | --q \
3479 + | -silent | --silent | --silen | --sile | --sil)
3480 + continue ;;
3481 + *\'*)
3482 + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
3483 + esac
3484 + case $ac_pass in
3485 + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
3486 + 2)
3487 + as_fn_append ac_configure_args1 " '$ac_arg'"
3488 + if test $ac_must_keep_next = true; then
3489 + ac_must_keep_next=false # Got value, back to normal.
3490 + else
3491 + case $ac_arg in
3492 + *=* | --config-cache | -C | -disable-* | --disable-* \
3493 + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
3494 + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
3495 + | -with-* | --with-* | -without-* | --without-* | --x)
3496 + case "$ac_configure_args0 " in
3497 + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
3498 + esac
3499 + ;;
3500 + -* ) ac_must_keep_next=true ;;
3501 + esac
3502 + fi
3503 + as_fn_append ac_configure_args " '$ac_arg'"
3504 + ;;
3505 + esac
3506 + done
3507 +done
3508 +{ ac_configure_args0=; unset ac_configure_args0;}
3509 +{ ac_configure_args1=; unset ac_configure_args1;}
3511 +# When interrupted or exit'd, cleanup temporary files, and complete
3512 +# config.log. We remove comments because anyway the quotes in there
3513 +# would cause problems or look ugly.
3514 +# WARNING: Use '\'' to represent an apostrophe within the trap.
3515 +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
3516 +trap 'exit_status=$?
3517 + # Save into config.log some information that might help in debugging.
3519 + echo
3521 + $as_echo "## ---------------- ##
3522 +## Cache variables. ##
3523 +## ---------------- ##"
3524 + echo
3525 + # The following way of writing the cache mishandles newlines in values,
3527 + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
3528 + eval ac_val=\$$ac_var
3529 + case $ac_val in #(
3530 + *${as_nl}*)
3531 + case $ac_var in #(
3532 + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
3533 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
3534 + esac
3535 + case $ac_var in #(
3536 + _ | IFS | as_nl) ;; #(
3537 + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
3538 + *) { eval $ac_var=; unset $ac_var;} ;;
3539 + esac ;;
3540 + esac
3541 + done
3542 + (set) 2>&1 |
3543 + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
3544 + *${as_nl}ac_space=\ *)
3545 + sed -n \
3546 + "s/'\''/'\''\\\\'\'''\''/g;
3547 + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
3548 + ;; #(
3549 + *)
3550 + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
3551 + ;;
3552 + esac |
3553 + sort
3555 + echo
3557 + $as_echo "## ----------------- ##
3558 +## Output variables. ##
3559 +## ----------------- ##"
3560 + echo
3561 + for ac_var in $ac_subst_vars
3562 + do
3563 + eval ac_val=\$$ac_var
3564 + case $ac_val in
3565 + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
3566 + esac
3567 + $as_echo "$ac_var='\''$ac_val'\''"
3568 + done | sort
3569 + echo
3571 + if test -n "$ac_subst_files"; then
3572 + $as_echo "## ------------------- ##
3573 +## File substitutions. ##
3574 +## ------------------- ##"
3575 + echo
3576 + for ac_var in $ac_subst_files
3577 + do
3578 + eval ac_val=\$$ac_var
3579 + case $ac_val in
3580 + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
3581 + esac
3582 + $as_echo "$ac_var='\''$ac_val'\''"
3583 + done | sort
3584 + echo
3585 + fi
3587 + if test -s confdefs.h; then
3588 + $as_echo "## ----------- ##
3589 +## confdefs.h. ##
3590 +## ----------- ##"
3591 + echo
3592 + cat confdefs.h
3593 + echo
3594 + fi
3595 + test "$ac_signal" != 0 &&
3596 + $as_echo "$as_me: caught signal $ac_signal"
3597 + $as_echo "$as_me: exit $exit_status"
3598 + } >&5
3599 + rm -f core *.core core.conftest.* &&
3600 + rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
3601 + exit $exit_status
3602 +' 0
3603 +for ac_signal in 1 2 13 15; do
3604 + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
3605 +done
3606 +ac_signal=0
3608 +# confdefs.h avoids OS command line length limits that DEFS can exceed.
3609 +rm -f -r conftest* confdefs.h
3611 +$as_echo "/* confdefs.h */" > confdefs.h
3613 +# Predefined preprocessor variables.
3615 +cat >>confdefs.h <<_ACEOF
3616 +#define PACKAGE_NAME "$PACKAGE_NAME"
3617 +_ACEOF
3619 +cat >>confdefs.h <<_ACEOF
3620 +#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
3621 +_ACEOF
3623 +cat >>confdefs.h <<_ACEOF
3624 +#define PACKAGE_VERSION "$PACKAGE_VERSION"
3625 +_ACEOF
3627 +cat >>confdefs.h <<_ACEOF
3628 +#define PACKAGE_STRING "$PACKAGE_STRING"
3629 +_ACEOF
3631 +cat >>confdefs.h <<_ACEOF
3632 +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
3633 +_ACEOF
3635 +cat >>confdefs.h <<_ACEOF
3636 +#define PACKAGE_URL "$PACKAGE_URL"
3637 +_ACEOF
3640 +# Let the site file select an alternate cache file if it wants to.
3641 +# Prefer an explicitly selected file to automatically selected ones.
3642 +ac_site_file1=NONE
3643 +ac_site_file2=NONE
3644 +if test -n "$CONFIG_SITE"; then
3645 + # We do not want a PATH search for config.site.
3646 + case $CONFIG_SITE in #((
3647 + -*) ac_site_file1=./$CONFIG_SITE;;
3648 + */*) ac_site_file1=$CONFIG_SITE;;
3649 + *) ac_site_file1=./$CONFIG_SITE;;
3650 + esac
3651 +elif test "x$prefix" != xNONE; then
3652 + ac_site_file1=$prefix/share/config.site
3653 + ac_site_file2=$prefix/etc/config.site
3654 +else
3655 + ac_site_file1=$ac_default_prefix/share/config.site
3656 + ac_site_file2=$ac_default_prefix/etc/config.site
3658 +for ac_site_file in "$ac_site_file1" "$ac_site_file2"
3660 + test "x$ac_site_file" = xNONE && continue
3661 + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
3662 + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
3663 +$as_echo "$as_me: loading site script $ac_site_file" >&6;}
3664 + sed 's/^/| /' "$ac_site_file" >&5
3665 + . "$ac_site_file" \
3666 + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3667 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
3668 +as_fn_error $? "failed to load site script $ac_site_file
3669 +See \`config.log' for more details" "$LINENO" 5; }
3670 + fi
3671 +done
3673 +if test -r "$cache_file"; then
3674 + # Some versions of bash will fail to source /dev/null (special files
3675 + # actually), so we avoid doing that. DJGPP emulates it as a regular file.
3676 + if test /dev/null != "$cache_file" && test -f "$cache_file"; then
3677 + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
3678 +$as_echo "$as_me: loading cache $cache_file" >&6;}
3679 + case $cache_file in
3680 + [\\/]* | ?:[\\/]* ) . "$cache_file";;
3681 + *) . "./$cache_file";;
3682 + esac
3683 + fi
3684 +else
3685 + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
3686 +$as_echo "$as_me: creating cache $cache_file" >&6;}
3687 + >$cache_file
3690 +# Check that the precious variables saved in the cache have kept the same
3691 +# value.
3692 +ac_cache_corrupted=false
3693 +for ac_var in $ac_precious_vars; do
3694 + eval ac_old_set=\$ac_cv_env_${ac_var}_set
3695 + eval ac_new_set=\$ac_env_${ac_var}_set
3696 + eval ac_old_val=\$ac_cv_env_${ac_var}_value
3697 + eval ac_new_val=\$ac_env_${ac_var}_value
3698 + case $ac_old_set,$ac_new_set in
3699 + set,)
3700 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
3701 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
3702 + ac_cache_corrupted=: ;;
3703 + ,set)
3704 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
3705 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
3706 + ac_cache_corrupted=: ;;
3707 + ,);;
3708 + *)
3709 + if test "x$ac_old_val" != "x$ac_new_val"; then
3710 + # differences in whitespace do not lead to failure.
3711 + ac_old_val_w=`echo x $ac_old_val`
3712 + ac_new_val_w=`echo x $ac_new_val`
3713 + if test "$ac_old_val_w" != "$ac_new_val_w"; then
3714 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
3715 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
3716 + ac_cache_corrupted=:
3717 + else
3718 + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
3719 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
3720 + eval $ac_var=\$ac_old_val
3721 + fi
3722 + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
3723 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
3724 + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
3725 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
3726 + fi;;
3727 + esac
3728 + # Pass precious variables to config.status.
3729 + if test "$ac_new_set" = set; then
3730 + case $ac_new_val in
3731 + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
3732 + *) ac_arg=$ac_var=$ac_new_val ;;
3733 + esac
3734 + case " $ac_configure_args " in
3735 + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
3736 + *) as_fn_append ac_configure_args " '$ac_arg'" ;;
3737 + esac
3738 + fi
3739 +done
3740 +if $ac_cache_corrupted; then
3741 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3742 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
3743 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
3744 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
3745 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
3747 +## -------------------- ##
3748 +## Main body of script. ##
3749 +## -------------------- ##
3751 +ac_ext=c
3752 +ac_cpp='$CPP $CPPFLAGS'
3753 +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3754 +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3755 +ac_compiler_gnu=$ac_cv_c_compiler_gnu
3760 +ac_aux_dir=
3761 +for ac_dir in ../../../.. "$srcdir"/../../../..; do
3762 + if test -f "$ac_dir/install-sh"; then
3763 + ac_aux_dir=$ac_dir
3764 + ac_install_sh="$ac_aux_dir/install-sh -c"
3765 + break
3766 + elif test -f "$ac_dir/install.sh"; then
3767 + ac_aux_dir=$ac_dir
3768 + ac_install_sh="$ac_aux_dir/install.sh -c"
3769 + break
3770 + elif test -f "$ac_dir/shtool"; then
3771 + ac_aux_dir=$ac_dir
3772 + ac_install_sh="$ac_aux_dir/shtool install -c"
3773 + break
3774 + fi
3775 +done
3776 +if test -z "$ac_aux_dir"; then
3777 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in ../../../.. \"$srcdir\"/../../../.." "$LINENO" 5
3780 +# These three variables are undocumented and unsupported,
3781 +# and are intended to be withdrawn in a future Autoconf release.
3782 +# They can cause serious problems if a builder's source tree is in a directory
3783 +# whose full name contains unusual characters.
3784 +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
3785 +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
3786 +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
3791 +# Make sure we can run config.sub.
3792 +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
3793 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
3795 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
3796 +$as_echo_n "checking build system type... " >&6; }
3797 +if ${ac_cv_build+:} false; then :
3798 + $as_echo_n "(cached) " >&6
3799 +else
3800 + ac_build_alias=$build_alias
3801 +test "x$ac_build_alias" = x &&
3802 + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
3803 +test "x$ac_build_alias" = x &&
3804 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
3805 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
3806 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
3809 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
3810 +$as_echo "$ac_cv_build" >&6; }
3811 +case $ac_cv_build in
3812 +*-*-*) ;;
3813 +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
3814 +esac
3815 +build=$ac_cv_build
3816 +ac_save_IFS=$IFS; IFS='-'
3817 +set x $ac_cv_build
3818 +shift
3819 +build_cpu=$1
3820 +build_vendor=$2
3821 +shift; shift
3822 +# Remember, the first character of IFS is used to create $*,
3823 +# except with old shells:
3824 +build_os=$*
3825 +IFS=$ac_save_IFS
3826 +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
3829 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
3830 +$as_echo_n "checking host system type... " >&6; }
3831 +if ${ac_cv_host+:} false; then :
3832 + $as_echo_n "(cached) " >&6
3833 +else
3834 + if test "x$host_alias" = x; then
3835 + ac_cv_host=$ac_cv_build
3836 +else
3837 + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
3838 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
3842 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
3843 +$as_echo "$ac_cv_host" >&6; }
3844 +case $ac_cv_host in
3845 +*-*-*) ;;
3846 +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
3847 +esac
3848 +host=$ac_cv_host
3849 +ac_save_IFS=$IFS; IFS='-'
3850 +set x $ac_cv_host
3851 +shift
3852 +host_cpu=$1
3853 +host_vendor=$2
3854 +shift; shift
3855 +# Remember, the first character of IFS is used to create $*,
3856 +# except with old shells:
3857 +host_os=$*
3858 +IFS=$ac_save_IFS
3859 +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
3862 +am__api_version='1.11'
3864 +# Find a good install program. We prefer a C program (faster),
3865 +# so one script is as good as another. But avoid the broken or
3866 +# incompatible versions:
3867 +# SysV /etc/install, /usr/sbin/install
3868 +# SunOS /usr/etc/install
3869 +# IRIX /sbin/install
3870 +# AIX /bin/install
3871 +# AmigaOS /C/install, which installs bootblocks on floppy discs
3872 +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
3873 +# AFS /usr/afsws/bin/install, which mishandles nonexistent args
3874 +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
3875 +# OS/2's system install, which has a completely different semantic
3876 +# ./install, which can be erroneously created by make from ./install.sh.
3877 +# Reject install programs that cannot install multiple files.
3878 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
3879 +$as_echo_n "checking for a BSD-compatible install... " >&6; }
3880 +if test -z "$INSTALL"; then
3881 +if ${ac_cv_path_install+:} false; then :
3882 + $as_echo_n "(cached) " >&6
3883 +else
3884 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3885 +for as_dir in $PATH
3887 + IFS=$as_save_IFS
3888 + test -z "$as_dir" && as_dir=.
3889 + # Account for people who put trailing slashes in PATH elements.
3890 +case $as_dir/ in #((
3891 + ./ | .// | /[cC]/* | \
3892 + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
3893 + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
3894 + /usr/ucb/* ) ;;
3895 + *)
3896 + # OSF1 and SCO ODT 3.0 have their own names for install.
3897 + # Don't use installbsd from OSF since it installs stuff as root
3898 + # by default.
3899 + for ac_prog in ginstall scoinst install; do
3900 + for ac_exec_ext in '' $ac_executable_extensions; do
3901 + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
3902 + if test $ac_prog = install &&
3903 + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
3904 + # AIX install. It has an incompatible calling convention.
3906 + elif test $ac_prog = install &&
3907 + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
3908 + # program-specific install script used by HP pwplus--don't use.
3910 + else
3911 + rm -rf conftest.one conftest.two conftest.dir
3912 + echo one > conftest.one
3913 + echo two > conftest.two
3914 + mkdir conftest.dir
3915 + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
3916 + test -s conftest.one && test -s conftest.two &&
3917 + test -s conftest.dir/conftest.one &&
3918 + test -s conftest.dir/conftest.two
3919 + then
3920 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
3921 + break 3
3922 + fi
3923 + fi
3924 + fi
3925 + done
3926 + done
3927 + ;;
3928 +esac
3930 + done
3931 +IFS=$as_save_IFS
3933 +rm -rf conftest.one conftest.two conftest.dir
3936 + if test "${ac_cv_path_install+set}" = set; then
3937 + INSTALL=$ac_cv_path_install
3938 + else
3939 + # As a last resort, use the slow shell script. Don't cache a
3940 + # value for INSTALL within a source directory, because that will
3941 + # break other packages using the cache if that directory is
3942 + # removed, or if the value is a relative name.
3943 + INSTALL=$ac_install_sh
3944 + fi
3946 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
3947 +$as_echo "$INSTALL" >&6; }
3949 +# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
3950 +# It thinks the first close brace ends the variable substitution.
3951 +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
3953 +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
3955 +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
3957 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
3958 +$as_echo_n "checking whether build environment is sane... " >&6; }
3959 +# Just in case
3960 +sleep 1
3961 +echo timestamp > conftest.file
3962 +# Reject unsafe characters in $srcdir or the absolute working directory
3963 +# name. Accept space and tab only in the latter.
3964 +am_lf='
3966 +case `pwd` in
3967 + *[\\\"\#\$\&\'\`$am_lf]*)
3968 + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
3969 +esac
3970 +case $srcdir in
3971 + *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
3972 + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
3973 +esac
3975 +# Do `set' in a subshell so we don't clobber the current shell's
3976 +# arguments. Must try -L first in case configure is actually a
3977 +# symlink; some systems play weird games with the mod time of symlinks
3978 +# (eg FreeBSD returns the mod time of the symlink's containing
3979 +# directory).
3980 +if (
3981 + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3982 + if test "$*" = "X"; then
3983 + # -L didn't work.
3984 + set X `ls -t "$srcdir/configure" conftest.file`
3985 + fi
3986 + rm -f conftest.file
3987 + if test "$*" != "X $srcdir/configure conftest.file" \
3988 + && test "$*" != "X conftest.file $srcdir/configure"; then
3990 + # If neither matched, then we have a broken ls. This can happen
3991 + # if, for instance, CONFIG_SHELL is bash and it inherits a
3992 + # broken ls alias from the environment. This has actually
3993 + # happened. Such a system could not be considered "sane".
3994 + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
3995 +alias in your environment" "$LINENO" 5
3996 + fi
3998 + test "$2" = conftest.file
4000 +then
4001 + # Ok.
4003 +else
4004 + as_fn_error $? "newly created file is older than distributed files!
4005 +Check your system clock" "$LINENO" 5
4007 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4008 +$as_echo "yes" >&6; }
4009 +test "$program_prefix" != NONE &&
4010 + program_transform_name="s&^&$program_prefix&;$program_transform_name"
4011 +# Use a double $ so make ignores it.
4012 +test "$program_suffix" != NONE &&
4013 + program_transform_name="s&\$&$program_suffix&;$program_transform_name"
4014 +# Double any \ or $.
4015 +# By default was `s,x,x', remove it if useless.
4016 +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
4017 +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
4019 +# expand $ac_aux_dir to an absolute path
4020 +am_aux_dir=`cd $ac_aux_dir && pwd`
4022 +if test x"${MISSING+set}" != xset; then
4023 + case $am_aux_dir in
4024 + *\ * | *\ *)
4025 + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
4026 + *)
4027 + MISSING="\${SHELL} $am_aux_dir/missing" ;;
4028 + esac
4030 +# Use eval to expand $SHELL
4031 +if eval "$MISSING --run true"; then
4032 + am_missing_run="$MISSING --run "
4033 +else
4034 + am_missing_run=
4035 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
4036 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
4039 +if test x"${install_sh}" != xset; then
4040 + case $am_aux_dir in
4041 + *\ * | *\ *)
4042 + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
4043 + *)
4044 + install_sh="\${SHELL} $am_aux_dir/install-sh"
4045 + esac
4048 +# Installed binaries are usually stripped using `strip' when the user
4049 +# run `make install-strip'. However `strip' might not be the right
4050 +# tool to use in cross-compilation environments, therefore Automake
4051 +# will honor the `STRIP' environment variable to overrule this program.
4052 +if test "$cross_compiling" != no; then
4053 + if test -n "$ac_tool_prefix"; then
4054 + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
4055 +set dummy ${ac_tool_prefix}strip; ac_word=$2
4056 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4057 +$as_echo_n "checking for $ac_word... " >&6; }
4058 +if ${ac_cv_prog_STRIP+:} false; then :
4059 + $as_echo_n "(cached) " >&6
4060 +else
4061 + if test -n "$STRIP"; then
4062 + ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
4063 +else
4064 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4065 +for as_dir in $PATH
4067 + IFS=$as_save_IFS
4068 + test -z "$as_dir" && as_dir=.
4069 + for ac_exec_ext in '' $ac_executable_extensions; do
4070 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4071 + ac_cv_prog_STRIP="${ac_tool_prefix}strip"
4072 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4073 + break 2
4074 + fi
4075 +done
4076 + done
4077 +IFS=$as_save_IFS
4081 +STRIP=$ac_cv_prog_STRIP
4082 +if test -n "$STRIP"; then
4083 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
4084 +$as_echo "$STRIP" >&6; }
4085 +else
4086 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4087 +$as_echo "no" >&6; }
4092 +if test -z "$ac_cv_prog_STRIP"; then
4093 + ac_ct_STRIP=$STRIP
4094 + # Extract the first word of "strip", so it can be a program name with args.
4095 +set dummy strip; ac_word=$2
4096 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4097 +$as_echo_n "checking for $ac_word... " >&6; }
4098 +if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
4099 + $as_echo_n "(cached) " >&6
4100 +else
4101 + if test -n "$ac_ct_STRIP"; then
4102 + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
4103 +else
4104 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4105 +for as_dir in $PATH
4107 + IFS=$as_save_IFS
4108 + test -z "$as_dir" && as_dir=.
4109 + for ac_exec_ext in '' $ac_executable_extensions; do
4110 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4111 + ac_cv_prog_ac_ct_STRIP="strip"
4112 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4113 + break 2
4114 + fi
4115 +done
4116 + done
4117 +IFS=$as_save_IFS
4121 +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
4122 +if test -n "$ac_ct_STRIP"; then
4123 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
4124 +$as_echo "$ac_ct_STRIP" >&6; }
4125 +else
4126 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4127 +$as_echo "no" >&6; }
4130 + if test "x$ac_ct_STRIP" = x; then
4131 + STRIP=":"
4132 + else
4133 + case $cross_compiling:$ac_tool_warned in
4134 +yes:)
4135 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
4136 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
4137 +ac_tool_warned=yes ;;
4138 +esac
4139 + STRIP=$ac_ct_STRIP
4140 + fi
4141 +else
4142 + STRIP="$ac_cv_prog_STRIP"
4146 +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
4148 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
4149 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
4150 +if test -z "$MKDIR_P"; then
4151 + if ${ac_cv_path_mkdir+:} false; then :
4152 + $as_echo_n "(cached) " >&6
4153 +else
4154 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4155 +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
4157 + IFS=$as_save_IFS
4158 + test -z "$as_dir" && as_dir=.
4159 + for ac_prog in mkdir gmkdir; do
4160 + for ac_exec_ext in '' $ac_executable_extensions; do
4161 + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
4162 + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
4163 + 'mkdir (GNU coreutils) '* | \
4164 + 'mkdir (coreutils) '* | \
4165 + 'mkdir (fileutils) '4.1*)
4166 + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
4167 + break 3;;
4168 + esac
4169 + done
4170 + done
4171 + done
4172 +IFS=$as_save_IFS
4176 + test -d ./--version && rmdir ./--version
4177 + if test "${ac_cv_path_mkdir+set}" = set; then
4178 + MKDIR_P="$ac_cv_path_mkdir -p"
4179 + else
4180 + # As a last resort, use the slow shell script. Don't cache a
4181 + # value for MKDIR_P within a source directory, because that will
4182 + # break other packages using the cache if that directory is
4183 + # removed, or if the value is a relative name.
4184 + MKDIR_P="$ac_install_sh -d"
4185 + fi
4187 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
4188 +$as_echo "$MKDIR_P" >&6; }
4190 +mkdir_p="$MKDIR_P"
4191 +case $mkdir_p in
4192 + [\\/$]* | ?:[\\/]*) ;;
4193 + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
4194 +esac
4196 +for ac_prog in gawk mawk nawk awk
4198 + # Extract the first word of "$ac_prog", so it can be a program name with args.
4199 +set dummy $ac_prog; ac_word=$2
4200 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4201 +$as_echo_n "checking for $ac_word... " >&6; }
4202 +if ${ac_cv_prog_AWK+:} false; then :
4203 + $as_echo_n "(cached) " >&6
4204 +else
4205 + if test -n "$AWK"; then
4206 + ac_cv_prog_AWK="$AWK" # Let the user override the test.
4207 +else
4208 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4209 +for as_dir in $PATH
4211 + IFS=$as_save_IFS
4212 + test -z "$as_dir" && as_dir=.
4213 + for ac_exec_ext in '' $ac_executable_extensions; do
4214 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4215 + ac_cv_prog_AWK="$ac_prog"
4216 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4217 + break 2
4218 + fi
4219 +done
4220 + done
4221 +IFS=$as_save_IFS
4225 +AWK=$ac_cv_prog_AWK
4226 +if test -n "$AWK"; then
4227 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
4228 +$as_echo "$AWK" >&6; }
4229 +else
4230 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4231 +$as_echo "no" >&6; }
4235 + test -n "$AWK" && break
4236 +done
4238 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
4239 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
4240 +set x ${MAKE-make}
4241 +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
4242 +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
4243 + $as_echo_n "(cached) " >&6
4244 +else
4245 + cat >conftest.make <<\_ACEOF
4246 +SHELL = /bin/sh
4247 +all:
4248 + @echo '@@@%%%=$(MAKE)=@@@%%%'
4249 +_ACEOF
4250 +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
4251 +case `${MAKE-make} -f conftest.make 2>/dev/null` in
4252 + *@@@%%%=?*=@@@%%%*)
4253 + eval ac_cv_prog_make_${ac_make}_set=yes;;
4254 + *)
4255 + eval ac_cv_prog_make_${ac_make}_set=no;;
4256 +esac
4257 +rm -f conftest.make
4259 +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
4260 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4261 +$as_echo "yes" >&6; }
4262 + SET_MAKE=
4263 +else
4264 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4265 +$as_echo "no" >&6; }
4266 + SET_MAKE="MAKE=${MAKE-make}"
4269 +rm -rf .tst 2>/dev/null
4270 +mkdir .tst 2>/dev/null
4271 +if test -d .tst; then
4272 + am__leading_dot=.
4273 +else
4274 + am__leading_dot=_
4276 +rmdir .tst 2>/dev/null
4278 +DEPDIR="${am__leading_dot}deps"
4280 +ac_config_commands="$ac_config_commands depfiles"
4283 +am_make=${MAKE-make}
4284 +cat > confinc << 'END'
4285 +am__doit:
4286 + @echo this is the am__doit target
4287 +.PHONY: am__doit
4288 +END
4289 +# If we don't find an include directive, just comment out the code.
4290 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
4291 +$as_echo_n "checking for style of include used by $am_make... " >&6; }
4292 +am__include="#"
4293 +am__quote=
4294 +_am_result=none
4295 +# First try GNU make style include.
4296 +echo "include confinc" > confmf
4297 +# Ignore all kinds of additional output from `make'.
4298 +case `$am_make -s -f confmf 2> /dev/null` in #(
4299 +*the\ am__doit\ target*)
4300 + am__include=include
4301 + am__quote=
4302 + _am_result=GNU
4303 + ;;
4304 +esac
4305 +# Now try BSD make style include.
4306 +if test "$am__include" = "#"; then
4307 + echo '.include "confinc"' > confmf
4308 + case `$am_make -s -f confmf 2> /dev/null` in #(
4309 + *the\ am__doit\ target*)
4310 + am__include=.include
4311 + am__quote="\""
4312 + _am_result=BSD
4313 + ;;
4314 + esac
4318 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
4319 +$as_echo "$_am_result" >&6; }
4320 +rm -f confinc confmf
4322 +# Check whether --enable-dependency-tracking was given.
4323 +if test "${enable_dependency_tracking+set}" = set; then :
4324 + enableval=$enable_dependency_tracking;
4327 +if test "x$enable_dependency_tracking" != xno; then
4328 + am_depcomp="$ac_aux_dir/depcomp"
4329 + AMDEPBACKSLASH='\'
4331 + if test "x$enable_dependency_tracking" != xno; then
4332 + AMDEP_TRUE=
4333 + AMDEP_FALSE='#'
4334 +else
4335 + AMDEP_TRUE='#'
4336 + AMDEP_FALSE=
4341 +# Check whether --enable-multilib was given.
4342 +if test "${enable_multilib+set}" = set; then :
4343 + enableval=$enable_multilib; case "${enableval}" in
4344 + yes) multilib=yes ;;
4345 + no) multilib=no ;;
4346 + *) as_fn_error $? "bad value ${enableval} for multilib option" "$LINENO" 5 ;;
4347 + esac
4348 +else
4349 + multilib=yes
4352 +# Check whether --enable-target-optspace was given.
4353 +if test "${enable_target_optspace+set}" = set; then :
4354 + enableval=$enable_target_optspace; case "${enableval}" in
4355 + yes) target_optspace=yes ;;
4356 + no) target_optspace=no ;;
4357 + *) as_fn_error $? "bad value ${enableval} for target-optspace option" "$LINENO" 5 ;;
4358 + esac
4359 +else
4360 + target_optspace=
4363 +# Check whether --enable-malloc-debugging was given.
4364 +if test "${enable_malloc_debugging+set}" = set; then :
4365 + enableval=$enable_malloc_debugging; case "${enableval}" in
4366 + yes) malloc_debugging=yes ;;
4367 + no) malloc_debugging=no ;;
4368 + *) as_fn_error $? "bad value ${enableval} for malloc-debugging option" "$LINENO" 5 ;;
4369 + esac
4370 +else
4371 + malloc_debugging=
4374 +# Check whether --enable-newlib-multithread was given.
4375 +if test "${enable_newlib_multithread+set}" = set; then :
4376 + enableval=$enable_newlib_multithread; case "${enableval}" in
4377 + yes) newlib_multithread=yes ;;
4378 + no) newlib_multithread=no ;;
4379 + *) as_fn_error $? "bad value ${enableval} for newlib-multithread option" "$LINENO" 5 ;;
4380 + esac
4381 +else
4382 + newlib_multithread=yes
4385 +# Check whether --enable-newlib-iconv was given.
4386 +if test "${enable_newlib_iconv+set}" = set; then :
4387 + enableval=$enable_newlib_iconv; if test "${newlib_iconv+set}" != set; then
4388 + case "${enableval}" in
4389 + yes) newlib_iconv=yes ;;
4390 + no) newlib_iconv=no ;;
4391 + *) as_fn_error $? "bad value ${enableval} for newlib-iconv option" "$LINENO" 5 ;;
4392 + esac
4393 + fi
4394 +else
4395 + newlib_iconv=${newlib_iconv}
4398 +# Check whether --enable-newlib-elix-level was given.
4399 +if test "${enable_newlib_elix_level+set}" = set; then :
4400 + enableval=$enable_newlib_elix_level; case "${enableval}" in
4401 + 0) newlib_elix_level=0 ;;
4402 + 1) newlib_elix_level=1 ;;
4403 + 2) newlib_elix_level=2 ;;
4404 + 3) newlib_elix_level=3 ;;
4405 + 4) newlib_elix_level=4 ;;
4406 + *) as_fn_error $? "bad value ${enableval} for newlib-elix-level option" "$LINENO" 5 ;;
4407 + esac
4408 +else
4409 + newlib_elix_level=0
4412 +# Check whether --enable-newlib-io-float was given.
4413 +if test "${enable_newlib_io_float+set}" = set; then :
4414 + enableval=$enable_newlib_io_float; case "${enableval}" in
4415 + yes) newlib_io_float=yes ;;
4416 + no) newlib_io_float=no ;;
4417 + *) as_fn_error $? "bad value ${enableval} for newlib-io-float option" "$LINENO" 5 ;;
4418 + esac
4419 +else
4420 + newlib_io_float=yes
4423 +# Check whether --enable-newlib-supplied-syscalls was given.
4424 +if test "${enable_newlib_supplied_syscalls+set}" = set; then :
4425 + enableval=$enable_newlib_supplied_syscalls; case "${enableval}" in
4426 + yes) newlib_may_supply_syscalls=yes ;;
4427 + no) newlib_may_supply_syscalls=no ;;
4428 + *) as_fn_error $? "bad value ${enableval} for newlib-supplied-syscalls option" "$LINENO" 5 ;;
4429 + esac
4430 +else
4431 + newlib_may_supply_syscalls=yes
4434 + if test x${newlib_may_supply_syscalls} = xyes; then
4435 + MAY_SUPPLY_SYSCALLS_TRUE=
4436 + MAY_SUPPLY_SYSCALLS_FALSE='#'
4437 +else
4438 + MAY_SUPPLY_SYSCALLS_TRUE='#'
4439 + MAY_SUPPLY_SYSCALLS_FALSE=
4444 +test -z "${with_target_subdir}" && with_target_subdir=.
4446 +if test "${srcdir}" = "."; then
4447 + if test "${with_target_subdir}" != "."; then
4448 + newlib_basedir="${srcdir}/${with_multisrctop}../../../.."
4449 + else
4450 + newlib_basedir="${srcdir}/${with_multisrctop}../../.."
4451 + fi
4452 +else
4453 + newlib_basedir="${srcdir}/../../.."
4459 +if test "`cd $srcdir && pwd`" != "`pwd`"; then
4460 + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4461 + # is not polluted with repeated "-I."
4462 + am__isrc=' -I$(srcdir)'
4463 + # test to see if srcdir already configured
4464 + if test -f $srcdir/config.status; then
4465 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
4466 + fi
4469 +# test whether we have cygpath
4470 +if test -z "$CYGPATH_W"; then
4471 + if (cygpath --version) >/dev/null 2>/dev/null; then
4472 + CYGPATH_W='cygpath -w'
4473 + else
4474 + CYGPATH_W=echo
4475 + fi
4479 +# Define the identity of the package.
4480 + PACKAGE='newlib'
4481 + VERSION='1.20.0'
4484 +# Some tools Automake needs.
4486 +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
4489 +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
4492 +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
4495 +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
4498 +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
4500 +# We need awk for the "check" target. The system "awk" is bad on
4501 +# some platforms.
4502 +# Always define AMTAR for backward compatibility.
4504 +AMTAR=${AMTAR-"${am_missing_run}tar"}
4506 +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
4513 +# FIXME: We temporarily define our own version of AC_PROG_CC. This is
4514 +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
4515 +# are probably using a cross compiler, which will not be able to fully
4516 +# link an executable. This should really be fixed in autoconf
4517 +# itself.
4525 +# Extract the first word of "gcc", so it can be a program name with args.
4526 +set dummy gcc; ac_word=$2
4527 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4528 +$as_echo_n "checking for $ac_word... " >&6; }
4529 +if ${ac_cv_prog_CC+:} false; then :
4530 + $as_echo_n "(cached) " >&6
4531 +else
4532 + if test -n "$CC"; then
4533 + ac_cv_prog_CC="$CC" # Let the user override the test.
4534 +else
4535 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4536 +for as_dir in $PATH
4538 + IFS=$as_save_IFS
4539 + test -z "$as_dir" && as_dir=.
4540 + for ac_exec_ext in '' $ac_executable_extensions; do
4541 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4542 + ac_cv_prog_CC="gcc"
4543 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4544 + break 2
4545 + fi
4546 +done
4547 + done
4548 +IFS=$as_save_IFS
4552 +CC=$ac_cv_prog_CC
4553 +if test -n "$CC"; then
4554 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
4555 +$as_echo "$CC" >&6; }
4556 +else
4557 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4558 +$as_echo "no" >&6; }
4563 +depcc="$CC" am_compiler_list=
4565 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
4566 +$as_echo_n "checking dependency style of $depcc... " >&6; }
4567 +if ${am_cv_CC_dependencies_compiler_type+:} false; then :
4568 + $as_echo_n "(cached) " >&6
4569 +else
4570 + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
4571 + # We make a subdir and do the tests there. Otherwise we can end up
4572 + # making bogus files that we don't know about and never remove. For
4573 + # instance it was reported that on HP-UX the gcc test will end up
4574 + # making a dummy file named `D' -- because `-MD' means `put the output
4575 + # in D'.
4576 + mkdir conftest.dir
4577 + # Copy depcomp to subdir because otherwise we won't find it if we're
4578 + # using a relative directory.
4579 + cp "$am_depcomp" conftest.dir
4580 + cd conftest.dir
4581 + # We will build objects and dependencies in a subdirectory because
4582 + # it helps to detect inapplicable dependency modes. For instance
4583 + # both Tru64's cc and ICC support -MD to output dependencies as a
4584 + # side effect of compilation, but ICC will put the dependencies in
4585 + # the current directory while Tru64 will put them in the object
4586 + # directory.
4587 + mkdir sub
4589 + am_cv_CC_dependencies_compiler_type=none
4590 + if test "$am_compiler_list" = ""; then
4591 + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
4592 + fi
4593 + am__universal=false
4594 + case " $depcc " in #(
4595 + *\ -arch\ *\ -arch\ *) am__universal=true ;;
4596 + esac
4598 + for depmode in $am_compiler_list; do
4599 + # Setup a source with many dependencies, because some compilers
4600 + # like to wrap large dependency lists on column 80 (with \), and
4601 + # we should not choose a depcomp mode which is confused by this.
4603 + # We need to recreate these files for each test, as the compiler may
4604 + # overwrite some of them when testing with obscure command lines.
4605 + # This happens at least with the AIX C compiler.
4606 + : > sub/conftest.c
4607 + for i in 1 2 3 4 5 6; do
4608 + echo '#include "conftst'$i'.h"' >> sub/conftest.c
4609 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
4610 + # Solaris 8's {/usr,}/bin/sh.
4611 + touch sub/conftst$i.h
4612 + done
4613 + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
4615 + # We check with `-c' and `-o' for the sake of the "dashmstdout"
4616 + # mode. It turns out that the SunPro C++ compiler does not properly
4617 + # handle `-M -o', and we need to detect this. Also, some Intel
4618 + # versions had trouble with output in subdirs
4619 + am__obj=sub/conftest.${OBJEXT-o}
4620 + am__minus_obj="-o $am__obj"
4621 + case $depmode in
4622 + gcc)
4623 + # This depmode causes a compiler race in universal mode.
4624 + test "$am__universal" = false || continue
4625 + ;;
4626 + nosideeffect)
4627 + # after this tag, mechanisms are not by side-effect, so they'll
4628 + # only be used when explicitly requested
4629 + if test "x$enable_dependency_tracking" = xyes; then
4630 + continue
4631 + else
4632 + break
4633 + fi
4634 + ;;
4635 + msvisualcpp | msvcmsys)
4636 + # This compiler won't grok `-c -o', but also, the minuso test has
4637 + # not run yet. These depmodes are late enough in the game, and
4638 + # so weak that their functioning should not be impacted.
4639 + am__obj=conftest.${OBJEXT-o}
4640 + am__minus_obj=
4641 + ;;
4642 + none) break ;;
4643 + esac
4644 + if depmode=$depmode \
4645 + source=sub/conftest.c object=$am__obj \
4646 + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
4647 + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
4648 + >/dev/null 2>conftest.err &&
4649 + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
4650 + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
4651 + grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
4652 + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
4653 + # icc doesn't choke on unknown options, it will just issue warnings
4654 + # or remarks (even with -Werror). So we grep stderr for any message
4655 + # that says an option was ignored or not supported.
4656 + # When given -MP, icc 7.0 and 7.1 complain thusly:
4657 + # icc: Command line warning: ignoring option '-M'; no argument required
4658 + # The diagnosis changed in icc 8.0:
4659 + # icc: Command line remark: option '-MP' not supported
4660 + if (grep 'ignoring option' conftest.err ||
4661 + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
4662 + am_cv_CC_dependencies_compiler_type=$depmode
4663 + break
4664 + fi
4665 + fi
4666 + done
4668 + cd ..
4669 + rm -rf conftest.dir
4670 +else
4671 + am_cv_CC_dependencies_compiler_type=none
4675 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
4676 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
4677 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
4679 + if
4680 + test "x$enable_dependency_tracking" != xno \
4681 + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
4682 + am__fastdepCC_TRUE=
4683 + am__fastdepCC_FALSE='#'
4684 +else
4685 + am__fastdepCC_TRUE='#'
4686 + am__fastdepCC_FALSE=
4690 +if test -z "$CC"; then
4691 + # Extract the first word of "cc", so it can be a program name with args.
4692 +set dummy cc; ac_word=$2
4693 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4694 +$as_echo_n "checking for $ac_word... " >&6; }
4695 +if ${ac_cv_prog_CC+:} false; then :
4696 + $as_echo_n "(cached) " >&6
4697 +else
4698 + if test -n "$CC"; then
4699 + ac_cv_prog_CC="$CC" # Let the user override the test.
4700 +else
4701 + ac_prog_rejected=no
4702 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4703 +for as_dir in $PATH
4705 + IFS=$as_save_IFS
4706 + test -z "$as_dir" && as_dir=.
4707 + for ac_exec_ext in '' $ac_executable_extensions; do
4708 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4709 + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
4710 + ac_prog_rejected=yes
4711 + continue
4712 + fi
4713 + ac_cv_prog_CC="cc"
4714 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4715 + break 2
4716 + fi
4717 +done
4718 + done
4719 +IFS=$as_save_IFS
4721 +if test $ac_prog_rejected = yes; then
4722 + # We found a bogon in the path, so make sure we never use it.
4723 + set dummy $ac_cv_prog_CC
4724 + shift
4725 + if test $# != 0; then
4726 + # We chose a different compiler from the bogus one.
4727 + # However, it has the same basename, so the bogon will be chosen
4728 + # first if we set CC to just the basename; use the full file name.
4729 + shift
4730 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
4731 + fi
4735 +CC=$ac_cv_prog_CC
4736 +if test -n "$CC"; then
4737 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
4738 +$as_echo "$CC" >&6; }
4739 +else
4740 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4741 +$as_echo "no" >&6; }
4745 + test -z "$CC" && as_fn_error $? "no acceptable cc found in \$PATH" "$LINENO" 5
4748 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using GNU C" >&5
4749 +$as_echo_n "checking whether we are using GNU C... " >&6; }
4750 +if ${ac_cv_c_compiler_gnu+:} false; then :
4751 + $as_echo_n "(cached) " >&6
4752 +else
4753 + cat > conftest.c <<EOF
4754 +#ifdef __GNUC__
4755 + yes;
4756 +#endif
4757 +EOF
4758 +if { ac_try='${CC-cc} -E conftest.c'
4759 + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
4760 + (eval $ac_try) 2>&5
4761 + ac_status=$?
4762 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
4763 + test $ac_status = 0; }; } | egrep yes >/dev/null 2>&1; then
4764 + ac_cv_c_compiler_gnu=yes
4765 +else
4766 + ac_cv_c_compiler_gnu=no
4769 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
4770 +$as_echo "$ac_cv_c_compiler_gnu" >&6; }
4772 +if test $ac_cv_c_compiler_gnu = yes; then
4773 + GCC=yes
4774 + ac_test_CFLAGS="${CFLAGS+set}"
4775 + ac_save_CFLAGS="$CFLAGS"
4776 + ac_test_CFLAGS=${CFLAGS+set}
4777 +ac_save_CFLAGS=$CFLAGS
4778 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
4779 +$as_echo_n "checking whether $CC accepts -g... " >&6; }
4780 +if ${ac_cv_prog_cc_g+:} false; then :
4781 + $as_echo_n "(cached) " >&6
4782 +else
4783 + ac_save_c_werror_flag=$ac_c_werror_flag
4784 + ac_c_werror_flag=yes
4785 + ac_cv_prog_cc_g=no
4786 + CFLAGS="-g"
4787 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4788 +/* end confdefs.h. */
4790 +int
4791 +main ()
4795 + return 0;
4797 +_ACEOF
4798 +if ac_fn_c_try_compile "$LINENO"; then :
4799 + ac_cv_prog_cc_g=yes
4800 +else
4801 + CFLAGS=""
4802 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4803 +/* end confdefs.h. */
4805 +int
4806 +main ()
4810 + return 0;
4812 +_ACEOF
4813 +if ac_fn_c_try_compile "$LINENO"; then :
4815 +else
4816 + ac_c_werror_flag=$ac_save_c_werror_flag
4817 + CFLAGS="-g"
4818 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4819 +/* end confdefs.h. */
4821 +int
4822 +main ()
4826 + return 0;
4828 +_ACEOF
4829 +if ac_fn_c_try_compile "$LINENO"; then :
4830 + ac_cv_prog_cc_g=yes
4832 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4834 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4836 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4837 + ac_c_werror_flag=$ac_save_c_werror_flag
4839 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
4840 +$as_echo "$ac_cv_prog_cc_g" >&6; }
4841 +if test "$ac_test_CFLAGS" = set; then
4842 + CFLAGS=$ac_save_CFLAGS
4843 +elif test $ac_cv_prog_cc_g = yes; then
4844 + if test "$GCC" = yes; then
4845 + CFLAGS="-g -O2"
4846 + else
4847 + CFLAGS="-g"
4848 + fi
4849 +else
4850 + if test "$GCC" = yes; then
4851 + CFLAGS="-O2"
4852 + else
4853 + CFLAGS=
4854 + fi
4856 + if test "$ac_test_CFLAGS" = set; then
4857 + CFLAGS="$ac_save_CFLAGS"
4858 + elif test $ac_cv_prog_cc_g = yes; then
4859 + CFLAGS="-g -O2"
4860 + else
4861 + CFLAGS="-O2"
4862 + fi
4863 +else
4864 + GCC=
4865 + test "${CFLAGS+set}" = set || CFLAGS="-g"
4869 +if test -n "$ac_tool_prefix"; then
4870 + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
4871 +set dummy ${ac_tool_prefix}as; ac_word=$2
4872 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4873 +$as_echo_n "checking for $ac_word... " >&6; }
4874 +if ${ac_cv_prog_AS+:} false; then :
4875 + $as_echo_n "(cached) " >&6
4876 +else
4877 + if test -n "$AS"; then
4878 + ac_cv_prog_AS="$AS" # Let the user override the test.
4879 +else
4880 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4881 +for as_dir in $PATH
4883 + IFS=$as_save_IFS
4884 + test -z "$as_dir" && as_dir=.
4885 + for ac_exec_ext in '' $ac_executable_extensions; do
4886 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4887 + ac_cv_prog_AS="${ac_tool_prefix}as"
4888 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4889 + break 2
4890 + fi
4891 +done
4892 + done
4893 +IFS=$as_save_IFS
4897 +AS=$ac_cv_prog_AS
4898 +if test -n "$AS"; then
4899 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
4900 +$as_echo "$AS" >&6; }
4901 +else
4902 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4903 +$as_echo "no" >&6; }
4908 +if test -z "$ac_cv_prog_AS"; then
4909 + ac_ct_AS=$AS
4910 + # Extract the first word of "as", so it can be a program name with args.
4911 +set dummy as; ac_word=$2
4912 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4913 +$as_echo_n "checking for $ac_word... " >&6; }
4914 +if ${ac_cv_prog_ac_ct_AS+:} false; then :
4915 + $as_echo_n "(cached) " >&6
4916 +else
4917 + if test -n "$ac_ct_AS"; then
4918 + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
4919 +else
4920 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4921 +for as_dir in $PATH
4923 + IFS=$as_save_IFS
4924 + test -z "$as_dir" && as_dir=.
4925 + for ac_exec_ext in '' $ac_executable_extensions; do
4926 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4927 + ac_cv_prog_ac_ct_AS="as"
4928 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4929 + break 2
4930 + fi
4931 +done
4932 + done
4933 +IFS=$as_save_IFS
4937 +ac_ct_AS=$ac_cv_prog_ac_ct_AS
4938 +if test -n "$ac_ct_AS"; then
4939 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
4940 +$as_echo "$ac_ct_AS" >&6; }
4941 +else
4942 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4943 +$as_echo "no" >&6; }
4946 + if test "x$ac_ct_AS" = x; then
4947 + AS=""
4948 + else
4949 + case $cross_compiling:$ac_tool_warned in
4950 +yes:)
4951 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
4952 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
4953 +ac_tool_warned=yes ;;
4954 +esac
4955 + AS=$ac_ct_AS
4956 + fi
4957 +else
4958 + AS="$ac_cv_prog_AS"
4961 +if test -n "$ac_tool_prefix"; then
4962 + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
4963 +set dummy ${ac_tool_prefix}ar; ac_word=$2
4964 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4965 +$as_echo_n "checking for $ac_word... " >&6; }
4966 +if ${ac_cv_prog_AR+:} false; then :
4967 + $as_echo_n "(cached) " >&6
4968 +else
4969 + if test -n "$AR"; then
4970 + ac_cv_prog_AR="$AR" # Let the user override the test.
4971 +else
4972 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4973 +for as_dir in $PATH
4975 + IFS=$as_save_IFS
4976 + test -z "$as_dir" && as_dir=.
4977 + for ac_exec_ext in '' $ac_executable_extensions; do
4978 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4979 + ac_cv_prog_AR="${ac_tool_prefix}ar"
4980 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4981 + break 2
4982 + fi
4983 +done
4984 + done
4985 +IFS=$as_save_IFS
4989 +AR=$ac_cv_prog_AR
4990 +if test -n "$AR"; then
4991 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
4992 +$as_echo "$AR" >&6; }
4993 +else
4994 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4995 +$as_echo "no" >&6; }
5000 +if test -z "$ac_cv_prog_AR"; then
5001 + ac_ct_AR=$AR
5002 + # Extract the first word of "ar", so it can be a program name with args.
5003 +set dummy ar; ac_word=$2
5004 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
5005 +$as_echo_n "checking for $ac_word... " >&6; }
5006 +if ${ac_cv_prog_ac_ct_AR+:} false; then :
5007 + $as_echo_n "(cached) " >&6
5008 +else
5009 + if test -n "$ac_ct_AR"; then
5010 + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
5011 +else
5012 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5013 +for as_dir in $PATH
5015 + IFS=$as_save_IFS
5016 + test -z "$as_dir" && as_dir=.
5017 + for ac_exec_ext in '' $ac_executable_extensions; do
5018 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5019 + ac_cv_prog_ac_ct_AR="ar"
5020 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
5021 + break 2
5022 + fi
5023 +done
5024 + done
5025 +IFS=$as_save_IFS
5029 +ac_ct_AR=$ac_cv_prog_ac_ct_AR
5030 +if test -n "$ac_ct_AR"; then
5031 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
5032 +$as_echo "$ac_ct_AR" >&6; }
5033 +else
5034 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
5035 +$as_echo "no" >&6; }
5038 + if test "x$ac_ct_AR" = x; then
5039 + AR=""
5040 + else
5041 + case $cross_compiling:$ac_tool_warned in
5042 +yes:)
5043 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
5044 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
5045 +ac_tool_warned=yes ;;
5046 +esac
5047 + AR=$ac_ct_AR
5048 + fi
5049 +else
5050 + AR="$ac_cv_prog_AR"
5053 +if test -n "$ac_tool_prefix"; then
5054 + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
5055 +set dummy ${ac_tool_prefix}ranlib; ac_word=$2
5056 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
5057 +$as_echo_n "checking for $ac_word... " >&6; }
5058 +if ${ac_cv_prog_RANLIB+:} false; then :
5059 + $as_echo_n "(cached) " >&6
5060 +else
5061 + if test -n "$RANLIB"; then
5062 + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
5063 +else
5064 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5065 +for as_dir in $PATH
5067 + IFS=$as_save_IFS
5068 + test -z "$as_dir" && as_dir=.
5069 + for ac_exec_ext in '' $ac_executable_extensions; do
5070 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5071 + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
5072 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
5073 + break 2
5074 + fi
5075 +done
5076 + done
5077 +IFS=$as_save_IFS
5081 +RANLIB=$ac_cv_prog_RANLIB
5082 +if test -n "$RANLIB"; then
5083 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
5084 +$as_echo "$RANLIB" >&6; }
5085 +else
5086 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
5087 +$as_echo "no" >&6; }
5092 +if test -z "$ac_cv_prog_RANLIB"; then
5093 + ac_ct_RANLIB=$RANLIB
5094 + # Extract the first word of "ranlib", so it can be a program name with args.
5095 +set dummy ranlib; ac_word=$2
5096 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
5097 +$as_echo_n "checking for $ac_word... " >&6; }
5098 +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
5099 + $as_echo_n "(cached) " >&6
5100 +else
5101 + if test -n "$ac_ct_RANLIB"; then
5102 + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
5103 +else
5104 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5105 +for as_dir in $PATH
5107 + IFS=$as_save_IFS
5108 + test -z "$as_dir" && as_dir=.
5109 + for ac_exec_ext in '' $ac_executable_extensions; do
5110 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5111 + ac_cv_prog_ac_ct_RANLIB="ranlib"
5112 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
5113 + break 2
5114 + fi
5115 +done
5116 + done
5117 +IFS=$as_save_IFS
5121 +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
5122 +if test -n "$ac_ct_RANLIB"; then
5123 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
5124 +$as_echo "$ac_ct_RANLIB" >&6; }
5125 +else
5126 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
5127 +$as_echo "no" >&6; }
5130 + if test "x$ac_ct_RANLIB" = x; then
5131 + RANLIB=":"
5132 + else
5133 + case $cross_compiling:$ac_tool_warned in
5134 +yes:)
5135 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
5136 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
5137 +ac_tool_warned=yes ;;
5138 +esac
5139 + RANLIB=$ac_ct_RANLIB
5140 + fi
5141 +else
5142 + RANLIB="$ac_cv_prog_RANLIB"
5145 +if test -n "$ac_tool_prefix"; then
5146 + # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
5147 +set dummy ${ac_tool_prefix}readelf; ac_word=$2
5148 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
5149 +$as_echo_n "checking for $ac_word... " >&6; }
5150 +if ${ac_cv_prog_READELF+:} false; then :
5151 + $as_echo_n "(cached) " >&6
5152 +else
5153 + if test -n "$READELF"; then
5154 + ac_cv_prog_READELF="$READELF" # Let the user override the test.
5155 +else
5156 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5157 +for as_dir in $PATH
5159 + IFS=$as_save_IFS
5160 + test -z "$as_dir" && as_dir=.
5161 + for ac_exec_ext in '' $ac_executable_extensions; do
5162 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5163 + ac_cv_prog_READELF="${ac_tool_prefix}readelf"
5164 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
5165 + break 2
5166 + fi
5167 +done
5168 + done
5169 +IFS=$as_save_IFS
5173 +READELF=$ac_cv_prog_READELF
5174 +if test -n "$READELF"; then
5175 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
5176 +$as_echo "$READELF" >&6; }
5177 +else
5178 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
5179 +$as_echo "no" >&6; }
5184 +if test -z "$ac_cv_prog_READELF"; then
5185 + ac_ct_READELF=$READELF
5186 + # Extract the first word of "readelf", so it can be a program name with args.
5187 +set dummy readelf; ac_word=$2
5188 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
5189 +$as_echo_n "checking for $ac_word... " >&6; }
5190 +if ${ac_cv_prog_ac_ct_READELF+:} false; then :
5191 + $as_echo_n "(cached) " >&6
5192 +else
5193 + if test -n "$ac_ct_READELF"; then
5194 + ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
5195 +else
5196 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5197 +for as_dir in $PATH
5199 + IFS=$as_save_IFS
5200 + test -z "$as_dir" && as_dir=.
5201 + for ac_exec_ext in '' $ac_executable_extensions; do
5202 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5203 + ac_cv_prog_ac_ct_READELF="readelf"
5204 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
5205 + break 2
5206 + fi
5207 +done
5208 + done
5209 +IFS=$as_save_IFS
5213 +ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
5214 +if test -n "$ac_ct_READELF"; then
5215 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
5216 +$as_echo "$ac_ct_READELF" >&6; }
5217 +else
5218 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
5219 +$as_echo "no" >&6; }
5222 + if test "x$ac_ct_READELF" = x; then
5223 + READELF=":"
5224 + else
5225 + case $cross_compiling:$ac_tool_warned in
5226 +yes:)
5227 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
5228 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
5229 +ac_tool_warned=yes ;;
5230 +esac
5231 + READELF=$ac_ct_READELF
5232 + fi
5233 +else
5234 + READELF="$ac_cv_prog_READELF"
5240 +# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */
5241 +ac_given_INSTALL=$INSTALL
5244 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
5245 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
5246 + # Check whether --enable-maintainer-mode was given.
5247 +if test "${enable_maintainer_mode+set}" = set; then :
5248 + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
5249 +else
5250 + USE_MAINTAINER_MODE=no
5253 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
5254 +$as_echo "$USE_MAINTAINER_MODE" >&6; }
5255 + if test $USE_MAINTAINER_MODE = yes; then
5256 + MAINTAINER_MODE_TRUE=
5257 + MAINTAINER_MODE_FALSE='#'
5258 +else
5259 + MAINTAINER_MODE_TRUE='#'
5260 + MAINTAINER_MODE_FALSE=
5263 + MAINT=$MAINTAINER_MODE_TRUE
5266 +# By default we simply use the C compiler to build assembly code.
5268 +test "${CCAS+set}" = set || CCAS=$CC
5269 +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
5274 +# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
5275 +# at least currently, we never actually build a program, so we never
5276 +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
5277 +# fails, because we are probably configuring with a cross compiler
5278 +# which can't create executables. So we include AC_EXEEXT to keep
5279 +# automake happy, but we don't execute it, since we don't care about
5280 +# the result.
5281 +if false; then
5283 + dummy_var=1
5286 +. ${newlib_basedir}/configure.host
5288 +newlib_cflags="${newlib_cflags} -fno-builtin"
5290 +NEWLIB_CFLAGS=${newlib_cflags}
5293 +NO_INCLUDE_LIST=${noinclude}
5296 +LDFLAGS=${ldflags}
5299 + if test x${newlib_elix_level} = x0; then
5300 + ELIX_LEVEL_0_TRUE=
5301 + ELIX_LEVEL_0_FALSE='#'
5302 +else
5303 + ELIX_LEVEL_0_TRUE='#'
5304 + ELIX_LEVEL_0_FALSE=
5307 + if test x${newlib_elix_level} = x1; then
5308 + ELIX_LEVEL_1_TRUE=
5309 + ELIX_LEVEL_1_FALSE='#'
5310 +else
5311 + ELIX_LEVEL_1_TRUE='#'
5312 + ELIX_LEVEL_1_FALSE=
5315 + if test x${newlib_elix_level} = x2; then
5316 + ELIX_LEVEL_2_TRUE=
5317 + ELIX_LEVEL_2_FALSE='#'
5318 +else
5319 + ELIX_LEVEL_2_TRUE='#'
5320 + ELIX_LEVEL_2_FALSE=
5323 + if test x${newlib_elix_level} = x3; then
5324 + ELIX_LEVEL_3_TRUE=
5325 + ELIX_LEVEL_3_FALSE='#'
5326 +else
5327 + ELIX_LEVEL_3_TRUE='#'
5328 + ELIX_LEVEL_3_FALSE=
5331 + if test x${newlib_elix_level} = x4; then
5332 + ELIX_LEVEL_4_TRUE=
5333 + ELIX_LEVEL_4_FALSE='#'
5334 +else
5335 + ELIX_LEVEL_4_TRUE='#'
5336 + ELIX_LEVEL_4_FALSE=
5340 + if test x${use_libtool} = xyes; then
5341 + USE_LIBTOOL_TRUE=
5342 + USE_LIBTOOL_FALSE='#'
5343 +else
5344 + USE_LIBTOOL_TRUE='#'
5345 + USE_LIBTOOL_FALSE=
5349 +# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
5350 +# use oext, which is set in configure.host based on the target platform.
5351 +OBJEXT=${oext}
5363 +ac_config_files="$ac_config_files Makefile"
5365 +cat >confcache <<\_ACEOF
5366 +# This file is a shell script that caches the results of configure
5367 +# tests run on this system so they can be shared between configure
5368 +# scripts and configure runs, see configure's option --config-cache.
5369 +# It is not useful on other systems. If it contains results you don't
5370 +# want to keep, you may remove or edit it.
5372 +# config.status only pays attention to the cache file if you give it
5373 +# the --recheck option to rerun configure.
5375 +# `ac_cv_env_foo' variables (set or unset) will be overridden when
5376 +# loading this file, other *unset* `ac_cv_foo' will be assigned the
5377 +# following values.
5379 +_ACEOF
5381 +# The following way of writing the cache mishandles newlines in values,
5382 +# but we know of no workaround that is simple, portable, and efficient.
5383 +# So, we kill variables containing newlines.
5384 +# Ultrix sh set writes to stderr and can't be redirected directly,
5385 +# and sets the high bit in the cache file unless we assign to the vars.
5387 + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
5388 + eval ac_val=\$$ac_var
5389 + case $ac_val in #(
5390 + *${as_nl}*)
5391 + case $ac_var in #(
5392 + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
5393 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
5394 + esac
5395 + case $ac_var in #(
5396 + _ | IFS | as_nl) ;; #(
5397 + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
5398 + *) { eval $ac_var=; unset $ac_var;} ;;
5399 + esac ;;
5400 + esac
5401 + done
5403 + (set) 2>&1 |
5404 + case $as_nl`(ac_space=' '; set) 2>&1` in #(
5405 + *${as_nl}ac_space=\ *)
5406 + # `set' does not quote correctly, so add quotes: double-quote
5407 + # substitution turns \\\\ into \\, and sed turns \\ into \.
5408 + sed -n \
5409 + "s/'/'\\\\''/g;
5410 + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
5411 + ;; #(
5412 + *)
5413 + # `set' quotes correctly as required by POSIX, so do not add quotes.
5414 + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
5415 + ;;
5416 + esac |
5417 + sort
5418 +) |
5419 + sed '
5420 + /^ac_cv_env_/b end
5421 + t clear
5422 + :clear
5423 + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
5424 + t end
5425 + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
5426 + :end' >>confcache
5427 +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
5428 + if test -w "$cache_file"; then
5429 + if test "x$cache_file" != "x/dev/null"; then
5430 + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
5431 +$as_echo "$as_me: updating cache $cache_file" >&6;}
5432 + if test ! -f "$cache_file" || test -h "$cache_file"; then
5433 + cat confcache >"$cache_file"
5434 + else
5435 + case $cache_file in #(
5436 + */* | ?:*)
5437 + mv -f confcache "$cache_file"$$ &&
5438 + mv -f "$cache_file"$$ "$cache_file" ;; #(
5439 + *)
5440 + mv -f confcache "$cache_file" ;;
5441 + esac
5442 + fi
5443 + fi
5444 + else
5445 + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
5446 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
5447 + fi
5449 +rm -f confcache
5451 +test "x$prefix" = xNONE && prefix=$ac_default_prefix
5452 +# Let make expand exec_prefix.
5453 +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
5455 +# Transform confdefs.h into DEFS.
5456 +# Protect against shell expansion while executing Makefile rules.
5457 +# Protect against Makefile macro expansion.
5459 +# If the first sed substitution is executed (which looks for macros that
5460 +# take arguments), then branch to the quote section. Otherwise,
5461 +# look for a macro that doesn't take arguments.
5462 +ac_script='
5463 +:mline
5464 +/\\$/{
5466 + s,\\\n,,
5467 + b mline
5469 +t clear
5470 +:clear
5471 +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
5472 +t quote
5473 +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
5474 +t quote
5475 +b any
5476 +:quote
5477 +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
5478 +s/\[/\\&/g
5479 +s/\]/\\&/g
5480 +s/\$/$$/g
5482 +:any
5485 + s/^\n//
5486 + s/\n/ /g
5490 +DEFS=`sed -n "$ac_script" confdefs.h`
5493 +ac_libobjs=
5494 +ac_ltlibobjs=
5496 +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
5497 + # 1. Remove the extension, and $U if already installed.
5498 + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
5499 + ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
5500 + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
5501 + # will be set to the directory where LIBOBJS objects are built.
5502 + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
5503 + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
5504 +done
5505 +LIBOBJS=$ac_libobjs
5507 +LTLIBOBJS=$ac_ltlibobjs
5510 +if test -z "${MAY_SUPPLY_SYSCALLS_TRUE}" && test -z "${MAY_SUPPLY_SYSCALLS_FALSE}"; then
5511 + as_fn_error $? "conditional \"MAY_SUPPLY_SYSCALLS\" was never defined.
5512 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5515 +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
5516 + as_fn_error $? "conditional \"AMDEP\" was never defined.
5517 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5519 +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
5520 + as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
5521 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5523 +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
5524 + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
5525 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5527 +if test -z "${ELIX_LEVEL_0_TRUE}" && test -z "${ELIX_LEVEL_0_FALSE}"; then
5528 + as_fn_error $? "conditional \"ELIX_LEVEL_0\" was never defined.
5529 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5531 +if test -z "${ELIX_LEVEL_1_TRUE}" && test -z "${ELIX_LEVEL_1_FALSE}"; then
5532 + as_fn_error $? "conditional \"ELIX_LEVEL_1\" was never defined.
5533 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5535 +if test -z "${ELIX_LEVEL_2_TRUE}" && test -z "${ELIX_LEVEL_2_FALSE}"; then
5536 + as_fn_error $? "conditional \"ELIX_LEVEL_2\" was never defined.
5537 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5539 +if test -z "${ELIX_LEVEL_3_TRUE}" && test -z "${ELIX_LEVEL_3_FALSE}"; then
5540 + as_fn_error $? "conditional \"ELIX_LEVEL_3\" was never defined.
5541 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5543 +if test -z "${ELIX_LEVEL_4_TRUE}" && test -z "${ELIX_LEVEL_4_FALSE}"; then
5544 + as_fn_error $? "conditional \"ELIX_LEVEL_4\" was never defined.
5545 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5547 +if test -z "${USE_LIBTOOL_TRUE}" && test -z "${USE_LIBTOOL_FALSE}"; then
5548 + as_fn_error $? "conditional \"USE_LIBTOOL\" was never defined.
5549 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
5552 +: "${CONFIG_STATUS=./config.status}"
5553 +ac_write_fail=0
5554 +ac_clean_files_save=$ac_clean_files
5555 +ac_clean_files="$ac_clean_files $CONFIG_STATUS"
5556 +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
5557 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
5558 +as_write_fail=0
5559 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
5560 +#! $SHELL
5561 +# Generated by $as_me.
5562 +# Run this file to recreate the current configuration.
5563 +# Compiler output produced by configure, useful for debugging
5564 +# configure, is in config.log if it exists.
5566 +debug=false
5567 +ac_cs_recheck=false
5568 +ac_cs_silent=false
5570 +SHELL=\${CONFIG_SHELL-$SHELL}
5571 +export SHELL
5572 +_ASEOF
5573 +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
5574 +## -------------------- ##
5575 +## M4sh Initialization. ##
5576 +## -------------------- ##
5578 +# Be more Bourne compatible
5579 +DUALCASE=1; export DUALCASE # for MKS sh
5580 +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
5581 + emulate sh
5582 + NULLCMD=:
5583 + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
5584 + # is contrary to our usage. Disable this feature.
5585 + alias -g '${1+"$@"}'='"$@"'
5586 + setopt NO_GLOB_SUBST
5587 +else
5588 + case `(set -o) 2>/dev/null` in #(
5589 + *posix*) :
5590 + set -o posix ;; #(
5591 + *) :
5592 + ;;
5593 +esac
5597 +as_nl='
5599 +export as_nl
5600 +# Printing a long string crashes Solaris 7 /usr/bin/printf.
5601 +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
5602 +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
5603 +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
5604 +# Prefer a ksh shell builtin over an external printf program on Solaris,
5605 +# but without wasting forks for bash or zsh.
5606 +if test -z "$BASH_VERSION$ZSH_VERSION" \
5607 + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
5608 + as_echo='print -r --'
5609 + as_echo_n='print -rn --'
5610 +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
5611 + as_echo='printf %s\n'
5612 + as_echo_n='printf %s'
5613 +else
5614 + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
5615 + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
5616 + as_echo_n='/usr/ucb/echo -n'
5617 + else
5618 + as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
5619 + as_echo_n_body='eval
5620 + arg=$1;
5621 + case $arg in #(
5622 + *"$as_nl"*)
5623 + expr "X$arg" : "X\\(.*\\)$as_nl";
5624 + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
5625 + esac;
5626 + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
5628 + export as_echo_n_body
5629 + as_echo_n='sh -c $as_echo_n_body as_echo'
5630 + fi
5631 + export as_echo_body
5632 + as_echo='sh -c $as_echo_body as_echo'
5635 +# The user is always right.
5636 +if test "${PATH_SEPARATOR+set}" != set; then
5637 + PATH_SEPARATOR=:
5638 + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
5639 + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
5640 + PATH_SEPARATOR=';'
5645 +# IFS
5646 +# We need space, tab and new line, in precisely that order. Quoting is
5647 +# there to prevent editors from complaining about space-tab.
5648 +# (If _AS_PATH_WALK were called with IFS unset, it would disable word
5649 +# splitting by setting IFS to empty value.)
5650 +IFS=" "" $as_nl"
5652 +# Find who we are. Look in the path if we contain no directory separator.
5653 +as_myself=
5654 +case $0 in #((
5655 + *[\\/]* ) as_myself=$0 ;;
5656 + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5657 +for as_dir in $PATH
5659 + IFS=$as_save_IFS
5660 + test -z "$as_dir" && as_dir=.
5661 + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
5662 + done
5663 +IFS=$as_save_IFS
5665 + ;;
5666 +esac
5667 +# We did not find ourselves, most probably we were run as `sh COMMAND'
5668 +# in which case we are not to be found in the path.
5669 +if test "x$as_myself" = x; then
5670 + as_myself=$0
5672 +if test ! -f "$as_myself"; then
5673 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
5674 + exit 1
5677 +# Unset variables that we do not need and which cause bugs (e.g. in
5678 +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
5679 +# suppresses any "Segmentation fault" message there. '((' could
5680 +# trigger a bug in pdksh 5.2.14.
5681 +for as_var in BASH_ENV ENV MAIL MAILPATH
5682 +do eval test x\${$as_var+set} = xset \
5683 + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
5684 +done
5685 +PS1='$ '
5686 +PS2='> '
5687 +PS4='+ '
5689 +# NLS nuisances.
5690 +LC_ALL=C
5691 +export LC_ALL
5692 +LANGUAGE=C
5693 +export LANGUAGE
5695 +# CDPATH.
5696 +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5699 +# as_fn_error STATUS ERROR [LINENO LOG_FD]
5700 +# ----------------------------------------
5701 +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
5702 +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
5703 +# script with STATUS, using 1 if that was 0.
5704 +as_fn_error ()
5706 + as_status=$1; test $as_status -eq 0 && as_status=1
5707 + if test "$4"; then
5708 + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
5709 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
5710 + fi
5711 + $as_echo "$as_me: error: $2" >&2
5712 + as_fn_exit $as_status
5713 +} # as_fn_error
5716 +# as_fn_set_status STATUS
5717 +# -----------------------
5718 +# Set $? to STATUS, without forking.
5719 +as_fn_set_status ()
5721 + return $1
5722 +} # as_fn_set_status
5724 +# as_fn_exit STATUS
5725 +# -----------------
5726 +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
5727 +as_fn_exit ()
5729 + set +e
5730 + as_fn_set_status $1
5731 + exit $1
5732 +} # as_fn_exit
5734 +# as_fn_unset VAR
5735 +# ---------------
5736 +# Portably unset VAR.
5737 +as_fn_unset ()
5739 + { eval $1=; unset $1;}
5741 +as_unset=as_fn_unset
5742 +# as_fn_append VAR VALUE
5743 +# ----------------------
5744 +# Append the text in VALUE to the end of the definition contained in VAR. Take
5745 +# advantage of any shell optimizations that allow amortized linear growth over
5746 +# repeated appends, instead of the typical quadratic growth present in naive
5747 +# implementations.
5748 +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
5749 + eval 'as_fn_append ()
5751 + eval $1+=\$2
5752 + }'
5753 +else
5754 + as_fn_append ()
5756 + eval $1=\$$1\$2
5758 +fi # as_fn_append
5760 +# as_fn_arith ARG...
5761 +# ------------------
5762 +# Perform arithmetic evaluation on the ARGs, and store the result in the
5763 +# global $as_val. Take advantage of shells that can avoid forks. The arguments
5764 +# must be portable across $(()) and expr.
5765 +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
5766 + eval 'as_fn_arith ()
5768 + as_val=$(( $* ))
5769 + }'
5770 +else
5771 + as_fn_arith ()
5773 + as_val=`expr "$@" || test $? -eq 1`
5775 +fi # as_fn_arith
5778 +if expr a : '\(a\)' >/dev/null 2>&1 &&
5779 + test "X`expr 00001 : '.*\(...\)'`" = X001; then
5780 + as_expr=expr
5781 +else
5782 + as_expr=false
5785 +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
5786 + as_basename=basename
5787 +else
5788 + as_basename=false
5791 +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
5792 + as_dirname=dirname
5793 +else
5794 + as_dirname=false
5797 +as_me=`$as_basename -- "$0" ||
5798 +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
5799 + X"$0" : 'X\(//\)$' \| \
5800 + X"$0" : 'X\(/\)' \| . 2>/dev/null ||
5801 +$as_echo X/"$0" |
5802 + sed '/^.*\/\([^/][^/]*\)\/*$/{
5803 + s//\1/
5806 + /^X\/\(\/\/\)$/{
5807 + s//\1/
5810 + /^X\/\(\/\).*/{
5811 + s//\1/
5814 + s/.*/./; q'`
5816 +# Avoid depending upon Character Ranges.
5817 +as_cr_letters='abcdefghijklmnopqrstuvwxyz'
5818 +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
5819 +as_cr_Letters=$as_cr_letters$as_cr_LETTERS
5820 +as_cr_digits='0123456789'
5821 +as_cr_alnum=$as_cr_Letters$as_cr_digits
5823 +ECHO_C= ECHO_N= ECHO_T=
5824 +case `echo -n x` in #(((((
5825 +-n*)
5826 + case `echo 'xy\c'` in
5827 + *c*) ECHO_T=' ';; # ECHO_T is single tab character.
5828 + xy) ECHO_C='\c';;
5829 + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
5830 + ECHO_T=' ';;
5831 + esac;;
5833 + ECHO_N='-n';;
5834 +esac
5836 +rm -f conf$$ conf$$.exe conf$$.file
5837 +if test -d conf$$.dir; then
5838 + rm -f conf$$.dir/conf$$.file
5839 +else
5840 + rm -f conf$$.dir
5841 + mkdir conf$$.dir 2>/dev/null
5843 +if (echo >conf$$.file) 2>/dev/null; then
5844 + if ln -s conf$$.file conf$$ 2>/dev/null; then
5845 + as_ln_s='ln -s'
5846 + # ... but there are two gotchas:
5847 + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
5848 + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
5849 + # In both cases, we have to default to `cp -p'.
5850 + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
5851 + as_ln_s='cp -p'
5852 + elif ln conf$$.file conf$$ 2>/dev/null; then
5853 + as_ln_s=ln
5854 + else
5855 + as_ln_s='cp -p'
5856 + fi
5857 +else
5858 + as_ln_s='cp -p'
5860 +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
5861 +rmdir conf$$.dir 2>/dev/null
5864 +# as_fn_mkdir_p
5865 +# -------------
5866 +# Create "$as_dir" as a directory, including parents if necessary.
5867 +as_fn_mkdir_p ()
5870 + case $as_dir in #(
5871 + -*) as_dir=./$as_dir;;
5872 + esac
5873 + test -d "$as_dir" || eval $as_mkdir_p || {
5874 + as_dirs=
5875 + while :; do
5876 + case $as_dir in #(
5877 + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
5878 + *) as_qdir=$as_dir;;
5879 + esac
5880 + as_dirs="'$as_qdir' $as_dirs"
5881 + as_dir=`$as_dirname -- "$as_dir" ||
5882 +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5883 + X"$as_dir" : 'X\(//\)[^/]' \| \
5884 + X"$as_dir" : 'X\(//\)$' \| \
5885 + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
5886 +$as_echo X"$as_dir" |
5887 + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
5888 + s//\1/
5891 + /^X\(\/\/\)[^/].*/{
5892 + s//\1/
5895 + /^X\(\/\/\)$/{
5896 + s//\1/
5899 + /^X\(\/\).*/{
5900 + s//\1/
5903 + s/.*/./; q'`
5904 + test -d "$as_dir" && break
5905 + done
5906 + test -z "$as_dirs" || eval "mkdir $as_dirs"
5907 + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
5910 +} # as_fn_mkdir_p
5911 +if mkdir -p . 2>/dev/null; then
5912 + as_mkdir_p='mkdir -p "$as_dir"'
5913 +else
5914 + test -d ./-p && rmdir ./-p
5915 + as_mkdir_p=false
5918 +if test -x / >/dev/null 2>&1; then
5919 + as_test_x='test -x'
5920 +else
5921 + if ls -dL / >/dev/null 2>&1; then
5922 + as_ls_L_option=L
5923 + else
5924 + as_ls_L_option=
5925 + fi
5926 + as_test_x='
5927 + eval sh -c '\''
5928 + if test -d "$1"; then
5929 + test -d "$1/.";
5930 + else
5931 + case $1 in #(
5932 + -*)set "./$1";;
5933 + esac;
5934 + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
5935 + ???[sx]*):;;*)false;;esac;fi
5936 + '\'' sh
5939 +as_executable_p=$as_test_x
5941 +# Sed expression to map a string onto a valid CPP name.
5942 +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
5944 +# Sed expression to map a string onto a valid variable name.
5945 +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
5948 +exec 6>&1
5949 +## ----------------------------------- ##
5950 +## Main body of $CONFIG_STATUS script. ##
5951 +## ----------------------------------- ##
5952 +_ASEOF
5953 +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
5955 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
5956 +# Save the log message, to keep $0 and so on meaningful, and to
5957 +# report actual input values of CONFIG_FILES etc. instead of their
5958 +# values after options handling.
5959 +ac_log="
5960 +This file was extended by newlib $as_me 1.20.0, which was
5961 +generated by GNU Autoconf 2.68. Invocation command line was
5963 + CONFIG_FILES = $CONFIG_FILES
5964 + CONFIG_HEADERS = $CONFIG_HEADERS
5965 + CONFIG_LINKS = $CONFIG_LINKS
5966 + CONFIG_COMMANDS = $CONFIG_COMMANDS
5967 + $ $0 $@
5969 +on `(hostname || uname -n) 2>/dev/null | sed 1q`
5972 +_ACEOF
5974 +case $ac_config_files in *"
5975 +"*) set x $ac_config_files; shift; ac_config_files=$*;;
5976 +esac
5980 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
5981 +# Files that config.status was made for.
5982 +config_files="$ac_config_files"
5983 +config_commands="$ac_config_commands"
5985 +_ACEOF
5987 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
5988 +ac_cs_usage="\
5989 +\`$as_me' instantiates files and other configuration actions
5990 +from templates according to the current configuration. Unless the files
5991 +and actions are specified as TAGs, all are instantiated by default.
5993 +Usage: $0 [OPTION]... [TAG]...
5995 + -h, --help print this help, then exit
5996 + -V, --version print version number and configuration settings, then exit
5997 + --config print configuration, then exit
5998 + -q, --quiet, --silent
5999 + do not print progress messages
6000 + -d, --debug don't remove temporary files
6001 + --recheck update $as_me by reconfiguring in the same conditions
6002 + --file=FILE[:TEMPLATE]
6003 + instantiate the configuration file FILE
6005 +Configuration files:
6006 +$config_files
6008 +Configuration commands:
6009 +$config_commands
6011 +Report bugs to the package provider."
6013 +_ACEOF
6014 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6015 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
6016 +ac_cs_version="\\
6017 +newlib config.status 1.20.0
6018 +configured by $0, generated by GNU Autoconf 2.68,
6019 + with options \\"\$ac_cs_config\\"
6021 +Copyright (C) 2010 Free Software Foundation, Inc.
6022 +This config.status script is free software; the Free Software Foundation
6023 +gives unlimited permission to copy, distribute and modify it."
6025 +ac_pwd='$ac_pwd'
6026 +srcdir='$srcdir'
6027 +INSTALL='$INSTALL'
6028 +MKDIR_P='$MKDIR_P'
6029 +AWK='$AWK'
6030 +test -n "\$AWK" || AWK=awk
6031 +_ACEOF
6033 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6034 +# The default lists apply if the user does not specify any file.
6035 +ac_need_defaults=:
6036 +while test $# != 0
6038 + case $1 in
6039 + --*=?*)
6040 + ac_option=`expr "X$1" : 'X\([^=]*\)='`
6041 + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
6042 + ac_shift=:
6043 + ;;
6044 + --*=)
6045 + ac_option=`expr "X$1" : 'X\([^=]*\)='`
6046 + ac_optarg=
6047 + ac_shift=:
6048 + ;;
6049 + *)
6050 + ac_option=$1
6051 + ac_optarg=$2
6052 + ac_shift=shift
6053 + ;;
6054 + esac
6056 + case $ac_option in
6057 + # Handling of the options.
6058 + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
6059 + ac_cs_recheck=: ;;
6060 + --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
6061 + $as_echo "$ac_cs_version"; exit ;;
6062 + --config | --confi | --conf | --con | --co | --c )
6063 + $as_echo "$ac_cs_config"; exit ;;
6064 + --debug | --debu | --deb | --de | --d | -d )
6065 + debug=: ;;
6066 + --file | --fil | --fi | --f )
6067 + $ac_shift
6068 + case $ac_optarg in
6069 + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
6070 + '') as_fn_error $? "missing file argument" ;;
6071 + esac
6072 + as_fn_append CONFIG_FILES " '$ac_optarg'"
6073 + ac_need_defaults=false;;
6074 + --he | --h | --help | --hel | -h )
6075 + $as_echo "$ac_cs_usage"; exit ;;
6076 + -q | -quiet | --quiet | --quie | --qui | --qu | --q \
6077 + | -silent | --silent | --silen | --sile | --sil | --si | --s)
6078 + ac_cs_silent=: ;;
6080 + # This is an error.
6081 + -*) as_fn_error $? "unrecognized option: \`$1'
6082 +Try \`$0 --help' for more information." ;;
6084 + *) as_fn_append ac_config_targets " $1"
6085 + ac_need_defaults=false ;;
6087 + esac
6088 + shift
6089 +done
6091 +ac_configure_extra_args=
6093 +if $ac_cs_silent; then
6094 + exec 6>/dev/null
6095 + ac_configure_extra_args="$ac_configure_extra_args --silent"
6098 +_ACEOF
6099 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6100 +if \$ac_cs_recheck; then
6101 + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
6102 + shift
6103 + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
6104 + CONFIG_SHELL='$SHELL'
6105 + export CONFIG_SHELL
6106 + exec "\$@"
6109 +_ACEOF
6110 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6111 +exec 5>>config.log
6113 + echo
6114 + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
6115 +## Running $as_me. ##
6116 +_ASBOX
6117 + $as_echo "$ac_log"
6118 +} >&5
6120 +_ACEOF
6121 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6123 +# INIT-COMMANDS
6125 +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
6127 +_ACEOF
6129 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6131 +# Handling of arguments.
6132 +for ac_config_target in $ac_config_targets
6134 + case $ac_config_target in
6135 + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
6136 + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
6138 + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
6139 + esac
6140 +done
6143 +# If the user did not use the arguments to specify the items to instantiate,
6144 +# then the envvar interface is used. Set only those that are not.
6145 +# We use the long form for the default assignment because of an extremely
6146 +# bizarre bug on SunOS 4.1.3.
6147 +if $ac_need_defaults; then
6148 + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
6149 + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
6152 +# Have a temporary directory for convenience. Make it in the build tree
6153 +# simply because there is no reason against having it here, and in addition,
6154 +# creating and moving files from /tmp can sometimes cause problems.
6155 +# Hook for its removal unless debugging.
6156 +# Note that there is a small window in which the directory will not be cleaned:
6157 +# after its creation but before its name has been assigned to `$tmp'.
6158 +$debug ||
6160 + tmp= ac_tmp=
6161 + trap 'exit_status=$?
6162 + : "${ac_tmp:=$tmp}"
6163 + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
6164 +' 0
6165 + trap 'as_fn_exit 1' 1 2 13 15
6167 +# Create a (secure) tmp directory for tmp files.
6170 + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
6171 + test -d "$tmp"
6172 +} ||
6174 + tmp=./conf$$-$RANDOM
6175 + (umask 077 && mkdir "$tmp")
6176 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
6177 +ac_tmp=$tmp
6179 +# Set up the scripts for CONFIG_FILES section.
6180 +# No need to generate them if there are no CONFIG_FILES.
6181 +# This happens for instance with `./config.status config.h'.
6182 +if test -n "$CONFIG_FILES"; then
6185 +ac_cr=`echo X | tr X '\015'`
6186 +# On cygwin, bash can eat \r inside `` if the user requested igncr.
6187 +# But we know of no other shell where ac_cr would be empty at this
6188 +# point, so we can use a bashism as a fallback.
6189 +if test "x$ac_cr" = x; then
6190 + eval ac_cr=\$\'\\r\'
6192 +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
6193 +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
6194 + ac_cs_awk_cr='\\r'
6195 +else
6196 + ac_cs_awk_cr=$ac_cr
6199 +echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
6200 +_ACEOF
6204 + echo "cat >conf$$subs.awk <<_ACEOF" &&
6205 + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
6206 + echo "_ACEOF"
6207 +} >conf$$subs.sh ||
6208 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
6209 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
6210 +ac_delim='%!_!# '
6211 +for ac_last_try in false false false false false :; do
6212 + . ./conf$$subs.sh ||
6213 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
6215 + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
6216 + if test $ac_delim_n = $ac_delim_num; then
6217 + break
6218 + elif $ac_last_try; then
6219 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
6220 + else
6221 + ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
6222 + fi
6223 +done
6224 +rm -f conf$$subs.sh
6226 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6227 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
6228 +_ACEOF
6229 +sed -n '
6231 +s/^/S["/; s/!.*/"]=/
6234 +s/^[^!]*!//
6235 +:repl
6236 +t repl
6237 +s/'"$ac_delim"'$//
6238 +t delim
6239 +:nl
6241 +s/\(.\{148\}\)..*/\1/
6242 +t more1
6243 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
6246 +b repl
6247 +:more1
6248 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/
6251 +s/.\{148\}//
6252 +t nl
6253 +:delim
6255 +s/\(.\{148\}\)..*/\1/
6256 +t more2
6257 +s/["\\]/\\&/g; s/^/"/; s/$/"/
6260 +:more2
6261 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/
6264 +s/.\{148\}//
6265 +t delim
6266 +' <conf$$subs.awk | sed '
6267 +/^[^""]/{
6269 + s/\n//
6271 +' >>$CONFIG_STATUS || ac_write_fail=1
6272 +rm -f conf$$subs.awk
6273 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6274 +_ACAWK
6275 +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
6276 + for (key in S) S_is_set[key] = 1
6277 + FS = "\a"
6281 + line = $ 0
6282 + nfields = split(line, field, "@")
6283 + substed = 0
6284 + len = length(field[1])
6285 + for (i = 2; i < nfields; i++) {
6286 + key = field[i]
6287 + keylen = length(key)
6288 + if (S_is_set[key]) {
6289 + value = S[key]
6290 + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
6291 + len += length(value) + length(field[++i])
6292 + substed = 1
6293 + } else
6294 + len += 1 + keylen
6297 + print line
6300 +_ACAWK
6301 +_ACEOF
6302 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6303 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
6304 + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
6305 +else
6306 + cat
6307 +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
6308 + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
6309 +_ACEOF
6311 +# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
6312 +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
6313 +# trailing colons and then remove the whole line if VPATH becomes empty
6314 +# (actually we leave an empty line to preserve line numbers).
6315 +if test "x$srcdir" = x.; then
6316 + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
6318 +s///
6319 +s/^/:/
6320 +s/[ ]*$/:/
6321 +s/:\$(srcdir):/:/g
6322 +s/:\${srcdir}:/:/g
6323 +s/:@srcdir@:/:/g
6324 +s/^:*//
6325 +s/:*$//
6327 +s/\(=[ ]*\).*/\1/
6329 +s/\n//
6330 +s/^[^=]*=[ ]*$//
6334 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6335 +fi # test -n "$CONFIG_FILES"
6338 +eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
6339 +shift
6340 +for ac_tag
6342 + case $ac_tag in
6343 + :[FHLC]) ac_mode=$ac_tag; continue;;
6344 + esac
6345 + case $ac_mode$ac_tag in
6346 + :[FHL]*:*);;
6347 + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
6348 + :[FH]-) ac_tag=-:-;;
6349 + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
6350 + esac
6351 + ac_save_IFS=$IFS
6352 + IFS=:
6353 + set x $ac_tag
6354 + IFS=$ac_save_IFS
6355 + shift
6356 + ac_file=$1
6357 + shift
6359 + case $ac_mode in
6360 + :L) ac_source=$1;;
6361 + :[FH])
6362 + ac_file_inputs=
6363 + for ac_f
6364 + do
6365 + case $ac_f in
6366 + -) ac_f="$ac_tmp/stdin";;
6367 + *) # Look for the file first in the build tree, then in the source tree
6368 + # (if the path is not absolute). The absolute path cannot be DOS-style,
6369 + # because $ac_f cannot contain `:'.
6370 + test -f "$ac_f" ||
6371 + case $ac_f in
6372 + [\\/$]*) false;;
6373 + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
6374 + esac ||
6375 + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
6376 + esac
6377 + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
6378 + as_fn_append ac_file_inputs " '$ac_f'"
6379 + done
6381 + # Let's still pretend it is `configure' which instantiates (i.e., don't
6382 + # use $as_me), people would be surprised to read:
6383 + # /* config.h. Generated by config.status. */
6384 + configure_input='Generated from '`
6385 + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
6386 + `' by configure.'
6387 + if test x"$ac_file" != x-; then
6388 + configure_input="$ac_file. $configure_input"
6389 + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
6390 +$as_echo "$as_me: creating $ac_file" >&6;}
6391 + fi
6392 + # Neutralize special characters interpreted by sed in replacement strings.
6393 + case $configure_input in #(
6394 + *\&* | *\|* | *\\* )
6395 + ac_sed_conf_input=`$as_echo "$configure_input" |
6396 + sed 's/[\\\\&|]/\\\\&/g'`;; #(
6397 + *) ac_sed_conf_input=$configure_input;;
6398 + esac
6400 + case $ac_tag in
6401 + *:-:* | *:-) cat >"$ac_tmp/stdin" \
6402 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
6403 + esac
6404 + ;;
6405 + esac
6407 + ac_dir=`$as_dirname -- "$ac_file" ||
6408 +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
6409 + X"$ac_file" : 'X\(//\)[^/]' \| \
6410 + X"$ac_file" : 'X\(//\)$' \| \
6411 + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
6412 +$as_echo X"$ac_file" |
6413 + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
6414 + s//\1/
6417 + /^X\(\/\/\)[^/].*/{
6418 + s//\1/
6421 + /^X\(\/\/\)$/{
6422 + s//\1/
6425 + /^X\(\/\).*/{
6426 + s//\1/
6429 + s/.*/./; q'`
6430 + as_dir="$ac_dir"; as_fn_mkdir_p
6431 + ac_builddir=.
6433 +case "$ac_dir" in
6434 +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
6436 + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
6437 + # A ".." for each directory in $ac_dir_suffix.
6438 + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
6439 + case $ac_top_builddir_sub in
6440 + "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
6441 + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
6442 + esac ;;
6443 +esac
6444 +ac_abs_top_builddir=$ac_pwd
6445 +ac_abs_builddir=$ac_pwd$ac_dir_suffix
6446 +# for backward compatibility:
6447 +ac_top_builddir=$ac_top_build_prefix
6449 +case $srcdir in
6450 + .) # We are building in place.
6451 + ac_srcdir=.
6452 + ac_top_srcdir=$ac_top_builddir_sub
6453 + ac_abs_top_srcdir=$ac_pwd ;;
6454 + [\\/]* | ?:[\\/]* ) # Absolute name.
6455 + ac_srcdir=$srcdir$ac_dir_suffix;
6456 + ac_top_srcdir=$srcdir
6457 + ac_abs_top_srcdir=$srcdir ;;
6458 + *) # Relative name.
6459 + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
6460 + ac_top_srcdir=$ac_top_build_prefix$srcdir
6461 + ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
6462 +esac
6463 +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
6466 + case $ac_mode in
6467 + :F)
6469 + # CONFIG_FILE
6472 + case $INSTALL in
6473 + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
6474 + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
6475 + esac
6476 + ac_MKDIR_P=$MKDIR_P
6477 + case $MKDIR_P in
6478 + [\\/$]* | ?:[\\/]* ) ;;
6479 + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
6480 + esac
6481 +_ACEOF
6483 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6484 +# If the template does not know about datarootdir, expand it.
6485 +# FIXME: This hack should be removed a few years after 2.60.
6486 +ac_datarootdir_hack=; ac_datarootdir_seen=
6487 +ac_sed_dataroot='
6488 +/datarootdir/ {
6492 +/@datadir@/p
6493 +/@docdir@/p
6494 +/@infodir@/p
6495 +/@localedir@/p
6496 +/@mandir@/p'
6497 +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
6498 +*datarootdir*) ac_datarootdir_seen=yes;;
6499 +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
6500 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
6501 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
6502 +_ACEOF
6503 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6504 + ac_datarootdir_hack='
6505 + s&@datadir@&$datadir&g
6506 + s&@docdir@&$docdir&g
6507 + s&@infodir@&$infodir&g
6508 + s&@localedir@&$localedir&g
6509 + s&@mandir@&$mandir&g
6510 + s&\\\${datarootdir}&$datarootdir&g' ;;
6511 +esac
6512 +_ACEOF
6514 +# Neutralize VPATH when `$srcdir' = `.'.
6515 +# Shell code in configure.ac might set extrasub.
6516 +# FIXME: do we really want to maintain this feature?
6517 +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6518 +ac_sed_extra="$ac_vpsub
6519 +$extrasub
6520 +_ACEOF
6521 +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6523 +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
6524 +s|@configure_input@|$ac_sed_conf_input|;t t
6525 +s&@top_builddir@&$ac_top_builddir_sub&;t t
6526 +s&@top_build_prefix@&$ac_top_build_prefix&;t t
6527 +s&@srcdir@&$ac_srcdir&;t t
6528 +s&@abs_srcdir@&$ac_abs_srcdir&;t t
6529 +s&@top_srcdir@&$ac_top_srcdir&;t t
6530 +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
6531 +s&@builddir@&$ac_builddir&;t t
6532 +s&@abs_builddir@&$ac_abs_builddir&;t t
6533 +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
6534 +s&@INSTALL@&$ac_INSTALL&;t t
6535 +s&@MKDIR_P@&$ac_MKDIR_P&;t t
6536 +$ac_datarootdir_hack
6538 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
6539 + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
6541 +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
6542 + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
6543 + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
6544 + "$ac_tmp/out"`; test -z "$ac_out"; } &&
6545 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
6546 +which seems to be undefined. Please make sure it is defined" >&5
6547 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
6548 +which seems to be undefined. Please make sure it is defined" >&2;}
6550 + rm -f "$ac_tmp/stdin"
6551 + case $ac_file in
6552 + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
6553 + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
6554 + esac \
6555 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5
6556 + ;;
6559 + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
6560 +$as_echo "$as_me: executing $ac_file commands" >&6;}
6561 + ;;
6562 + esac
6565 + case $ac_file$ac_mode in
6566 + "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
6567 + # Autoconf 2.62 quotes --file arguments for eval, but not when files
6568 + # are listed without --file. Let's play safe and only enable the eval
6569 + # if we detect the quoting.
6570 + case $CONFIG_FILES in
6571 + *\'*) eval set x "$CONFIG_FILES" ;;
6572 + *) set x $CONFIG_FILES ;;
6573 + esac
6574 + shift
6575 + for mf
6576 + do
6577 + # Strip MF so we end up with the name of the file.
6578 + mf=`echo "$mf" | sed -e 's/:.*$//'`
6579 + # Check whether this is an Automake generated Makefile or not.
6580 + # We used to match only the files named `Makefile.in', but
6581 + # some people rename them; so instead we look at the file content.
6582 + # Grep'ing the first line is not enough: some people post-process
6583 + # each Makefile.in and add a new line on top of each file to say so.
6584 + # Grep'ing the whole file is not good either: AIX grep has a line
6585 + # limit of 2048, but all sed's we know have understand at least 4000.
6586 + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
6587 + dirpart=`$as_dirname -- "$mf" ||
6588 +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
6589 + X"$mf" : 'X\(//\)[^/]' \| \
6590 + X"$mf" : 'X\(//\)$' \| \
6591 + X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
6592 +$as_echo X"$mf" |
6593 + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
6594 + s//\1/
6597 + /^X\(\/\/\)[^/].*/{
6598 + s//\1/
6601 + /^X\(\/\/\)$/{
6602 + s//\1/
6605 + /^X\(\/\).*/{
6606 + s//\1/
6609 + s/.*/./; q'`
6610 + else
6611 + continue
6612 + fi
6613 + # Extract the definition of DEPDIR, am__include, and am__quote
6614 + # from the Makefile without running `make'.
6615 + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
6616 + test -z "$DEPDIR" && continue
6617 + am__include=`sed -n 's/^am__include = //p' < "$mf"`
6618 + test -z "am__include" && continue
6619 + am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
6620 + # When using ansi2knr, U may be empty or an underscore; expand it
6621 + U=`sed -n 's/^U = //p' < "$mf"`
6622 + # Find all dependency output files, they are included files with
6623 + # $(DEPDIR) in their names. We invoke sed twice because it is the
6624 + # simplest approach to changing $(DEPDIR) to its actual value in the
6625 + # expansion.
6626 + for file in `sed -n "
6627 + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
6628 + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
6629 + # Make sure the directory exists.
6630 + test -f "$dirpart/$file" && continue
6631 + fdir=`$as_dirname -- "$file" ||
6632 +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
6633 + X"$file" : 'X\(//\)[^/]' \| \
6634 + X"$file" : 'X\(//\)$' \| \
6635 + X"$file" : 'X\(/\)' \| . 2>/dev/null ||
6636 +$as_echo X"$file" |
6637 + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
6638 + s//\1/
6641 + /^X\(\/\/\)[^/].*/{
6642 + s//\1/
6645 + /^X\(\/\/\)$/{
6646 + s//\1/
6649 + /^X\(\/\).*/{
6650 + s//\1/
6653 + s/.*/./; q'`
6654 + as_dir=$dirpart/$fdir; as_fn_mkdir_p
6655 + # echo "creating $dirpart/$file"
6656 + echo '# dummy' > "$dirpart/$file"
6657 + done
6658 + done
6660 + ;;
6662 + esac
6663 +done # for ac_tag
6666 +as_fn_exit 0
6667 +_ACEOF
6668 +ac_clean_files=$ac_clean_files_save
6670 +test $ac_write_fail = 0 ||
6671 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
6674 +# configure is writing to config.log, and then calls config.status.
6675 +# config.status does its own redirection, appending to config.log.
6676 +# Unfortunately, on DOS this fails, as config.log is still kept open
6677 +# by configure, so config.status won't be able to write to it; its
6678 +# output is simply discarded. So we exec the FD to /dev/null,
6679 +# effectively closing config.log, so it can be properly (re)opened and
6680 +# appended to by config.status. When coming back to configure, we
6681 +# need to make the FD available again.
6682 +if test "$no_create" != yes; then
6683 + ac_cs_success=:
6684 + ac_config_status_args=
6685 + test "$silent" = yes &&
6686 + ac_config_status_args="$ac_config_status_args --quiet"
6687 + exec 5>/dev/null
6688 + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
6689 + exec 5>>config.log
6690 + # Use ||, not &&, to avoid exiting from the if with $? = 1, which
6691 + # would make configure fail if this is the last instruction.
6692 + $ac_cs_success || as_fn_exit 1
6694 +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
6695 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
6696 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
6699 diff --git a/newlib/libc/sys/psp/configure.in b/newlib/libc/sys/psp/configure.in
6700 new file mode 100644
6701 index 000000000..eb11b09a3
6702 --- /dev/null
6703 +++ b/newlib/libc/sys/psp/configure.in
6704 @@ -0,0 +1,14 @@
6705 +dnl This is the newlib/libc/sys/sun4 configure.in file.
6706 +dnl Process this file with autoconf to produce a configure script.
6708 +AC_PREREQ(2.59)
6709 +AC_INIT([newlib],[NEWLIB_VERSION])
6710 +AC_CONFIG_SRCDIR([libcglue.c])
6712 +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
6713 +AC_CONFIG_AUX_DIR(../../../..)
6715 +NEWLIB_CONFIGURE(../../..)
6717 +AC_CONFIG_FILES(Makefile)
6718 +AC_OUTPUT
6719 diff --git a/newlib/libc/sys/psp/crt0.c b/newlib/libc/sys/psp/crt0.c
6720 new file mode 100644
6721 index 000000000..af6712c20
6722 --- /dev/null
6723 +++ b/newlib/libc/sys/psp/crt0.c
6724 @@ -0,0 +1,3 @@
6725 +/* The real crt0.c lives in PSPSDK. */
6727 +void _start() { }
6728 diff --git a/newlib/libc/sys/psp/fdman.c b/newlib/libc/sys/psp/fdman.c
6729 new file mode 100644
6730 index 000000000..d7af4014d
6731 --- /dev/null
6732 +++ b/newlib/libc/sys/psp/fdman.c
6733 @@ -0,0 +1,115 @@
6735 + * PSP Software Development Kit - http://www.pspdev.org
6736 + * -----------------------------------------------------------------------
6737 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
6739 + * fdman.c - File descriptor management.
6741 + * Copyright (c) 2006 Rafael Cabezas <rafpsp@gmail.com>
6742 + */
6743 +#include <psptypes.h>
6744 +#include <errno.h>
6745 +#include "fdman.h"
6747 +extern int pspDisableInterrupts();
6748 +extern void pspEnableInterrupts(int);
6750 +static __psp_descriptormap_type __psp_descriptor_data_pool[__PSP_FILENO_MAX];
6751 +__psp_descriptormap_type *__psp_descriptormap [__PSP_FILENO_MAX];
6753 +void __psp_fdman_init()
6755 + int scefd;
6757 + /* Initialize descriptor data*/
6758 + memset(__psp_descriptor_data_pool, 0, sizeof(__psp_descriptormap_type) *__PSP_FILENO_MAX);
6759 + /* Initialize descriptor map*/
6760 + memset(__psp_descriptormap, 0, sizeof(__psp_descriptormap_type*)*__PSP_FILENO_MAX);
6762 + scefd = sceKernelStdin();
6763 + if (scefd >= 0) {
6764 + __psp_descriptormap[0] = &__psp_descriptor_data_pool[0];
6765 + __psp_descriptormap[0]->sce_descriptor = scefd;
6766 + __psp_descriptormap[0]->type = __PSP_DESCRIPTOR_TYPE_TTY;
6768 + scefd = sceKernelStdout();
6769 + if (scefd >= 0) {
6770 + __psp_descriptormap[1] = &__psp_descriptor_data_pool[1];
6771 + __psp_descriptormap[1]->sce_descriptor = scefd;
6772 + __psp_descriptormap[1]->type = __PSP_DESCRIPTOR_TYPE_TTY;
6774 + scefd = sceKernelStderr();
6775 + if (scefd >= 0) {
6776 + __psp_descriptormap[2] = &__psp_descriptor_data_pool[2];
6777 + __psp_descriptormap[2]->sce_descriptor = scefd;
6778 + __psp_descriptormap[2]->type = __PSP_DESCRIPTOR_TYPE_TTY;
6782 +int __psp_fdman_get_new_descriptor()
6784 + int i = 0;
6785 + int inten;
6787 + inten = pspDisableInterrupts(); /* lock here to make thread safe */
6788 + for (i = 0; i < __PSP_FILENO_MAX; i++) {
6789 + if (__psp_descriptormap[i] == NULL) {
6790 + __psp_descriptormap[i] = &__psp_descriptor_data_pool[i];
6791 + __psp_descriptormap[i]->ref_count++;
6792 + pspEnableInterrupts(inten); /* release lock */
6793 + return i;
6796 + pspEnableInterrupts(inten); /* release lock */
6798 + errno = ENOMEM;
6799 + return -1;
6802 +int __psp_fdman_get_dup_descriptor(int fd)
6804 + int i = 0;
6805 + int inten;
6807 + if (!__PSP_IS_FD_VALID(fd)) {
6808 + errno = EBADF;
6809 + return -1;
6812 + inten = pspDisableInterrupts(); /* lock here to make thread safe */
6813 + for (i = 0; i < __PSP_FILENO_MAX; i++) {
6814 + if (__psp_descriptormap[i] == NULL) {
6815 + __psp_descriptormap[i] = &__psp_descriptor_data_pool[fd];
6816 + __psp_descriptormap[i]->ref_count++;
6817 + pspEnableInterrupts(inten); /* release lock */
6818 + return i;
6821 + pspEnableInterrupts(inten); /* release lock */
6823 + errno = ENOMEM;
6824 + return -1;
6827 +void __psp_fdman_release_descriptor(int fd)
6829 + if (!__PSP_IS_FD_VALID(fd)) {
6830 + errno = EBADF;
6831 + return;
6834 + __psp_descriptormap[fd]->ref_count--;
6836 + if (__psp_descriptormap[fd]->ref_count == 0) {
6838 + if (__psp_descriptormap[fd]->filename != NULL) {
6839 + free(__psp_descriptormap[fd]->filename);
6841 + __psp_descriptormap[fd]->filename = NULL;
6842 + __psp_descriptormap[fd]->sce_descriptor = 0;
6843 + __psp_descriptormap[fd]->type = 0;
6844 + __psp_descriptormap[fd]->flags = 0;
6847 + __psp_descriptormap[fd] = NULL;
6849 diff --git a/newlib/libc/sys/psp/fdman.h b/newlib/libc/sys/psp/fdman.h
6850 new file mode 100644
6851 index 000000000..d3a90b25e
6852 --- /dev/null
6853 +++ b/newlib/libc/sys/psp/fdman.h
6854 @@ -0,0 +1,44 @@
6856 + * PSP Software Development Kit - http://www.pspdev.org
6857 + * -----------------------------------------------------------------------
6858 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
6860 + * fdman.h - File descriptor management.
6862 + * Copyright (c) 2006 Rafael Cabezas <rafpsp@gmail.com>
6863 + */
6865 +#ifndef _FDMAN_H_
6866 + #define _FDMAN_H_
6868 + #define __PSP_FILENO_MAX 1024
6870 + #define __PSP_IS_FD_VALID(FD) \
6871 + ( (FD >= 0) && (FD < __PSP_FILENO_MAX) && (__psp_descriptormap[FD] != NULL) )
6873 + #define __PSP_IS_FD_OF_TYPE(FD, TYPE) \
6874 + ( (__PSP_IS_FD_VALID(FD)) && (__psp_descriptormap[FD]->type == TYPE) )
6876 + typedef enum {
6877 + __PSP_DESCRIPTOR_TYPE_FILE ,
6878 + __PSP_DESCRIPTOR_TYPE_PIPE ,
6879 + __PSP_DESCRIPTOR_TYPE_SOCKET,
6880 + __PSP_DESCRIPTOR_TYPE_TTY
6881 + } __psp_fdman_fd_types;
6883 + typedef struct {
6884 + char * filename;
6885 + u8 type;
6886 + u32 sce_descriptor;
6887 + u32 flags;
6888 + u32 ref_count;
6889 + } __psp_descriptormap_type;
6891 + extern __psp_descriptormap_type *__psp_descriptormap[__PSP_FILENO_MAX];
6893 + void __psp_fdman_init();
6894 + int __psp_fdman_get_new_descriptor();
6895 + int __psp_fdman_get_dup_descriptor(int fd);
6896 + void __psp_fdman_release_descriptor(int fd);
6898 +#endif
6899 diff --git a/newlib/libc/sys/psp/include/netdb.h b/newlib/libc/sys/psp/include/netdb.h
6900 new file mode 100644
6901 index 000000000..bb8cdb4df
6902 --- /dev/null
6903 +++ b/newlib/libc/sys/psp/include/netdb.h
6904 @@ -0,0 +1,36 @@
6905 +/* Simple gethostbyname and gethostbyaddr replacements, note not thread safe */
6906 +#ifndef __NETDB_H__
6907 +#define __NETDB_H__
6909 +#ifdef __cplusplus
6910 +extern "C" {
6911 +#endif
6913 +#define NETDB_INTERNAL -1 /* see errno */
6914 +#define NETDB_SUCCESS 0 /* no problem */
6915 +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
6916 +#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
6917 +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
6918 +#define NO_DATA 4 /* Valid name, no data record of requested type */
6919 +#define NO_ADDRESS NO_DATA /* no address, look for MX record */
6921 +extern int h_errno;
6923 +struct hostent
6925 + char *h_name;
6926 + char **h_aliases;
6927 + int h_addrtype;
6928 + int h_length;
6929 + char **h_addr_list;
6930 + char *h_addr;
6933 +struct hostent *gethostbyaddr(const void *addr, int len, int type);
6934 +struct hostent *gethostbyname(const char *name);
6936 +#ifdef __cplusplus
6938 +#endif
6940 +#endif
6941 diff --git a/newlib/libc/sys/psp/interrupt.S b/newlib/libc/sys/psp/interrupt.S
6942 new file mode 100644
6943 index 000000000..e0d7668ea
6944 --- /dev/null
6945 +++ b/newlib/libc/sys/psp/interrupt.S
6946 @@ -0,0 +1,66 @@
6948 + .set noreorder
6949 + .set noat
6951 + .global pspDisableInterrupts
6952 + .ent pspDisableInterrupts
6954 +pspDisableInterrupts:
6955 + mfic $v0, $0
6956 + mtic $0, $0
6957 + nop
6958 + nop
6959 + nop
6960 + nop
6961 + nop
6962 + nop
6963 + nop
6964 + nop
6965 + nop
6966 + nop
6967 + nop
6968 + nop
6969 + nop
6970 + nop
6971 + nop
6972 + nop
6973 + nop
6974 + nop
6975 + nop
6976 + nop
6977 + nop
6978 + jr $ra
6979 + nop
6981 + .end pspDisableInterrupts
6983 + .global pspEnableInterrupts
6984 + .ent pspEnableInterrupts
6986 +pspEnableInterrupts:
6987 + mtic $a0, $0
6988 + nop
6989 + nop
6990 + nop
6991 + nop
6992 + nop
6993 + nop
6994 + nop
6995 + nop
6996 + nop
6997 + nop
6998 + nop
6999 + nop
7000 + nop
7001 + nop
7002 + nop
7003 + nop
7004 + nop
7005 + nop
7006 + nop
7007 + nop
7008 + nop
7009 + jr $ra
7010 + nop
7012 + .end pspEnableInterrupts
7013 diff --git a/newlib/libc/sys/psp/libcglue.c b/newlib/libc/sys/psp/libcglue.c
7014 new file mode 100644
7015 index 000000000..fa00b4966
7016 --- /dev/null
7017 +++ b/newlib/libc/sys/psp/libcglue.c
7018 @@ -0,0 +1,969 @@
7020 + * PSP Software Development Kit - http://www.pspdev.org
7021 + * -----------------------------------------------------------------------
7022 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
7024 + * libcglue.c - Newlib-compatible system calls.
7026 + * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
7027 + * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
7028 + * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
7029 + * Copyright (c) 2005 Jim Paris <jim@jtan.com>
7030 + *
7031 + */
7032 +#include <errno.h>
7033 +#include <malloc.h>
7034 +#include <reent.h>
7035 +#include <stdarg.h>
7036 +#include <stdlib.h>
7037 +#include <string.h>
7038 +#include <time.h>
7039 +#include <sys/fcntl.h>
7040 +#include <sys/stat.h>
7041 +#include <sys/time.h>
7042 +#include <sys/types.h>
7043 +#include <sys/unistd.h>
7044 +#include <sys/dirent.h>
7045 +#include <sys/socket.h>
7047 +#include <psptypes.h>
7048 +#include <pspiofilemgr.h>
7049 +#include <pspmodulemgr.h>
7050 +#include <pspsysmem.h>
7051 +#include <pspthreadman.h>
7052 +#include <psputils.h>
7053 +#include <psputility.h>
7054 +#include <pspstdio.h>
7055 +#include <pspintrman.h>
7056 +#include "fdman.h"
7058 +extern char __psp_cwd[MAXPATHLEN + 1];
7059 +extern void __psp_init_cwd(char *argv_0);
7060 +extern int __psp_path_absolute(const char *in, char *out, int len);
7061 +extern int pspDisableInterrupts();
7062 +extern void pspEnableInterrupts(int);
7064 +/* The following functions are defined in socket.c. They have weak linkage so
7065 + that the user doesn't have to link against the PSP network libraries if they
7066 + don't use the sockets API. */
7067 +extern int __psp_socket_close(int s) __attribute__((weak));
7068 +extern ssize_t __psp_socket_recv(int s, void *buf, size_t len, int flags) __attribute__((weak));
7069 +extern ssize_t __psp_socket_send(int s, const void *buf, size_t len, int flags) __attribute__((weak));
7071 +extern int pipe(int fildes[2]);
7072 +extern int __psp_pipe_close(int filedes);
7073 +extern int __psp_pipe_nonblocking_read(int fd, void *buf, size_t len);
7074 +extern int __psp_pipe_read(int fd, void *buf, size_t len);
7075 +extern int __psp_pipe_write(int fd, const void *buf, size_t size);
7076 +extern int __psp_pipe_nonblocking_write(int fd, const void *buf, size_t len);
7078 +int __psp_set_errno(int code);
7080 +#ifdef F___psp_set_errno
7081 +int __psp_set_errno(int code)
7083 + if ((code & 0x80010000) == 0x80010000) {
7084 + errno = code & 0xFFFF;
7085 + return -1;
7087 + return code;
7089 +#endif
7091 +#ifdef F_getcwd
7092 +char *getcwd(char *buf, size_t size)
7094 + if(!buf) {
7095 + errno = EINVAL;
7096 + return NULL;
7097 + }
7099 + if(strlen(__psp_cwd) >= size) {
7100 + errno = ERANGE;
7101 + return NULL;
7104 + strcpy(buf, __psp_cwd);
7105 + return buf;
7107 +#endif
7109 +#ifdef F_chdir
7110 +int chdir(const char *path)
7112 + char dest[MAXPATHLEN + 1];
7113 + SceUID uid;
7115 + if(__psp_path_absolute(path, dest, MAXPATHLEN) < 0) {
7116 + errno = ENAMETOOLONG;
7117 + return -1;
7120 + /* sceIoChdir doesn't give an indication of whether it worked,
7121 + so test for existence by attempting to open the dir */
7122 + uid = sceIoDopen(dest);
7123 + if(uid < 0) {
7124 + errno = ENOTDIR;
7125 + return -1;
7127 + sceIoDclose(uid);
7129 + sceIoChdir(dest);
7130 + strcpy(__psp_cwd, dest);
7131 + return 0;
7133 +#endif
7135 +#ifdef F_mkdir
7136 +int mkdir(const char *pathname, mode_t mode)
7138 + char dest[MAXPATHLEN + 1];
7140 + if(__psp_path_absolute(pathname, dest, MAXPATHLEN) < 0) {
7141 + errno = ENAMETOOLONG;
7142 + return -1;
7145 + return __psp_set_errno(sceIoMkdir(dest, mode));
7147 +#endif
7149 +#ifdef F_rmdir
7150 +int rmdir(const char *pathname)
7152 + char dest[MAXPATHLEN + 1];
7154 + if(__psp_path_absolute(pathname, dest, MAXPATHLEN) < 0) {
7155 + errno = ENAMETOOLONG;
7156 + return -1;
7159 + return __psp_set_errno(sceIoRmdir(dest));
7161 +#endif
7163 +#ifdef F_realpath
7164 +char *realpath(const char *path, char *resolved_path)
7166 + if(!path || !resolved_path) {
7167 + errno = EINVAL;
7168 + return NULL;
7170 + if(__psp_path_absolute(path, resolved_path, MAXPATHLEN) < 0) {
7171 + errno = ENAMETOOLONG;
7172 + return NULL;
7174 + if(access(resolved_path, F_OK) < 0) {
7175 + errno = ENOENT;
7176 + return NULL;
7178 + return resolved_path;
7180 +#endif
7182 +/* Wrappers of the standard open(), close(), read(), write(), unlink() and lseek() routines. */
7183 +#ifdef F__open
7184 +int _open(const char *name, int flags, int mode)
7186 + int scefd, fd;
7187 + int sce_flags;
7188 + char dest[MAXPATHLEN + 1];
7190 + if(__psp_path_absolute(name, dest, MAXPATHLEN) < 0) {
7191 + errno = ENAMETOOLONG;
7192 + return -1;
7195 + /* O_RDONLY starts at 0, where PSP_O_RDONLY starts at 1, so remap the read/write
7196 + flags by adding 1. */
7197 + sce_flags = (flags & O_ACCMODE) + 1;
7199 + /* Translate standard open flags into the flags understood by the PSP kernel. */
7200 + if (flags & O_APPEND) {
7201 + sce_flags |= PSP_O_APPEND;
7203 + if (flags & O_CREAT) {
7204 + sce_flags |= PSP_O_CREAT;
7206 + if (flags & O_TRUNC) {
7207 + sce_flags |= PSP_O_TRUNC;
7209 + if (flags & O_EXCL) {
7210 + sce_flags |= PSP_O_EXCL;
7212 + if (flags & O_NONBLOCK) {
7213 + sce_flags |= PSP_O_NBLOCK;
7216 + scefd = sceIoOpen(dest, sce_flags, mode);
7217 + if (scefd >= 0) {
7218 + fd = __psp_fdman_get_new_descriptor();
7219 + if (fd != -1) {
7220 + __psp_descriptormap[fd]->sce_descriptor = scefd;
7221 + __psp_descriptormap[fd]->type = __PSP_DESCRIPTOR_TYPE_FILE;
7222 + __psp_descriptormap[fd]->flags = flags;
7223 + __psp_descriptormap[fd]->filename = strdup(dest);
7224 + return fd;
7226 + else {
7227 + sceIoClose(scefd);
7228 + errno = ENOMEM;
7229 + return -1;
7231 + }
7232 + else {
7233 + return __psp_set_errno(scefd);
7237 +#endif
7239 +#ifdef F__close
7240 +int _close(int fd)
7242 + int ret = 0;
7244 + if (!__PSP_IS_FD_VALID(fd)) {
7245 + errno = EBADF;
7246 + return -1;
7249 + switch(__psp_descriptormap[fd]->type)
7251 + case __PSP_DESCRIPTOR_TYPE_FILE:
7252 + case __PSP_DESCRIPTOR_TYPE_TTY:
7253 + if (__psp_descriptormap[fd]->ref_count == 1) {
7254 + ret = __psp_set_errno(sceIoClose(__psp_descriptormap[fd]->sce_descriptor));
7256 + __psp_fdman_release_descriptor(fd);
7257 + return ret;
7258 + break;
7259 + case __PSP_DESCRIPTOR_TYPE_PIPE:
7260 + return __psp_pipe_close(fd);
7261 + break;
7262 + case __PSP_DESCRIPTOR_TYPE_SOCKET:
7263 + if (__psp_socket_close != NULL) {
7264 + ret = __psp_socket_close(fd);
7265 + return ret;
7267 + break;
7268 + default:
7269 + break;
7272 + errno = EBADF;
7273 + return -1;
7275 +#endif
7277 +#ifdef F__read
7278 +int _read(int fd, void *buf, size_t size)
7280 + if (!__PSP_IS_FD_VALID(fd)) {
7281 + errno = EBADF;
7282 + return -1;
7285 + switch(__psp_descriptormap[fd]->type)
7287 + case __PSP_DESCRIPTOR_TYPE_FILE:
7288 + case __PSP_DESCRIPTOR_TYPE_TTY:
7289 + return __psp_set_errno(sceIoRead(__psp_descriptormap[fd]->sce_descriptor, buf, size));
7290 + break;
7291 + case __PSP_DESCRIPTOR_TYPE_PIPE:
7292 + if (__psp_descriptormap[fd]->flags & O_NONBLOCK) {
7293 + return __psp_pipe_nonblocking_read(fd, buf, size);
7295 + else {
7296 + return __psp_pipe_read(fd, buf, size);
7298 + break;
7299 + case __PSP_DESCRIPTOR_TYPE_SOCKET:
7300 + if (__psp_socket_recv != NULL) {
7301 + return __psp_socket_recv(fd, buf, size, 0);
7303 + break;
7304 + default:
7305 + break;
7308 + errno = EBADF;
7309 + return -1;
7312 +#endif
7314 +#ifdef F__write
7315 +int _write(int fd, const void *buf, size_t size)
7317 + if (!__PSP_IS_FD_VALID(fd)) {
7318 + errno = EBADF;
7319 + return -1;
7322 + switch(__psp_descriptormap[fd]->type)
7324 + case __PSP_DESCRIPTOR_TYPE_FILE:
7325 + case __PSP_DESCRIPTOR_TYPE_TTY:
7326 + return __psp_set_errno(sceIoWrite(__psp_descriptormap[fd]->sce_descriptor, buf, size));
7327 + break;
7328 + case __PSP_DESCRIPTOR_TYPE_PIPE:
7329 + if (__psp_descriptormap[fd]->flags & O_NONBLOCK) {
7330 + return __psp_pipe_nonblocking_write(fd, buf, size);
7332 + else {
7333 + return __psp_pipe_write(fd, buf, size);
7335 + break;
7336 + break;
7337 + case __PSP_DESCRIPTOR_TYPE_SOCKET:
7338 + if (__psp_socket_send != NULL) {
7339 + return __psp_socket_send(fd, buf, size, 0);
7341 + break;
7342 + default:
7343 + break;
7346 + errno = EBADF;
7347 + return -1;
7349 +#endif
7351 +#ifdef F__lseek
7352 +off_t _lseek(int fd, off_t offset, int whence)
7354 + if (!__PSP_IS_FD_VALID(fd)) {
7355 + errno = EBADF;
7356 + return -1;
7359 + switch(__psp_descriptormap[fd]->type)
7361 + case __PSP_DESCRIPTOR_TYPE_FILE:
7362 + /* We don't have to do anything with the whence argument because SEEK_* == PSP_SEEK_*. */
7363 + return (off_t) __psp_set_errno(sceIoLseek(__psp_descriptormap[fd]->sce_descriptor, offset, whence));
7364 + break;
7365 + case __PSP_DESCRIPTOR_TYPE_PIPE:
7366 + break;
7367 + case __PSP_DESCRIPTOR_TYPE_SOCKET:
7368 + break;
7369 + default:
7370 + break;
7373 + errno = EBADF;
7374 + return -1;
7377 +#endif
7379 +#ifdef F__unlink
7380 +int _unlink(const char *path)
7382 + char dest[MAXPATHLEN + 1];
7384 + if(__psp_path_absolute(path, dest, MAXPATHLEN) < 0) {
7385 + errno = ENAMETOOLONG;
7386 + return -1;
7389 + return __psp_set_errno(sceIoRemove(dest));
7391 +#endif
7393 +#ifdef F__link
7394 +int _link(const char *name1, const char *name2)
7396 + errno = ENOSYS;
7397 + return -1; /* not supported */
7399 +#endif
7401 +#ifdef F_opendir
7402 +DIR *opendir(const char *filename)
7404 + char dest[MAXPATHLEN + 1];
7405 + DIR *dirp;
7406 + SceUID uid;
7408 + /* Normalize pathname so that opendir(".") works */
7409 + if(__psp_path_absolute(filename, dest, MAXPATHLEN) < 0) {
7410 + errno = ENOENT;
7411 + return NULL;
7414 + dirp = (DIR *)malloc(sizeof(DIR));
7416 + uid = sceIoDopen(dest);
7418 + if (uid < 0)
7420 + free(dirp);
7421 + (void) __psp_set_errno(uid);
7422 + return NULL;
7425 + dirp->uid = uid;
7427 + return dirp;
7429 +#endif
7431 +#ifdef F_readdir
7432 +struct dirent *readdir(DIR *dirp)
7434 + int ret;
7436 + /* Zero the dirent, to avoid possible problems with sceIoDread */
7437 + memset(&dirp->de, 0, sizeof(struct dirent));
7439 + ret = sceIoDread(dirp->uid, (SceIoDirent *)&dirp->de);
7440 + if (ret == 0) {
7441 + /* EOF */
7442 + errno = 0;
7443 + return NULL;
7445 + if (ret < 0) {
7446 + (void) __psp_set_errno(ret);
7447 + return NULL;
7450 + return &dirp->de;
7452 +#endif
7454 +#ifdef F_closedir
7455 +int closedir(DIR *dirp)
7457 + if (dirp != NULL)
7459 + int uid;
7460 + uid = dirp->uid;
7461 + free (dirp);
7462 + return __psp_set_errno(sceIoDclose(uid));
7464 + errno = EBADF;
7465 + return -1;
7467 +#endif
7469 +/* Time routines. These wrap around the routines provided by the kernel. */
7470 +#ifdef F__gettimeofday
7471 +int _gettimeofday(struct timeval *tp, struct timezone *tzp)
7473 + int ret;
7474 + time_t t;
7475 + struct timeval tv1, tv2;
7477 + /* The kernel sceKernelLibcGettimeofday only returns time
7478 + since midnight. To get a proper timeval return value, we
7479 + get seconds using sceKernelLibcTime and microseconds using
7480 + sceKernelLibcGettimeofday. Since we are reading the time
7481 + with two different function calls, we need to be careful
7482 + to avoid glitches when the time changes between calls. */
7484 + retry:
7485 + /* Get seconds and microseconds since midnight */
7486 + ret = __psp_set_errno(sceKernelLibcGettimeofday(&tv1, tzp));
7487 + if (ret < 0)
7488 + return ret;
7490 + /* Get seconds since epoch */
7491 + ret = __psp_set_errno(sceKernelLibcTime(&t));
7492 + if (ret < 0)
7493 + return ret;
7495 + /* Get seconds and microseconds since midnight, again */
7496 + ret = __psp_set_errno(sceKernelLibcGettimeofday(&tv2, tzp));
7497 + if (ret < 0)
7498 + return ret;
7500 + /* Retry if microseconds wrapped around */
7501 + if (tv2.tv_usec < tv1.tv_usec)
7502 + goto retry;
7504 + /* Return the actual time since epoch */
7505 + tp->tv_sec = t;
7506 + tp->tv_usec = tv2.tv_usec;
7508 + return 0;
7511 +#endif
7513 +#if defined(F_clock)
7514 +clock_t clock(void)
7516 + return sceKernelLibcClock();
7518 +#endif
7520 +#if defined(F_time)
7521 +time_t time(time_t *t)
7523 + return __psp_set_errno(sceKernelLibcTime(t));
7525 +#endif
7527 +#if defined(F_sleep)
7528 +unsigned int sleep(unsigned int secs) {
7529 + while(secs--) {
7530 + sceKernelDelayThreadCB(1000000);
7532 + return 0;
7534 +#endif
7536 +/* PSP-compatible sbrk(). */
7537 +#if defined(F__sbrk) || defined(F_glue__sbrk)
7539 +#define DEFAULT_PRX_HEAP_SIZE_KB 64
7541 +/* If defined it specifies the desired size of the heap, in KB. */
7542 +extern int sce_newlib_heap_kb_size __attribute__((weak));
7543 +extern int __pspsdk_is_prx __attribute__((weak));
7545 +/* UID of the memory block that represents the heap. */
7546 +static SceUID __psp_heap_blockid;
7548 +void * _sbrk(ptrdiff_t incr)
7550 + static void * heap_bottom = NULL;
7551 + static void * heap_top = NULL;
7552 + static void * heap_ptr = NULL;
7554 + /* Has our heap been initialized? */
7555 + if (heap_bottom == NULL) {
7556 + /* No, initialize the heap. */
7557 + SceSize heap_size = (SceSize) -1;
7559 + if (&sce_newlib_heap_kb_size != NULL) {
7560 + heap_size = sce_newlib_heap_kb_size;
7561 + } else if(&__pspsdk_is_prx != NULL) {
7562 + heap_size = DEFAULT_PRX_HEAP_SIZE_KB;
7565 + heap_size *= 1024;
7566 + if ((int)heap_size < 0) {
7567 + heap_size += sceKernelMaxFreeMemSize();
7570 + if (heap_size != 0) {
7571 + __psp_heap_blockid = sceKernelAllocPartitionMemory(2, "block", PSP_SMEM_Low, heap_size, NULL);
7572 + if (__psp_heap_blockid > 0) {
7573 + heap_bottom = sceKernelGetBlockHeadAddr(__psp_heap_blockid);
7574 + heap_ptr = heap_bottom;
7575 + heap_top = (unsigned char *) heap_bottom + heap_size;
7580 + void * heap_addr = (void *) -1;
7581 + void * next_heap_ptr = (void *) ((ptrdiff_t) heap_ptr + incr);
7582 + if ((heap_bottom != NULL) && (next_heap_ptr >= heap_bottom) && (next_heap_ptr < heap_top)) {
7583 + heap_addr = heap_ptr;
7584 + heap_ptr = next_heap_ptr;
7587 + return heap_addr;
7590 +/* Free the heap. */
7591 +int __psp_free_heap(void)
7593 + if (__psp_heap_blockid > 0) {
7594 + return sceKernelFreePartitionMemory(__psp_heap_blockid);
7597 + return __psp_heap_blockid;
7599 +#endif
7601 +/* Other POSIX routines that must be defined. */
7602 +#ifdef F__fstat
7603 +int _fstat(int fd, struct stat *sbuf)
7605 + int ret;
7606 + SceOff oldpos;
7607 + if (!__PSP_IS_FD_VALID(fd)) {
7608 + errno = EBADF;
7609 + return -1;
7612 + switch(__psp_descriptormap[fd]->type)
7614 + case __PSP_DESCRIPTOR_TYPE_TTY:
7615 + memset(sbuf, '\0', sizeof(struct stat));
7616 + sbuf->st_mode = S_IFCHR;
7617 + return 0;
7618 + break;
7619 + case __PSP_DESCRIPTOR_TYPE_FILE:
7620 + if (__psp_descriptormap[fd]->filename != NULL) {
7621 + ret = stat(__psp_descriptormap[fd]->filename, sbuf);
7623 + /* Find true size of the open file */
7624 + oldpos = sceIoLseek(__psp_descriptormap[fd]->sce_descriptor, 0, SEEK_CUR);
7625 + if (oldpos != (off_t) -1) {
7626 + sbuf->st_size = (off_t) sceIoLseek(__psp_descriptormap[fd]->sce_descriptor, 0, SEEK_END);
7627 + sceIoLseek(__psp_descriptormap[fd]->sce_descriptor, oldpos, SEEK_SET);
7629 + return ret;
7631 + break;
7632 + case __PSP_DESCRIPTOR_TYPE_PIPE:
7633 + case __PSP_DESCRIPTOR_TYPE_SOCKET:
7634 + default:
7635 + break;
7638 + errno = EBADF;
7639 + return -1;
7641 +#endif
7643 +#ifdef F_isatty
7644 +int isatty(int fd)
7646 + if (!__PSP_IS_FD_VALID(fd)) {
7647 + errno = EBADF;
7648 + return 0;
7651 + if (__psp_descriptormap[fd]->type == __PSP_DESCRIPTOR_TYPE_TTY) {
7652 + return 1;
7654 + else {
7655 + return 0;
7658 +#endif
7660 +#ifdef F__isatty
7661 +int _isatty(int fd)
7663 + return isatty(fd);
7665 +#endif
7667 +#ifdef F__stat
7668 +static time_t psp_to_epoch_time(ScePspDateTime psp_time)
7670 + struct tm conv_time;
7671 + conv_time.tm_year = psp_time.year;
7672 + conv_time.tm_mon = psp_time.month;
7673 + conv_time.tm_mday = psp_time.day;
7674 + conv_time.tm_hour = psp_time.hour;
7675 + conv_time.tm_min = psp_time.minute;
7676 + conv_time.tm_sec = psp_time.second;
7677 + conv_time.tm_isdst = -1;
7678 + return mktime(&conv_time);
7681 +int _stat(const char *filename, struct stat *buf)
7683 + SceIoStat psp_stat;
7684 + char dest[MAXPATHLEN + 1];
7685 + int ret;
7687 + if(__psp_path_absolute(filename, dest, MAXPATHLEN) < 0) {
7688 + errno = ENAMETOOLONG;
7689 + return -1;
7692 + memset(buf, '\0', sizeof(struct stat));
7693 + ret = sceIoGetstat(dest, &psp_stat);
7694 + if (ret < 0) {
7695 + return __psp_set_errno(ret);
7698 + buf->st_ctime = psp_to_epoch_time(psp_stat.sce_st_ctime);
7699 + buf->st_atime = psp_to_epoch_time(psp_stat.sce_st_atime);
7700 + buf->st_mtime = psp_to_epoch_time(psp_stat.sce_st_mtime);
7702 + buf->st_mode = (psp_stat.st_mode & 0xfff) |
7703 + ((FIO_S_ISLNK(psp_stat.st_mode))?(S_IFLNK):(0)) |
7704 + ((FIO_S_ISREG(psp_stat.st_mode))?(S_IFREG):(0)) |
7705 + ((FIO_S_ISDIR(psp_stat.st_mode))?(S_IFDIR):(0));
7706 + buf->st_size = psp_stat.st_size;
7707 + return 0;
7709 +#endif
7711 +/* from stat.h in ps2sdk, this function may be correct */
7712 +#define FIO_CST_SIZE 0x0004
7714 +#ifdef F_truncate
7715 +int truncate(const char *filename, off_t length)
7717 + SceIoStat psp_stat;
7718 + char dest[MAXPATHLEN + 1];
7720 + if(__psp_path_absolute(filename, dest, MAXPATHLEN) < 0) {
7721 + errno = ENAMETOOLONG;
7722 + return -1;
7725 + psp_stat.st_size = length;
7726 + if(length < 0)
7728 + errno = EINVAL;
7729 + return -1;
7731 + return __psp_set_errno(sceIoChstat(dest, &psp_stat, FIO_CST_SIZE));
7733 +#endif
7735 +/* Unsupported newlib system calls. */
7736 +#ifdef F__fork
7737 +pid_t fork(void)
7739 + errno = ENOSYS;
7740 + return (pid_t) -1;
7742 +#endif
7744 +#ifdef F__getpid
7745 +pid_t _getpid(void)
7747 + errno = ENOSYS;
7748 + return (pid_t) -1;
7750 +#endif
7752 +#ifdef F__kill
7753 +int _kill(int unused, int unused2)
7755 + errno = ENOSYS;
7756 + return -1;
7758 +#endif
7760 +#ifdef F__wait
7761 +pid_t _wait(int *unused)
7763 + errno = ENOSYS;
7764 + return (pid_t) -1;
7766 +#endif
7768 +#ifdef F_access
7769 +int access(const char *fn, int flags)
7771 + struct stat s;
7772 + if (stat(fn, &s))
7773 + return -1;
7774 + if (s.st_mode & S_IFDIR)
7775 + return 0;
7776 + if (flags & W_OK)
7778 + if (s.st_mode & S_IWRITE)
7779 + return 0;
7780 + errno = EACCES;
7781 + return -1;
7783 + return 0;
7785 +#endif
7787 +#ifdef F__fcntl
7788 +int _fcntl(int fd, int cmd, ...)
7790 + if (!__PSP_IS_FD_VALID(fd)) {
7791 + errno = EBADF;
7792 + return -1;
7795 + switch (cmd)
7797 + case F_DUPFD:
7799 + return __psp_fdman_get_dup_descriptor(fd);
7800 + break;
7802 + case F_GETFL:
7804 + return __psp_descriptormap[fd]->flags;
7805 + break;
7807 + case F_SETFL:
7809 + int newfl;
7810 + va_list args;
7812 + va_start (args, cmd); /* Initialize the argument list. */
7813 + newfl = va_arg(args, int);
7814 + va_end (args); /* Clean up. */
7816 + __psp_descriptormap[fd]->flags = newfl;
7818 + switch(__psp_descriptormap[fd]->type)
7820 + case __PSP_DESCRIPTOR_TYPE_FILE:
7821 + break;
7822 + case __PSP_DESCRIPTOR_TYPE_PIPE:
7823 + break;
7824 + case __PSP_DESCRIPTOR_TYPE_SOCKET:
7825 + if (newfl & O_NONBLOCK)
7827 + int one = 1;
7828 + return setsockopt(fd, SOL_SOCKET, SO_NONBLOCK, (char *)&one, sizeof(one));
7830 + else
7832 + int zero = 0;
7833 + return setsockopt(fd, SOL_SOCKET, SO_NONBLOCK, (char *)&zero, sizeof(zero));
7835 + break;
7836 + default:
7837 + break;
7839 + return 0;
7840 + break;
7844 + errno = EBADF;
7845 + return -1;
7847 +#endif /* F__fcntl */
7849 +#ifdef F_tzset
7850 +void tzset(void)
7852 + static int initialized = 0;
7854 + if (!initialized)
7856 + initialized = 1;
7858 + /* Don't init if TZ has already been set once, this probably means the user
7859 + wanted to override what we would set below. */
7860 + if (getenv("TZ") == NULL)
7862 + /* Initialize timezone from PSP configuration */
7863 + int tzOffset = 0;
7864 + sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_TIMEZONE, &tzOffset);
7865 + int tzOffsetAbs = tzOffset < 0 ? -tzOffset : tzOffset;
7866 + int hours = tzOffsetAbs / 60;
7867 + int minutes = tzOffsetAbs - hours * 60;
7868 + int pspDaylight = 0;
7869 + sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS, &pspDaylight);
7870 + static char tz[18];
7871 + sprintf(tz, "GMT%s%02i:%02i%s", tzOffset < 0 ? "+" : "-", hours, minutes, pspDaylight ? "daylight" : "");
7872 + setenv("TZ", tz, 1);
7876 + _tzset_r(_REENT);
7878 +#endif
7880 +#ifdef F_mlock
7881 +static unsigned int lock_count = 0;
7882 +static unsigned int intr_flags = 0;
7884 +void __malloc_lock(struct _reent *ptr)
7886 + unsigned int flags = pspDisableInterrupts();
7888 + if (lock_count == 0) {
7889 + intr_flags = flags;
7892 + lock_count++;
7895 +void __malloc_unlock(struct _reent *ptr)
7897 + if (--lock_count == 0) {
7898 + pspEnableInterrupts(intr_flags);
7901 +#endif
7903 +/* Exit. */
7904 +#if defined(F__exit) || defined(F_glue__exit)
7905 +extern int sce_newlib_nocreate_thread_in_start __attribute__((weak));
7907 +extern int __psp_free_heap(void);
7909 +void _exit(int status)
7911 + if (&sce_newlib_nocreate_thread_in_start == NULL) {
7912 + /* Free the heap created by _sbrk(). */
7913 + __psp_free_heap();
7915 + sceKernelSelfStopUnloadModule(1, 0, NULL);
7916 + } else {
7917 + if (status == 0) {
7918 + /* Free the heap created by _sbrk(). */
7919 + __psp_free_heap();
7922 + sceKernelExitThread(status);
7925 + while (1) ;
7928 +/* Note: This function is being linked into _exit.o.
7930 + Because __psp_libc_init is a weak import in crt0.c, the linker
7931 + chooses to ignore an object file in libc.a that contains just this
7932 + function, since it's not necessary for successful compilation.
7934 + By putting it instead in _exit.o, which is already used by crt0.c,
7935 + the linker sees __psp_libc_init and resolves the symbol properly.
7937 +void __psp_libc_init(int argc, char *argv[])
7939 + (void) argc;
7941 + /* Initialize cwd from this program's path */
7942 + __psp_init_cwd(argv[0]);
7944 + /* Initialize filedescriptor management */
7945 + __psp_fdman_init();
7948 +#endif /* F__exit */
7950 +#ifdef F__rename
7951 +int _rename(const char *old, const char *new)
7953 + char oldname[MAXPATHLEN + 1];
7954 + char newname[MAXPATHLEN + 1];
7956 + if(__psp_path_absolute(old, oldname, MAXPATHLEN) < 0) {
7957 + errno = ENAMETOOLONG;
7958 + return -1;
7961 + if(__psp_path_absolute(new, newname, MAXPATHLEN) < 0) {
7962 + errno = ENAMETOOLONG;
7963 + return -1;
7966 + return __psp_set_errno(sceIoRename(oldname, newname));
7968 +#endif
7970 +#ifdef F_nanosleep
7971 +/* note: we don't use rem as we have no signals */
7972 +int nanosleep(const struct timespec *req, struct timespec *rem)
7974 + if( req == NULL )
7975 + return EFAULT;
7977 + if( rem != NULL ) {
7978 + rem->tv_sec = 0;
7979 + rem->tv_nsec = 0;
7982 + sceKernelDelayThreadCB( 1000000 * req->tv_sec + (req->tv_nsec / 1000) );
7984 + return 0;
7986 +#endif
7988 diff --git a/newlib/libc/sys/psp/netdb.c b/newlib/libc/sys/psp/netdb.c
7989 new file mode 100644
7990 index 000000000..58e07d750
7991 --- /dev/null
7992 +++ b/newlib/libc/sys/psp/netdb.c
7993 @@ -0,0 +1,103 @@
7994 +/* Simple gethostbyname and gethostbyaddr replacements using the resolver lib */
7995 +#include <stdio.h>
7996 +#include <netdb.h>
7997 +#include <netinet/in.h>
7998 +#include <arpa/inet.h>
7999 +#include <sys/socket.h>
8000 +#include <pspkerneltypes.h>
8001 +#include <pspnet_resolver.h>
8003 +#define MAX_NAME 512
8005 +#ifdef F_h_errno
8006 +int h_errno = NETDB_SUCCESS;
8007 +#endif
8009 +#ifdef F_gethostbyaddr
8010 +struct hostent *gethostbyaddr(const void *addr, int len, int type)
8012 + static struct hostent ent;
8013 + static char * aliases[1] = { NULL };
8014 + char buf[1024];
8015 + static char sname[MAX_NAME] = "";
8016 + static struct in_addr saddr = { 0 };
8017 + static char *addrlist[2] = { (char *) &saddr, NULL };
8018 + int rid;
8019 + int err;
8021 + if((len != sizeof(struct in_addr)) || (type != AF_INET) || (addr == NULL))
8023 + h_errno = HOST_NOT_FOUND;
8024 + return NULL;
8027 + memcpy(&saddr, addr, len);
8029 + if(sceNetResolverCreate(&rid, buf, sizeof(buf)) < 0)
8031 + h_errno = NO_RECOVERY;
8032 + return NULL;
8035 + err = sceNetResolverStartAtoN(rid, &saddr, sname, sizeof(sname), 2, 3);
8036 + sceNetResolverStop(rid);
8037 + sceNetResolverDelete(rid);
8038 + if(err < 0)
8040 + h_errno = HOST_NOT_FOUND;
8041 + return NULL;
8044 + ent.h_name = sname;
8045 + ent.h_aliases = aliases;
8046 + ent.h_addrtype = AF_INET;
8047 + ent.h_length = sizeof(struct in_addr);
8048 + ent.h_addr_list = addrlist;
8049 + ent.h_addr = (char *) &saddr;
8051 + return &ent;
8053 +#endif
8055 +#ifdef F_gethostbyname
8056 +struct hostent *gethostbyname(const char *name)
8058 + static struct hostent ent;
8059 + char buf[1024];
8060 + static char sname[MAX_NAME] = "";
8061 + static struct in_addr saddr = { 0 };
8062 + static char *addrlist[2] = { (char *) &saddr, NULL };
8063 + int rid;
8065 + if(sceNetInetInetAton(name, &saddr) == 0)
8067 + int err;
8069 + if(sceNetResolverCreate(&rid, buf, sizeof(buf)) < 0)
8071 + h_errno = NO_RECOVERY;
8072 + return NULL;
8075 + err = sceNetResolverStartNtoA(rid, name, &saddr, 2, 3);
8076 + sceNetResolverDelete(rid);
8077 + if(err < 0)
8079 + h_errno = HOST_NOT_FOUND;
8080 + return NULL;
8085 + snprintf(sname, MAX_NAME, "%s", name);
8086 + ent.h_name = sname;
8087 + ent.h_aliases = 0;
8088 + ent.h_addrtype = AF_INET;
8089 + ent.h_length = sizeof(struct in_addr);
8090 + ent.h_addr_list = addrlist;
8091 + ent.h_addr = (char *) &saddr;
8093 + return &ent;
8096 +#endif
8097 diff --git a/newlib/libc/sys/psp/netinet/in.h b/newlib/libc/sys/psp/netinet/in.h
8098 new file mode 100644
8099 index 000000000..86134a9bb
8100 --- /dev/null
8101 +++ b/newlib/libc/sys/psp/netinet/in.h
8102 @@ -0,0 +1,280 @@
8103 +/* $NetBSD: in.h,v 1.71 2005/08/05 09:21:25 elad Exp $ */
8106 + * Copyright (c) 1982, 1986, 1990, 1993
8107 + * The Regents of the University of California. All rights reserved.
8109 + * Redistribution and use in source and binary forms, with or without
8110 + * modification, are permitted provided that the following conditions
8111 + * are met:
8112 + * 1. Redistributions of source code must retain the above copyright
8113 + * notice, this list of conditions and the following disclaimer.
8114 + * 2. Redistributions in binary form must reproduce the above copyright
8115 + * notice, this list of conditions and the following disclaimer in the
8116 + * documentation and/or other materials provided with the distribution.
8117 + * 3. Neither the name of the University nor the names of its contributors
8118 + * may be used to endorse or promote products derived from this software
8119 + * without specific prior written permission.
8121 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
8122 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8123 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8124 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
8125 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8126 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8127 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8128 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8129 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8130 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8131 + * SUCH DAMAGE.
8133 + * @(#)in.h 8.3 (Berkeley) 1/3/94
8134 + */
8137 + * Constants and structures defined by the internet system,
8138 + * Per RFC 790, September 1981, and numerous additions.
8139 + */
8141 +#ifndef _NETINET_IN_H_
8142 +#define _NETINET_IN_H_
8144 +#ifdef __cplusplus
8145 +extern "C" {
8146 +#endif
8148 +#include <sys/socket.h>
8150 +typedef uint32_t in_addr_t;
8151 +typedef uint16_t in_port_t;
8154 + * Protocols
8155 + */
8156 +#define IPPROTO_IP 0 /* dummy for IP */
8157 +#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
8158 +#define IPPROTO_ICMP 1 /* control message protocol */
8159 +#define IPPROTO_IGMP 2 /* group mgmt protocol */
8160 +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
8161 +#define IPPROTO_IPV4 4 /* IP header */
8162 +#define IPPROTO_IPIP 4 /* IP inside IP */
8163 +#define IPPROTO_TCP 6 /* tcp */
8164 +#define IPPROTO_EGP 8 /* exterior gateway protocol */
8165 +#define IPPROTO_PUP 12 /* pup */
8166 +#define IPPROTO_UDP 17 /* user datagram protocol */
8167 +#define IPPROTO_IDP 22 /* xns idp */
8168 +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
8169 +#define IPPROTO_IPV6 41 /* IP6 header */
8170 +#define IPPROTO_ROUTING 43 /* IP6 routing header */
8171 +#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
8172 +#define IPPROTO_RSVP 46 /* resource reservation */
8173 +#define IPPROTO_GRE 47 /* GRE encaps RFC 1701 */
8174 +#define IPPROTO_ESP 50 /* encap. security payload */
8175 +#define IPPROTO_AH 51 /* authentication header */
8176 +#define IPPROTO_MOBILE 55 /* IP Mobility RFC 2004 */
8177 +#define IPPROTO_IPV6_ICMP 58 /* IPv6 ICMP */
8178 +#define IPPROTO_ICMPV6 58 /* ICMP6 */
8179 +#define IPPROTO_NONE 59 /* IP6 no next header */
8180 +#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
8181 +#define IPPROTO_EON 80 /* ISO cnlp */
8182 +#define IPPROTO_ETHERIP 97 /* Ethernet-in-IP */
8183 +#define IPPROTO_ENCAP 98 /* encapsulation header */
8184 +#define IPPROTO_PIM 103 /* Protocol indep. multicast */
8185 +#define IPPROTO_IPCOMP 108 /* IP Payload Comp. Protocol */
8186 +#define IPPROTO_VRRP 112 /* VRRP RFC 2338 */
8188 +#define IPPROTO_RAW 255 /* raw IP packet */
8189 +#define IPPROTO_MAX 256
8191 +/* last return value of *_input(), meaning "all job for this pkt is done". */
8192 +#define IPPROTO_DONE 257
8194 +/* sysctl placeholder for (FAST_)IPSEC */
8195 +#define CTL_IPPROTO_IPSEC 258
8199 + * Local port number conventions:
8201 + * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
8202 + * unless a kernel is compiled with IPNOPRIVPORTS defined.
8204 + * When a user does a bind(2) or connect(2) with a port number of zero,
8205 + * a non-conflicting local port address is chosen.
8207 + * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
8208 + * that is settable by sysctl(3); net.inet.ip.anonportmin and
8209 + * net.inet.ip.anonportmax respectively.
8211 + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
8212 + * default assignment range.
8214 + * The value IP_PORTRANGE_DEFAULT causes the default behavior.
8216 + * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
8217 + * and exists only for FreeBSD compatibility purposes.
8219 + * The value IP_PORTRANGE_LOW changes the range to the "low" are
8220 + * that is (by convention) restricted to privileged processes.
8221 + * This convention is based on "vouchsafe" principles only.
8222 + * It is only secure if you trust the remote host to restrict these ports.
8223 + * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
8224 + */
8226 +#define IPPORT_RESERVED 1024
8227 +#define IPPORT_ANONMIN 49152
8228 +#define IPPORT_ANONMAX 65535
8229 +#define IPPORT_RESERVEDMIN 600
8230 +#define IPPORT_RESERVEDMAX (IPPORT_RESERVED-1)
8233 + * Internet address (a structure for historical reasons)
8234 + */
8235 +struct in_addr {
8236 + in_addr_t s_addr;
8237 +} __attribute__((__packed__));
8239 +#define __IPADDR(x) ((uint32_t)(x))
8241 +#define IN_CLASSA(i) (((uint32_t)(i) & __IPADDR(0x80000000)) == \
8242 + __IPADDR(0x00000000))
8243 +#define IN_CLASSA_NET __IPADDR(0xff000000)
8244 +#define IN_CLASSA_NSHIFT 24
8245 +#define IN_CLASSA_HOST __IPADDR(0x00ffffff)
8246 +#define IN_CLASSA_MAX 128
8248 +#define IN_CLASSB(i) (((uint32_t)(i) & __IPADDR(0xc0000000)) == \
8249 + __IPADDR(0x80000000))
8250 +#define IN_CLASSB_NET __IPADDR(0xffff0000)
8251 +#define IN_CLASSB_NSHIFT 16
8252 +#define IN_CLASSB_HOST __IPADDR(0x0000ffff)
8253 +#define IN_CLASSB_MAX 65536
8255 +#define IN_CLASSC(i) (((uint32_t)(i) & __IPADDR(0xe0000000)) == \
8256 + __IPADDR(0xc0000000))
8257 +#define IN_CLASSC_NET __IPADDR(0xffffff00)
8258 +#define IN_CLASSC_NSHIFT 8
8259 +#define IN_CLASSC_HOST __IPADDR(0x000000ff)
8261 +#define IN_CLASSD(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
8262 + __IPADDR(0xe0000000))
8263 +/* These ones aren't really net and host fields, but routing needn't know. */
8264 +#define IN_CLASSD_NET __IPADDR(0xf0000000)
8265 +#define IN_CLASSD_NSHIFT 28
8266 +#define IN_CLASSD_HOST __IPADDR(0x0fffffff)
8267 +#define IN_MULTICAST(i) IN_CLASSD(i)
8269 +#define IN_EXPERIMENTAL(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
8270 + __IPADDR(0xf0000000))
8271 +#define IN_BADCLASS(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
8272 + __IPADDR(0xf0000000))
8274 +#define IN_LOCAL_GROUP(i) (((uint32_t)(i) & __IPADDR(0xffffff00)) == \
8275 + __IPADDR(0xe0000000))
8277 +#define INADDR_ANY __IPADDR(0x00000000)
8278 +#define INADDR_LOOPBACK __IPADDR(0x7f000001)
8279 +#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */
8281 +#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */
8282 +#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */
8283 +#define INADDR_ALLRTRS_GROUP __IPADDR(0xe0000002) /* 224.0.0.2 */
8284 +#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */
8286 +#define IN_LOOPBACKNET 127 /* official! */
8289 + * Socket address, internet style.
8290 + */
8291 +struct sockaddr_in {
8292 + uint8_t sin_len;
8293 + sa_family_t sin_family;
8294 + in_port_t sin_port;
8295 + struct in_addr sin_addr;
8296 + int8_t sin_zero[8];
8299 +#define INET_ADDRSTRLEN 16
8302 + * Structure used to describe IP options.
8303 + * Used to store options internally, to pass them to a process,
8304 + * or to restore options retrieved earlier.
8305 + * The ip_dst is used for the first-hop gateway when using a source route
8306 + * (this gets put into the header proper).
8307 + */
8308 +struct ip_opts {
8309 + struct in_addr ip_dst; /* first hop, 0 w/o src rt */
8310 +#if defined(__cplusplus)
8311 + int8_t Ip_opts[40]; /* actually variable in size */
8312 +#else
8313 + int8_t ip_opts[40]; /* actually variable in size */
8314 +#endif
8318 + * Options for use with [gs]etsockopt at the IP level.
8319 + * First word of comment is data type; bool is stored in int.
8320 + */
8321 +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
8322 +#define IP_HDRINCL 2 /* int; header is included with data */
8323 +#define IP_TOS 3 /* int; IP type of service and preced. */
8324 +#define IP_TTL 4 /* int; IP time to live */
8325 +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
8326 +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
8327 +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
8328 +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
8329 +#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
8330 +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
8331 +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
8332 +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
8333 +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
8334 +#define IP_PORTRANGE 19 /* int; range to use for ephemeral port */
8335 +#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
8336 +#define IP_ERRORMTU 21 /* int; get MTU of last xmit = EMSGSIZE */
8337 +#if 1 /*IPSEC*/
8338 +#define IP_IPSEC_POLICY 22 /* struct; get/set security policy */
8339 +#endif
8342 + * Defaults and limits for options
8343 + */
8344 +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
8345 +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
8346 +#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
8349 + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
8350 + */
8351 +struct ip_mreq {
8352 + struct in_addr imr_multiaddr; /* IP multicast address of group */
8353 + struct in_addr imr_interface; /* local IP address of interface */
8357 + * Argument for IP_PORTRANGE:
8358 + * - which range to search when port is unspecified at bind() or connect()
8359 + */
8360 +#define IP_PORTRANGE_DEFAULT 0 /* default range */
8361 +#define IP_PORTRANGE_HIGH 1 /* same as DEFAULT (FreeBSD compat) */
8362 +#define IP_PORTRANGE_LOW 2 /* use privileged range */
8365 +#if 0
8366 +// FIXME: These are optimized (one instruction), but currently not part of psp-gcc
8367 +#define ntohs(x) __builtin_allegrex_wsbh(x)
8368 +#define ntohl(x) __builtin_allegrex_wsbw(x)
8369 +#define htons(x) __builtin_allegrex_wsbh(x)
8370 +#define htonl(x) __builtin_allegrex_wsbw(x)
8371 +#else
8372 +#define ntohs(x) __builtin_bswap16(x)
8373 +#define ntohl(x) __builtin_bswap32(x)
8374 +#define htons(x) __builtin_bswap16(x)
8375 +#define htonl(x) __builtin_bswap32(x)
8376 +#endif
8378 +#ifdef __cplusplus
8380 +#endif
8382 +#endif /* !_NETINET_IN_H_ */
8383 diff --git a/newlib/libc/sys/psp/netinet/tcp.h b/newlib/libc/sys/psp/netinet/tcp.h
8384 new file mode 100644
8385 index 000000000..deda3f2f0
8386 --- /dev/null
8387 +++ b/newlib/libc/sys/psp/netinet/tcp.h
8388 @@ -0,0 +1,12 @@
8389 +#ifndef __NETINET_TCP_H__
8390 +#define __NETINET_TCP_H__
8392 +#include <netinet/in.h>
8394 +#define SOL_TCP IPPROTO_TCP
8396 +/* Socket options */
8397 +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
8398 +#define TCP_MAXSEG 0x02 /* set maximum segment size */
8400 +#endif
8401 diff --git a/newlib/libc/sys/psp/pipe.c b/newlib/libc/sys/psp/pipe.c
8402 new file mode 100644
8403 index 000000000..ed5197725
8404 --- /dev/null
8405 +++ b/newlib/libc/sys/psp/pipe.c
8406 @@ -0,0 +1,305 @@
8408 + * PSP Software Development Kit - http://www.pspdev.org
8409 + * -----------------------------------------------------------------------
8410 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
8412 + * pipe.c - Socket wrappers to provide similar functions to normal unix
8414 + * Copyright (c) 2006 Rafael Cabezas <rafpsp@gmail.com>
8416 + * - 20070630 Alper Akcan "anhanguera" <distchx@yahoo.com>
8417 + * [non]blocking read/write() fix
8418 + * illegal size fix for read/write()
8419 + *
8420 + */
8421 +#include <stdio.h>
8422 +#include <errno.h>
8423 +#include <sys/syslimits.h>
8424 +#include <sys/fd_set.h>
8426 +#include <psptypes.h>
8427 +#include <pspthreadman.h>
8428 +#include <pspmodulemgr.h>
8429 +#include <pspkerror.h>
8430 +#include "fdman.h"
8432 +/* Pipe functions */
8433 +/* Returns how many bytes are in the pipe -- waiting to be read */
8434 +size_t __psp_pipe_peekmsgsize(int fd)
8436 + SceKernelMppInfo info;
8437 + info.size = sizeof(info);
8439 + if (!__PSP_IS_FD_OF_TYPE(fd, __PSP_DESCRIPTOR_TYPE_PIPE)) {
8440 + errno = EBADF;
8441 + return -1;
8444 + if (sceKernelReferMsgPipeStatus(__psp_descriptormap[fd]->sce_descriptor, &info) == 0) {
8445 + return (info.bufSize - info.freeSize);
8447 + else {
8448 + return -1;
8452 +int pipe(int fildes[2])
8454 + static int iIndex = 0;
8455 + char name[32];
8456 + iIndex++;
8458 + sprintf(name, "__psp_pipe_%02d", iIndex);
8460 + SceUID uid = sceKernelCreateMsgPipe(name, PSP_MEMORY_PARTITION_USER, 0, (void *)PIPE_BUF, NULL);
8462 + if (uid >= 0) {
8463 + fildes[0] = __psp_fdman_get_new_descriptor();
8464 + if (fildes[0] != -1) {
8465 + __psp_descriptormap[fildes[0]]->sce_descriptor = uid;
8466 + __psp_descriptormap[fildes[0]]->type = __PSP_DESCRIPTOR_TYPE_PIPE;
8467 + }
8468 + else {
8469 + sceKernelDeleteMsgPipe(uid);
8470 + errno = EFAULT;
8471 + return -1;
8474 + fildes[1] = __psp_fdman_get_dup_descriptor(fildes[0]);
8475 + if (fildes[1] != -1) {
8476 + __psp_descriptormap[fildes[1]]->sce_descriptor = uid;
8477 + return 0;
8478 + }
8479 + else {
8480 + sceKernelDeleteMsgPipe(uid);
8481 + errno = EFAULT;
8482 + return -1;
8486 + else {
8487 + errno = EFAULT;
8488 + return -1;
8492 +int __psp_pipe_close(int fd)
8494 + int ret = 0;
8496 + if (!__PSP_IS_FD_OF_TYPE(fd, __PSP_DESCRIPTOR_TYPE_PIPE)) {
8497 + errno = EBADF;
8498 + return -1;
8502 + if ( __psp_descriptormap[fd]->ref_count == 1 ) {
8503 + /**
8504 + * Delete a message pipe
8506 + * @param uid - The UID of the pipe
8508 + * @return 0 on success, < 0 on error
8509 + */
8510 + ret = sceKernelDeleteMsgPipe(__psp_descriptormap[fd]->sce_descriptor);
8513 + __psp_fdman_release_descriptor(fd);
8515 + if(ret < 0) {
8516 + return __psp_set_errno(ret);
8519 + return 0;
8522 +int __psp_pipe_nonblocking_read(int fd, void *buf, size_t len)
8524 + int ret;
8525 + int sceuid;
8526 + int size;
8528 + if (!__PSP_IS_FD_OF_TYPE(fd, __PSP_DESCRIPTOR_TYPE_PIPE)) {
8529 + errno = EBADF;
8530 + return -1;
8533 + sceuid = __psp_descriptormap[fd]->sce_descriptor;
8535 + size = __psp_pipe_peekmsgsize(fd);
8536 + if (size > 0) {
8537 + if (size < len) {
8538 + len = size;
8541 + else if (size == 0) {
8542 + errno = EAGAIN;
8543 + return -1;
8545 + else {
8546 + errno = EBADF;
8547 + return -1;
8550 + /**
8551 + * Receive a message from a pipe
8553 + * @param uid - The UID of the pipe
8554 + * @param message - Pointer to the message
8555 + * @param size - Size of the message
8556 + * @param unk1 - Unknown
8557 + * @param unk2 - Unknown
8558 + * @param timeout - Timeout for receive
8560 + * @return 0 on success, < 0 on error
8561 + */
8562 + ret = sceKernelTryReceiveMsgPipe(sceuid, buf, len, 0, 0);
8564 + if (ret == 0) {/* Success - Data */
8565 + return len;
8567 + else if (ret == SCE_KERNEL_ERROR_MPP_EMPTY) {/* No data */
8568 + errno = EAGAIN;
8569 + return -1;
8571 + else {/* Error */
8572 + return __psp_set_errno(ret);
8576 +int __psp_pipe_read(int fd, void *buf, size_t len)
8578 + int ret;
8579 + int sceuid;
8580 + int size;
8582 + if (!__PSP_IS_FD_OF_TYPE(fd, __PSP_DESCRIPTOR_TYPE_PIPE)) {
8583 + errno = EBADF;
8584 + return -1;
8587 + sceuid = __psp_descriptormap[fd]->sce_descriptor;
8589 +#if 0
8590 + /* we should block until there is some data (or maybe for enough data),
8591 + * peeking the msg size should be only for nonblocking reads
8592 + */
8593 + size = __psp_pipe_peekmsgsize(fd);
8594 + if (size > 0) {
8595 + if (size < len) {
8596 + len = size;
8599 + else {
8600 + errno = EBADF;
8601 + return -1;
8603 +#endif
8604 + /* if len is greater than PIPE_BUF then, MsgPipe functions returns
8605 + * SCE_KERNEL_ERROR_ILLEGAL_SIZE, but it should read at least
8606 + * PIPE_BUF bytes, and return the number of bytes read.
8607 + */
8608 + if (len > PIPE_BUF) {
8609 + len = PIPE_BUF;
8612 + /**
8613 + * Receive a message from a pipe
8615 + * @param uid - The UID of the pipe
8616 + * @param message - Pointer to the message
8617 + * @param size - Size of the message
8618 + * @param unk1 - Unknown
8619 + * @param unk2 - Unknown
8620 + * @param timeout - Timeout for receive
8622 + * @return 0 on success, < 0 on error
8623 + */
8624 + ret = sceKernelReceiveMsgPipe(sceuid, buf, len, 0, NULL, NULL);
8626 + if (ret == 0) {/* Success - Data */
8627 + return len;
8629 + else {/* Error */
8630 + return __psp_set_errno(ret);
8634 +int __psp_pipe_write(int fd, const void *buf, size_t len)
8636 + int ret;
8637 + int sceuid;
8638 + char *cbuf;
8640 + if (!__PSP_IS_FD_OF_TYPE(fd, __PSP_DESCRIPTOR_TYPE_PIPE)) {
8641 + errno = EBADF;
8642 + return -1;
8645 + sceuid = __psp_descriptormap[fd]->sce_descriptor;
8647 + /* if len is greater than PIPE_BUF then, MsgPipe functions returns
8648 + * SCE_KERNEL_ERROR_ILLEGAL_SIZE, but it should write at least
8649 + * PIPE_BUF bytes, and return the number of bytes written.
8650 + */
8651 + if (len > PIPE_BUF) {
8652 + len = PIPE_BUF;
8655 + /**
8656 + * Send a message to a pipe
8658 + * @param uid - The UID of the pipe
8659 + * @param message - Pointer to the message
8660 + * @param size - Size of the message
8661 + * @param unk1 - Unknown
8662 + * @param unk2 - Unknown
8663 + * @param timeout - Timeout for send
8665 + * @return 0 on success, < 0 on error
8666 + */
8667 + cbuf = (char *)buf;
8668 + ret = sceKernelSendMsgPipe(sceuid, cbuf, len, 0, NULL, NULL);
8669 + if (ret == 0) {/* Success - Data */
8670 + return len;
8672 + else {/* Error */
8673 + return __psp_set_errno(ret);
8677 +int __psp_pipe_nonblocking_write(int fd, const void *buf, size_t len)
8679 + int ret;
8680 + int sceuid;
8681 + char *cbuf;
8683 + if (!__PSP_IS_FD_OF_TYPE(fd, __PSP_DESCRIPTOR_TYPE_PIPE)) {
8684 + errno = EBADF;
8685 + return -1;
8688 + sceuid = __psp_descriptormap[fd]->sce_descriptor;
8690 + /* if len is greater than PIPE_BUF then, MsgPipe functions returns
8691 + * SCE_KERNEL_ERROR_ILLEGAL_SIZE, but it should write at least
8692 + * PIPE_BUF bytes, and return the number of bytes written.
8693 + */
8694 + if (len > PIPE_BUF) {
8695 + len = PIPE_BUF;
8698 + cbuf = (char *)buf;
8699 + ret = sceKernelTrySendMsgPipe(sceuid, cbuf, len, 0, 0);
8701 + if (ret == 0) {/* Success - Data */
8702 + return len;
8704 + else if (ret == SCE_KERNEL_ERROR_MPP_FULL) {
8705 + errno = EAGAIN;
8706 + return -1;
8708 + else {/* Error */
8709 + return __psp_set_errno(ret);
8712 diff --git a/newlib/libc/sys/psp/pspcwd.c b/newlib/libc/sys/psp/pspcwd.c
8713 new file mode 100644
8714 index 000000000..46a60c43e
8715 --- /dev/null
8716 +++ b/newlib/libc/sys/psp/pspcwd.c
8717 @@ -0,0 +1,166 @@
8719 + * PSP Software Development Kit - http://www.pspdev.org
8720 + * -----------------------------------------------------------------------
8721 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
8723 + * pspcwd.c - Current working directory emulation helper functions
8725 + * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
8726 + * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
8727 + * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
8728 + * Copyright (c) 2005 Jim Paris <jim@jtan.com>
8730 + */
8731 +#include <string.h>
8732 +#include <sys/types.h>
8733 +#include <sys/unistd.h>
8735 +#include <psptypes.h>
8736 +#include <pspiofilemgr.h>
8738 +char __psp_cwd[MAXPATHLEN + 1] = { 0 };
8740 +/* Set the current working directory (CWD) to the path where the module was launched. */
8741 +void __psp_init_cwd(char *argv_0)
8743 + if (argv_0 != NULL) {
8744 + char base_path[MAXPATHLEN + 1];
8745 + char *end;
8747 + strncpy(base_path, argv_0, sizeof(base_path) - 1);
8748 + base_path[sizeof(base_path) - 1] = '\0';
8749 + end = strrchr(base_path, '/');
8750 + if (end != NULL) {
8751 + *(end + 1) = '\0';
8752 + chdir(base_path);
8757 +/* Return the number of bytes taken up by the "drive:" prefix,
8758 + or -1 if it's not found */
8759 +int __psp_get_drive(const char *d)
8761 + int i;
8762 + for(i=0; d[i]; i++) {
8763 + if(! ((d[i] >= 'a' && d[i] <= 'z') ||
8764 + (d[i] >= '0' && d[i] <= '9') ))
8765 + break;
8767 + if(d[i] == ':') return i+1;
8768 + return -1;
8771 +/* Like strcpy, but returns 0 if the string doesn't fit */
8772 +int __psp_safe_strcpy(char *out, const char *in, int maxlen)
8774 + for( ; maxlen > 0 && *in ; maxlen-- )
8775 + *(out++) = *(in++);
8776 + if(maxlen < 1) return 0;
8777 + *out = 0;
8778 + return 1;
8781 +/* Like strcat, but returns 0 if the string doesn't fit */
8782 +int __psp_safe_strcat(char *out, const char *in, int maxlen)
8784 + for( ; *out ; out++,maxlen-- )
8785 + continue;
8786 + return __psp_safe_strcpy(out, in, maxlen);
8789 +/* Normalize a pathname (without leading "drive:") by removing
8790 + . and .. components, duplicated /, etc. */
8791 +int __psp_path_normalize(char *out, int len)
8793 + int i, j;
8794 + int first, next;
8796 + /* First append "/" to make the rest easier */
8797 + if(!__psp_safe_strcat(out,"/",len)) return -10;
8799 + /* Convert "//" to "/" */
8800 + for(i=0; out[i+1]; i++) {
8801 + if(out[i]=='/' && out[i+1]=='/') {
8802 + for(j=i+1; out[j]; j++)
8803 + out[j] = out[j+1];
8804 + i--;
8808 + /* Convert "/./" to "/" */
8809 + for(i=0; out[i] && out[i+1] && out[i+2]; i++) {
8810 + if(out[i]=='/' && out[i+1]=='.' && out[i+2]=='/') {
8811 + for(j=i+1; out[j]; j++)
8812 + out[j] = out[j+2];
8813 + i--;
8817 + /* Convert "/asdf/../" to "/" until we can't anymore. Also
8818 + * convert leading "/../" to "/" */
8819 + first = next = 0;
8820 + while(1) {
8821 + /* If a "../" follows, remove it and the parent */
8822 + if(out[next+1] && out[next+1]=='.' &&
8823 + out[next+2] && out[next+2]=='.' &&
8824 + out[next+3] && out[next+3]=='/') {
8825 + for(j=0; out[first+j+1]; j++)
8826 + out[first+j+1] = out[next+j+4];
8827 + first = next = 0;
8828 + continue;
8831 + /* Find next slash */
8832 + first = next;
8833 + for(next=first+1; out[next] && out[next] != '/'; next++)
8834 + continue;
8835 + if(!out[next]) break;
8838 + /* Remove trailing "/" */
8839 + for(i=1; out[i]; i++)
8840 + continue;
8841 + if(i >= 1 && out[i-1] == '/')
8842 + out[i-1] = 0;
8844 + return 0;
8847 +/* Convert relative path to absolute path. */
8848 +int __psp_path_absolute(const char *in, char *out, int len)
8850 + int dr;
8852 + /* See what the relative URL starts with */
8853 + dr = __psp_get_drive(in);
8854 + if(dr > 0 && in[dr] == '/') {
8855 + /* It starts with "drive:/", so it's already absolute */
8856 + if(!__psp_safe_strcpy(out, in, len))
8857 + return -1;
8858 + } else if(in[0] == '/') {
8859 + /* It's absolute, but missing the drive, so use cwd's drive */
8860 + if(strlen(__psp_cwd) >= len)
8861 + return -2;
8862 + strcpy(out, __psp_cwd);
8863 + dr = __psp_get_drive(out);
8864 + out[dr] = 0;
8865 + if(!__psp_safe_strcat(out, in, len))
8866 + return -3;
8867 + } else {
8868 + /* It's not absolute, so append it to the current cwd */
8869 + if(strlen(__psp_cwd) >= len)
8870 + return -4;
8871 + strcpy(out, __psp_cwd);
8872 + if(!__psp_safe_strcat(out, "/", len))
8873 + return -6;
8874 + if(!__psp_safe_strcat(out, in, len))
8875 + return -7;
8878 + /* Now normalize the pathname portion */
8879 + dr = __psp_get_drive(out);
8880 + if(dr < 0) dr = 0;
8881 + return __psp_path_normalize(out + dr, len - dr);
8884 diff --git a/newlib/libc/sys/psp/select.c b/newlib/libc/sys/psp/select.c
8885 new file mode 100644
8886 index 000000000..88468ce5b
8887 --- /dev/null
8888 +++ b/newlib/libc/sys/psp/select.c
8889 @@ -0,0 +1,199 @@
8891 + * PSP Software Development Kit - http://www.pspdev.org
8892 + * -----------------------------------------------------------------------
8893 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
8895 + * select.c - Socket wrappers to provide similar functions to normal unix
8897 + * Copyright (c) 2006 Rafael Cabezas <rafpsp@gmail.com>
8899 + * - 20070701 Alper Akcan "anhanguera" <distchx@yahoo.com>
8900 + * select EBADF fix
8901 + *
8902 + */
8903 +#include <fcntl.h>
8904 +#include <errno.h>
8905 +#include <sys/select.h>
8906 +#include <psptypes.h>
8907 +#include <pspthreadman.h>
8909 +#include "fdman.h"
8911 +#define SELECT_POLLING_DELAY_IN_us 100
8913 +static int __psp_poll_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds);
8915 +int select(int n, fd_set *readfds, fd_set *writefds,
8916 + fd_set *exceptfds, struct timeval *timeout)
8918 + int count;
8919 + clock_t start_time, time;
8921 + start_time = clock();
8923 + count = 0;
8925 + if (timeout) {
8926 + time = (timeout->tv_sec * CLOCKS_PER_SEC) + (timeout->tv_usec * (1*1000*1000/CLOCKS_PER_SEC));
8927 + }
8928 + else {
8929 + time = 0;
8932 + for (;;) {
8933 + count = __psp_poll_select(n, readfds, writefds, exceptfds);
8934 + /* If timeout == NULL, then don't timeout! */
8935 + if ( (count > 0) || ((timeout != NULL) && ((clock() - start_time) >= time)) ) {
8936 + break;
8938 + if (count < 0) {
8939 + /* anhanguera - 20070701
8940 + * error, lets let the caller to handle error state
8941 + */
8942 + break;
8944 + else {
8945 + /* Nothing found, and not timed-out yet; let's yield for SELECT_POLLING_DELAY_IN_us, so we're not in a busy loop */
8946 + sceKernelDelayThread(SELECT_POLLING_DELAY_IN_us);
8947 + }
8950 + return count;
8953 +#define SCE_FD_SET(n, p) \
8954 + ((p)->fds_bits[((n) & 0xFF) /__NFDBITS] |= (1 << ((n) % __NFDBITS)))
8956 +static int __psp_poll_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
8958 + int fd, count;
8959 + fd_set ready_readfds, ready_writefds, ready_exceptfds;
8960 + fd_set scereadfds, scewritefds, sceexceptfds;
8961 + SceKernelMppInfo info;
8962 + struct timeval scetv;
8964 + FD_ZERO(&ready_readfds);
8965 + FD_ZERO(&ready_writefds);
8966 + FD_ZERO(&ready_exceptfds);
8968 + info.size = sizeof(info);
8969 + scetv.tv_sec = 0;
8970 + scetv.tv_usec = 0;
8971 + count = 0;
8973 + for (fd = 0; fd < n; fd++)
8975 + if (__psp_descriptormap[fd] != NULL) {
8976 + switch(__psp_descriptormap[fd]->type)
8978 + case __PSP_DESCRIPTOR_TYPE_PIPE:
8979 + if (readfds && FD_ISSET(fd, readfds)) {
8980 + if (sceKernelReferMsgPipeStatus(__psp_descriptormap[fd]->sce_descriptor, &info) == 0) {
8981 + if (info.bufSize != info.freeSize) {
8982 + FD_SET(fd, &ready_readfds);
8983 + count++;
8986 + else {
8987 + FD_SET(fd, &ready_exceptfds);
8988 + count++;
8991 + if (writefds && FD_ISSET(fd, writefds)) {
8992 + if (sceKernelReferMsgPipeStatus(__psp_descriptormap[fd]->sce_descriptor, &info) == 0) {
8993 + if (info.freeSize > 0) {
8994 + FD_SET(fd, &ready_writefds);
8995 + count++;
8998 + else {
8999 + FD_SET(fd, &ready_exceptfds);
9000 + count++;
9003 + break;
9004 + case __PSP_DESCRIPTOR_TYPE_FILE:
9005 + if (readfds && FD_ISSET(fd, readfds)) {
9006 + if (readfds && FD_ISSET(fd, readfds)) {
9007 + /** Just set it for now */
9008 + FD_SET(fd, &ready_readfds);
9009 + count++;
9011 + }
9012 + break;
9013 + case __PSP_DESCRIPTOR_TYPE_SOCKET:
9014 + if (readfds && FD_ISSET(fd, readfds)) {
9015 + int sce_ret, sce_fd;
9016 + sce_fd = __psp_descriptormap[fd]->sce_descriptor;
9017 + FD_ZERO(&scereadfds);
9018 + SCE_FD_SET(sce_fd, &scereadfds);
9019 + errno = 0;
9020 + sce_ret = sceNetInetSelect (sce_fd+1, &scereadfds, NULL, NULL, &scetv);
9021 + if (sce_ret>0) {
9022 + FD_SET(fd, &ready_readfds);
9023 + count++;
9025 + else if (sce_ret == -1) {
9026 + errno = sceNetInetGetErrno();
9027 + if (exceptfds && FD_ISSET(fd, exceptfds)) {
9028 + FD_SET(fd, &ready_exceptfds);
9029 + count++;
9030 + } else {
9031 + count = -1;
9035 + if (writefds && FD_ISSET(fd, writefds)) {
9036 + int sce_ret;
9037 + FD_ZERO(&scewritefds);
9038 + SCE_FD_SET(__psp_descriptormap[fd]->sce_descriptor, &scewritefds);
9039 + sce_ret = sceNetInetSelect (__psp_descriptormap[fd]->sce_descriptor+1, NULL, &scewritefds, NULL, &scetv);
9040 + if (sce_ret>0) {
9041 + FD_SET(fd, &ready_writefds);
9042 + count++;
9044 + else if (sce_ret == -1) {
9045 + if (exceptfds && FD_ISSET(fd, exceptfds)) {
9046 + FD_SET(fd, &ready_exceptfds);
9047 + count++;
9048 + }
9049 + else {
9050 + count = -1;
9054 + break;
9056 + } else {
9057 + /* anhanguera - 20070701
9059 + * here we know that, system has no idea about 'fd'. if caller requested
9060 + * information about 'fd', return '-1' and set errno to 'EBADF'. we should
9061 + * increse the count and set exceptfd for fd, but it is safe to obey select
9062 + * manual.
9064 + * from manual;
9065 + * On error, -1 is returned, and errno is set appropriately; the sets and
9066 + * timeout become undefined, so do not rely on their contents after an error.
9067 + */
9068 + if ((readfds && FD_ISSET(fd, readfds)) ||
9069 + (writefds && FD_ISSET(fd, writefds)) ||
9070 + (exceptfds && FD_ISSET(fd, exceptfds))) {
9071 + errno = EBADF;
9072 + return -1;
9077 + if (count > 0) {
9078 + if (readfds)
9079 + *readfds = ready_readfds;
9080 + if (writefds)
9081 + *writefds = ready_writefds;
9082 + if (exceptfds)
9083 + *exceptfds = ready_exceptfds;
9086 + return count;
9089 diff --git a/newlib/libc/sys/psp/socket.c b/newlib/libc/sys/psp/socket.c
9090 new file mode 100644
9091 index 000000000..18deefb05
9092 --- /dev/null
9093 +++ b/newlib/libc/sys/psp/socket.c
9094 @@ -0,0 +1,390 @@
9096 + * PSP Software Development Kit - http://www.pspdev.org
9097 + * -----------------------------------------------------------------------
9098 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
9100 + * socket.c - Socket wrappers to provide similar functions to normal unix
9102 + * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
9103 + * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
9104 + *
9105 + */
9106 +#include <fcntl.h>
9107 +#include <errno.h>
9108 +#include <sys/socket.h>
9109 +#include <sys/select.h>
9110 +#include <netinet/in.h>
9111 +#include <arpa/inet.h>
9113 +#include <psptypes.h>
9114 +#include "fdman.h"
9116 +#ifdef F_socket
9117 +int socket(int domain, int type, int protocol)
9119 + int sock, scesock;
9120 + int i;
9122 + scesock = sceNetInetSocket(domain, type, protocol);
9123 + if(scesock < 0) {
9124 + errno = sceNetInetGetErrno();
9125 + return -1;
9128 + sock = __psp_fdman_get_new_descriptor();
9129 + if( sock != -1 ) {
9130 + __psp_descriptormap[sock]->sce_descriptor = scesock;
9131 + __psp_descriptormap[sock]->type = __PSP_DESCRIPTOR_TYPE_SOCKET;
9133 + else {
9134 + sceNetInetClose(scesock);
9135 + errno = ENOENT;
9136 + return -1;
9139 + return sock;
9142 +/* These are glue routines that are called from _close(), _read(), and
9143 + _write(). They are here so that any program that uses socket() will pull
9144 + them in and have expanded socket capability. */
9146 +int __psp_socket_close(int sock)
9148 + int ret = 0;
9150 + if (__psp_descriptormap[sock]->ref_count == 1) {
9151 + ret = sceNetInetClose(__psp_descriptormap[sock]->sce_descriptor);
9154 + __psp_fdman_release_descriptor(sock);
9156 + if(ret < 0)
9158 + /* If close is defined likely errno is */
9159 + errno = sceNetInetGetErrno();
9160 + return -1;
9163 + return 0;
9166 +ssize_t __psp_socket_recv(int s, void *buf, size_t len, int flags)
9168 + return recv(s, buf, len, flags);
9171 +ssize_t __psp_socket_send(int s, const void *buf, size_t len, int flags)
9173 + return send(s, buf, len, flags);
9175 +#endif
9177 +#ifdef F_accept
9178 +int accept(int s, struct sockaddr *addr, socklen_t *addrlen)
9180 + int newscesock, newsock;
9182 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9183 + errno = EBADF;
9184 + return -1;
9187 + newscesock = sceNetInetAccept(__psp_descriptormap[s]->sce_descriptor, addr, addrlen);
9188 + if( (newscesock >= 0) ) {
9189 + newsock = __psp_fdman_get_new_descriptor();
9190 + if ( newsock != -1 ) {
9191 + __psp_descriptormap[newsock]->sce_descriptor = newscesock;
9192 + __psp_descriptormap[newsock]->type = __PSP_DESCRIPTOR_TYPE_SOCKET;
9194 + else {
9195 + sceNetInetClose(newscesock);
9196 + errno = ENOENT;
9197 + return -1;
9200 + else {
9201 + errno = ENOENT;
9202 + return -1;
9205 + return newsock;
9207 +#endif
9209 +#ifdef F_bind
9210 +int bind(int s, const struct sockaddr *my_addr, socklen_t addrlen)
9212 + int ret;
9214 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9215 + errno = EBADF;
9216 + return -1;
9219 + ret = sceNetInetBind(__psp_descriptormap[s]->sce_descriptor, my_addr, addrlen);
9220 + if(ret < 0)
9222 + errno = sceNetInetGetErrno();
9223 + return -1;
9226 + return 0;
9228 +#endif
9230 +#ifdef F_connect
9231 +int connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen)
9233 + int ret;
9235 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9236 + errno = EBADF;
9237 + return -1;
9240 + ret = sceNetInetConnect(__psp_descriptormap[s]->sce_descriptor, serv_addr, addrlen);
9241 + if(ret < 0)
9243 + errno = sceNetInetGetErrno();
9244 + return -1;
9247 + return 0;
9249 +#endif
9251 +#ifdef F_setsockopt
9252 +int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
9254 + int ret;
9256 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9257 + errno = EBADF;
9258 + return -1;
9261 + ret = sceNetInetGetsockopt(__psp_descriptormap[s]->sce_descriptor, level, optname, optval, optlen);
9262 + if(ret < 0)
9264 + errno = sceNetInetGetErrno();
9265 + return -1;
9268 + return 0;
9270 +#endif
9272 +#ifdef F_listen
9273 +int listen(int s, int backlog)
9275 + int ret;
9277 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9278 + errno = EBADF;
9279 + return -1;
9282 + ret = sceNetInetListen(__psp_descriptormap[s]->sce_descriptor, backlog);
9283 + if(ret < 0)
9285 + errno = sceNetInetGetErrno();
9286 + return -1;
9289 + return 0;
9291 +#endif
9293 +#ifdef F_recv
9294 +ssize_t recv(int s, void *buf, size_t len, int flags)
9296 + int ret;
9298 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9299 + errno = EBADF;
9300 + return -1;
9303 + ret = sceNetInetRecv(__psp_descriptormap[s]->sce_descriptor, buf, len, flags);
9304 + if(ret < 0)
9306 + errno = sceNetInetGetErrno();
9307 + return -1;
9310 + return ret;
9312 +#endif
9314 +#ifdef F_recvfrom
9315 +ssize_t recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
9317 + int ret;
9319 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9320 + errno = EBADF;
9321 + return -1;
9324 + ret = sceNetInetRecvfrom(__psp_descriptormap[s]->sce_descriptor, buf, len, flags, from, fromlen);
9325 + if(ret < 0)
9327 + errno = sceNetInetGetErrno();
9328 + return -1;
9331 + return ret;
9333 +#endif
9335 +#ifdef F_send
9336 +ssize_t send(int s, const void *buf, size_t len, int flags)
9338 + int ret;
9340 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9341 + errno = EBADF;
9342 + return -1;
9345 + ret = sceNetInetSend(__psp_descriptormap[s]->sce_descriptor, buf, len, flags);
9346 + if(ret < 0)
9348 + errno = sceNetInetGetErrno();
9349 + return -1;
9352 + return ret;
9354 +#endif
9356 +#ifdef F_sendto
9357 +ssize_t sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
9359 + int ret;
9361 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9362 + errno = EBADF;
9363 + return -1;
9366 + ret = sceNetInetSendto(__psp_descriptormap[s]->sce_descriptor, buf, len, flags, to, tolen);
9367 + if(ret < 0)
9369 + errno = sceNetInetGetErrno();
9370 + return -1;
9373 + return ret;
9375 +#endif
9377 +#ifdef F_setsockopt
9378 +int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen)
9380 + int ret;
9382 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9383 + errno = EBADF;
9384 + return -1;
9387 + ret = sceNetInetSetsockopt(__psp_descriptormap[s]->sce_descriptor, level, optname, optval, optlen);
9388 + if(ret < 0)
9390 + errno = sceNetInetGetErrno();
9391 + return -1;
9393 + else
9395 + if ( (level == SOL_SOCKET) && (optname == SO_NONBLOCK) ) {
9396 + if (*((int*)optval) == 1) {
9397 + __psp_descriptormap[s]->flags |= O_NONBLOCK;
9399 + else {
9400 + __psp_descriptormap[s]->flags &= ~O_NONBLOCK;
9401 + }
9405 + return 0;
9407 +#endif
9409 +#ifdef F_shutdown
9410 +int shutdown(int s, int how)
9412 + int ret;
9414 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9415 + errno = EBADF;
9416 + return -1;
9419 + ret = sceNetInetShutdown(__psp_descriptormap[s]->sce_descriptor, how);
9420 + if(ret < 0)
9422 + errno = sceNetInetGetErrno();
9423 + return -1;
9426 + return 0;
9428 +#endif
9430 +#ifdef F_getpeername
9431 +int getpeername(int s, struct sockaddr *name, socklen_t *namelen)
9433 + int ret;
9435 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9436 + errno = EBADF;
9437 + return -1;
9440 + ret = sceNetInetGetpeername(__psp_descriptormap[s]->sce_descriptor, name, namelen);
9441 + if(ret < 0)
9443 + errno = sceNetInetGetErrno();
9444 + return -1;
9447 + return 0;
9449 +#endif
9451 +#ifdef F_getsockname
9452 +int getsockname(int s, struct sockaddr *name, socklen_t *namelen)
9454 + int ret;
9456 + if (!__PSP_IS_FD_OF_TYPE(s, __PSP_DESCRIPTOR_TYPE_SOCKET)) {
9457 + errno = EBADF;
9458 + return -1;
9461 + ret = sceNetInetGetsockname(__psp_descriptormap[s]->sce_descriptor, name, namelen);
9462 + if(ret < 0)
9464 + errno = sceNetInetGetErrno();
9465 + return -1;
9468 + return 0;
9470 +#endif
9472 +#ifdef F_inet_ntoa
9473 +char *inet_ntoa(struct in_addr in)
9475 + static char ip_addr[INET_ADDRSTRLEN+1];
9477 + if(sceNetInetInetNtop(AF_INET, &in, ip_addr, INET_ADDRSTRLEN) == NULL)
9479 + strcpy(ip_addr, "Invalid");
9482 + return ip_addr;
9484 +#endif
9485 diff --git a/newlib/libc/sys/psp/sys/dirent.h b/newlib/libc/sys/psp/sys/dirent.h
9486 new file mode 100644
9487 index 000000000..26e2cccbb
9488 --- /dev/null
9489 +++ b/newlib/libc/sys/psp/sys/dirent.h
9490 @@ -0,0 +1,39 @@
9491 +#ifndef _SYS_DIRENT_H
9492 +#define _SYS_DIRENT_H
9494 +/* PSP dirent.h, based on pspiofilemgr_dirent.h
9495 + by Jim Paris <jim@jtan.com> */
9497 +#ifdef __cplusplus
9498 +extern "C" {
9499 +#endif
9501 +#include <pspiofilemgr_dirent.h>
9503 +#define MAXNAMLEN 255
9505 +/* Same as SceIoDirent, just with a different name. */
9506 +struct dirent {
9507 + /** File status. */
9508 + SceIoStat d_stat;
9509 + /** File name. */
9510 + char d_name[256];
9511 + /** Device-specific data. */
9512 + void * d_private;
9513 + int dummy;
9516 +typedef struct {
9517 + SceUID uid;
9518 + struct dirent de;
9519 +} DIR;
9521 +DIR *opendir (const char *);
9522 +struct dirent *readdir (DIR *);
9523 +int closedir (DIR *);
9525 +#ifdef __cplusplus
9527 +#endif
9529 +#endif
9530 diff --git a/newlib/libc/sys/psp/sys/errno.h b/newlib/libc/sys/psp/sys/errno.h
9531 new file mode 100644
9532 index 000000000..4061256f6
9533 --- /dev/null
9534 +++ b/newlib/libc/sys/psp/sys/errno.h
9535 @@ -0,0 +1,158 @@
9536 +/* errno.h for PSP, based on newlib/libc/include/sys/errno.h. */
9538 +#ifndef _SYS_ERRNO_H_
9539 +#ifdef __cplusplus
9540 +extern "C" {
9541 +#endif
9542 +#define _SYS_ERRNO_H_
9544 +#include <sys/reent.h>
9546 +#ifndef _REENT_ONLY
9547 +#define errno (*__errno())
9548 +extern int *__errno _PARAMS ((void));
9549 +#endif
9551 +/* Please don't use these variables directly.
9552 + Use strerror instead. */
9553 +extern __IMPORT _CONST char * _CONST _sys_errlist[];
9554 +extern __IMPORT int _sys_nerr;
9555 +#ifdef __CYGWIN__
9556 +extern __IMPORT const char * const sys_errlist[];
9557 +extern __IMPORT int sys_nerr;
9558 +#endif
9560 +#define __errno_r(ptr) ((ptr)->_errno)
9562 +#define EPERM 1 /* Not super-user */
9563 +#define ENOENT 2 /* No such file or directory */
9564 +#define ESRCH 3 /* No such process */
9565 +#define EINTR 4 /* Interrupted system call */
9566 +#define EIO 5 /* I/O error */
9567 +#define ENXIO 6 /* No such device or address */
9568 +#define E2BIG 7 /* Arg list too long */
9569 +#define ENOEXEC 8 /* Exec format error */
9570 +#define EBADF 9 /* Bad file number */
9571 +#define ECHILD 10 /* No children */
9572 +#define EAGAIN 11 /* No more processes */
9573 +#define ENOMEM 12 /* Not enough core */
9574 +#define EACCES 13 /* Permission denied */
9575 +#define EFAULT 14 /* Bad address */
9576 +#define ENOTBLK 15 /* Block device required */
9577 +#define EBUSY 16 /* Mount device busy */
9578 +#define EEXIST 17 /* File exists */
9579 +#define EXDEV 18 /* Cross-device link */
9580 +#define ENODEV 19 /* No such device */
9581 +#define ENOTDIR 20 /* Not a directory */
9582 +#define EISDIR 21 /* Is a directory */
9583 +#define EINVAL 22 /* Invalid argument */
9584 +#define ENFILE 23 /* Too many open files in system */
9585 +#define EMFILE 24 /* Too many open files */
9586 +#define ENOTTY 25 /* Not a typewriter */
9587 +#define ETXTBSY 26 /* Text file busy */
9588 +#define EFBIG 27 /* File too large */
9589 +#define ENOSPC 28 /* No space left on device */
9590 +#define ESPIPE 29 /* Illegal seek */
9591 +#define EROFS 30 /* Read only file system */
9592 +#define EMLINK 31 /* Too many links */
9593 +#define EPIPE 32 /* Broken pipe */
9594 +#define EDOM 33 /* Math arg out of domain of func */
9595 +#define ERANGE 34 /* Math result not representable */
9596 +#define ENOMSG 35 /* No message of desired type */
9597 +#define EIDRM 36 /* Identifier removed */
9598 +#define ECHRNG 37 /* Channel number out of range */
9599 +#define EL2NSYNC 38 /* Level 2 not synchronized */
9600 +#define EL3HLT 39 /* Level 3 halted */
9601 +#define EL3RST 40 /* Level 3 reset */
9602 +#define ELNRNG 41 /* Link number out of range */
9603 +#define EUNATCH 42 /* Protocol driver not attached */
9604 +#define ENOCSI 43 /* No CSI structure available */
9605 +#define EL2HLT 44 /* Level 2 halted */
9606 +#define EDEADLK 45 /* Deadlock condition */
9607 +#define ENOLCK 46 /* No record locks available */
9608 +#define EBADE 50 /* Invalid exchange */
9609 +#define EBADR 51 /* Invalid request descriptor */
9610 +#define EXFULL 52 /* Exchange full */
9611 +#define ENOANO 53 /* No anode */
9612 +#define EBADRQC 54 /* Invalid request code */
9613 +#define EBADSLT 55 /* Invalid slot */
9614 +#define EDEADLOCK 56 /* File locking deadlock error */
9615 +#define EBFONT 57 /* Bad font file fmt */
9616 +#define ENOSTR 60 /* Device not a stream */
9617 +#define ENODATA 61 /* No data (for no delay io) */
9618 +#define ETIME 62 /* Timer expired */
9619 +#define ENOSR 63 /* Out of streams resources */
9620 +#define ENONET 64 /* Machine is not on the network */
9621 +#define ENOPKG 65 /* Package not installed */
9622 +#define EREMOTE 66 /* The object is remote */
9623 +#define ENOLINK 67 /* The link has been severed */
9624 +#define EADV 68 /* Advertise error */
9625 +#define ESRMNT 69 /* Srmount error */
9626 +#define ECOMM 70 /* Communication error on send */
9627 +#define EPROTO 71 /* Protocol error */
9628 +#define EMULTIHOP 74 /* Multihop attempted */
9629 +#define ELBIN 75 /* Inode is remote (not really error) */
9630 +#define EDOTDOT 76 /* Cross mount point (not really error) */
9631 +#define EBADMSG 77 /* Trying to read unreadable message */
9632 +#define EFTYPE 79 /* Inappropriate file type or format */
9633 +#define ENOTUNIQ 80 /* Given log. name not unique */
9634 +#define EBADFD 81 /* f.d. invalid for this operation */
9635 +#define EREMCHG 82 /* Remote address changed */
9636 +#define ELIBACC 83 /* Can't access a needed shared lib */
9637 +#define ELIBBAD 84 /* Accessing a corrupted shared lib */
9638 +#define ELIBSCN 85 /* .lib section in a.out corrupted */
9639 +#define ELIBMAX 86 /* Attempting to link in too many libs */
9640 +#define ELIBEXEC 87 /* Attempting to exec a shared library */
9641 +#define ENOSYS 88 /* Function not implemented */
9642 +#define ENMFILE 89 /* No more files */
9643 +#define ENOTEMPTY 90 /* Directory not empty */
9644 +#define ENAMETOOLONG 91 /* File or path name too long */
9645 +#define ELOOP 92 /* Too many symbolic links */
9646 +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
9647 +#define EPFNOSUPPORT 96 /* Protocol family not supported */
9648 +#define ECONNRESET 104 /* Connection reset by peer */
9649 +#define ENOBUFS 105 /* No buffer space available */
9650 +#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
9651 +#define EPROTOTYPE 107 /* Protocol wrong type for socket */
9652 +#define ENOTSOCK 108 /* Socket operation on non-socket */
9653 +#define ENOPROTOOPT 109 /* Protocol not available */
9654 +#define ESHUTDOWN 110 /* Can't send after socket shutdown */
9655 +#define ECONNREFUSED 111 /* Connection refused */
9656 +#define EADDRINUSE 112 /* Address already in use */
9657 +#define ECONNABORTED 113 /* Connection aborted */
9658 +#define ENETUNREACH 114 /* Network is unreachable */
9659 +#define ENETDOWN 115 /* Network interface is not configured */
9660 +#define ETIMEDOUT 116 /* Connection timed out */
9661 +#define EHOSTDOWN 117 /* Host is down */
9662 +#define EHOSTUNREACH 118 /* Host is unreachable */
9663 +#define EINPROGRESS 119 /* Connection already in progress */
9664 +#define EALREADY 120 /* Socket already connected */
9665 +#define EDESTADDRREQ 121 /* Destination address required */
9666 +#define EMSGSIZE 122 /* Message too long */
9667 +#define EPROTONOSUPPORT 123 /* Unknown protocol */
9668 +#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
9669 +#define EADDRNOTAVAIL 125 /* Address not available */
9670 +#define ENETRESET 126
9671 +#define EISCONN 127 /* Socket is already connected */
9672 +#define ENOTCONN 128 /* Socket is not connected */
9673 +#define ETOOMANYREFS 129
9674 +#define EPROCLIM 130
9675 +#define EUSERS 131
9676 +#define EDQUOT 132
9677 +#define ESTALE 133
9678 +#define ENOTSUP 134 /* Not supported */
9679 +#define ENOMEDIUM 135 /* No medium (in tape drive) */
9680 +#define ENOSHARE 136 /* No such host or network path */
9681 +#define ECASECLASH 137 /* Filename exists with different case */
9682 +#define EILSEQ 138
9683 +#define EOVERFLOW 139 /* Value too large for defined data type */
9685 +/* From cygwin32. */
9686 +#define EWOULDBLOCK EAGAIN /* Operation would block */
9688 +#define __ELASTERROR 2000 /* Users can add values starting here */
9690 +#ifdef __cplusplus
9692 +#endif
9693 +#endif /* _SYS_ERRNO_H */
9694 diff --git a/newlib/libc/sys/psp/sys/fd_set.h b/newlib/libc/sys/psp/sys/fd_set.h
9695 new file mode 100644
9696 index 000000000..d228bc447
9697 --- /dev/null
9698 +++ b/newlib/libc/sys/psp/sys/fd_set.h
9699 @@ -0,0 +1,69 @@
9700 +/* $NetBSD: fd_set.h,v 1.1 2005/05/22 12:44:24 kleink Exp $ */
9702 +/*-
9703 + * Copyright (c) 1992, 1993
9704 + * The Regents of the University of California. All rights reserved.
9706 + * Redistribution and use in source and binary forms, with or without
9707 + * modification, are permitted provided that the following conditions
9708 + * are met:
9709 + * 1. Redistributions of source code must retain the above copyright
9710 + * notice, this list of conditions and the following disclaimer.
9711 + * 2. Redistributions in binary form must reproduce the above copyright
9712 + * notice, this list of conditions and the following disclaimer in the
9713 + * documentation and/or other materials provided with the distribution.
9714 + * 3. Neither the name of the University nor the names of its contributors
9715 + * may be used to endorse or promote products derived from this software
9716 + * without specific prior written permission.
9718 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
9719 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9720 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9721 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
9722 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9723 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9724 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9725 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9726 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9727 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9728 + * SUCH DAMAGE.
9730 + * from: @(#)types.h 8.4 (Berkeley) 1/21/94
9731 + */
9733 +#ifndef _SYS_FD_SET_H_
9734 +#define _SYS_FD_SET_H_
9736 +#include <sys/socket.h>
9737 +#include <stdint.h>
9740 + * Implementation dependent defines, hidden from user space. X/Open does not
9741 + * specify them.
9742 + */
9743 +#define __NBBY 8 /* number of bits in a byte */
9744 +typedef uint32_t __fd_mask;
9746 +/* bits per mask */
9747 +#define __NFDBITS ((unsigned int)sizeof(__fd_mask) * __NBBY)
9749 +#define __howmany(x, y) (((x) + ((y) - 1)) / (y))
9751 +#define FD_SETSIZE 256
9753 +typedef struct fd_set {
9754 + __fd_mask fds_bits[__howmany(FD_SETSIZE, __NFDBITS)];
9755 +} fd_set;
9757 +#define FD_SET(n, p) \
9758 + ((p)->fds_bits[(n) /__NFDBITS] |= (1 << ((n) % __NFDBITS)))
9760 +#define FD_CLR(n, p) \
9761 + ((p)->fds_bits[(n) /__NFDBITS] &= ~(1 << ((n) % __NFDBITS)))
9763 +#define FD_ISSET(n, p) \
9764 + ((p)->fds_bits[(n) /__NFDBITS] & (1 << ((n) % __NFDBITS)))
9766 +#define FD_ZERO(p) (void)__builtin_memset((p), 0, sizeof(*(p)))
9768 +#endif /* _SYS_FD_SET_H_ */
9769 diff --git a/newlib/libc/sys/psp/sys/ioctl.h b/newlib/libc/sys/psp/sys/ioctl.h
9770 new file mode 100644
9771 index 000000000..3c6ec00c5
9772 --- /dev/null
9773 +++ b/newlib/libc/sys/psp/sys/ioctl.h
9774 @@ -0,0 +1 @@
9775 +/* Empty file, here for compatibility */
9776 diff --git a/newlib/libc/sys/psp/sys/select.h b/newlib/libc/sys/psp/sys/select.h
9777 new file mode 100644
9778 index 000000000..3d9ed46ec
9779 --- /dev/null
9780 +++ b/newlib/libc/sys/psp/sys/select.h
9781 @@ -0,0 +1,54 @@
9782 +/* $NetBSD: select.h,v 1.24 2005/05/22 12:44:24 kleink Exp $ */
9784 +/*-
9785 + * Copyright (c) 1992, 1993
9786 + * The Regents of the University of California. All rights reserved.
9788 + * Redistribution and use in source and binary forms, with or without
9789 + * modification, are permitted provided that the following conditions
9790 + * are met:
9791 + * 1. Redistributions of source code must retain the above copyright
9792 + * notice, this list of conditions and the following disclaimer.
9793 + * 2. Redistributions in binary form must reproduce the above copyright
9794 + * notice, this list of conditions and the following disclaimer in the
9795 + * documentation and/or other materials provided with the distribution.
9796 + * 3. Neither the name of the University nor the names of its contributors
9797 + * may be used to endorse or promote products derived from this software
9798 + * without specific prior written permission.
9800 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
9801 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9802 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9803 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
9804 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9805 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9806 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9807 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9808 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9809 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9810 + * SUCH DAMAGE.
9812 + * @(#)select.h 8.2 (Berkeley) 1/4/94
9813 + */
9815 +#ifndef _SYS_SELECT_H_
9816 +#define _SYS_SELECT_H_
9818 +#ifdef __cplusplus
9819 +extern "C" {
9820 +#endif
9822 +#include <sys/fd_set.h>
9823 +#include <sys/time.h>
9825 +int sceNetInetSelect(int n, fd_set *readfds, fd_set *writefds,
9826 + fd_set *exceptfds, struct timeval *timeout);
9828 +int select(int n, fd_set *readfds, fd_set *writefds,
9829 + fd_set *exceptfds, struct timeval *timeout);
9831 +#ifdef __cplusplus
9833 +#endif
9835 +#endif /* !_SYS_SELECT_H_ */
9836 diff --git a/newlib/libc/sys/psp/sys/socket.h b/newlib/libc/sys/psp/sys/socket.h
9837 new file mode 100644
9838 index 000000000..cb5db45a6
9839 --- /dev/null
9840 +++ b/newlib/libc/sys/psp/sys/socket.h
9841 @@ -0,0 +1,294 @@
9842 +/* $NetBSD: socket.h,v 1.77 2005/11/29 03:12:16 christos Exp $ */
9845 + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
9846 + * All rights reserved.
9848 + * Redistribution and use in source and binary forms, with or without
9849 + * modification, are permitted provided that the following conditions
9850 + * are met:
9851 + * 1. Redistributions of source code must retain the above copyright
9852 + * notice, this list of conditions and the following disclaimer.
9853 + * 2. Redistributions in binary form must reproduce the above copyright
9854 + * notice, this list of conditions and the following disclaimer in the
9855 + * documentation and/or other materials provided with the distribution.
9856 + * 3. Neither the name of the project nor the names of its contributors
9857 + * may be used to endorse or promote products derived from this software
9858 + * without specific prior written permission.
9860 + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
9861 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9862 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9863 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
9864 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9865 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9866 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9867 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9868 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9869 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9870 + * SUCH DAMAGE.
9871 + */
9874 + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
9875 + * The Regents of the University of California. All rights reserved.
9877 + * Redistribution and use in source and binary forms, with or without
9878 + * modification, are permitted provided that the following conditions
9879 + * are met:
9880 + * 1. Redistributions of source code must retain the above copyright
9881 + * notice, this list of conditions and the following disclaimer.
9882 + * 2. Redistributions in binary form must reproduce the above copyright
9883 + * notice, this list of conditions and the following disclaimer in the
9884 + * documentation and/or other materials provided with the distribution.
9885 + * 3. Neither the name of the University nor the names of its contributors
9886 + * may be used to endorse or promote products derived from this software
9887 + * without specific prior written permission.
9889 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
9890 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9891 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9892 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
9893 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9894 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9895 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9896 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9897 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9898 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9899 + * SUCH DAMAGE.
9901 + * @(#)socket.h 8.6 (Berkeley) 5/3/95
9902 + */
9904 +#ifndef _SYS_SOCKET_H_
9905 +#define _SYS_SOCKET_H_
9907 +#ifdef __cplusplus
9908 +extern "C" {
9909 +#endif
9911 +#include <stdint.h>
9912 +#include <stddef.h>
9913 +#include <sys/types.h>
9915 +typedef uint8_t sa_family_t;
9916 +typedef uint32_t socklen_t;
9919 + * Socket types.
9920 + */
9921 +#define SOCK_STREAM 1 /* stream socket */
9922 +#define SOCK_DGRAM 2 /* datagram socket */
9923 +#define SOCK_RAW 3 /* raw-protocol interface */
9924 +#define SOCK_RDM 4 /* reliably-delivered message */
9925 +#define SOCK_SEQPACKET 5 /* sequenced packet stream */
9928 + * Option flags per-socket.
9929 + */
9930 +#define SO_DEBUG 0x0001 /* turn on debugging info recording */
9931 +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
9932 +#define SO_REUSEADDR 0x0004 /* allow local address reuse */
9933 +#define SO_KEEPALIVE 0x0008 /* keep connections alive */
9934 +#define SO_DONTROUTE 0x0010 /* just use interface addresses */
9935 +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
9936 +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
9937 +#define SO_LINGER 0x0080 /* linger on close if data present */
9938 +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
9939 +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
9940 +#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */
9943 + * Additional options, not kept in so_options.
9944 + */
9945 +#define SO_SNDBUF 0x1001 /* send buffer size */
9946 +#define SO_RCVBUF 0x1002 /* receive buffer size */
9947 +#define SO_SNDLOWAT 0x1003 /* send low-water mark */
9948 +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
9949 +#define SO_SNDTIMEO 0x1005 /* send timeout */
9950 +#define SO_RCVTIMEO 0x1006 /* receive timeout */
9951 +#define SO_ERROR 0x1007 /* get error status and clear */
9952 +#define SO_TYPE 0x1008 /* get socket type */
9953 +#define SO_OVERFLOWED 0x1009 /* datagrams: return packets dropped */
9954 +#define SO_NONBLOCK 0x1009 /* non-blocking I/O */
9957 + * Structure used for manipulating linger option.
9958 + */
9959 +struct linger {
9960 + int l_onoff; /* option on/off */
9961 + int l_linger; /* linger time in seconds */
9965 + * Level number for (get/set)sockopt() to apply to socket itself.
9966 + */
9967 +#define SOL_SOCKET 0xffff /* options for socket level */
9970 + * Address families.
9971 + */
9972 +#define AF_UNSPEC 0 /* unspecified */
9973 +#define AF_LOCAL 1 /* local to host (pipes, portals) */
9974 +#define AF_UNIX AF_LOCAL /* backward compatibility */
9975 +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
9976 +#define AF_IMPLINK 3 /* arpanet imp addresses */
9977 +#define AF_PUP 4 /* pup protocols: e.g. BSP */
9978 +#define AF_CHAOS 5 /* mit CHAOS protocols */
9979 +#define AF_NS 6 /* XEROX NS protocols */
9980 +#define AF_ISO 7 /* ISO protocols */
9981 +#define AF_OSI AF_ISO
9982 +#define AF_ECMA 8 /* european computer manufacturers */
9983 +#define AF_DATAKIT 9 /* datakit protocols */
9984 +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
9985 +#define AF_SNA 11 /* IBM SNA */
9986 +#define AF_DECnet 12 /* DECnet */
9987 +#define AF_DLI 13 /* DEC Direct data link interface */
9988 +#define AF_LAT 14 /* LAT */
9989 +#define AF_HYLINK 15 /* NSC Hyperchannel */
9990 +#define AF_APPLETALK 16 /* Apple Talk */
9991 +#define AF_ROUTE 17 /* Internal Routing Protocol */
9992 +#define AF_LINK 18 /* Link layer interface */
9993 +#define AF_COIP 20 /* connection-oriented IP, aka ST II */
9994 +#define AF_CNT 21 /* Computer Network Technology */
9995 +#define AF_IPX 23 /* Novell Internet Protocol */
9996 +#define AF_INET6 24 /* IP version 6 */
9997 +#define AF_ISDN 26 /* Integrated Services Digital Network*/
9998 +#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */
9999 +#define AF_NATM 27 /* native ATM access */
10000 +#define AF_ARP 28 /* (rev.) addr. res. prot. (RFC 826) */
10001 +#define AF_MAX 31
10004 + * Structure used by kernel to store most
10005 + * addresses.
10006 + */
10007 +struct sockaddr {
10008 + uint8_t sa_len; /* total length */
10009 + sa_family_t sa_family; /* address family */
10010 + char sa_data[14]; /* actually longer; address value */
10014 + * Protocol families, same as address families for now.
10015 + */
10016 +#define PF_UNSPEC AF_UNSPEC
10017 +#define PF_LOCAL AF_LOCAL
10018 +#define PF_UNIX PF_LOCAL /* backward compatibility */
10019 +#define PF_INET AF_INET
10020 +#define PF_IMPLINK AF_IMPLINK
10021 +#define PF_PUP AF_PUP
10022 +#define PF_CHAOS AF_CHAOS
10023 +#define PF_NS AF_NS
10024 +#define PF_ISO AF_ISO
10025 +#define PF_OSI AF_ISO
10026 +#define PF_ECMA AF_ECMA
10027 +#define PF_DATAKIT AF_DATAKIT
10028 +#define PF_CCITT AF_CCITT
10029 +#define PF_SNA AF_SNA
10030 +#define PF_DECnet AF_DECnet
10031 +#define PF_DLI AF_DLI
10032 +#define PF_LAT AF_LAT
10033 +#define PF_HYLINK AF_HYLINK
10034 +#define PF_APPLETALK AF_APPLETALK
10035 +#define PF_ROUTE AF_ROUTE
10036 +#define PF_LINK AF_LINK
10037 +#if defined(_NETBSD_SOURCE)
10038 +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
10039 +#endif
10040 +#define PF_COIP AF_COIP
10041 +#define PF_CNT AF_CNT
10042 +#define PF_INET6 AF_INET6
10043 +#define PF_IPX AF_IPX /* same format as AF_NS */
10044 +#if defined(_NETBSD_SOURCE)
10045 +#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */
10046 +#define PF_PIP pseudo_AF_PIP
10047 +#endif
10048 +#define PF_ISDN AF_ISDN /* same as E164 */
10049 +#define PF_E164 AF_E164
10050 +#define PF_NATM AF_NATM
10051 +#define PF_ARP AF_ARP
10052 +#if defined(_NETBSD_SOURCE)
10053 +#define PF_KEY pseudo_AF_KEY /* like PF_ROUTE, only for key mgmt */
10054 +#endif
10056 +#define PF_MAX AF_MAX
10058 +#define MSG_OOB 0x1 /* process out-of-band data */
10059 +#define MSG_PEEK 0x2 /* peek at incoming message */
10060 +#define MSG_DONTROUTE 0x4 /* send without using routing tables */
10061 +#define MSG_EOR 0x8 /* data completes record */
10062 +#define MSG_TRUNC 0x10 /* data discarded before delivery */
10063 +#define MSG_CTRUNC 0x20 /* control data lost before delivery */
10064 +#define MSG_WAITALL 0x40 /* wait for full request or error */
10065 +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
10066 +#define MSG_BCAST 0x100 /* this message was rcvd using link-level brdcst */
10067 +#define MSG_MCAST 0x200 /* this message was rcvd using link-level mcast */
10070 + * Types of socket shutdown(2).
10071 + */
10072 +#define SHUT_RD 0 /* Disallow further receives. */
10073 +#define SHUT_WR 1 /* Disallow further sends. */
10074 +#define SHUT_RDWR 2 /* Disallow further sends/receives. */
10076 +struct iovec {
10077 + void *iov_base; /* Base address. */
10078 + size_t iov_len; /* Length. */
10081 +struct msghdr {
10082 + void *msg_name; /* optional address */
10083 + socklen_t msg_namelen; /* size of address */
10084 + struct iovec *msg_iov; /* scatter/gather array */
10085 + int msg_iovlen; /* # elements in msg_iov */
10086 + void *msg_control; /* ancillary data, see below */
10087 + socklen_t msg_controllen; /* ancillary data buffer len */
10088 + int msg_flags; /* flags on received message */
10091 +/* BSD-compatible socket API. */
10092 +int accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
10093 +int bind(int, const struct sockaddr *, socklen_t);
10094 +int connect(int, const struct sockaddr *, socklen_t);
10095 +int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
10096 +int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
10097 +int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict);
10098 +int listen(int, int);
10099 +ssize_t recv(int, void *, size_t, int);
10100 +ssize_t recvfrom(int, void * __restrict, size_t, int,
10101 + struct sockaddr * __restrict, socklen_t * __restrict);
10102 +ssize_t recvmsg(int s, struct msghdr *msg, int flags);
10103 +ssize_t send(int, const void *, size_t, int);
10104 +ssize_t sendto(int, const void *,
10105 + size_t, int, const struct sockaddr *, socklen_t);
10106 +ssize_t sendmsg(int s, const struct msghdr *msg, int flags);
10107 +int setsockopt(int, int, int, const void *, socklen_t);
10108 +int shutdown(int, int);
10109 +int socket(int, int, int);
10111 +/* sceNetInet socket API. */
10112 +int sceNetInetAccept(int s, struct sockaddr *addr, socklen_t *addrlen);
10113 +int sceNetInetBind(int s, const struct sockaddr *my_addr, socklen_t addrlen);
10114 +int sceNetInetConnect(int s, const struct sockaddr *serv_addr, socklen_t addrlen);
10115 +int sceNetInetGetsockopt(int s, int level, int optname, void *optval, socklen_t *optlen);
10116 +int sceNetInetListen(int s, int backlog);
10117 +ssize_t sceNetInetRecv(int s, void *buf, size_t len, int flags);
10118 +ssize_t sceNetInetRecvfrom(int s, void *buf, size_t flags, int, struct sockaddr *from, socklen_t *fromlen);
10119 +ssize_t sceNetInetRecvmsg(int s, struct msghdr *msg, int flags);
10120 +ssize_t sceNetInetSend(int s, const void *buf, size_t len, int flags);
10121 +ssize_t sceNetInetSendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
10122 +ssize_t sceNetInetSendmsg(int s, const struct msghdr *msg, int flags);
10123 +int sceNetInetSetsockopt(int s, int level, int optname, const void *optval, socklen_t optlen);
10124 +int sceNetInetShutdown(int s, int how);
10125 +int sceNetInetSocket(int domain, int type, int protocol);
10126 +int sceNetInetClose(int s);
10127 +int sceNetInetGetErrno(void);
10128 +int sceNetInetGetsockname(int s, struct sockaddr *name, socklen_t *namelen);
10129 +int sceNetInetGetpeername(int s, struct sockaddr *name, socklen_t *namelen);
10131 +#ifdef __cplusplus
10133 +#endif
10135 +#endif /* !_SYS_SOCKET_H_ */
10136 diff --git a/newlib/libc/sys/psp/syscalls.c b/newlib/libc/sys/psp/syscalls.c
10137 new file mode 100644
10138 index 000000000..233950e29
10139 --- /dev/null
10140 +++ b/newlib/libc/sys/psp/syscalls.c
10141 @@ -0,0 +1,19 @@
10143 + * PSP Software Development Kit - http://www.pspdev.org
10144 + * -----------------------------------------------------------------------
10145 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
10147 + * syscalls.c - functions in systeam namespace goes here
10149 + * Copyright (c) 2007 Alper Akcan "anhanguera" <distchx@yahoo.com>
10150 + *
10151 + */
10153 +#include <stdio.h>
10155 +int __psp_set_errno (int code);
10157 +time_t _times (time_t *t)
10159 + return __psp_set_errno(sceKernelLibcTime(t));
10161 diff --git a/newlib/libc/sys/psp/xprintf.c b/newlib/libc/sys/psp/xprintf.c
10162 new file mode 100644
10163 index 000000000..0fb24c071
10164 --- /dev/null
10165 +++ b/newlib/libc/sys/psp/xprintf.c
10166 @@ -0,0 +1,984 @@
10168 + * PSP Software Development Kit - http://www.pspdev.org
10169 + * -----------------------------------------------------------------------
10170 + * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
10172 + * xprintf.c - Various *printf functions.
10174 + * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
10175 + * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
10176 + * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
10178 + * $Id: newlib-1.13.0.patch 1891 2006-05-02 15:32:28Z raf $
10179 + */
10180 +/* Code borrowed from mysql's xprintf.c, by Richard Hipp */
10181 +/* This xprintf.c file on which this one is based is in public domain. */
10183 +#include <stdio.h>
10184 +#include <string.h>
10185 +#include <malloc.h>
10187 +#include <stdarg.h>
10188 +#include <stddef.h>
10191 +** The maximum number of digits of accuracy in a floating-point conversion.
10193 +#define MAXDIG 20
10195 +/* Instead of including ctype.h, use the isdigit() prototype because psplibc doesn't
10196 + know about newlib, and newlib defines isdigit as a macro that uses _ctype_. */
10197 +int isdigit(int __c);
10199 +int vxprintf(void (*func)(char *, int, void *), void *arg, const char *format, va_list ap);
10201 +#ifdef F_vxprintf
10203 +** Conversion types fall into various categories as defined by the
10204 +** following enumeration.
10207 +enum e_type { /* The type of the format field */
10208 + RADIX, /* Integer types. %d, %x, %o, and so forth */
10209 + FLOAT, /* Floating point. %f */
10210 + EXP, /* Exponentional notation. %e and %E */
10211 + GENERIC, /* Floating or exponential, depending on exponent. %g */
10212 + SIZE, /* Return number of characters processed so far. %n */
10213 + STRING, /* Strings. %s */
10214 + PERCENT, /* Percent symbol. %% */
10215 + CHAR, /* Characters. %c */
10216 + ERROR, /* Used to indicate no such conversion type */
10217 +/* The rest are extensions, not normally found in printf() */
10218 + CHARLIT, /* Literal characters. %' */
10219 + SEEIT, /* Strings with visible control characters. %S */
10220 + MEM_STRING, /* A string which should be deleted after use. %z */
10221 + ORDINAL, /* 1st, 2nd, 3rd and so forth */
10225 +** Each builtin conversion character (ex: the 'd' in "%d") is described
10226 +** by an instance of the following structure
10228 +typedef struct s_info { /* Information about each format field */
10229 + int fmttype; /* The format field code letter */
10230 + int base; /* The base for radix conversion */
10231 + char *charset; /* The character set for conversion */
10232 + int flag_signed; /* Is the quantity signed? */
10233 + char *prefix; /* Prefix on non-zero values in alt format */
10234 + enum e_type type; /* Conversion paradigm */
10235 +} info;
10238 +** The following table is searched linearly, so it is good to put the
10239 +** most frequently used conversion types first.
10241 +static info fmtinfo[] = {
10242 + { 'd', 10, "0123456789", 1, 0, RADIX, },
10243 + { 's', 0, 0, 0, 0, STRING, },
10244 + { 'S', 0, 0, 0, 0, SEEIT, },
10245 + { 'z', 0, 0, 0, 0, MEM_STRING, },
10246 + { 'c', 0, 0, 0, 0, CHAR, },
10247 + { 'o', 8, "01234567", 0, "0", RADIX, },
10248 + { 'u', 10, "0123456789", 0, 0, RADIX, },
10249 + { 'x', 16, "0123456789abcdef", 0, "x0", RADIX, },
10250 + { 'X', 16, "0123456789ABCDEF", 0, "X0", RADIX, },
10251 + { 'r', 10, "0123456789", 0, 0, ORDINAL, },
10252 + { 'f', 0, 0, 1, 0, FLOAT, },
10253 + { 'e', 0, "e", 1, 0, EXP, },
10254 + { 'E', 0, "E", 1, 0, EXP, },
10255 + { 'g', 0, "e", 1, 0, GENERIC, },
10256 + { 'G', 0, "E", 1, 0, GENERIC, },
10257 + { 'i', 10, "0123456789", 1, 0, RADIX, },
10258 + { 'n', 0, 0, 0, 0, SIZE, },
10259 + { 'S', 0, 0, 0, 0, SEEIT, },
10260 + { '%', 0, 0, 0, 0, PERCENT, },
10261 + { 'b', 2, "01", 0, "b0", RADIX, }, /* Binary notation */
10262 + { 'p', 16, "0123456789ABCDEF", 0, "x0", RADIX, }, /* Pointers */
10263 + { '\'', 0, 0, 0, 0, CHARLIT, }, /* Literal char */
10265 +#define NINFO (sizeof(fmtinfo)/sizeof(info)) /* Size of the fmtinfo table */
10268 +** If NOFLOATINGPOINT is defined, then none of the floating point
10269 +** conversions will work.
10271 +#ifndef NOFLOATINGPOINT
10273 +** "*val" is a double such that 0.1 <= *val < 10.0
10274 +** Return the ascii code for the leading digit of *val, then
10275 +** multiply "*val" by 10.0 to renormalize.
10277 +** Example:
10278 +** input: *val = 3.14159
10279 +** output: *val = 1.4159 function return = '3'
10281 +** The counter *cnt is incremented each time. After counter exceeds
10282 +** 16 (the number of significant digits in a 64-bit float) '0' is
10283 +** always returned.
10285 +static int getdigit(long double *val, int *cnt){
10286 + int digit;
10287 + long double d;
10288 + if( (*cnt)++ >= MAXDIG ) return '0';
10289 + digit = (int)*val;
10290 + d = digit;
10291 + digit += '0';
10292 + *val = (*val - d)*10.0;
10293 + return digit;
10295 +#endif
10298 +** Setting the size of the BUFFER involves trade-offs. No %d or %f
10299 +** conversion can have more than BUFSIZE characters. If the field
10300 +** width is larger than BUFSIZE, it is silently shortened. On the
10301 +** other hand, this routine consumes more stack space with larger
10302 +** BUFSIZEs. If you have some threads for which you want to minimize
10303 +** stack space, you should keep BUFSIZE small.
10305 +#define BUFSIZE 100 /* Size of the output buffer */
10308 +** The root program. All variations call this core.
10310 +** INPUTS:
10311 +** func This is a pointer to a function taking three arguments
10312 +** 1. A pointer to the list of characters to be output
10313 +** (Note, this list is NOT null terminated.)
10314 +** 2. An integer number of characters to be output.
10315 +** (Note: This number might be zero.)
10316 +** 3. A pointer to anything. Same as the "arg" parameter.
10318 +** arg This is the pointer to anything which will be passed as the
10319 +** third argument to "func". Use it for whatever you like.
10321 +** fmt This is the format string, as in the usual print.
10323 +** ap This is a pointer to a list of arguments. Same as in
10324 +** vfprint.
10326 +** OUTPUTS:
10327 +** The return value is the total number of characters sent to
10328 +** the function "func". Returns -1 on a error.
10330 +** Note that the order in which automatic variables are declared below
10331 +** seems to make a big difference in determining how fast this beast
10332 +** will run.
10335 +int vxprintf(func,arg,format,ap)
10336 + void (*func)(char*,int,void*);
10337 + void *arg;
10338 + const char *format;
10339 + va_list ap;
10341 + register const char *fmt; /* The format string. */
10342 + register int c; /* Next character in the format string */
10343 + register char *bufpt; /* Pointer to the conversion buffer */
10344 + register int precision; /* Precision of the current field */
10345 + register int length; /* Length of the field */
10346 + register int idx; /* A general purpose loop counter */
10347 + int count; /* Total number of characters output */
10348 + int width; /* Width of the current field */
10349 + int flag_leftjustify; /* True if "-" flag is present */
10350 + int flag_plussign; /* True if "+" flag is present */
10351 + int flag_blanksign; /* True if " " flag is present */
10352 + int flag_alternateform; /* True if "#" flag is present */
10353 + int flag_zeropad; /* True if field width constant starts with zero */
10354 + int flag_long; /* True if "l" flag is present */
10355 + int flag_center; /* True if "=" flag is present */
10356 + unsigned long long longvalue; /* Value for integer types */
10358 + long double realvalue; /* Value for real types */
10359 + info *infop; /* Pointer to the appropriate info structure */
10360 + char buf[BUFSIZE]; /* Conversion buffer */
10361 + char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
10362 + int errorflag = 0; /* True if an error is encountered */
10363 + enum e_type xtype; /* Conversion paradigm */
10364 + char *zMem = 0; /* String to be freed */
10365 + static char spaces[] =
10366 + " ";
10367 +#define SPACESIZE (sizeof(spaces)-1)
10368 +#ifndef NOFLOATINGPOINT
10369 + int exp; /* exponent of real numbers */
10370 + long double rounder; /* Used for rounding floating point values */
10371 + int flag_dp; /* True if decimal point should be shown */
10372 + int flag_rtz; /* True if trailing zeros should be removed */
10373 + int flag_exp; /* True to force display of the exponent */
10374 + int nsd; /* Number of significant digits returned */
10375 +#endif
10377 + fmt = format; /* Put in a register for speed */
10378 + count = length = 0;
10379 + bufpt = 0;
10380 + for(; (c=(*fmt))!=0; ++fmt){
10381 + if( c!='%' ){
10382 + register int amt;
10383 + bufpt = (char *)fmt;
10384 + amt = 1;
10385 + while( (c=(*++fmt))!='%' && c!=0 ) amt++;
10386 + (*func)(bufpt,amt,arg);
10387 + count += amt;
10388 + if( c==0 ) break;
10390 + if( (c=(*++fmt))==0 ){
10391 + errorflag = 1;
10392 + (*func)("%",1,arg);
10393 + count++;
10394 + break;
10396 + /* Find out what flags are present */
10397 + flag_leftjustify = flag_plussign = flag_blanksign =
10398 + flag_alternateform = flag_zeropad = flag_center = 0;
10399 + do{
10400 + switch( c ){
10401 + case '-': flag_leftjustify = 1; c = 0; break;
10402 + case '+': flag_plussign = 1; c = 0; break;
10403 + case ' ': flag_blanksign = 1; c = 0; break;
10404 + case '#': flag_alternateform = 1; c = 0; break;
10405 + case '0': flag_zeropad = 1; c = 0; break;
10406 + case '=': flag_center = 1; c = 0; break;
10407 + default: break;
10409 + }while( c==0 && (c=(*++fmt))!=0 );
10410 + if( flag_center ) flag_leftjustify = 0;
10411 + /* Get the field width */
10412 + width = 0;
10413 + if( c=='*' ){
10414 + width = va_arg(ap,int);
10415 + if( width<0 ){
10416 + flag_leftjustify = 1;
10417 + width = -width;
10419 + c = *++fmt;
10420 + }else{
10421 + while( isdigit(c) ){
10422 + width = width*10 + c - '0';
10423 + c = *++fmt;
10426 + if( width > BUFSIZE-10 ){
10427 + width = BUFSIZE-10;
10429 + /* Get the precision */
10430 + if( c=='.' ){
10431 + precision = 0;
10432 + c = *++fmt;
10433 + if( c=='*' ){
10434 + precision = va_arg(ap,int);
10435 +#ifndef COMPATIBILITY
10436 + /* This is sensible, but SUN OS 4.1 doesn't do it. */
10437 + if( precision<0 ) precision = -precision;
10438 +#endif
10439 + c = *++fmt;
10440 + }else{
10441 + while( isdigit(c) ){
10442 + precision = precision*10 + c - '0';
10443 + c = *++fmt;
10446 + /* Limit the precision to prevent overflowing buf[] during conversion */
10447 + if( precision>BUFSIZE-40 ) precision = BUFSIZE-40;
10448 + }else{
10449 + precision = -1;
10451 + /* Get the conversion type modifier */
10452 + if( c=='l' ){
10453 + flag_long = 1;
10454 + c = *++fmt;
10455 + if( c == 'l' ){
10456 + flag_long = 2;
10457 + c = *++fmt;
10459 + }else{
10460 + flag_long = 0;
10462 + /* Fetch the info entry for the field */
10463 + infop = 0;
10464 + for(idx=0; idx<NINFO; idx++){
10465 + if( c==fmtinfo[idx].fmttype ){
10466 + infop = &fmtinfo[idx];
10467 + break;
10470 + /* No info entry found. It must be an error. */
10471 + if( infop==0 ){
10472 + xtype = ERROR;
10473 + }else{
10474 + xtype = infop->type;
10477 + /*
10478 + ** At this point, variables are initialized as follows:
10479 + **
10480 + ** flag_alternateform TRUE if a '#' is present.
10481 + ** flag_plussign TRUE if a '+' is present.
10482 + ** flag_leftjustify TRUE if a '-' is present or if the
10483 + ** field width was negative.
10484 + ** flag_zeropad TRUE if the width began with 0.
10485 + ** flag_long TRUE if the letter 'l' (ell) prefixed
10486 + ** the conversion character.
10487 + ** flag_blanksign TRUE if a ' ' is present.
10488 + ** width The specified field width. This is
10489 + ** always non-negative. Zero is the default.
10490 + ** precision The specified precision. The default
10491 + ** is -1.
10492 + ** xtype The class of the conversion.
10493 + ** infop Pointer to the appropriate info struct.
10494 + */
10495 + switch( xtype ){
10496 + case ORDINAL:
10497 + case RADIX:
10498 + if(( flag_long>1 )&&( infop->flag_signed )){
10499 + signed long long t = va_arg(ap,signed long long);
10500 + longvalue = t;
10501 + }else if(( flag_long>1 )&&( !infop->flag_signed )){
10502 + unsigned long long t = va_arg(ap,unsigned long long);
10503 + longvalue = t;
10504 + }else if(( flag_long )&&( infop->flag_signed )){
10505 + signed long t = va_arg(ap,signed long);
10506 + longvalue = t;
10507 + }else if(( flag_long )&&( !infop->flag_signed )){
10508 + unsigned long t = va_arg(ap,unsigned long);
10509 + longvalue = t;
10510 + }else if(( !flag_long )&&( infop->flag_signed )){
10511 + signed int t = va_arg(ap,signed int) & ((unsigned long) 0xffffffff);
10512 + longvalue = t;
10513 + }else{
10514 + unsigned int t = va_arg(ap,unsigned int) & ((unsigned long) 0xffffffff);
10515 + longvalue = t;
10517 +#ifdef COMPATIBILITY
10518 + /* For the format %#x, the value zero is printed "0" not "0x0".
10519 + ** I think this is stupid. */
10520 + if( longvalue==0 ) flag_alternateform = 0;
10521 +#else
10522 + /* More sensible: turn off the prefix for octal (to prevent "00"),
10523 + ** but leave the prefix for hex. */
10524 + if( longvalue==0 && infop->base==8 ) flag_alternateform = 0;
10525 +#endif
10526 + if( infop->flag_signed ){
10527 + if( *(long long*)&longvalue<0 ){
10528 + longvalue = -*(long long*)&longvalue;
10529 + prefix = '-';
10530 + }else if( flag_plussign ) prefix = '+';
10531 + else if( flag_blanksign ) prefix = ' ';
10532 + else prefix = 0;
10533 + }else prefix = 0;
10534 + if( flag_zeropad && precision<width-(prefix!=0) ){
10535 + precision = width-(prefix!=0);
10537 + bufpt = &buf[BUFSIZE];
10538 + if( xtype==ORDINAL ){
10539 + long a,b;
10540 + a = longvalue%10;
10541 + b = longvalue%100;
10542 + bufpt -= 2;
10543 + if( a==0 || a>3 || (b>10 && b<14) ){
10544 + bufpt[0] = 't';
10545 + bufpt[1] = 'h';
10546 + }else if( a==1 ){
10547 + bufpt[0] = 's';
10548 + bufpt[1] = 't';
10549 + }else if( a==2 ){
10550 + bufpt[0] = 'n';
10551 + bufpt[1] = 'd';
10552 + }else if( a==3 ){
10553 + bufpt[0] = 'r';
10554 + bufpt[1] = 'd';
10558 + register char *cset; /* Use registers for speed */
10559 + register int base;
10560 + cset = infop->charset;
10561 + base = infop->base;
10562 + do{ /* Convert to ascii */
10563 + *(--bufpt) = cset[longvalue%base];
10564 + longvalue = longvalue/base;
10565 + }while( longvalue>0 );
10567 + length = (int)(&buf[BUFSIZE]-bufpt);
10568 + if(infop->fmttype == 'p')
10570 + precision = 8;
10571 + flag_alternateform = 1;
10574 + for(idx=precision-length; idx>0; idx--){
10575 + *(--bufpt) = '0'; /* Zero pad */
10577 + if( prefix ) *(--bufpt) = prefix; /* Add sign */
10578 + if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
10579 + char *pre, x;
10580 + pre = infop->prefix;
10581 + if( *bufpt!=pre[0] ){
10582 + for(pre=infop->prefix; (x=(*pre))!=0; pre++) *(--bufpt) = x;
10586 + length = (int)(&buf[BUFSIZE]-bufpt);
10587 + break;
10588 + case FLOAT:
10589 + case EXP:
10590 + case GENERIC:
10591 + realvalue = va_arg(ap,double);
10592 +#ifndef NOFLOATINGPOINT
10593 + if( precision<0 ) precision = 6; /* Set default precision */
10594 + if( precision>BUFSIZE-10 ) precision = BUFSIZE-10;
10595 + if( realvalue<0.0 ){
10596 + realvalue = -realvalue;
10597 + prefix = '-';
10598 + }else{
10599 + if( flag_plussign ) prefix = '+';
10600 + else if( flag_blanksign ) prefix = ' ';
10601 + else prefix = 0;
10603 + if( infop->type==GENERIC && precision>0 ) precision--;
10604 + rounder = 0.0;
10605 +#ifdef COMPATIBILITY
10606 + /* Rounding works like BSD when the constant 0.4999 is used. Wierd! */
10607 + for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1);
10608 +#else
10609 + /* It makes more sense to use 0.5 */
10610 + if( precision>MAXDIG-1 ) idx = MAXDIG-1;
10611 + else idx = precision;
10612 + for(rounder=0.5; idx>0; idx--, rounder*=0.1);
10613 +#endif
10614 + if( infop->type==FLOAT ) realvalue += rounder;
10615 + /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
10616 + exp = 0;
10617 + if( realvalue>0.0 ){
10618 + int k = 0;
10619 + while( realvalue>=1e8 && k++<100 ){ realvalue *= 1e-8; exp+=8; }
10620 + while( realvalue>=10.0 && k++<100 ){ realvalue *= 0.1; exp++; }
10621 + while( realvalue<1e-8 && k++<100 ){ realvalue *= 1e8; exp-=8; }
10622 + while( realvalue<1.0 && k++<100 ){ realvalue *= 10.0; exp--; }
10623 + if( k>=100 ){
10624 + bufpt = "NaN";
10625 + length = 3;
10626 + break;
10629 + bufpt = buf;
10630 + /*
10631 + ** If the field type is GENERIC, then convert to either EXP
10632 + ** or FLOAT, as appropriate.
10633 + */
10634 + flag_exp = xtype==EXP;
10635 + if( xtype!=FLOAT ){
10636 + realvalue += rounder;
10637 + if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
10639 + if( xtype==GENERIC ){
10640 + flag_rtz = !flag_alternateform;
10641 + if( exp<-4 || exp>precision ){
10642 + xtype = EXP;
10643 + }else{
10644 + precision = precision - exp;
10645 + xtype = FLOAT;
10647 + }else{
10648 + flag_rtz = 0;
10650 + /*
10651 + ** The "exp+precision" test causes output to be of type EXP if
10652 + ** the precision is too large to fit in buf[].
10653 + */
10654 + nsd = 0;
10655 + if( xtype==FLOAT && exp+precision<BUFSIZE-30 ){
10656 + flag_dp = (precision>0 || flag_alternateform);
10657 + if( prefix ) *(bufpt++) = prefix; /* Sign */
10658 + if( exp<0 ) *(bufpt++) = '0'; /* Digits before "." */
10659 + else for(; exp>=0; exp--) *(bufpt++) = getdigit(&realvalue,&nsd);
10660 + if( flag_dp ) *(bufpt++) = '.'; /* The decimal point */
10661 + for(exp++; exp<0 && precision>0; precision--, exp++){
10662 + *(bufpt++) = '0';
10664 + while( (precision--)>0 ) *(bufpt++) = getdigit(&realvalue,&nsd);
10665 + *(bufpt--) = 0; /* Null terminate */
10666 + if( flag_rtz && flag_dp ){ /* Remove trailing zeros and "." */
10667 + while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0;
10668 + if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
10670 + bufpt++; /* point to next free slot */
10671 + }else{ /* EXP or GENERIC */
10672 + flag_dp = (precision>0 || flag_alternateform);
10673 + if( prefix ) *(bufpt++) = prefix; /* Sign */
10674 + *(bufpt++) = getdigit(&realvalue,&nsd); /* First digit */
10675 + if( flag_dp ) *(bufpt++) = '.'; /* Decimal point */
10676 + while( (precision--)>0 ) *(bufpt++) = getdigit(&realvalue,&nsd);
10677 + bufpt--; /* point to last digit */
10678 + if( flag_rtz && flag_dp ){ /* Remove tail zeros */
10679 + while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0;
10680 + if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
10682 + bufpt++; /* point to next free slot */
10683 + if( exp || flag_exp ){
10684 + *(bufpt++) = infop->charset[0];
10685 + if( exp<0 ){ *(bufpt++) = '-'; exp = -exp; } /* sign of exp */
10686 + else { *(bufpt++) = '+'; }
10687 + if( exp>=100 ){
10688 + *(bufpt++) = (exp/100)+'0'; /* 100's digit */
10689 + exp %= 100;
10691 + *(bufpt++) = exp/10+'0'; /* 10's digit */
10692 + *(bufpt++) = exp%10+'0'; /* 1's digit */
10695 + /* The converted number is in buf[] and zero terminated. Output it.
10696 + ** Note that the number is in the usual order, not reversed as with
10697 + ** integer conversions. */
10698 + length = (int)(bufpt-buf);
10699 + bufpt = buf;
10701 + /* Special case: Add leading zeros if the flag_zeropad flag is
10702 + ** set and we are not left justified */
10703 + if( flag_zeropad && !flag_leftjustify && length < width){
10704 + int i;
10705 + int nPad = width - length;
10706 + for(i=width; i>=nPad; i--){
10707 + bufpt[i] = bufpt[i-nPad];
10709 + i = prefix!=0;
10710 + while( nPad-- ) bufpt[i++] = '0';
10711 + length = width;
10713 +#endif
10714 + break;
10715 + case SIZE:
10716 + *(va_arg(ap,int*)) = count;
10717 + length = width = 0;
10718 + break;
10719 + case PERCENT:
10720 + buf[0] = '%';
10721 + bufpt = buf;
10722 + length = 1;
10723 + break;
10724 + case CHARLIT:
10725 + case CHAR:
10726 + c = buf[0] = (xtype==CHAR ? va_arg(ap,int) : *++fmt);
10727 + if( precision>=0 ){
10728 + for(idx=1; idx<precision; idx++) buf[idx] = c;
10729 + length = precision;
10730 + }else{
10731 + length =1;
10733 + bufpt = buf;
10734 + break;
10735 + case STRING:
10736 + case MEM_STRING:
10737 + zMem = bufpt = va_arg(ap,char*);
10738 + if( bufpt==0 ) bufpt = "(null)";
10739 + length = strlen(bufpt);
10740 + if( precision>=0 && precision<length ) length = precision;
10741 + break;
10742 + case SEEIT:
10744 + int i;
10745 + int c;
10746 + char *arg = va_arg(ap,char*);
10747 + for(i=0; i<BUFSIZE-1 && (c = *arg++)!=0; i++){
10748 + if( c<0x20 || c>=0x7f ){
10749 + buf[i++] = '^';
10750 + buf[i] = (c&0x1f)+0x40;
10751 + }else{
10752 + buf[i] = c;
10755 + bufpt = buf;
10756 + length = i;
10757 + if( precision>=0 && precision<length ) length = precision;
10759 + break;
10760 + case ERROR:
10761 + buf[0] = '%';
10762 + buf[1] = c;
10763 + errorflag = 0;
10764 + idx = 1+(c!=0);
10765 + (*func)("%",idx,arg);
10766 + count += idx;
10767 + if( c==0 ) fmt--;
10768 + break;
10769 + }/* End switch over the format type */
10770 + /*
10771 + ** The text of the conversion is pointed to by "bufpt" and is
10772 + ** "length" characters long. The field width is "width". Do
10773 + ** the output.
10774 + */
10775 + if( !flag_leftjustify ){
10776 + register int nspace;
10777 + nspace = width-length;
10778 + if( nspace>0 ){
10779 + if( flag_center ){
10780 + nspace = nspace/2;
10781 + width -= nspace;
10782 + flag_leftjustify = 1;
10784 + count += nspace;
10785 + while( nspace>=SPACESIZE ){
10786 + (*func)(spaces,SPACESIZE,arg);
10787 + nspace -= SPACESIZE;
10789 + if( nspace>0 ) (*func)(spaces,nspace,arg);
10792 + if( length>0 ){
10793 + (*func)(bufpt,length,arg);
10794 + count += length;
10796 + if( xtype==MEM_STRING && zMem ){
10797 + free(zMem);
10799 + if( flag_leftjustify ){
10800 + register int nspace;
10801 + nspace = width-length;
10802 + if( nspace>0 ){
10803 + count += nspace;
10804 + while( nspace>=SPACESIZE ){
10805 + (*func)(spaces,SPACESIZE,arg);
10806 + nspace -= SPACESIZE;
10808 + if( nspace>0 ) (*func)(spaces,nspace,arg);
10811 + }/* End for loop over the format string */
10812 + return errorflag ? -1 : count;
10813 +} /* End of function */
10814 +#endif
10816 +#ifdef F__xprintf
10818 +** This non-standard function is still occasionally useful....
10820 +int xprintf(
10821 + void (*func)(char*,int,void*),
10822 + void *arg,
10823 + const char *format,
10824 + ...
10826 + va_list ap;
10827 + va_start(ap,format);
10828 + return vxprintf(func,arg,format,ap);
10830 +#endif
10833 +** Now for string-print, also as found in any standard library.
10834 +** Add to this the snprint function which stops added characters
10835 +** to the string at a given length.
10837 +** Note that snprint returns the length of the string as it would
10838 +** be if there were no limit on the output.
10840 +struct s_strargument { /* Describes the string being written to */
10841 + char *next; /* Next free slot in the string */
10842 + char *last; /* Last available slot in the string */
10845 +void __sout(char *, int, void *);
10846 +#ifdef F___sout
10847 +void __sout(txt,amt,arg)
10848 + char *txt;
10849 + int amt;
10850 + void *arg;
10852 + register char *head;
10853 + register const char *t;
10854 + register int a;
10855 + register char *tail;
10856 + a = amt;
10857 + t = txt;
10858 + head = ((struct s_strargument*)arg)->next;
10859 + tail = ((struct s_strargument*)arg)->last;
10860 + if( tail ){
10861 + while( a-- >0 && head<tail ) *(head++) = *(t++);
10862 + }else{
10863 + while( a-- >0 ) *(head++) = *(t++);
10865 + *head = 0;
10866 + ((struct s_strargument*)arg)->next = head;
10868 +#endif
10870 +#ifdef F_vsnprintf
10871 +int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap){
10872 + struct s_strargument arg;
10873 + arg.next = buf;
10874 + arg.last = &buf[n-1];
10875 + *buf = 0;
10876 + return vxprintf(__sout,&arg,fmt,ap);
10878 +#endif
10880 +#ifdef F_snprintf
10881 +int snprintf(char *str, size_t sz, const char *format, ...)
10883 + va_list args;
10884 + struct s_strargument arg;
10885 + int ret;
10887 + arg.next = str;
10888 + arg.last = &str[sz-1];
10890 + va_start(args, format);
10891 + ret = vxprintf(__sout, &arg, format, args);
10892 + va_end(args);
10894 + return ret;
10896 +#endif
10898 +#ifdef F_vsprintf
10899 +int vsprintf(char *buf, const char *fmt, va_list ap){
10900 + struct s_strargument arg;
10901 + arg.next = buf;
10902 + arg.last = NULL;
10903 + *buf = 0;
10904 + return vxprintf(__sout,&arg,fmt,ap);
10906 +#endif
10908 +#ifdef F_sprintf
10909 +int sprintf (char *str, const char *format, ...)
10911 + va_list args;
10912 + struct s_strargument arg;
10913 + int ret;
10915 + arg.next = str;
10916 + arg.last = NULL;
10918 + va_start(args, format);
10919 + ret = vxprintf(__sout, &arg, format, args);
10920 + va_end(args);
10922 + return ret;
10924 +#endif
10927 +** The following section of code handles the mprintf routine, that
10928 +** writes to memory obtained from malloc().
10931 +/* This structure is used to store state information about the
10932 +** write in progress
10934 +struct sgMprintf {
10935 + char *zBase; /* A base allocation */
10936 + char *zText; /* The string collected so far */
10937 + int nChar; /* Length of the string so far */
10938 + int nAlloc; /* Amount of space allocated in zText */
10941 +void __mout(char *, int, void*);
10943 +#ifdef F___mout
10944 +/* The xprintf callback function. */
10945 +void __mout(zNewText,nNewChar,arg)
10946 + char *zNewText;
10947 + int nNewChar;
10948 + void *arg;
10950 + struct sgMprintf *pM = (struct sgMprintf*)arg;
10951 + if( pM->nChar + nNewChar + 1 > pM->nAlloc ){
10952 + pM->nAlloc = pM->nChar + nNewChar*2 + 1;
10953 + if( pM->zText==pM->zBase ){
10954 + pM->zText = malloc(pM->nAlloc);
10955 + if( pM->zText && pM->nChar ) memcpy(pM->zText,pM->zBase,pM->nChar);
10956 + }else{
10957 + pM->zText = realloc(pM->zText, pM->nAlloc);
10960 + if( pM->zText ){
10961 + memcpy(&pM->zText[pM->nChar], zNewText, nNewChar);
10962 + pM->nChar += nNewChar;
10963 + pM->zText[pM->nChar] = 0;
10966 +#endif
10969 +** mprintf() works like printf(), but allocations memory to hold the
10970 +** resulting string and returns a pointer to the allocated memory.
10972 +** We changed the name to TclMPrint() to conform with the Tcl private
10973 +** routine naming conventions.
10976 +#ifdef F_mprintf
10977 +char *mprintf(const char *zFormat, ...){
10978 + va_list ap;
10979 + struct sgMprintf sMprintf;
10980 + char *zNew;
10981 + char zBuf[200];
10983 + va_start(ap,zFormat);
10984 + sMprintf.nChar = 0;
10985 + sMprintf.nAlloc = sizeof(zBuf);
10986 + sMprintf.zText = zBuf;
10987 + sMprintf.zBase = zBuf;
10988 + vxprintf(__mout,&sMprintf,zFormat,ap);
10989 + va_end(ap);
10990 + if( sMprintf.zText==sMprintf.zBase ){
10991 + zNew = malloc( sMprintf.nChar+1 );
10992 + if( zNew ) strcpy(zNew,zBuf);
10993 + }else{
10994 + zNew = realloc(sMprintf.zText,sMprintf.nChar+1);
10997 + return zNew;
10999 +#endif
11001 +/* This is the varargs version of mprintf.
11003 +** The name is changed to TclVMPrintf() to conform with Tcl naming
11004 +** conventions.
11006 +#ifdef F_vmprintf
11007 +char *vmprintf(const char *zFormat,va_list ap){
11008 + struct sgMprintf sMprintf;
11009 + char zBuf[200];
11010 + sMprintf.nChar = 0;
11011 + sMprintf.zText = zBuf;
11012 + sMprintf.nAlloc = sizeof(zBuf);
11013 + sMprintf.zBase = zBuf;
11014 + vxprintf(__mout,&sMprintf,zFormat,ap);
11015 + if( sMprintf.zText==sMprintf.zBase ){
11016 + sMprintf.zText = malloc( strlen(zBuf)+1 );
11017 + if( sMprintf.zText ) strcpy(sMprintf.zText,zBuf);
11018 + }else{
11019 + sMprintf.zText = realloc(sMprintf.zText,sMprintf.nChar+1);
11021 + return sMprintf.zText;
11023 +#endif
11025 +#ifdef F_asprintf
11026 +int asprintf(char ** strp, const char *zFormat, ...){
11027 + va_list ap;
11028 + struct sgMprintf sMprintf;
11029 + char *zNew;
11030 + char zBuf[200];
11032 + va_start(ap,zFormat);
11033 + sMprintf.nChar = 0;
11034 + sMprintf.nAlloc = sizeof(zBuf);
11035 + sMprintf.zText = zBuf;
11036 + sMprintf.zBase = zBuf;
11037 + vxprintf(__mout,&sMprintf,zFormat,ap);
11038 + va_end(ap);
11039 + if( sMprintf.zText==sMprintf.zBase ){
11040 + zNew = malloc( sMprintf.nChar+1 );
11041 + if( zNew ) strcpy(zNew,zBuf);
11042 + }else{
11043 + zNew = realloc(sMprintf.zText,sMprintf.nChar+1);
11046 + *strp = zNew;
11048 + return sMprintf.nChar+1;
11050 +#endif
11052 +#ifdef F_vasprintf
11053 +int vasprintf(char **strp, const char *format, va_list ap) {
11054 + struct sgMprintf sMprintf;
11055 + char zBuf[200];
11056 + sMprintf.nChar = 0;
11057 + sMprintf.zText = zBuf;
11058 + sMprintf.nAlloc = sizeof(zBuf);
11059 + sMprintf.zBase = zBuf;
11060 + vxprintf(__mout,&sMprintf,format,ap);
11061 + if( sMprintf.zText==sMprintf.zBase ){
11062 + sMprintf.zText = malloc( strlen(zBuf)+1 );
11063 + if( sMprintf.zText ) strcpy(sMprintf.zText,zBuf);
11064 + }else{
11065 + sMprintf.zText = realloc(sMprintf.zText,sMprintf.nChar+1);
11067 + *strp = sMprintf.zText;
11068 + return sMprintf.nChar;
11070 +#endif
11073 +** The following section of code handles the standard fprintf routines
11074 +** for pthreads.
11077 +void __fout(char *, int, void *);
11079 +#ifdef F___fout
11080 +void __fout(zNewText,nNewChar,arg)
11081 + char *zNewText;
11082 + int nNewChar;
11083 + void *arg;
11085 + fwrite(zNewText,1,nNewChar,(FILE*)arg);
11087 +#endif
11089 +#ifdef F_fprintf
11090 +/* The public interface routines */
11091 +int fprintf(FILE *pOut, const char *zFormat, ...){
11092 + va_list ap;
11093 + int retc;
11095 + va_start(ap,zFormat);
11096 + retc = vxprintf(__fout,pOut,zFormat,ap);
11097 + va_end(ap);
11098 + return retc;
11100 +#endif
11102 +#ifdef F_vfprintf
11103 +int vfprintf(FILE *pOut, const char *zFormat, va_list ap){
11104 + return vxprintf(__fout,pOut,zFormat,ap);
11106 +#endif
11109 +#ifdef F_printf
11110 +int printf(const char *format, ...)
11112 + va_list args;
11113 + int ret;
11115 + va_start(args, format);
11116 + ret = vprintf(format, args);
11117 + va_end(args);
11119 + return ret;
11121 +#endif
11123 +#ifdef F_vprintf
11124 +int vprintf(const char *format, va_list args)
11126 + return vxprintf(__fout, stdout, format, args);
11128 +#endif
11130 +#ifdef F__sprintf_r
11131 +/* Idiotic kludge to get around newlib stupidity. tmpnam() calls this
11132 + directly, but since sprintf() above replaces newlib's sprintf() (and
11133 + _sprintf_r()) we have to define this in order to link tmpnam(). */
11134 +int _sprintf_r(struct _reent *unused, char *str, const char *format, ...)
11136 + va_list args;
11137 + struct s_strargument arg;
11138 + int ret;
11140 + (void) unused;
11141 + arg.next = str;
11142 + arg.last = NULL;
11144 + va_start(args, format);
11145 + ret = vxprintf(__sout, &arg, format, args);
11146 + va_end(args);
11148 + return ret;
11150 +#endif