diff options
Diffstat (limited to 'newlib/libc/sys/linux')
276 files changed, 0 insertions, 45192 deletions
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am deleted file mode 100644 index 9f3986f5b..000000000 --- a/newlib/libc/sys/linux/Makefile.am +++ /dev/null @@ -1,241 +0,0 @@ -## Process this file with automake to generate Makefile.in - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = -I$(srcdir)/include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(INCLTDL) - -if ELIX_LEVEL_1 -argp_dir= -ARGP_LIB= -else -argp_dir=argp -ARGP_LIB=argp/libargp.la -endif - -SUBDIRS = machine \ - $(argp_dir) \ - cmath \ - . -SUBLIBS = \ - $(ARGP_LIB) \ - cmath/libcmath.la \ - $(LINUX_MACH_LIB) - -GENERAL_SOURCES = \ - aio.c \ - brk.c \ - calloc.c \ - callocr.c \ - cfreer.c \ - cfspeed.c \ - clock_getres.c \ - clock_gettime.c \ - clock_settime.c \ - flockfile.c \ - free.c \ - freer.c \ - ftok.c \ - funlockfile.c \ - getdate.c \ - getdate_err.c \ - gethostname.c \ - getreent.c \ - ids.c \ - inode.c \ - io.c \ - ipc.c \ - linux.c \ - mallinfor.c \ - mallocr.c \ - mallstatsr.c \ - mmap.c \ - mq_close.c \ - mq_getattr.c \ - mq_notify.c \ - mq_open.c \ - mq_receive.c \ - mq_send.c \ - mq_setattr.c \ - mq_unlink.c \ - msize.c \ - msizer.c \ - mstats.c \ - mtrim.c \ - mtrimr.c \ - ntp_gettime.c \ - pread.c \ - process.c \ - prof-freq.c \ - profile.c \ - psignal.c \ - pwrite.c \ - raise.c \ - realloc.c \ - reallocr.c \ - rename.c \ - resource.c \ - sched.c \ - select.c \ - seteuid.c \ - sethostname.c \ - shm_open.c \ - shm_unlink.c \ - sig.c \ - sigaction.c \ - sigqueue.c \ - signal.c \ - siglongjmp.c \ - sigset.c \ - sigwait.c \ - socket.c \ - sleep.c \ - strsignal.c \ - strverscmp.c \ - sysconf.c \ - sysctl.c \ - systat.c \ - tcdrain.c \ - tcsendbrk.c \ - termios.c \ - time.c \ - usleep.c \ - versionsort.c - -ELIX_2_OBJS = \ - aio64.$(oext) \ - confstr.$(oext) \ - ctermid.$(oext) \ - fclean.$(oext) \ - fpathconf.$(oext) \ - fstab.$(oext) \ - fstatvfs.$(oext) \ - fstatvfs64.$(oext) \ - ftw.$(oext) \ - ftw64.$(oext) \ - getopt.$(oext) \ - getopt1.$(oext) \ - getrlimit64.$(oext) \ - getwd.$(oext) \ - io64.$(oext) \ - malign.$(oext) \ - malignr.$(oext) \ - malloptr.$(oext) \ - mcheck.$(oext) \ - mntent.$(oext) \ - mntent_r.$(oext) \ - pathconf.$(oext) \ - pread64.$(oext) \ - pvallocr.$(oext) \ - pwrite64.$(oext) \ - readdir64.$(oext) \ - realpath.$(oext) \ - scandir64.$(oext) \ - setrlimit64.$(oext) \ - statvfs.$(oext) \ - statvfs64.$(oext) \ - ttyname_r.$(oext) \ - utimes.$(oext) \ - vallocr.$(oext) \ - versionsort64.$(oext) - -ELIX_3_OBJS = \ - system.$(oext) \ - wait.$(oext) - -ELIX_4_OBJS = \ - stack.$(oext) - -if ELIX_LEVEL_1 -LIB_OBJS = -else -if ELIX_LEVEL_2 -LIB_OBJS = $(ELIX_2_OBJS) -else -if ELIX_LEVEL_3 -LIB_OBJS = $(ELIX_2_OBJS) $(ELIX_3_OBJS) -else -LIB_OBJS = $(ELIX_2_OBJS) $(ELIX_3_OBJS) $(ELIX_4_OBJS) -endif -endif -endif - -# This will handle both /usr/src/linux-2.4/include/asm/signal.h (in Red Hat Linux 7.1) -# and also /usr/src/linux/include/asm/signal.h in older versions of Red Hat Linux -SIGNAL_H = /usr/src/$(shell ls /usr/src/ | grep ^linux | head -n 1)/include/asm/signal.h - -liblinux_la_LDFLAGS = -Xcompiler -nostdlib - -ADD_OBJS = \ - malloc.$(oext) \ - $(LINUX_MACH_LIB) - -if USE_LIBTOOL -noinst_LTLIBRARIES = liblinux.la -liblinux_la_SOURCES = $(GENERAL_SOURCES) -liblinux_la_LIBADD = $(ADD_OBJS) $(LIB_OBJS) -liblinux_la_DEPENDENCIES = $(ADD_OBJS) $(LIB_OBJS) -LIBC_COMPILE = $(LTCOMPILE) -noinst_DATA = objectlist.awk.in -else -noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(GENERAL_SOURCES) -lib_a_LIBADD = $(ADD_OBJS) $(LIB_OBJS) -lib_a_DEPENDENCIES = $(ADD_OBJS) $(LIB_OBJS) -LIBC_COMPILE = $(COMPILE) -noinst_DATA = - -lib.a: $(ADD_OBJS) $(LIB_OBJS) $(lib_a_OBJECTS) - rm -f $@ - rm -rf tmp - mkdir tmp - cd tmp; \ - for i in $(SUBLIBS); do \ - $(AR) x ../$$i; \ - done; \ - $(AR) $(AR_FLAGS) ../$@ *.o - $(RANLIB) $@ - rm -rf tmp - -endif # USE_LIBTOOL - -objectlist.awk.in: $(noinst_LTLIBRARIES) $(SUBLIBS) - -rm -f objectlist.awk.in - for i in `ls *.lo` ; \ - do \ - echo $$i `pwd`/$$i >> objectlist.awk.in ; \ - done - for j in $(SUBLIBS) ; \ - do \ - export i=`echo $$j | sed -e 's,\(.*\)\/[^\/]*$$,\1,'`; \ - if test $$i != "." && test -f $$i/objectlist.awk.in; then \ - cat $$i/objectlist.awk.in >> objectlist.awk.in ; \ - fi; \ - done - -all: crt0.o crt1.o - -crt0.o: machine/crt0.o - rm -f $@ - ln machine/crt0.o $@ >/dev/null 2>/dev/null || cp machine/crt0.o $@ - -machine/crt0.o: ; @true - -malloc.$(oext): $(srcdir)/malloc.c - $(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@ - -mcheck.$(oext): $(srcdir)/mcheck.c - $(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@ - -sig.$(oext): siglist.inc - -siglist.inc: - $(AWK) '/#define.SIG.*[1-9][0-9]*/ { n[$$3] = $$2 } \ - /#define.NSIG.*[1-9][0-9]*/ { max = $$3 } \ - /#define.SIGUNUSED/ \ - { for (i = 0; i <= max; i++) print "\"" n[i] "\"," }' \ - < $(SIGNAL_H) > siglist.inc || \ - { rm -f siglist.inc; exit 1; } - -AM_CFLAGS = -I $(srcdir)/../../stdio -ACLOCAL_AMFLAGS = -I ../../.. -CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in deleted file mode 100644 index 9a36c9cc9..000000000 --- a/newlib/libc/sys/linux/Makefile.in +++ /dev/null @@ -1,730 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AR = @AR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DLLTOOL = @DLLTOOL@ -EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBTOOL = @LIBTOOL@ -LINUX_MACH_LIB = @LINUX_MACH_LIB@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -aext = @aext@ -libm_machine_dir = @libm_machine_dir@ -machine_dir = @machine_dir@ -newlib_basedir = @newlib_basedir@ -oext = @oext@ -sys_dir = @sys_dir@ - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = -I$(srcdir)/include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(INCLTDL) -@ELIX_LEVEL_1_TRUE@argp_dir = -@ELIX_LEVEL_1_FALSE@argp_dir = @ELIX_LEVEL_1_FALSE@argp -@ELIX_LEVEL_1_TRUE@ARGP_LIB = -@ELIX_LEVEL_1_FALSE@ARGP_LIB = @ELIX_LEVEL_1_FALSE@argp/libargp.la - -SUBDIRS = machine \ - $(argp_dir) \ - cmath \ - . - -SUBLIBS = \ - $(ARGP_LIB) \ - cmath/libcmath.la \ - $(LINUX_MACH_LIB) - - -GENERAL_SOURCES = \ - aio.c \ - brk.c \ - calloc.c \ - callocr.c \ - cfreer.c \ - cfspeed.c \ - clock_getres.c \ - clock_gettime.c \ - clock_settime.c \ - flockfile.c \ - free.c \ - freer.c \ - ftok.c \ - funlockfile.c \ - getdate.c \ - getdate_err.c \ - gethostname.c \ - getreent.c \ - ids.c \ - inode.c \ - io.c \ - ipc.c \ - linux.c \ - mallinfor.c \ - mallocr.c \ - mallstatsr.c \ - mmap.c \ - mq_close.c \ - mq_getattr.c \ - mq_notify.c \ - mq_open.c \ - mq_receive.c \ - mq_send.c \ - mq_setattr.c \ - mq_unlink.c \ - msize.c \ - msizer.c \ - mstats.c \ - mtrim.c \ - mtrimr.c \ - ntp_gettime.c \ - pread.c \ - process.c \ - prof-freq.c \ - profile.c \ - psignal.c \ - pwrite.c \ - raise.c \ - realloc.c \ - reallocr.c \ - rename.c \ - resource.c \ - sched.c \ - select.c \ - seteuid.c \ - sethostname.c \ - shm_open.c \ - shm_unlink.c \ - sig.c \ - sigaction.c \ - sigqueue.c \ - signal.c \ - siglongjmp.c \ - sigset.c \ - sigwait.c \ - socket.c \ - sleep.c \ - strsignal.c \ - strverscmp.c \ - sysconf.c \ - sysctl.c \ - systat.c \ - tcdrain.c \ - tcsendbrk.c \ - termios.c \ - time.c \ - usleep.c \ - versionsort.c - - -ELIX_2_OBJS = \ - aio64.$(oext) \ - confstr.$(oext) \ - ctermid.$(oext) \ - fclean.$(oext) \ - fpathconf.$(oext) \ - fstab.$(oext) \ - fstatvfs.$(oext) \ - fstatvfs64.$(oext) \ - ftw.$(oext) \ - ftw64.$(oext) \ - getopt.$(oext) \ - getopt1.$(oext) \ - getrlimit64.$(oext) \ - getwd.$(oext) \ - io64.$(oext) \ - malign.$(oext) \ - malignr.$(oext) \ - malloptr.$(oext) \ - mcheck.$(oext) \ - mntent.$(oext) \ - mntent_r.$(oext) \ - pathconf.$(oext) \ - pread64.$(oext) \ - pvallocr.$(oext) \ - pwrite64.$(oext) \ - readdir64.$(oext) \ - realpath.$(oext) \ - scandir64.$(oext) \ - setrlimit64.$(oext) \ - statvfs.$(oext) \ - statvfs64.$(oext) \ - ttyname_r.$(oext) \ - utimes.$(oext) \ - vallocr.$(oext) \ - versionsort64.$(oext) - - -ELIX_3_OBJS = \ - system.$(oext) \ - wait.$(oext) - - -ELIX_4_OBJS = \ - stack.$(oext) - -@ELIX_LEVEL_1_TRUE@LIB_OBJS = -@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@LIB_OBJS = @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@$(ELIX_2_OBJS) -@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@LIB_OBJS = @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@$(ELIX_2_OBJS) $(ELIX_3_OBJS) -@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@LIB_OBJS = @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@$(ELIX_2_OBJS) $(ELIX_3_OBJS) $(ELIX_4_OBJS) - -# This will handle both /usr/src/linux-2.4/include/asm/signal.h (in Red Hat Linux 7.1) -# and also /usr/src/linux/include/asm/signal.h in older versions of Red Hat Linux -SIGNAL_H = /usr/src/$(shell ls /usr/src/ | grep ^linux | head -n 1)/include/asm/signal.h - -liblinux_la_LDFLAGS = -Xcompiler -nostdlib - -ADD_OBJS = \ - malloc.$(oext) \ - $(LINUX_MACH_LIB) - - -@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@liblinux.la -@USE_LIBTOOL_TRUE@liblinux_la_SOURCES = @USE_LIBTOOL_TRUE@$(GENERAL_SOURCES) -@USE_LIBTOOL_TRUE@liblinux_la_LIBADD = @USE_LIBTOOL_TRUE@$(ADD_OBJS) $(LIB_OBJS) -@USE_LIBTOOL_TRUE@liblinux_la_DEPENDENCIES = @USE_LIBTOOL_TRUE@$(ADD_OBJS) $(LIB_OBJS) -@USE_LIBTOOL_TRUE@LIBC_COMPILE = @USE_LIBTOOL_TRUE@$(LTCOMPILE) -@USE_LIBTOOL_FALSE@LIBC_COMPILE = @USE_LIBTOOL_FALSE@$(COMPILE) -@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in -@USE_LIBTOOL_FALSE@noinst_DATA = -@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a -@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(GENERAL_SOURCES) -@USE_LIBTOOL_FALSE@lib_a_LIBADD = @USE_LIBTOOL_FALSE@$(ADD_OBJS) $(LIB_OBJS) -@USE_LIBTOOL_FALSE@lib_a_DEPENDENCIES = @USE_LIBTOOL_FALSE@$(ADD_OBJS) $(LIB_OBJS) - -AM_CFLAGS = -I $(srcdir)/../../stdio -ACLOCAL_AMFLAGS = -I ../../.. -CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -@USE_LIBTOOL_FALSE@lib_a_OBJECTS = aio.$(OBJEXT) brk.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@calloc.$(OBJEXT) callocr.$(OBJEXT) cfreer.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@cfspeed.$(OBJEXT) clock_getres.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@clock_gettime.$(OBJEXT) clock_settime.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@flockfile.$(OBJEXT) free.$(OBJEXT) freer.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ftok.$(OBJEXT) funlockfile.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@getdate.$(OBJEXT) getdate_err.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@gethostname.$(OBJEXT) getreent.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ids.$(OBJEXT) inode.$(OBJEXT) io.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ipc.$(OBJEXT) linux.$(OBJEXT) mallinfor.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@mallocr.$(OBJEXT) mallstatsr.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@mmap.$(OBJEXT) mq_close.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@mq_getattr.$(OBJEXT) mq_notify.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@mq_open.$(OBJEXT) mq_receive.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@mq_send.$(OBJEXT) mq_setattr.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@mq_unlink.$(OBJEXT) msize.$(OBJEXT) msizer.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@mstats.$(OBJEXT) mtrim.$(OBJEXT) mtrimr.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ntp_gettime.$(OBJEXT) pread.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@process.$(OBJEXT) prof-freq.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@profile.$(OBJEXT) psignal.$(OBJEXT) pwrite.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@raise.$(OBJEXT) realloc.$(OBJEXT) reallocr.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@rename.$(OBJEXT) resource.$(OBJEXT) sched.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@select.$(OBJEXT) seteuid.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sethostname.$(OBJEXT) shm_open.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@shm_unlink.$(OBJEXT) sig.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sigaction.$(OBJEXT) sigqueue.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@signal.$(OBJEXT) siglongjmp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sigset.$(OBJEXT) sigwait.$(OBJEXT) socket.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sleep.$(OBJEXT) strsignal.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strverscmp.$(OBJEXT) sysconf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sysctl.$(OBJEXT) systat.$(OBJEXT) tcdrain.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@tcsendbrk.$(OBJEXT) termios.$(OBJEXT) time.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@usleep.$(OBJEXT) versionsort.$(OBJEXT) -LTLIBRARIES = $(noinst_LTLIBRARIES) - -@USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = aio.lo brk.lo calloc.lo \ -@USE_LIBTOOL_TRUE@callocr.lo cfreer.lo cfspeed.lo clock_getres.lo \ -@USE_LIBTOOL_TRUE@clock_gettime.lo clock_settime.lo flockfile.lo \ -@USE_LIBTOOL_TRUE@free.lo freer.lo ftok.lo funlockfile.lo getdate.lo \ -@USE_LIBTOOL_TRUE@getdate_err.lo gethostname.lo getreent.lo ids.lo \ -@USE_LIBTOOL_TRUE@inode.lo io.lo ipc.lo linux.lo mallinfor.lo \ -@USE_LIBTOOL_TRUE@mallocr.lo mallstatsr.lo mmap.lo mq_close.lo \ -@USE_LIBTOOL_TRUE@mq_getattr.lo mq_notify.lo mq_open.lo mq_receive.lo \ -@USE_LIBTOOL_TRUE@mq_send.lo mq_setattr.lo mq_unlink.lo msize.lo \ -@USE_LIBTOOL_TRUE@msizer.lo mstats.lo mtrim.lo mtrimr.lo ntp_gettime.lo \ -@USE_LIBTOOL_TRUE@pread.lo process.lo prof-freq.lo profile.lo \ -@USE_LIBTOOL_TRUE@psignal.lo pwrite.lo raise.lo realloc.lo reallocr.lo \ -@USE_LIBTOOL_TRUE@rename.lo resource.lo sched.lo select.lo seteuid.lo \ -@USE_LIBTOOL_TRUE@sethostname.lo shm_open.lo shm_unlink.lo sig.lo \ -@USE_LIBTOOL_TRUE@sigaction.lo sigqueue.lo signal.lo siglongjmp.lo \ -@USE_LIBTOOL_TRUE@sigset.lo sigwait.lo socket.lo sleep.lo strsignal.lo \ -@USE_LIBTOOL_TRUE@strverscmp.lo sysconf.lo sysctl.lo systat.lo \ -@USE_LIBTOOL_TRUE@tcdrain.lo tcsendbrk.lo termios.lo time.lo usleep.lo \ -@USE_LIBTOOL_TRUE@versionsort.lo -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(noinst_DATA) - -DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -DIST_SUBDIRS = machine argp cmath . -SOURCES = $(lib_a_SOURCES) $(liblinux_la_SOURCES) -OBJECTS = $(lib_a_OBJECTS) $(liblinux_la_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status - -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \ - ../../../acinclude.m4 ../../../aclocal.m4 \ - ../../../libtool.m4 - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -mostlyclean-noinstLTLIBRARIES: - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - -distclean-noinstLTLIBRARIES: - -maintainer-clean-noinstLTLIBRARIES: - -liblinux.la: $(liblinux_la_OBJECTS) $(liblinux_la_DEPENDENCIES) - $(LINK) $(liblinux_la_LDFLAGS) $(liblinux_la_OBJECTS) $(liblinux_la_LIBADD) $(LIBS) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - -all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ - done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -rm -rf $(distdir) - GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist - -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(DIST_SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive -check-am: -check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -install-info-am: -install-info: install-info-recursive -install-exec-am: -install-exec: install-exec-recursive - -install-data-am: -install-data: install-data-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: -uninstall: uninstall-recursive -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) -all-redirect: all-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: installdirs-recursive -installdirs-am: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-recursive - -clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-noinstLTLIBRARIES clean-tags clean-generic \ - mostlyclean-am - -clean: clean-recursive - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-noinstLTLIBRARIES \ - distclean-tags distclean-generic clean-am - -rm -f libtool - -distclean: distclean-recursive - -rm -f config.status - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-noinstLTLIBRARIES \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-recursive - -rm -f config.status - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ -distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ -maintainer-clean-noinstLTLIBRARIES install-data-recursive \ -uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-info-am \ -install-info install-exec-am install-exec install-data-am install-data \ -install-am install uninstall-am uninstall all-redirect all-am all \ -installdirs-am installdirs mostlyclean-generic distclean-generic \ -clean-generic maintainer-clean-generic clean mostlyclean distclean \ -maintainer-clean - - -@USE_LIBTOOL_FALSE@lib.a: $(ADD_OBJS) $(LIB_OBJS) $(lib_a_OBJECTS) -@USE_LIBTOOL_FALSE@ rm -f $@ -@USE_LIBTOOL_FALSE@ rm -rf tmp -@USE_LIBTOOL_FALSE@ mkdir tmp -@USE_LIBTOOL_FALSE@ cd tmp; \ -@USE_LIBTOOL_FALSE@ for i in $(SUBLIBS); do \ -@USE_LIBTOOL_FALSE@ $(AR) x ../$$i; \ -@USE_LIBTOOL_FALSE@ done; \ -@USE_LIBTOOL_FALSE@ $(AR) $(AR_FLAGS) ../$@ *.o -@USE_LIBTOOL_FALSE@ $(RANLIB) $@ -@USE_LIBTOOL_FALSE@ rm -rf tmp - -objectlist.awk.in: $(noinst_LTLIBRARIES) $(SUBLIBS) - -rm -f objectlist.awk.in - for i in `ls *.lo` ; \ - do \ - echo $$i `pwd`/$$i >> objectlist.awk.in ; \ - done - for j in $(SUBLIBS) ; \ - do \ - export i=`echo $$j | sed -e 's,\(.*\)\/[^\/]*$$,\1,'`; \ - if test $$i != "." && test -f $$i/objectlist.awk.in; then \ - cat $$i/objectlist.awk.in >> objectlist.awk.in ; \ - fi; \ - done - -all: crt0.o crt1.o - -crt0.o: machine/crt0.o - rm -f $@ - ln machine/crt0.o $@ >/dev/null 2>/dev/null || cp machine/crt0.o $@ - -machine/crt0.o: ; @true - -malloc.$(oext): $(srcdir)/malloc.c - $(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@ - -mcheck.$(oext): $(srcdir)/mcheck.c - $(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@ - -sig.$(oext): siglist.inc - -siglist.inc: - $(AWK) '/#define.SIG.*[1-9][0-9]*/ { n[$$3] = $$2 } \ - /#define.NSIG.*[1-9][0-9]*/ { max = $$3 } \ - /#define.SIGUNUSED/ \ - { for (i = 0; i <= max; i++) print "\"" n[i] "\"," }' \ - < $(SIGNAL_H) > siglist.inc || \ - { rm -f siglist.inc; exit 1; } - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/newlib/libc/sys/linux/aclocal.m4 b/newlib/libc/sys/linux/aclocal.m4 deleted file mode 100644 index 2d16695b0..000000000 --- a/newlib/libc/sys/linux/aclocal.m4 +++ /dev/null @@ -1,1181 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 - -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -dnl This provides configure definitions used by all the newlib -dnl configure.in files. - -dnl Basic newlib configury. This calls basic introductory stuff, -dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs -dnl configure.host. The only argument is the relative path to the top -dnl newlib directory. - -AC_DEFUN(NEWLIB_CONFIGURE, -[ -dnl Default to --enable-multilib -AC_ARG_ENABLE(multilib, -[ --enable-multilib build many library versions (default)], -[case "${enableval}" in - yes) multilib=yes ;; - no) multilib=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; - esac], [multilib=yes])dnl - -dnl Support --enable-target-optspace -AC_ARG_ENABLE(target-optspace, -[ --enable-target-optspace optimize for space], -[case "${enableval}" in - yes) target_optspace=yes ;; - no) target_optspace=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; - esac], [target_optspace=])dnl - -dnl Support --enable-malloc-debugging - currently only supported for Cygwin -AC_ARG_ENABLE(malloc-debugging, -[ --enable-malloc-debugging indicate malloc debugging requested], -[case "${enableval}" in - yes) malloc_debugging=yes ;; - no) malloc_debugging=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;; - esac], [malloc_debugging=])dnl - -dnl Support --enable-newlib-mb -AC_ARG_ENABLE(newlib-mb, -[ --enable-newlib-mb enable multibyte support], -[case "${enableval}" in - yes) newlib_mb=yes ;; - no) newlib_mb=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; - esac], [newlib_mb=])dnl - -dnl Support --enable-newlib-multithread -AC_ARG_ENABLE(newlib-multithread, -[ --enable-newlib-multithread enable support for multiple threads], -[case "${enableval}" in - yes) newlib_multithread=yes ;; - no) newlib_multithread=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; - esac], [newlib_multithread=yes])dnl - -dnl Support --enable-newlib-elix-level -AC_ARG_ENABLE(newlib-elix-level, -[ --enable-newlib-elix-level supply desired elix library level (1-4)], -[case "${enableval}" in - 0) newlib_elix_level=0 ;; - 1) newlib_elix_level=1 ;; - 2) newlib_elix_level=2 ;; - 3) newlib_elix_level=3 ;; - 4) newlib_elix_level=4 ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; - esac], [newlib_elix_level=0])dnl - -dnl Support --disable-newlib-io-float -AC_ARG_ENABLE(newlib-io-float, -[ --disable-newlib-io-float disable printf/scanf family float support], -[case "${enableval}" in - yes) newlib_io_float=yes ;; - no) newlib_io_float=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; - esac], [newlib_io_float=yes])dnl - - -dnl We may get other options which we don't document: -dnl --with-target-subdir, --with-multisrctop, --with-multisubdir - -test -z "[$]{with_target_subdir}" && with_target_subdir=. - -if test "[$]{srcdir}" = "."; then - if test "[$]{with_target_subdir}" != "."; then - newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" - else - newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" - fi -else - newlib_basedir="[$]{srcdir}/$1" -fi -AC_SUBST(newlib_basedir) - -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE(newlib, 1.10.0) - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - -AC_DEFUN(LIB_AC_PROG_CC, -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_PROG(CC, gcc, gcc) -if test -z "$CC"; then - AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -fi - -AC_PROG_CC_GNU - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -dnl Check whether -g works, even if CFLAGS is set, in case the package -dnl plays around with CFLAGS (such as to build both debugging and -dnl normal versions of a library), tasteless as that idea is. - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - AC_PROG_CC_G - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi -]) - -LIB_AC_PROG_CC - -AC_CHECK_TOOL(AS, as) -AC_CHECK_TOOL(AR, ar) -AC_CHECK_TOOL(RANLIB, ranlib, :) - -AC_PROG_INSTALL - -AM_MAINTAINER_MODE - -# We need AC_EXEEXT to keep automake happy in cygnus mode. However, -# at least currently, we never actually build a program, so we never -# need to use $(EXEEXT). Moreover, the test for EXEEXT normally -# fails, because we are probably configuring with a cross compiler -# which can't create executables. So we include AC_EXEEXT to keep -# automake happy, but we don't execute it, since we don't care about -# the result. -if false; then - AC_EXEEXT -fi - -. [$]{newlib_basedir}/configure.host - -newlib_cflags="[$]{newlib_cflags} -fno-builtin" - -NEWLIB_CFLAGS=${newlib_cflags} -AC_SUBST(NEWLIB_CFLAGS) - -LDFLAGS=${ldflags} -AC_SUBST(LDFLAGS) - -AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) -AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) -AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) -AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) -AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) - -AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) - -# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we -# use oext, which is set in configure.host based on the target platform. -OBJEXT=${oext} - -AC_SUBST(OBJEXT) -AC_SUBST(oext) -AC_SUBST(aext) - -AC_SUBST(libm_machine_dir) -AC_SUBST(machine_dir) -AC_SUBST(sys_dir) -]) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering - -# serial 1 - -AC_DEFUN(AM_MAINTAINER_MODE, -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT($USE_MAINTAINER_MODE) - AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) - -# Define a conditional. - -AC_DEFUN(AM_CONDITIONAL, -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - - -# serial 46 AC_PROG_LIBTOOL -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ -])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ -])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ -])])])])])]) - -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# Save cache, so that ltconfig can load it -AC_CACHE_SAVE - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Reload cache, that may have been modified by ltconfig -AC_CACHE_LOAD - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], -[libtool_flags="$libtool_flags --enable-dlopen"]) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[libtool_flags="$libtool_flags --enable-win32-dll"]) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -AC_ARG_WITH(pic, - [ --with-pic try to use only PIC/non-PIC objects [default=use both]], - pic_mode="$withval", pic_mode=default) -test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" -test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_SAVE - AC_LANG_C - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_RESTORE]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one - AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, - [AC_TRY_LINK([], - [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); - DllMain (0, 0, 0);], - [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) - - case $host/$CC in - *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) - # old mingw systems require "-dll" to link a DLL, while more recent ones - # require "-mdll" - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdll" - AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, - [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) - CFLAGS="$SAVE_CFLAGS" ;; - *-*-cygwin* | *-*-pw32*) - # cygwin systems need to pass --dll to the linker, and not link - # crt.o which will require a WinMain@16 definition. - lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; - esac - ;; - ]) -esac -]) - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_LIBTOOL_PICMODE - implement the --with-pic flag -# Usage: AC_LIBTOOL_PICMODE[(MODE)] -# Where MODE is either `yes' or `no'. If omitted, it defaults to -# `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default)]) - - -# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -]) - - -# AC_PATH_MAGIC - find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl -AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) - else - MAGIC_CMD=: - fi -fi -]) - - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - re_direlt=['/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$lt_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -AC_DEFUN([AC_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$lt_cv_prog_gnu_ld -]) - -# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker -# -- PORTME Some linkers may need a different reload flag. -AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], -[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, -[lt_cv_ld_reload_flag='-r']) -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" -]) - -# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependant libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* |pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.[012]) - lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd* ) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - case $host_cpu in - hppa*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - ia64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - esac - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] - else - [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] - fi - ;; - -newsos6) - [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -[sysv5uw[78]* | sysv4*uw2*)] - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - motorola) - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -]) - - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and INCLTDL are not -# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not -# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed -# with '${top_builddir}/' and INCLTDL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is -# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed -# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed -# with '${top_srcdir}/' (note the single quotes!). If your package is -# not flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -# If this macro is not defined by Autoconf, define it here. -ifdef([AC_PROVIDE_IFELSE], - [], - [define([AC_PROVIDE_IFELSE], - [ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - -# AC_LIBTOOL_CXX - enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) - -AC_DEFUN([_AC_LIBTOOL_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" -lt_save_CC="$CC" -lt_save_CFLAGS="$CFLAGS" -dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC -dnl is set to the C++ compiler. -AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" \ -file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ ---build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ -|| AC_MSG_ERROR([libtool tag configuration failed]) -CC="$lt_save_CC" -CFLAGS="$lt_save_CFLAGS" - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -# AC_LIBTOOL_GCJ - enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) - -AC_DEFUN([_AC_LIBTOOL_GCJ], -[AC_REQUIRE([AC_PROG_LIBTOOL]) -AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" -lt_save_CC="$CC" -lt_save_CFLAGS="$CFLAGS" -dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC -dnl is set to the C++ compiler. -AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" \ -file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ ---build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ -|| AC_MSG_ERROR([libtool tag configuration failed]) -CC="$lt_save_CC" -CFLAGS="$lt_save_CFLAGS" - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -dnl old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -dnl This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL])dnl - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - diff --git a/newlib/libc/sys/linux/aio.c b/newlib/libc/sys/linux/aio.c deleted file mode 100644 index de988ebfc..000000000 --- a/newlib/libc/sys/linux/aio.c +++ /dev/null @@ -1,75 +0,0 @@ -/* libc/sys/linux/aio.c - asychronous I/O */ - -/* Copyright 2002, Red Hat Inc. */ - -/* Currently asynchronous I/O is not implemented. */ - -#include <sys/types.h> -#include <aio.h> -#include <errno.h> - -int -aio_cancel (int fd, struct aiocb *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_error (const struct aiocb *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_fsync (int op, struct aiocb *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_read (struct aiocb *cb) -{ - errno = ENOSYS; - return -1; -} - -ssize_t -aio_return (struct aiocb *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_suspend (const struct aiocb *const list[], int nent, - const struct timespec *timeout) -{ - errno = ENOSYS; - return -1; -} - -int -aio_write (struct aiocb *cb) -{ - errno = ENOSYS; - return -1; -} - -int -lio_listio (int mode, struct aiocb * const list[], int nent, - struct sigevent *sig) -{ - errno = ENOSYS; - return -1; -} - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4 -void -aio_init (const struct aioinit *INIT) -{ - errno = ENOSYS; -} -#endif diff --git a/newlib/libc/sys/linux/aio64.c b/newlib/libc/sys/linux/aio64.c deleted file mode 100644 index 5a9cdd928..000000000 --- a/newlib/libc/sys/linux/aio64.c +++ /dev/null @@ -1,67 +0,0 @@ -/* libc/sys/linux/aio64.c - asychronous I/O */ - -/* Copyright 2002, Red Hat Inc. */ - -/* Currently asynchronous I/O is not implemented. */ - -#include <sys/types.h> -#include <aio.h> -#include <errno.h> - -int -aio_cancel64 (int fd, struct aiocb64 *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_error64 (const struct aiocb64 *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_fsync64 (int op, struct aiocb64 *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_read64 (struct aiocb64 *cb) -{ - errno = ENOSYS; - return -1; -} - -ssize_t -aio_return64 (struct aiocb64 *cb) -{ - errno = ENOSYS; - return -1; -} - -int -aio_suspend64 (const struct aiocb64 *const list[], int nent, - const struct timespec *timeout) -{ - errno = ENOSYS; - return -1; -} - -int -aio_write64 (struct aiocb64 *cb) -{ - errno = ENOSYS; - return -1; -} - -int -lio_listio64 (int mode, struct aiocb64 * const list[], int nent, - struct sigevent *sig) -{ - errno = ENOSYS; - return -1; -} diff --git a/newlib/libc/sys/linux/argp/Makefile.am b/newlib/libc/sys/linux/argp/Makefile.am deleted file mode 100644 index 95869fec5..000000000 --- a/newlib/libc/sys/linux/argp/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -## Process this file with automake to generate Makefile.in - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -LIB_SOURCES = \ - argp-ba.c argp-eexst.c argp-fmtstream.c argp-fs-xinl.c \ - argp-help.c argp-parse.c argp-pv.c argp-pvh.c argp-xinl.c - -libargp_la_LDFLAGS = -Xcompiler -nostdlib - -if USE_LIBTOOL -noinst_LTLIBRARIES = libargp.la -libargp_la_SOURCES = $(LIB_SOURCES) -noinst_DATA = objectlist.awk.in -else -noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(LIB_SOURCES) -noinst_DATA = -endif # USE_LIBTOOL - -include $(srcdir)/../../../../Makefile.shared diff --git a/newlib/libc/sys/linux/argp/Makefile.in b/newlib/libc/sys/linux/argp/Makefile.in deleted file mode 100644 index aa66a62b0..000000000 --- a/newlib/libc/sys/linux/argp/Makefile.in +++ /dev/null @@ -1,367 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AR = @AR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DLLTOOL = @DLLTOOL@ -EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBTOOL = @LIBTOOL@ -LINUX_MACH_LIB = @LINUX_MACH_LIB@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -aext = @aext@ -libm_machine_dir = @libm_machine_dir@ -machine_dir = @machine_dir@ -newlib_basedir = @newlib_basedir@ -oext = @oext@ -sys_dir = @sys_dir@ - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -LIB_SOURCES = \ - argp-ba.c argp-eexst.c argp-fmtstream.c argp-fs-xinl.c \ - argp-help.c argp-parse.c argp-pv.c argp-pvh.c argp-xinl.c - - -libargp_la_LDFLAGS = -Xcompiler -nostdlib - -@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libargp.la -@USE_LIBTOOL_TRUE@libargp_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) -@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in -@USE_LIBTOOL_FALSE@noinst_DATA = -@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a -@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) -mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -lib_a_LIBADD = -@USE_LIBTOOL_FALSE@lib_a_OBJECTS = argp-ba.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@argp-eexst.$(OBJEXT) argp-fmtstream.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@argp-fs-xinl.$(OBJEXT) argp-help.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@argp-parse.$(OBJEXT) argp-pv.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@argp-pvh.$(OBJEXT) argp-xinl.$(OBJEXT) -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libargp_la_LIBADD = -@USE_LIBTOOL_TRUE@libargp_la_OBJECTS = argp-ba.lo argp-eexst.lo \ -@USE_LIBTOOL_TRUE@argp-fmtstream.lo argp-fs-xinl.lo argp-help.lo \ -@USE_LIBTOOL_TRUE@argp-parse.lo argp-pv.lo argp-pvh.lo argp-xinl.lo -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(noinst_DATA) - -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -SOURCES = $(lib_a_SOURCES) $(libargp_la_SOURCES) -OBJECTS = $(lib_a_OBJECTS) $(libargp_la_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared - cd $(top_srcdir) && $(AUTOMAKE) --cygnus argp/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) - -rm -f lib.a - $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) - $(RANLIB) lib.a - -mostlyclean-noinstLTLIBRARIES: - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - -distclean-noinstLTLIBRARIES: - -maintainer-clean-noinstLTLIBRARIES: - -libargp.la: $(libargp_la_OBJECTS) $(libargp_la_DEPENDENCIES) - $(LINK) $(libargp_la_LDFLAGS) $(libargp_la_OBJECTS) $(libargp_la_LIBADD) $(LIBS) - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = argp - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: -check: check-am -installcheck-am: -installcheck: installcheck-am -install-info-am: -install-info: install-info-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-noinstLTLIBRARIES clean-tags clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-noinstLTLIBRARIES \ - distclean-tags distclean-generic clean-am - -rm -f libtool - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-noinstLTLIBRARIES \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ -distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ -maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-info-am install-info \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all installdirs \ -mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -objectlist.awk.in: $(noinst_LTLIBRARIES) - -rm -f objectlist.awk.in - for i in `ls *.lo` ; \ - do \ - echo $$i `pwd`/$$i >> objectlist.awk.in ; \ - done - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/newlib/libc/sys/linux/argp/argp-ba.c b/newlib/libc/sys/linux/argp/argp-ba.c deleted file mode 100644 index f5270c88d..000000000 --- a/newlib/libc/sys/linux/argp/argp-ba.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Default definition for ARGP_PROGRAM_BUG_ADDRESS. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* If set by the user program, it should point to string that is the - bug-reporting address for the program. It will be printed by argp_help if - the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help - messages), embedded in a sentence that says something like `Report bugs to - ADDR.'. */ -const char *argp_program_bug_address; diff --git a/newlib/libc/sys/linux/argp/argp-eexst.c b/newlib/libc/sys/linux/argp/argp-eexst.c deleted file mode 100644 index a94c34674..000000000 --- a/newlib/libc/sys/linux/argp/argp-eexst.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Default definition for ARGP_ERR_EXIT_STATUS - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <sysexits.h> - -#include <argp.h> - -/* The exit status that argp will use when exiting due to a parsing error. - If not defined or set by the user program, this defaults to EX_USAGE from - <sysexits.h>. */ -error_t argp_err_exit_status = EX_USAGE; diff --git a/newlib/libc/sys/linux/argp/argp-fmtstream.c b/newlib/libc/sys/linux/argp/argp-fmtstream.c deleted file mode 100644 index f783b803b..000000000 --- a/newlib/libc/sys/linux/argp/argp-fmtstream.c +++ /dev/null @@ -1,430 +0,0 @@ -/* Word-wrapping and line-truncating streams - Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This package emulates glibc `line_wrap_stream' semantics for systems that - don't have that. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <stdarg.h> -#include <ctype.h> - -#include "argp-fmtstream.h" -#include "argp-namefrob.h" - -#ifndef ARGP_FMTSTREAM_USE_LINEWRAP - -#ifndef isblank -#define isblank(ch) ((ch)==' ' || (ch)=='\t') -#endif - -#if defined _LIBC && defined USE_IN_LIBIO -# include <wchar.h> -# include <libio/libioP.h> -# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) -#endif - -#define INIT_BUF_SIZE 200 -#define PRINTF_SIZE_GUESS 150 - -/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines - written on it with LMARGIN spaces and limits them to RMARGIN columns - total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by - replacing the whitespace before them with a newline and WMARGIN spaces. - Otherwise, chars beyond RMARGIN are simply dropped until a newline. - Returns NULL if there was an error. */ -argp_fmtstream_t -__argp_make_fmtstream (FILE *stream, - size_t lmargin, size_t rmargin, ssize_t wmargin) -{ - argp_fmtstream_t fs; - - fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream)); - if (fs != NULL) - { - fs->stream = stream; - - fs->lmargin = lmargin; - fs->rmargin = rmargin; - fs->wmargin = wmargin; - fs->point_col = 0; - fs->point_offs = 0; - - fs->buf = (char *) malloc (INIT_BUF_SIZE); - if (! fs->buf) - { - free (fs); - fs = 0; - } - else - { - fs->p = fs->buf; - fs->end = fs->buf + INIT_BUF_SIZE; - } - } - - return fs; -} -#ifdef weak_alias -weak_alias (__argp_make_fmtstream, argp_make_fmtstream) -#endif - -/* Flush FS to its stream, and free it (but don't close the stream). */ -void -__argp_fmtstream_free (argp_fmtstream_t fs) -{ - __argp_fmtstream_update (fs); - if (fs->p > fs->buf) - { -#ifdef USE_IN_LIBIO - if (_IO_fwide (fs->stream, 0) > 0) - __fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf); - else -#endif - fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream); - } - free (fs->buf); - free (fs); -} -#ifdef weak_alias -weak_alias (__argp_fmtstream_free, argp_fmtstream_free) -#endif - -/* Process FS's buffer so that line wrapping is done from POINT_OFFS to the - end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ -void -__argp_fmtstream_update (argp_fmtstream_t fs) -{ - char *buf, *nl; - size_t len; - - /* Scan the buffer for newlines. */ - buf = fs->buf + fs->point_offs; - while (buf < fs->p) - { - size_t r; - - if (fs->point_col == 0 && fs->lmargin != 0) - { - /* We are starting a new line. Print spaces to the left margin. */ - const size_t pad = fs->lmargin; - if (fs->p + pad < fs->end) - { - /* We can fit in them in the buffer by moving the - buffer text up and filling in the beginning. */ - memmove (buf + pad, buf, fs->p - buf); - fs->p += pad; /* Compensate for bigger buffer. */ - memset (buf, ' ', pad); /* Fill in the spaces. */ - buf += pad; /* Don't bother searching them. */ - } - else - { - /* No buffer space for spaces. Must flush. */ - size_t i; - for (i = 0; i < pad; i++) - { -#ifdef USE_IN_LIBIO - if (_IO_fwide (fs->stream, 0) > 0) - putwc_unlocked (L' ', fs->stream); - else -#endif - putc_unlocked (' ', fs->stream); - } - } - fs->point_col = pad; - } - - len = fs->p - buf; - nl = memchr (buf, '\n', len); - - if (fs->point_col < 0) - fs->point_col = 0; - - if (!nl) - { - /* The buffer ends in a partial line. */ - - if (fs->point_col + len < fs->rmargin) - { - /* The remaining buffer text is a partial line and fits - within the maximum line width. Advance point for the - characters to be written and stop scanning. */ - fs->point_col += len; - break; - } - else - /* Set the end-of-line pointer for the code below to - the end of the buffer. */ - nl = fs->p; - } - else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) - { - /* The buffer contains a full line that fits within the maximum - line width. Reset point and scan the next line. */ - fs->point_col = 0; - buf = nl + 1; - continue; - } - - /* This line is too long. */ - r = fs->rmargin - 1; - - if (fs->wmargin < 0) - { - /* Truncate the line by overwriting the excess with the - newline and anything after it in the buffer. */ - if (nl < fs->p) - { - memmove (buf + (r - fs->point_col), nl, fs->p - nl); - fs->p -= buf + (r - fs->point_col) - nl; - /* Reset point for the next line and start scanning it. */ - fs->point_col = 0; - buf += r + 1; /* Skip full line plus \n. */ - } - else - { - /* The buffer ends with a partial line that is beyond the - maximum line width. Advance point for the characters - written, and discard those past the max from the buffer. */ - fs->point_col += len; - fs->p -= fs->point_col - r; - break; - } - } - else - { - /* Do word wrap. Go to the column just past the maximum line - width and scan back for the beginning of the word there. - Then insert a line break. */ - - char *p, *nextline; - int i; - - p = buf + (r + 1 - fs->point_col); - while (p >= buf && !isblank (*p)) - --p; - nextline = p + 1; /* This will begin the next line. */ - - if (nextline > buf) - { - /* Swallow separating blanks. */ - if (p >= buf) - do - --p; - while (p >= buf && isblank (*p)); - nl = p + 1; /* The newline will replace the first blank. */ - } - else - { - /* A single word that is greater than the maximum line width. - Oh well. Put it on an overlong line by itself. */ - p = buf + (r + 1 - fs->point_col); - /* Find the end of the long word. */ - do - ++p; - while (p < nl && !isblank (*p)); - if (p == nl) - { - /* It already ends a line. No fussing required. */ - fs->point_col = 0; - buf = nl + 1; - continue; - } - /* We will move the newline to replace the first blank. */ - nl = p; - /* Swallow separating blanks. */ - do - ++p; - while (isblank (*p)); - /* The next line will start here. */ - nextline = p; - } - - /* Note: There are a bunch of tests below for - NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall - at the end of the buffer, and NEXTLINE is in fact empty (and so - we need not be careful to maintain its contents). */ - - if (nextline == buf + len + 1 - ? fs->end - nl < fs->wmargin + 1 - : nextline - (nl + 1) < fs->wmargin) - { - /* The margin needs more blanks than we removed. */ - if (fs->end - fs->p > fs->wmargin + 1) - /* Make some space for them. */ - { - size_t mv = fs->p - nextline; - memmove (nl + 1 + fs->wmargin, nextline, mv); - nextline = nl + 1 + fs->wmargin; - len = nextline + mv - buf; - *nl++ = '\n'; - } - else - /* Output the first line so we can use the space. */ - { -#ifdef USE_IN_LIBIO - if (_IO_fwide (fs->stream, 0) > 0) - __fwprintf (fs->stream, L"%.*s\n", - (int) (nl - fs->buf), fs->buf); - else -#endif - { - if (nl > fs->buf) - fwrite (fs->buf, 1, nl - fs->buf, fs->stream); - putc_unlocked ('\n', fs->stream); - } - len += buf - fs->buf; - nl = buf = fs->buf; - } - } - else - /* We can fit the newline and blanks in before - the next word. */ - *nl++ = '\n'; - - if (nextline - nl >= fs->wmargin - || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin)) - /* Add blanks up to the wrap margin column. */ - for (i = 0; i < fs->wmargin; ++i) - *nl++ = ' '; - else - for (i = 0; i < fs->wmargin; ++i) -#ifdef USE_IN_LIBIO - if (_IO_fwide (fs->stream, 0) > 0) - putwc_unlocked (L' ', fs->stream); - else -#endif - putc_unlocked (' ', fs->stream); - - /* Copy the tail of the original buffer into the current buffer - position. */ - if (nl < nextline) - memmove (nl, nextline, buf + len - nextline); - len -= nextline - buf; - - /* Continue the scan on the remaining lines in the buffer. */ - buf = nl; - - /* Restore bufp to include all the remaining text. */ - fs->p = nl + len; - - /* Reset the counter of what has been output this line. If wmargin - is 0, we want to avoid the lmargin getting added, so we set - point_col to a magic value of -1 in that case. */ - fs->point_col = fs->wmargin ? fs->wmargin : -1; - } - } - - /* Remember that we've scanned as far as the end of the buffer. */ - fs->point_offs = fs->p - fs->buf; -} - -/* Ensure that FS has space for AMOUNT more bytes in its buffer, either by - growing the buffer, or by flushing it. True is returned iff we succeed. */ -int -__argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount) -{ - if ((size_t) (fs->end - fs->p) < amount) - { - ssize_t wrote; - - /* Flush FS's buffer. */ - __argp_fmtstream_update (fs); - -#ifdef USE_IN_LIBIO - if (_IO_fwide (fs->stream, 0) > 0) - { - __fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf); - wrote = fs->p - fs->buf; - } - else -#endif - wrote = fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream); - if (wrote == fs->p - fs->buf) - { - fs->p = fs->buf; - fs->point_offs = 0; - } - else - { - fs->p -= wrote; - fs->point_offs -= wrote; - memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf); - return 0; - } - - if ((size_t) (fs->end - fs->buf) < amount) - /* Gotta grow the buffer. */ - { - size_t new_size = fs->end - fs->buf + amount; - char *new_buf = realloc (fs->buf, new_size); - - if (! new_buf) - { - __set_errno (ENOMEM); - return 0; - } - - fs->buf = new_buf; - fs->end = new_buf + new_size; - fs->p = fs->buf; - } - } - - return 1; -} - -ssize_t -__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...) -{ - int out; - size_t avail; - size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */ - - do - { - va_list args; - - if (! __argp_fmtstream_ensure (fs, size_guess)) - return -1; - - va_start (args, fmt); - avail = fs->end - fs->p; - out = __vsnprintf (fs->p, avail, fmt, args); - va_end (args); - if (out >= avail) - size_guess = out + 1; - } - while (out >= avail); - - fs->p += out; - - return out; -} -#ifdef weak_alias -weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf) -#endif - -#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */ diff --git a/newlib/libc/sys/linux/argp/argp-fmtstream.h b/newlib/libc/sys/linux/argp/argp-fmtstream.h deleted file mode 100644 index 7a291e28c..000000000 --- a/newlib/libc/sys/linux/argp/argp-fmtstream.h +++ /dev/null @@ -1,297 +0,0 @@ -/* Word-wrapping and line-truncating streams. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This package emulates glibc `line_wrap_stream' semantics for systems that - don't have that. If the system does have it, it is just a wrapper for - that. This header file is only used internally while compiling argp, and - shouldn't be installed. */ - -#ifndef _ARGP_FMTSTREAM_H -#define _ARGP_FMTSTREAM_H - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \ - || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)) -/* line_wrap_stream is available, so use that. */ -#define ARGP_FMTSTREAM_USE_LINEWRAP -#endif - -#ifdef ARGP_FMTSTREAM_USE_LINEWRAP -/* Just be a simple wrapper for line_wrap_stream; the semantics are - *slightly* different, as line_wrap_stream doesn't actually make a new - object, it just modifies the given stream (reversibly) to do - line-wrapping. Since we control who uses this code, it doesn't matter. */ - -#include <linewrap.h> - -typedef FILE *argp_fmtstream_t; - -#define argp_make_fmtstream line_wrap_stream -#define __argp_make_fmtstream line_wrap_stream -#define argp_fmtstream_free line_unwrap_stream -#define __argp_fmtstream_free line_unwrap_stream - -#define __argp_fmtstream_putc(fs,ch) putc(ch,fs) -#define argp_fmtstream_putc(fs,ch) putc(ch,fs) -#define __argp_fmtstream_puts(fs,str) fputs(str,fs) -#define argp_fmtstream_puts(fs,str) fputs(str,fs) -#define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) -#define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) -#define __argp_fmtstream_printf fprintf -#define argp_fmtstream_printf fprintf - -#define __argp_fmtstream_lmargin line_wrap_lmargin -#define argp_fmtstream_lmargin line_wrap_lmargin -#define __argp_fmtstream_set_lmargin line_wrap_set_lmargin -#define argp_fmtstream_set_lmargin line_wrap_set_lmargin -#define __argp_fmtstream_rmargin line_wrap_rmargin -#define argp_fmtstream_rmargin line_wrap_rmargin -#define __argp_fmtstream_set_rmargin line_wrap_set_rmargin -#define argp_fmtstream_set_rmargin line_wrap_set_rmargin -#define __argp_fmtstream_wmargin line_wrap_wmargin -#define argp_fmtstream_wmargin line_wrap_wmargin -#define __argp_fmtstream_set_wmargin line_wrap_set_wmargin -#define argp_fmtstream_set_wmargin line_wrap_set_wmargin -#define __argp_fmtstream_point line_wrap_point -#define argp_fmtstream_point line_wrap_point - -#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */ -/* Guess we have to define our own version. */ - -#ifndef __const -#define __const const -#endif - -struct argp_fmtstream -{ - FILE *stream; /* The stream we're outputting to. */ - - size_t lmargin, rmargin; /* Left and right margins. */ - ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */ - - /* Point in buffer to which we've processed for wrapping, but not output. */ - size_t point_offs; - /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */ - ssize_t point_col; - - char *buf; /* Output buffer. */ - char *p; /* Current end of text in BUF. */ - char *end; /* Absolute end of BUF. */ -}; - -typedef struct argp_fmtstream *argp_fmtstream_t; - -/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines - written on it with LMARGIN spaces and limits them to RMARGIN columns - total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by - replacing the whitespace before them with a newline and WMARGIN spaces. - Otherwise, chars beyond RMARGIN are simply dropped until a newline. - Returns NULL if there was an error. */ -extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream, - size_t __lmargin, - size_t __rmargin, - ssize_t __wmargin); -extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream, - size_t __lmargin, - size_t __rmargin, - ssize_t __wmargin); - -/* Flush __FS to its stream, and free it (but don't close the stream). */ -extern void __argp_fmtstream_free (argp_fmtstream_t __fs); -extern void argp_fmtstream_free (argp_fmtstream_t __fs); - -extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, - __const char *__fmt, ...) - __attribute__ ((__format__ (printf, 2, 3))); -extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, - __const char *__fmt, ...) - __attribute__ ((__format__ (printf, 2, 3))); - -extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); -extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); - -extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); -extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); - -extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs, - __const char *__str, size_t __len); -extern size_t argp_fmtstream_write (argp_fmtstream_t __fs, - __const char *__str, size_t __len); - -/* Access macros for various bits of state. */ -#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin) -#define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin) -#define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin) -#define __argp_fmtstream_lmargin argp_fmtstream_lmargin -#define __argp_fmtstream_rmargin argp_fmtstream_rmargin -#define __argp_fmtstream_wmargin argp_fmtstream_wmargin - -/* Set __FS's left margin to LMARGIN and return the old value. */ -extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, - size_t __lmargin); -extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, - size_t __lmargin); - -/* Set __FS's right margin to __RMARGIN and return the old value. */ -extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, - size_t __rmargin); -extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, - size_t __rmargin); - -/* Set __FS's wrap margin to __WMARGIN and return the old value. */ -extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, - size_t __wmargin); -extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, - size_t __wmargin); - -/* Return the column number of the current output point in __FS. */ -extern size_t argp_fmtstream_point (argp_fmtstream_t __fs); -extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs); - -/* Internal routines. */ -extern void _argp_fmtstream_update (argp_fmtstream_t __fs); -extern void __argp_fmtstream_update (argp_fmtstream_t __fs); -extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); -extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); - -#ifdef __OPTIMIZE__ -/* Inline versions of above routines. */ - -#if !_LIBC -#define __argp_fmtstream_putc argp_fmtstream_putc -#define __argp_fmtstream_puts argp_fmtstream_puts -#define __argp_fmtstream_write argp_fmtstream_write -#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin -#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin -#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin -#define __argp_fmtstream_point argp_fmtstream_point -#define __argp_fmtstream_update _argp_fmtstream_update -#define __argp_fmtstream_ensure _argp_fmtstream_ensure -#endif - -#ifndef ARGP_FS_EI -#define ARGP_FS_EI extern inline -#endif - -ARGP_FS_EI size_t -__argp_fmtstream_write (argp_fmtstream_t __fs, - __const char *__str, size_t __len) -{ - if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len)) - { - memcpy (__fs->p, __str, __len); - __fs->p += __len; - return __len; - } - else - return 0; -} - -ARGP_FS_EI int -__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str) -{ - size_t __len = strlen (__str); - if (__len) - { - size_t __wrote = __argp_fmtstream_write (__fs, __str, __len); - return __wrote == __len ? 0 : -1; - } - else - return 0; -} - -ARGP_FS_EI int -__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch) -{ - if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1)) - return *__fs->p++ = __ch; - else - return EOF; -} - -/* Set __FS's left margin to __LMARGIN and return the old value. */ -ARGP_FS_EI size_t -__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin) -{ - size_t __old; - if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) - __argp_fmtstream_update (__fs); - __old = __fs->lmargin; - __fs->lmargin = __lmargin; - return __old; -} - -/* Set __FS's right margin to __RMARGIN and return the old value. */ -ARGP_FS_EI size_t -__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin) -{ - size_t __old; - if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) - __argp_fmtstream_update (__fs); - __old = __fs->rmargin; - __fs->rmargin = __rmargin; - return __old; -} - -/* Set FS's wrap margin to __WMARGIN and return the old value. */ -ARGP_FS_EI size_t -__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin) -{ - size_t __old; - if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) - __argp_fmtstream_update (__fs); - __old = __fs->wmargin; - __fs->wmargin = __wmargin; - return __old; -} - -/* Return the column number of the current output point in __FS. */ -ARGP_FS_EI size_t -__argp_fmtstream_point (argp_fmtstream_t __fs) -{ - if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) - __argp_fmtstream_update (__fs); - return __fs->point_col >= 0 ? __fs->point_col : 0; -} - -#if !_LIBC -#undef __argp_fmtstream_putc -#undef __argp_fmtstream_puts -#undef __argp_fmtstream_write -#undef __argp_fmtstream_set_lmargin -#undef __argp_fmtstream_set_rmargin -#undef __argp_fmtstream_set_wmargin -#undef __argp_fmtstream_point -#undef __argp_fmtstream_update -#undef __argp_fmtstream_ensure -#endif - -#endif /* __OPTIMIZE__ */ - -#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */ - -#endif /* argp-fmtstream.h */ diff --git a/newlib/libc/sys/linux/argp/argp-fs-xinl.c b/newlib/libc/sys/linux/argp/argp-fs-xinl.c deleted file mode 100644 index b61a303e8..000000000 --- a/newlib/libc/sys/linux/argp/argp-fs-xinl.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Real definitions for extern inline functions in argp-fmtstream.h - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#define ARGP_FS_EI -#undef __OPTIMIZE__ -#define __OPTIMIZE__ -#include "argp-fmtstream.h" - -/* Add weak aliases. */ -#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias) - -weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc) -weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts) -weak_alias (__argp_fmtstream_write, argp_fmtstream_write) -weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin) -weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin) -weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin) -weak_alias (__argp_fmtstream_point, argp_fmtstream_point) - -#endif diff --git a/newlib/libc/sys/linux/argp/argp-help.c b/newlib/libc/sys/linux/argp/argp-help.c deleted file mode 100644 index d1523693b..000000000 --- a/newlib/libc/sys/linux/argp/argp-help.c +++ /dev/null @@ -1,1863 +0,0 @@ -/* Hierarchial argument parsing help output - Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# define HAVE_ALLOCA 1 -# else -# if defined HAVE_ALLOCA_H || defined _LIBC -# include <alloca.h> -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <stdarg.h> -#include <malloc.h> -#include <ctype.h> -#ifdef USE_IN_LIBIO -# include <wchar.h> -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. */ -# if defined HAVE_LIBINTL_H || defined _LIBC -# include <libintl.h> -# ifdef _LIBC -# undef dgettext -# define dgettext(domain, msgid) __dcgettext (domain, msgid, LC_MESSAGES) -# endif -# else -# define dgettext(domain, msgid) (msgid) -# endif -#endif - -#include <argp.h> -#include "argp-fmtstream.h" -#include "argp-namefrob.h" - -/* User-selectable (using an environment variable) formatting parameters. - - These may be specified in an environment variable called `ARGP_HELP_FMT', - with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2 - Where VALn must be a positive integer. The list of variables is in the - UPARAM_NAMES vector, below. */ - -/* Default parameters. */ -#define DUP_ARGS 0 /* True if option argument can be duplicated. */ -#define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */ -#define SHORT_OPT_COL 2 /* column in which short options start */ -#define LONG_OPT_COL 6 /* column in which long options start */ -#define DOC_OPT_COL 2 /* column in which doc options start */ -#define OPT_DOC_COL 29 /* column in which option text starts */ -#define HEADER_COL 1 /* column in which group headers are printed */ -#define USAGE_INDENT 12 /* indentation of wrapped usage lines */ -#define RMARGIN 79 /* right margin used for wrapping */ - -/* User-selectable (using an environment variable) formatting parameters. - They must all be of type `int' for the parsing code to work. */ -struct uparams -{ - /* If true, arguments for an option are shown with both short and long - options, even when a given option has both, e.g. `-x ARG, --longx=ARG'. - If false, then if an option has both, the argument is only shown with - the long one, e.g., `-x, --longx=ARG', and a message indicating that - this really means both is printed below the options. */ - int dup_args; - - /* This is true if when DUP_ARGS is false, and some duplicate arguments have - been suppressed, an explanatory message should be printed. */ - int dup_args_note; - - /* Various output columns. */ - int short_opt_col; - int long_opt_col; - int doc_opt_col; - int opt_doc_col; - int header_col; - int usage_indent; - int rmargin; - - int valid; /* True when the values in here are valid. */ -}; - -/* This is a global variable, as user options are only ever read once. */ -static struct uparams uparams = { - DUP_ARGS, DUP_ARGS_NOTE, - SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL, - USAGE_INDENT, RMARGIN, - 0 -}; - -/* A particular uparam, and what the user name is. */ -struct uparam_name -{ - const char *name; /* User name. */ - int is_bool; /* Whether it's `boolean'. */ - size_t uparams_offs; /* Location of the (int) field in UPARAMS. */ -}; - -/* The name-field mappings we know about. */ -static const struct uparam_name uparam_names[] = -{ - { "dup-args", 1, offsetof (struct uparams, dup_args) }, - { "dup-args-note", 1, offsetof (struct uparams, dup_args_note) }, - { "short-opt-col", 0, offsetof (struct uparams, short_opt_col) }, - { "long-opt-col", 0, offsetof (struct uparams, long_opt_col) }, - { "doc-opt-col", 0, offsetof (struct uparams, doc_opt_col) }, - { "opt-doc-col", 0, offsetof (struct uparams, opt_doc_col) }, - { "header-col", 0, offsetof (struct uparams, header_col) }, - { "usage-indent", 0, offsetof (struct uparams, usage_indent) }, - { "rmargin", 0, offsetof (struct uparams, rmargin) }, - { 0 } -}; - -/* Read user options from the environment, and fill in UPARAMS appropiately. */ -static void -fill_in_uparams (const struct argp_state *state) -{ - const char *var = getenv ("ARGP_HELP_FMT"); - -#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0); - - if (var) - /* Parse var. */ - while (*var) - { - SKIPWS (var); - - if (isalpha (*var)) - { - size_t var_len; - const struct uparam_name *un; - int unspec = 0, val = 0; - const char *arg = var; - - while (isalnum (*arg) || *arg == '-' || *arg == '_') - arg++; - var_len = arg - var; - - SKIPWS (arg); - - if (*arg == '\0' || *arg == ',') - unspec = 1; - else if (*arg == '=') - { - arg++; - SKIPWS (arg); - } - - if (unspec) - { - if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') - { - val = 0; - var += 3; - var_len -= 3; - } - else - val = 1; - } - else if (isdigit (*arg)) - { - val = atoi (arg); - while (isdigit (*arg)) - arg++; - SKIPWS (arg); - } - - for (un = uparam_names; un->name; un++) - if (strlen (un->name) == var_len - && strncmp (var, un->name, var_len) == 0) - { - if (unspec && !un->is_bool) - __argp_failure (state, 0, 0, - dgettext (state->root_argp->argp_domain, "\ -%.*s: ARGP_HELP_FMT parameter requires a value"), - (int) var_len, var); - else - *(int *)((char *)&uparams + un->uparams_offs) = val; - break; - } - if (! un->name) - __argp_failure (state, 0, 0, - dgettext (state->root_argp->argp_domain, "\ -%.*s: Unknown ARGP_HELP_FMT parameter"), - (int) var_len, var); - - var = arg; - if (*var == ',') - var++; - } - else if (*var) - { - __argp_failure (state, 0, 0, - dgettext (state->root_argp->argp_domain, - "Garbage in ARGP_HELP_FMT: %s"), var); - break; - } - } -} - -/* Returns true if OPT hasn't been marked invisible. Visibility only affects - whether OPT is displayed or used in sorting, not option shadowing. */ -#define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN)) - -/* Returns true if OPT is an alias for an earlier option. */ -#define oalias(opt) ((opt)->flags & OPTION_ALIAS) - -/* Returns true if OPT is an documentation-only entry. */ -#define odoc(opt) ((opt)->flags & OPTION_DOC) - -/* Returns true if OPT is the end-of-list marker for a list of options. */ -#define oend(opt) __option_is_end (opt) - -/* Returns true if OPT has a short option. */ -#define oshort(opt) __option_is_short (opt) - -/* - The help format for a particular option is like: - - -xARG, -yARG, --long1=ARG, --long2=ARG Documentation... - - Where ARG will be omitted if there's no argument, for this option, or - will be surrounded by "[" and "]" appropiately if the argument is - optional. The documentation string is word-wrapped appropiately, and if - the list of options is long enough, it will be started on a separate line. - If there are no short options for a given option, the first long option is - indented slighly in a way that's supposed to make most long options appear - to be in a separate column. - - For example, the following output (from ps): - - -p PID, --pid=PID List the process PID - --pgrp=PGRP List processes in the process group PGRP - -P, -x, --no-parent Include processes without parents - -Q, --all-fields Don't elide unusable fields (normally if there's - some reason ps can't print a field for any - process, it's removed from the output entirely) - -r, --reverse, --gratuitously-long-reverse-option - Reverse the order of any sort - --session[=SID] Add the processes from the session SID (which - defaults to the sid of the current process) - - Here are some more options: - -f ZOT, --foonly=ZOT Glork a foonly - -z, --zaza Snit a zar - - -?, --help Give this help list - --usage Give a short usage message - -V, --version Print program version - - The struct argp_option array for the above could look like: - - { - {"pid", 'p', "PID", 0, "List the process PID"}, - {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"}, - {"no-parent", 'P', 0, 0, "Include processes without parents"}, - {0, 'x', 0, OPTION_ALIAS}, - {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" - " if there's some reason ps can't" - " print a field for any process, it's" - " removed from the output entirely)" }, - {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, - {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, - {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL, - "Add the processes from the session" - " SID (which defaults to the sid of" - " the current process)" }, - - {0,0,0,0, "Here are some more options:"}, - {"foonly", 'f', "ZOT", 0, "Glork a foonly"}, - {"zaza", 'z', 0, 0, "Snit a zar"}, - - {0} - } - - Note that the last three options are automatically supplied by argp_parse, - unless you tell it not to with ARGP_NO_HELP. - -*/ - -/* Returns true if CH occurs between BEG and END. */ -static int -find_char (char ch, char *beg, char *end) -{ - while (beg < end) - if (*beg == ch) - return 1; - else - beg++; - return 0; -} - -struct hol_cluster; /* fwd decl */ - -struct hol_entry -{ - /* First option. */ - const struct argp_option *opt; - /* Number of options (including aliases). */ - unsigned num; - - /* A pointers into the HOL's short_options field, to the first short option - letter for this entry. The order of the characters following this point - corresponds to the order of options pointed to by OPT, and there are at - most NUM. A short option recorded in a option following OPT is only - valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's - probably been shadowed by some other entry). */ - char *short_options; - - /* Entries are sorted by their group first, in the order: - 1, 2, ..., n, 0, -m, ..., -2, -1 - and then alphabetically within each group. The default is 0. */ - int group; - - /* The cluster of options this entry belongs to, or 0 if none. */ - struct hol_cluster *cluster; - - /* The argp from which this option came. */ - const struct argp *argp; -}; - -/* A cluster of entries to reflect the argp tree structure. */ -struct hol_cluster -{ - /* A descriptive header printed before options in this cluster. */ - const char *header; - - /* Used to order clusters within the same group with the same parent, - according to the order in which they occurred in the parent argp's child - list. */ - int index; - - /* How to sort this cluster with respect to options and other clusters at the - same depth (clusters always follow options in the same group). */ - int group; - - /* The cluster to which this cluster belongs, or 0 if it's at the base - level. */ - struct hol_cluster *parent; - - /* The argp from which this cluster is (eventually) derived. */ - const struct argp *argp; - - /* The distance this cluster is from the root. */ - int depth; - - /* Clusters in a given hol are kept in a linked list, to make freeing them - possible. */ - struct hol_cluster *next; -}; - -/* A list of options for help. */ -struct hol -{ - /* An array of hol_entry's. */ - struct hol_entry *entries; - /* The number of entries in this hol. If this field is zero, the others - are undefined. */ - unsigned num_entries; - - /* A string containing all short options in this HOL. Each entry contains - pointers into this string, so the order can't be messed with blindly. */ - char *short_options; - - /* Clusters of entries in this hol. */ - struct hol_cluster *clusters; -}; - -/* Create a struct hol from the options in ARGP. CLUSTER is the - hol_cluster in which these entries occur, or 0, if at the root. */ -static struct hol * -make_hol (const struct argp *argp, struct hol_cluster *cluster) -{ - char *so; - const struct argp_option *o; - const struct argp_option *opts = argp->options; - struct hol_entry *entry; - unsigned num_short_options = 0; - struct hol *hol = malloc (sizeof (struct hol)); - - assert (hol); - - hol->num_entries = 0; - hol->clusters = 0; - - if (opts) - { - int cur_group = 0; - - /* The first option must not be an alias. */ - assert (! oalias (opts)); - - /* Calculate the space needed. */ - for (o = opts; ! oend (o); o++) - { - if (! oalias (o)) - hol->num_entries++; - if (oshort (o)) - num_short_options++; /* This is an upper bound. */ - } - - hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries); - hol->short_options = malloc (num_short_options + 1); - - assert (hol->entries && hol->short_options); - - /* Fill in the entries. */ - so = hol->short_options; - for (o = opts, entry = hol->entries; ! oend (o); entry++) - { - entry->opt = o; - entry->num = 0; - entry->short_options = so; - entry->group = cur_group = - o->group - ? o->group - : ((!o->name && !o->key) - ? cur_group + 1 - : cur_group); - entry->cluster = cluster; - entry->argp = argp; - - do - { - entry->num++; - if (oshort (o) && ! find_char (o->key, hol->short_options, so)) - /* O has a valid short option which hasn't already been used.*/ - *so++ = o->key; - o++; - } - while (! oend (o) && oalias (o)); - } - *so = '\0'; /* null terminated so we can find the length */ - } - - return hol; -} - -/* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the - associated argp child list entry), INDEX, and PARENT, and return a pointer - to it. ARGP is the argp that this cluster results from. */ -static struct hol_cluster * -hol_add_cluster (struct hol *hol, int group, const char *header, int index, - struct hol_cluster *parent, const struct argp *argp) -{ - struct hol_cluster *cl = malloc (sizeof (struct hol_cluster)); - if (cl) - { - cl->group = group; - cl->header = header; - - cl->index = index; - cl->parent = parent; - cl->argp = argp; - cl->depth = parent ? parent->depth + 1 : 0; - - cl->next = hol->clusters; - hol->clusters = cl; - } - return cl; -} - -/* Free HOL and any resources it uses. */ -static void -hol_free (struct hol *hol) -{ - struct hol_cluster *cl = hol->clusters; - - while (cl) - { - struct hol_cluster *next = cl->next; - free (cl); - cl = next; - } - - if (hol->num_entries > 0) - { - free (hol->entries); - free (hol->short_options); - } - - free (hol); -} - -static inline int -hol_entry_short_iterate (const struct hol_entry *entry, - int (*func)(const struct argp_option *opt, - const struct argp_option *real, - const char *domain, void *cookie), - const char *domain, void *cookie) -{ - unsigned nopts; - int val = 0; - const struct argp_option *opt, *real = entry->opt; - char *so = entry->short_options; - - for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) - if (oshort (opt) && *so == opt->key) - { - if (!oalias (opt)) - real = opt; - if (ovisible (opt)) - val = (*func)(opt, real, domain, cookie); - so++; - } - - return val; -} - -static inline int -hol_entry_long_iterate (const struct hol_entry *entry, - int (*func)(const struct argp_option *opt, - const struct argp_option *real, - const char *domain, void *cookie), - const char *domain, void *cookie) -{ - unsigned nopts; - int val = 0; - const struct argp_option *opt, *real = entry->opt; - - for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) - if (opt->name) - { - if (!oalias (opt)) - real = opt; - if (ovisible (opt)) - val = (*func)(opt, real, domain, cookie); - } - - return val; -} - -/* Iterator that returns true for the first short option. */ -static inline int -until_short (const struct argp_option *opt, const struct argp_option *real, - const char *domain, void *cookie) -{ - return oshort (opt) ? opt->key : 0; -} - -/* Returns the first valid short option in ENTRY, or 0 if there is none. */ -static char -hol_entry_first_short (const struct hol_entry *entry) -{ - return hol_entry_short_iterate (entry, until_short, - entry->argp->argp_domain, 0); -} - -/* Returns the first valid long option in ENTRY, or 0 if there is none. */ -static const char * -hol_entry_first_long (const struct hol_entry *entry) -{ - const struct argp_option *opt; - unsigned num; - for (opt = entry->opt, num = entry->num; num > 0; opt++, num--) - if (opt->name && ovisible (opt)) - return opt->name; - return 0; -} - -/* Returns the entry in HOL with the long option name NAME, or 0 if there is - none. */ -static struct hol_entry * -hol_find_entry (struct hol *hol, const char *name) -{ - struct hol_entry *entry = hol->entries; - unsigned num_entries = hol->num_entries; - - while (num_entries-- > 0) - { - const struct argp_option *opt = entry->opt; - unsigned num_opts = entry->num; - - while (num_opts-- > 0) - if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0) - return entry; - else - opt++; - - entry++; - } - - return 0; -} - -/* If an entry with the long option NAME occurs in HOL, set it's special - sort position to GROUP. */ -static void -hol_set_group (struct hol *hol, const char *name, int group) -{ - struct hol_entry *entry = hol_find_entry (hol, name); - if (entry) - entry->group = group; -} - -/* Order by group: 0, 1, 2, ..., n, -m, ..., -2, -1. - EQ is what to return if GROUP1 and GROUP2 are the same. */ -static int -group_cmp (int group1, int group2, int eq) -{ - if (group1 == group2) - return eq; - else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0)) - return group1 - group2; - else - return group2 - group1; -} - -/* Compare clusters CL1 & CL2 by the order that they should appear in - output. */ -static int -hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2) -{ - /* If one cluster is deeper than the other, use its ancestor at the same - level, so that finding the common ancestor is straightforward. */ - while (cl1->depth < cl2->depth) - cl1 = cl1->parent; - while (cl2->depth < cl1->depth) - cl2 = cl2->parent; - - /* Now reduce both clusters to their ancestors at the point where both have - a common parent; these can be directly compared. */ - while (cl1->parent != cl2->parent) - cl1 = cl1->parent, cl2 = cl2->parent; - - return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index); -} - -/* Return the ancestor of CL that's just below the root (i.e., has a parent - of 0). */ -static struct hol_cluster * -hol_cluster_base (struct hol_cluster *cl) -{ - while (cl->parent) - cl = cl->parent; - return cl; -} - -/* Return true if CL1 is a child of CL2. */ -static int -hol_cluster_is_child (const struct hol_cluster *cl1, - const struct hol_cluster *cl2) -{ - while (cl1 && cl1 != cl2) - cl1 = cl1->parent; - return cl1 == cl2; -} - -/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail - that should be used for comparisons, and returns true iff it should be - treated as a non-option. */ -static int -canon_doc_option (const char **name) -{ - int non_opt; - /* Skip initial whitespace. */ - while (isspace (**name)) - (*name)++; - /* Decide whether this looks like an option (leading `-') or not. */ - non_opt = (**name != '-'); - /* Skip until part of name used for sorting. */ - while (**name && !isalnum (**name)) - (*name)++; - return non_opt; -} - -/* Order ENTRY1 & ENTRY2 by the order which they should appear in a help - listing. */ -static int -hol_entry_cmp (const struct hol_entry *entry1, - const struct hol_entry *entry2) -{ - /* The group numbers by which the entries should be ordered; if either is - in a cluster, then this is just the group within the cluster. */ - int group1 = entry1->group, group2 = entry2->group; - - if (entry1->cluster != entry2->cluster) - { - /* The entries are not within the same cluster, so we can't compare them - directly, we have to use the appropiate clustering level too. */ - if (! entry1->cluster) - /* ENTRY1 is at the `base level', not in a cluster, so we have to - compare it's group number with that of the base cluster in which - ENTRY2 resides. Note that if they're in the same group, the - clustered option always comes laster. */ - return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); - else if (! entry2->cluster) - /* Likewise, but ENTRY2's not in a cluster. */ - return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); - else - /* Both entries are in clusters, we can just compare the clusters. */ - return hol_cluster_cmp (entry1->cluster, entry2->cluster); - } - else if (group1 == group2) - /* The entries are both in the same cluster and group, so compare them - alphabetically. */ - { - int short1 = hol_entry_first_short (entry1); - int short2 = hol_entry_first_short (entry2); - int doc1 = odoc (entry1->opt); - int doc2 = odoc (entry2->opt); - const char *long1 = hol_entry_first_long (entry1); - const char *long2 = hol_entry_first_long (entry2); - - if (doc1) - doc1 = canon_doc_option (&long1); - if (doc2) - doc2 = canon_doc_option (&long2); - - if (doc1 != doc2) - /* `documentation' options always follow normal options (or - documentation options that *look* like normal options). */ - return doc1 - doc2; - else if (!short1 && !short2 && long1 && long2) - /* Only long options. */ - return __strcasecmp (long1, long2); - else - /* Compare short/short, long/short, short/long, using the first - character of long options. Entries without *any* valid - options (such as options with OPTION_HIDDEN set) will be put - first, but as they're not displayed, it doesn't matter where - they are. */ - { - char first1 = short1 ? short1 : long1 ? *long1 : 0; - char first2 = short2 ? short2 : long2 ? *long2 : 0; -#ifdef _tolower - int lower_cmp = _tolower (first1) - _tolower (first2); -#else - int lower_cmp = tolower (first1) - tolower (first2); -#endif - /* Compare ignoring case, except when the options are both the - same letter, in which case lower-case always comes first. */ - return lower_cmp ? lower_cmp : first2 - first1; - } - } - else - /* Within the same cluster, but not the same group, so just compare - groups. */ - return group_cmp (group1, group2, 0); -} - -/* Version of hol_entry_cmp with correct signature for qsort. */ -static int -hol_entry_qcmp (const void *entry1_v, const void *entry2_v) -{ - return hol_entry_cmp (entry1_v, entry2_v); -} - -/* Sort HOL by group and alphabetically by option name (with short options - taking precedence over long). Since the sorting is for display purposes - only, the shadowing of options isn't effected. */ -static void -hol_sort (struct hol *hol) -{ - if (hol->num_entries > 0) - qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry), - hol_entry_qcmp); -} - -/* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow - any in MORE with the same name. */ -static void -hol_append (struct hol *hol, struct hol *more) -{ - struct hol_cluster **cl_end = &hol->clusters; - char *tmp; - - /* Steal MORE's cluster list, and add it to the end of HOL's. */ - while (*cl_end) - cl_end = &(*cl_end)->next; - *cl_end = more->clusters; - more->clusters = 0; - - /* Merge entries. */ - if (more->num_entries > 0) - { - if (hol->num_entries == 0) - { - hol->num_entries = more->num_entries; - hol->entries = more->entries; - hol->short_options = more->short_options; - more->num_entries = 0; /* Mark MORE's fields as invalid. */ - } - else - /* Append the entries in MORE to those in HOL, taking care to only add - non-shadowed SHORT_OPTIONS values. */ - { - unsigned left; - char *so, *more_so; - struct hol_entry *e; - unsigned num_entries = hol->num_entries + more->num_entries; - struct hol_entry *entries = - malloc (num_entries * sizeof (struct hol_entry)); - unsigned hol_so_len = strlen (hol->short_options); - char *short_options = - malloc (hol_so_len + strlen (more->short_options) + 1); - - tmp = memcpy (entries, hol->entries, - hol->num_entries * sizeof (struct hol_entry)); - tmp += hol->num_entries * sizeof (struct hol_entry); - memcpy (tmp, - more->entries, - more->num_entries * sizeof (struct hol_entry)); - - memcpy (short_options, hol->short_options, hol_so_len); - - /* Fix up the short options pointers from HOL. */ - for (e = entries, left = hol->num_entries; left > 0; e++, left--) - e->short_options += (short_options - hol->short_options); - - /* Now add the short options from MORE, fixing up its entries - too. */ - so = short_options + hol_so_len; - more_so = more->short_options; - for (left = more->num_entries; left > 0; e++, left--) - { - int opts_left; - const struct argp_option *opt; - - e->short_options = so; - - for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--) - { - int ch = *more_so; - if (oshort (opt) && ch == opt->key) - /* The next short option in MORE_SO, CH, is from OPT. */ - { - if (! find_char (ch, short_options, - short_options + hol_so_len)) - /* The short option CH isn't shadowed by HOL's options, - so add it to the sum. */ - *so++ = ch; - more_so++; - } - } - } - - *so = '\0'; - - free (hol->entries); - free (hol->short_options); - - hol->entries = entries; - hol->num_entries = num_entries; - hol->short_options = short_options; - } - } - - hol_free (more); -} - -/* Inserts enough spaces to make sure STREAM is at column COL. */ -static void -indent_to (argp_fmtstream_t stream, unsigned col) -{ - int needed = col - __argp_fmtstream_point (stream); - while (needed-- > 0) - __argp_fmtstream_putc (stream, ' '); -} - -/* Output to STREAM either a space, or a newline if there isn't room for at - least ENSURE characters before the right margin. */ -static void -space (argp_fmtstream_t stream, size_t ensure) -{ - if (__argp_fmtstream_point (stream) + ensure - >= __argp_fmtstream_rmargin (stream)) - __argp_fmtstream_putc (stream, '\n'); - else - __argp_fmtstream_putc (stream, ' '); -} - -/* If the option REAL has an argument, we print it in using the printf - format REQ_FMT or OPT_FMT depending on whether it's a required or - optional argument. */ -static void -arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt, - const char *domain, argp_fmtstream_t stream) -{ - if (real->arg) - { - if (real->flags & OPTION_ARG_OPTIONAL) - __argp_fmtstream_printf (stream, opt_fmt, - dgettext (domain, real->arg)); - else - __argp_fmtstream_printf (stream, req_fmt, - dgettext (domain, real->arg)); - } -} - -/* Helper functions for hol_entry_help. */ - -/* State used during the execution of hol_help. */ -struct hol_help_state -{ - /* PREV_ENTRY should contain the previous entry printed, or 0. */ - struct hol_entry *prev_entry; - - /* If an entry is in a different group from the previous one, and SEP_GROUPS - is true, then a blank line will be printed before any output. */ - int sep_groups; - - /* True if a duplicate option argument was suppressed (only ever set if - UPARAMS.dup_args is false). */ - int suppressed_dup_arg; -}; - -/* Some state used while printing a help entry (used to communicate with - helper functions). See the doc for hol_entry_help for more info, as most - of the fields are copied from its arguments. */ -struct pentry_state -{ - const struct hol_entry *entry; - argp_fmtstream_t stream; - struct hol_help_state *hhstate; - - /* True if nothing's been printed so far. */ - int first; - - /* If non-zero, the state that was used to print this help. */ - const struct argp_state *state; -}; - -/* If a user doc filter should be applied to DOC, do so. */ -static const char * -filter_doc (const char *doc, int key, const struct argp *argp, - const struct argp_state *state) -{ - if (argp->help_filter) - /* We must apply a user filter to this output. */ - { - void *input = __argp_input (argp, state); - return (*argp->help_filter) (key, doc, input); - } - else - /* No filter. */ - return doc; -} - -/* Prints STR as a header line, with the margin lines set appropiately, and - notes the fact that groups should be separated with a blank line. ARGP is - the argp that should dictate any user doc filtering to take place. Note - that the previous wrap margin isn't restored, but the left margin is reset - to 0. */ -static void -print_header (const char *str, const struct argp *argp, - struct pentry_state *pest) -{ - const char *tstr = dgettext (argp->argp_domain, str); - const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state); - - if (fstr) - { - if (*fstr) - { - if (pest->hhstate->prev_entry) - /* Precede with a blank line. */ - __argp_fmtstream_putc (pest->stream, '\n'); - indent_to (pest->stream, uparams.header_col); - __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col); - __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col); - __argp_fmtstream_puts (pest->stream, fstr); - __argp_fmtstream_set_lmargin (pest->stream, 0); - __argp_fmtstream_putc (pest->stream, '\n'); - } - - pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */ - } - - if (fstr != tstr) - free ((char *) fstr); -} - -/* Inserts a comma if this isn't the first item on the line, and then makes - sure we're at least to column COL. If this *is* the first item on a line, - prints any pending whitespace/headers that should precede this line. Also - clears FIRST. */ -static void -comma (unsigned col, struct pentry_state *pest) -{ - if (pest->first) - { - const struct hol_entry *pe = pest->hhstate->prev_entry; - const struct hol_cluster *cl = pest->entry->cluster; - - if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group) - __argp_fmtstream_putc (pest->stream, '\n'); - - if (cl && cl->header && *cl->header - && (!pe - || (pe->cluster != cl - && !hol_cluster_is_child (pe->cluster, cl)))) - /* If we're changing clusters, then this must be the start of the - ENTRY's cluster unless that is an ancestor of the previous one - (in which case we had just popped into a sub-cluster for a bit). - If so, then print the cluster's header line. */ - { - int old_wm = __argp_fmtstream_wmargin (pest->stream); - print_header (cl->header, cl->argp, pest); - __argp_fmtstream_set_wmargin (pest->stream, old_wm); - } - - pest->first = 0; - } - else - __argp_fmtstream_puts (pest->stream, ", "); - - indent_to (pest->stream, col); -} - -/* Print help for ENTRY to STREAM. */ -static void -hol_entry_help (struct hol_entry *entry, const struct argp_state *state, - argp_fmtstream_t stream, struct hol_help_state *hhstate) -{ - unsigned num; - const struct argp_option *real = entry->opt, *opt; - char *so = entry->short_options; - int have_long_opt = 0; /* We have any long options. */ - /* Saved margins. */ - int old_lm = __argp_fmtstream_set_lmargin (stream, 0); - int old_wm = __argp_fmtstream_wmargin (stream); - /* PEST is a state block holding some of our variables that we'd like to - share with helper functions. */ - struct pentry_state pest = { entry, stream, hhstate, 1, state }; - - if (! odoc (real)) - for (opt = real, num = entry->num; num > 0; opt++, num--) - if (opt->name && ovisible (opt)) - { - have_long_opt = 1; - break; - } - - /* First emit short options. */ - __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */ - for (opt = real, num = entry->num; num > 0; opt++, num--) - if (oshort (opt) && opt->key == *so) - /* OPT has a valid (non shadowed) short option. */ - { - if (ovisible (opt)) - { - comma (uparams.short_opt_col, &pest); - __argp_fmtstream_putc (stream, '-'); - __argp_fmtstream_putc (stream, *so); - if (!have_long_opt || uparams.dup_args) - arg (real, " %s", "[%s]", state->root_argp->argp_domain, stream); - else if (real->arg) - hhstate->suppressed_dup_arg = 1; - } - so++; - } - - /* Now, long options. */ - if (odoc (real)) - /* A `documentation' option. */ - { - __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col); - for (opt = real, num = entry->num; num > 0; opt++, num--) - if (opt->name && ovisible (opt)) - { - comma (uparams.doc_opt_col, &pest); - /* Calling gettext here isn't quite right, since sorting will - have been done on the original; but documentation options - should be pretty rare anyway... */ - __argp_fmtstream_puts (stream, - dgettext (state->root_argp->argp_domain, - opt->name)); - } - } - else - /* A real long option. */ - { - int first_long_opt = 1; - - __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col); - for (opt = real, num = entry->num; num > 0; opt++, num--) - if (opt->name && ovisible (opt)) - { - comma (uparams.long_opt_col, &pest); - __argp_fmtstream_printf (stream, "--%s", opt->name); - if (first_long_opt || uparams.dup_args) - arg (real, "=%s", "[=%s]", state->root_argp->argp_domain, - stream); - else if (real->arg) - hhstate->suppressed_dup_arg = 1; - } - } - - /* Next, documentation strings. */ - __argp_fmtstream_set_lmargin (stream, 0); - - if (pest.first) - { - /* Didn't print any switches, what's up? */ - if (!oshort (real) && !real->name) - /* This is a group header, print it nicely. */ - print_header (real->doc, entry->argp, &pest); - else - /* Just a totally shadowed option or null header; print nothing. */ - goto cleanup; /* Just return, after cleaning up. */ - } - else - { - const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain, - real->doc) : 0; - const char *fstr = filter_doc (tstr, real->key, entry->argp, state); - if (fstr && *fstr) - { - unsigned int col = __argp_fmtstream_point (stream); - - __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col); - __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col); - - if (col > (unsigned int) (uparams.opt_doc_col + 3)) - __argp_fmtstream_putc (stream, '\n'); - else if (col >= (unsigned int) uparams.opt_doc_col) - __argp_fmtstream_puts (stream, " "); - else - indent_to (stream, uparams.opt_doc_col); - - __argp_fmtstream_puts (stream, fstr); - } - if (fstr && fstr != tstr) - free ((char *) fstr); - - /* Reset the left margin. */ - __argp_fmtstream_set_lmargin (stream, 0); - __argp_fmtstream_putc (stream, '\n'); - } - - hhstate->prev_entry = entry; - -cleanup: - __argp_fmtstream_set_lmargin (stream, old_lm); - __argp_fmtstream_set_wmargin (stream, old_wm); -} - -/* Output a long help message about the options in HOL to STREAM. */ -static void -hol_help (struct hol *hol, const struct argp_state *state, - argp_fmtstream_t stream) -{ - unsigned num; - struct hol_entry *entry; - struct hol_help_state hhstate = { 0, 0, 0 }; - - for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--) - hol_entry_help (entry, state, stream, &hhstate); - - if (hhstate.suppressed_dup_arg && uparams.dup_args_note) - { - const char *tstr = dgettext (state->root_argp->argp_domain, "\ -Mandatory or optional arguments to long options are also mandatory or \ -optional for any corresponding short options."); - const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE, - state ? state->root_argp : 0, state); - if (fstr && *fstr) - { - __argp_fmtstream_putc (stream, '\n'); - __argp_fmtstream_puts (stream, fstr); - __argp_fmtstream_putc (stream, '\n'); - } - if (fstr && fstr != tstr) - free ((char *) fstr); - } -} - -/* Helper functions for hol_usage. */ - -/* If OPT is a short option without an arg, append its key to the string - pointer pointer to by COOKIE, and advance the pointer. */ -static int -add_argless_short_opt (const struct argp_option *opt, - const struct argp_option *real, - const char *domain, void *cookie) -{ - char **snao_end = cookie; - if (!(opt->arg || real->arg) - && !((opt->flags | real->flags) & OPTION_NO_USAGE)) - *(*snao_end)++ = opt->key; - return 0; -} - -/* If OPT is a short option with an arg, output a usage entry for it to the - stream pointed at by COOKIE. */ -static int -usage_argful_short_opt (const struct argp_option *opt, - const struct argp_option *real, - const char *domain, void *cookie) -{ - argp_fmtstream_t stream = cookie; - const char *arg = opt->arg; - int flags = opt->flags | real->flags; - - if (! arg) - arg = real->arg; - - if (arg && !(flags & OPTION_NO_USAGE)) - { - arg = dgettext (domain, arg); - - if (flags & OPTION_ARG_OPTIONAL) - __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg); - else - { - /* Manually do line wrapping so that it (probably) won't - get wrapped at the embedded space. */ - space (stream, 6 + strlen (arg)); - __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg); - } - } - - return 0; -} - -/* Output a usage entry for the long option opt to the stream pointed at by - COOKIE. */ -static int -usage_long_opt (const struct argp_option *opt, - const struct argp_option *real, - const char *domain, void *cookie) -{ - argp_fmtstream_t stream = cookie; - const char *arg = opt->arg; - int flags = opt->flags | real->flags; - - if (! arg) - arg = real->arg; - - if (! (flags & OPTION_NO_USAGE)) - { - if (arg) - { - arg = dgettext (domain, arg); - if (flags & OPTION_ARG_OPTIONAL) - __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg); - else - __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg); - } - else - __argp_fmtstream_printf (stream, " [--%s]", opt->name); - } - - return 0; -} - -/* Print a short usage description for the arguments in HOL to STREAM. */ -static void -hol_usage (struct hol *hol, argp_fmtstream_t stream) -{ - if (hol->num_entries > 0) - { - unsigned nentries; - struct hol_entry *entry; - char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1); - char *snao_end = short_no_arg_opts; - - /* First we put a list of short options without arguments. */ - for (entry = hol->entries, nentries = hol->num_entries - ; nentries > 0 - ; entry++, nentries--) - hol_entry_short_iterate (entry, add_argless_short_opt, - entry->argp->argp_domain, &snao_end); - if (snao_end > short_no_arg_opts) - { - *snao_end++ = 0; - __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts); - } - - /* Now a list of short options *with* arguments. */ - for (entry = hol->entries, nentries = hol->num_entries - ; nentries > 0 - ; entry++, nentries--) - hol_entry_short_iterate (entry, usage_argful_short_opt, - entry->argp->argp_domain, stream); - - /* Finally, a list of long options (whew!). */ - for (entry = hol->entries, nentries = hol->num_entries - ; nentries > 0 - ; entry++, nentries--) - hol_entry_long_iterate (entry, usage_long_opt, - entry->argp->argp_domain, stream); - } -} - -/* Make a HOL containing all levels of options in ARGP. CLUSTER is the - cluster in which ARGP's entries should be clustered, or 0. */ -static struct hol * -argp_hol (const struct argp *argp, struct hol_cluster *cluster) -{ - const struct argp_child *child = argp->children; - struct hol *hol = make_hol (argp, cluster); - if (child) - while (child->argp) - { - struct hol_cluster *child_cluster = - ((child->group || child->header) - /* Put CHILD->argp within its own cluster. */ - ? hol_add_cluster (hol, child->group, child->header, - child - argp->children, cluster, argp) - /* Just merge it into the parent's cluster. */ - : cluster); - hol_append (hol, argp_hol (child->argp, child_cluster)) ; - child++; - } - return hol; -} - -/* Calculate how many different levels with alternative args strings exist in - ARGP. */ -static size_t -argp_args_levels (const struct argp *argp) -{ - size_t levels = 0; - const struct argp_child *child = argp->children; - - if (argp->args_doc && strchr (argp->args_doc, '\n')) - levels++; - - if (child) - while (child->argp) - levels += argp_args_levels ((child++)->argp); - - return levels; -} - -/* Print all the non-option args documented in ARGP to STREAM. Any output is - preceded by a space. LEVELS is a pointer to a byte vector the length - returned by argp_args_levels; it should be initialized to zero, and - updated by this routine for the next call if ADVANCE is true. True is - returned as long as there are more patterns to output. */ -static int -argp_args_usage (const struct argp *argp, const struct argp_state *state, - char **levels, int advance, argp_fmtstream_t stream) -{ - char *our_level = *levels; - int multiple = 0; - const struct argp_child *child = argp->children; - const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0; - const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state); - - if (fdoc) - { - const char *cp = fdoc; - nl = strchr (cp, '\n'); - if (!nl) - { - nl = cp; - while (*nl != '\0') nl++; - } - - if (*nl != '\0') - /* This is a `multi-level' args doc; advance to the correct position - as determined by our state in LEVELS, and update LEVELS. */ - { - int i; - multiple = 1; - for (i = 0; i < *our_level; i++) - { - cp = nl + 1; - nl = strchr (cp, '\n'); - if (!nl) - { - nl = cp; - while (*nl != '\0') nl++; - } - } - (*levels)++; - } - - /* Manually do line wrapping so that it (probably) won't get wrapped at - any embedded spaces. */ - space (stream, 1 + nl - cp); - - __argp_fmtstream_write (stream, cp, nl - cp); - } - if (fdoc && fdoc != tdoc) - free ((char *)fdoc); /* Free user's modified doc string. */ - - if (child) - while (child->argp) - advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream); - - if (advance && multiple) - { - /* Need to increment our level. */ - if (*nl) - /* There's more we can do here. */ - { - (*our_level)++; - advance = 0; /* Our parent shouldn't advance also. */ - } - else if (*our_level > 0) - /* We had multiple levels, but used them up; reset to zero. */ - *our_level = 0; - } - - return !advance; -} - -/* Print the documentation for ARGP to STREAM; if POST is false, then - everything preceeding a `\v' character in the documentation strings (or - the whole string, for those with none) is printed, otherwise, everything - following the `\v' character (nothing for strings without). Each separate - bit of documentation is separated a blank line, and if PRE_BLANK is true, - then the first is as well. If FIRST_ONLY is true, only the first - occurrence is output. Returns true if anything was output. */ -static int -argp_doc (const struct argp *argp, const struct argp_state *state, - int post, int pre_blank, int first_only, - argp_fmtstream_t stream) -{ - const char *text; - const char *inp_text; - char *tmp_text; - void *input = 0; - int anything = 0; - size_t inp_text_limit = 0; - const char *doc = dgettext (argp->argp_domain, argp->doc); - const struct argp_child *child = argp->children; - - if (doc) - { - char *vt = strchr (doc, '\v'); - inp_text = post ? (vt ? vt + 1 : 0) : doc; - inp_text_limit = (!post && vt) ? (vt - doc) : 0; - } - else - inp_text = 0; - - if (argp->help_filter) - /* We have to filter the doc strings. */ - { - if (inp_text_limit) - { - /* Copy INP_TEXT so that it's nul-terminated. */ - tmp_text = _malloc_r (_REENT, inp_text_limit); - strncpy (tmp_text, inp_text, inp_text_limit); - _free_r (_REENT, inp_text); - inp_text = tmp_text; - } - input = __argp_input (argp, state); - text = - (*argp->help_filter) (post - ? ARGP_KEY_HELP_POST_DOC - : ARGP_KEY_HELP_PRE_DOC, - inp_text, input); - } - else - text = (const char *) inp_text; - - if (text) - { - if (pre_blank) - __argp_fmtstream_putc (stream, '\n'); - - if (text == inp_text && inp_text_limit) - __argp_fmtstream_write (stream, inp_text, inp_text_limit); - else - __argp_fmtstream_puts (stream, text); - - if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream)) - __argp_fmtstream_putc (stream, '\n'); - - anything = 1; - } - - if (text && text != inp_text) - free ((char *) text); /* Free TEXT returned from the help filter. */ - if (inp_text && inp_text_limit && argp->help_filter) - free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */ - - if (post && argp->help_filter) - /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */ - { - text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input); - if (text) - { - if (anything || pre_blank) - __argp_fmtstream_putc (stream, '\n'); - __argp_fmtstream_puts (stream, text); - free ((char *) text); - if (__argp_fmtstream_point (stream) - > __argp_fmtstream_lmargin (stream)) - __argp_fmtstream_putc (stream, '\n'); - anything = 1; - } - } - - if (child) - while (child->argp && !(first_only && anything)) - anything |= - argp_doc ((child++)->argp, state, - post, anything || pre_blank, first_only, - stream); - - return anything; -} - -/* Output a usage message for ARGP to STREAM. If called from - argp_state_help, STATE is the relevent parsing state. FLAGS are from the - set ARGP_HELP_*. NAME is what to use wherever a `program name' is - needed. */ -static void -_help (const struct argp *argp, const struct argp_state *state, FILE *stream, - unsigned flags, char *name) -{ - int anything = 0; /* Whether we've output anything. */ - struct hol *hol = 0; - argp_fmtstream_t fs; - - if (! stream) - return; - - _flockfile (stream); - - if (! uparams.valid) - fill_in_uparams (state); - - fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0); - if (! fs) - { - _funlockfile (stream); - return; - } - - if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG)) - { - hol = argp_hol (argp, 0); - - /* If present, these options always come last. */ - hol_set_group (hol, "help", -1); - hol_set_group (hol, "version", -1); - - hol_sort (hol); - } - - if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE)) - /* Print a short `Usage:' message. */ - { - int first_pattern = 1, more_patterns; - size_t num_pattern_levels = argp_args_levels (argp); - char *pattern_levels = alloca (num_pattern_levels); - - memset (pattern_levels, 0, num_pattern_levels); - - do - { - int old_lm; - int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent); - char *levels = pattern_levels; - - if (first_pattern) - __argp_fmtstream_printf (fs, "%s %s", - dgettext (argp->argp_domain, "Usage:"), - name); - else - __argp_fmtstream_printf (fs, "%s %s", - dgettext (argp->argp_domain, " or: "), - name); - - /* We set the lmargin as well as the wmargin, because hol_usage - manually wraps options with newline to avoid annoying breaks. */ - old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent); - - if (flags & ARGP_HELP_SHORT_USAGE) - /* Just show where the options go. */ - { - if (hol->num_entries > 0) - __argp_fmtstream_puts (fs, dgettext (argp->argp_domain, - " [OPTION...]")); - } - else - /* Actually print the options. */ - { - hol_usage (hol, fs); - flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */ - } - - more_patterns = argp_args_usage (argp, state, &levels, 1, fs); - - __argp_fmtstream_set_wmargin (fs, old_wm); - __argp_fmtstream_set_lmargin (fs, old_lm); - - __argp_fmtstream_putc (fs, '\n'); - anything = 1; - - first_pattern = 0; - } - while (more_patterns); - } - - if (flags & ARGP_HELP_PRE_DOC) - anything |= argp_doc (argp, state, 0, 0, 1, fs); - - if (flags & ARGP_HELP_SEE) - { - __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\ -Try `%s --help' or `%s --usage' for more information.\n"), - name, name); - anything = 1; - } - - if (flags & ARGP_HELP_LONG) - /* Print a long, detailed help message. */ - { - /* Print info about all the options. */ - if (hol->num_entries > 0) - { - if (anything) - __argp_fmtstream_putc (fs, '\n'); - hol_help (hol, state, fs); - anything = 1; - } - } - - if (flags & ARGP_HELP_POST_DOC) - /* Print any documentation strings at the end. */ - anything |= argp_doc (argp, state, 1, anything, 0, fs); - - if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address) - { - if (anything) - __argp_fmtstream_putc (fs, '\n'); - __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, - "Report bugs to %s.\n"), - argp_program_bug_address); - anything = 1; - } - - _funlockfile (stream); - - if (hol) - hol_free (hol); - - __argp_fmtstream_free (fs); -} - -/* Output a usage message for ARGP to STREAM. FLAGS are from the set - ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ -void __argp_help (const struct argp *argp, FILE *stream, - unsigned flags, char *name) -{ - _help (argp, 0, stream, flags, name); -} -#ifdef weak_alias -weak_alias (__argp_help, argp_help) -#endif - -/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are - from the set ARGP_HELP_*. */ -void -__argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags) -{ - if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream) - { - if (state && (state->flags & ARGP_LONG_ONLY)) - flags |= ARGP_HELP_LONG_ONLY; - - _help (state ? state->root_argp : 0, state, stream, flags, - state ? state->name : program_invocation_short_name); - - if (!state || ! (state->flags & ARGP_NO_EXIT)) - { - if (flags & ARGP_HELP_EXIT_ERR) - exit (argp_err_exit_status); - if (flags & ARGP_HELP_EXIT_OK) - exit (0); - } - } -} -#ifdef weak_alias -weak_alias (__argp_state_help, argp_state_help) -#endif - -/* If appropriate, print the printf string FMT and following args, preceded - by the program name and `:', to stderr, and followed by a `Try ... --help' - message, then exit (1). */ -void -__argp_error (const struct argp_state *state, const char *fmt, ...) -{ - if (!state || !(state->flags & ARGP_NO_ERRS)) - { - FILE *stream = state ? state->err_stream : stderr; - - if (stream) - { - va_list ap; - - _flockfile (stream); - - va_start (ap, fmt); - -#ifdef USE_IN_LIBIO - if (_IO_fwide (stream, 0) > 0) - { - char *buf; - - __asprintf (&buf, fmt, ap); - - __fwprintf (stream, L"%s: %s\n", - state ? state->name : program_invocation_short_name, - buf); - - free (buf); - } - else -#endif - { - fputs (state - ? state->name : program_invocation_short_name, - stream); - putc_unlocked (':', stream); - putc_unlocked (' ', stream); - - vfprintf (stream, fmt, ap); - - putc_unlocked ('\n', stream); - } - - __argp_state_help (state, stream, ARGP_HELP_STD_ERR); - - va_end (ap); - - _funlockfile (stream); - } - } -} -#ifdef weak_alias -weak_alias (__argp_error, argp_error) -#endif - -/* Similar to the standard gnu error-reporting function error(), but will - respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print - to STATE->err_stream. This is useful for argument parsing code that is - shared between program startup (when exiting is desired) and runtime - option parsing (when typically an error code is returned instead). The - difference between this function and argp_error is that the latter is for - *parsing errors*, and the former is for other problems that occur during - parsing but don't reflect a (syntactic) problem with the input. */ -void -__argp_failure (const struct argp_state *state, int status, int errnum, - const char *fmt, ...) -{ - if (!state || !(state->flags & ARGP_NO_ERRS)) - { - FILE *stream = state ? state->err_stream : stderr; - - if (stream) - { - _flockfile (stream); - -#ifdef USE_IN_LIBIO - if (_IO_fwide (stream, 0) > 0) - __fwprintf (stream, L"%s", - state ? state->name : program_invocation_short_name); - else -#endif - fputs (state - ? state->name : program_invocation_short_name, - stream); - - if (fmt) - { - va_list ap; - - va_start (ap, fmt); -#ifdef USE_IN_LIBIO - if (_IO_fwide (stream, 0) > 0) - { - char *buf; - - __asprintf (&buf, fmt, ap); - - __fwprintf (stream, L": %s", buf); - - free (buf); - } - else -#endif - { - putc_unlocked (':', stream); - putc_unlocked (' ', stream); - - vfprintf (stream, fmt, ap); - } - - va_end (ap); - } - - if (errnum) - { - char buf[200]; - -#ifdef USE_IN_LIBIO - if (_IO_fwide (stream, 0) > 0) - __fwprintf (stream, L": %s", - strerror_r (errnum, buf, sizeof (buf))); - else -#endif - { - putc_unlocked (':', stream); - putc_unlocked (' ', stream); - fputs (strerror_r (errnum, buf, sizeof (buf)), stream); - } - } - -#ifdef USE_IN_LIBIO - if (_IO_fwide (stream, 0) > 0) - putwc_unlocked (L'\n', stream); - else -#endif - putc_unlocked ('\n', stream); - - _funlockfile (stream); - - if (status && (!state || !(state->flags & ARGP_NO_EXIT))) - exit (status); - } - } -} -#ifdef weak_alias -weak_alias (__argp_failure, argp_failure) -#endif diff --git a/newlib/libc/sys/linux/argp/argp-namefrob.h b/newlib/libc/sys/linux/argp/argp-namefrob.h deleted file mode 100644 index 668f35d0d..000000000 --- a/newlib/libc/sys/linux/argp/argp-namefrob.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Name frobnication for compiling argp outside of glibc - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#if !_LIBC -/* This code is written for inclusion in gnu-libc, and uses names in the - namespace reserved for libc. If we're not compiling in libc, define those - names to be the normal ones instead. */ - -/* argp-parse functions */ -#undef __argp_parse -#define __argp_parse argp_parse -#undef __option_is_end -#define __option_is_end _option_is_end -#undef __option_is_short -#define __option_is_short _option_is_short -#undef __argp_input -#define __argp_input _argp_input - -/* argp-help functions */ -#undef __argp_help -#define __argp_help argp_help -#undef __argp_error -#define __argp_error argp_error -#undef __argp_failure -#define __argp_failure argp_failure -#undef __argp_state_help -#define __argp_state_help argp_state_help -#undef __argp_usage -#define __argp_usage argp_usage - -/* argp-fmtstream functions */ -#undef __argp_make_fmtstream -#define __argp_make_fmtstream argp_make_fmtstream -#undef __argp_fmtstream_free -#define __argp_fmtstream_free argp_fmtstream_free -#undef __argp_fmtstream_putc -#define __argp_fmtstream_putc argp_fmtstream_putc -#undef __argp_fmtstream_puts -#define __argp_fmtstream_puts argp_fmtstream_puts -#undef __argp_fmtstream_write -#define __argp_fmtstream_write argp_fmtstream_write -#undef __argp_fmtstream_printf -#define __argp_fmtstream_printf argp_fmtstream_printf -#undef __argp_fmtstream_set_lmargin -#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin -#undef __argp_fmtstream_set_rmargin -#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin -#undef __argp_fmtstream_set_wmargin -#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin -#undef __argp_fmtstream_point -#define __argp_fmtstream_point argp_fmtstream_point -#undef __argp_fmtstream_update -#define __argp_fmtstream_update _argp_fmtstream_update -#undef __argp_fmtstream_ensure -#define __argp_fmtstream_ensure _argp_fmtstream_ensure -#undef __argp_fmtstream_lmargin -#define __argp_fmtstream_lmargin argp_fmtstream_lmargin -#undef __argp_fmtstream_rmargin -#define __argp_fmtstream_rmargin argp_fmtstream_rmargin -#undef __argp_fmtstream_wmargin -#define __argp_fmtstream_wmargin argp_fmtstream_wmargin - -/* normal libc functions we call */ -#undef __sleep -#define __sleep sleep -#undef __strcasecmp -#define __strcasecmp strcasecmp -#undef __vsnprintf -#define __vsnprintf vsnprintf - -#endif /* !_LIBC */ - -#ifndef __set_errno -#define __set_errno(e) (errno = (e)) -#endif diff --git a/newlib/libc/sys/linux/argp/argp-parse.c b/newlib/libc/sys/linux/argp/argp-parse.c deleted file mode 100644 index 38211e3e2..000000000 --- a/newlib/libc/sys/linux/argp/argp-parse.c +++ /dev/null @@ -1,966 +0,0 @@ -/* Hierarchial argument parsing, layered over getopt - Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <limits.h> -#include <getopt.h> - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# if defined HAVE_LIBINTL_H || defined _LIBC -# include <libintl.h> -# ifdef _LIBC -# undef dgettext -# define dgettext(domain, msgid) __dcgettext (domain, msgid, LC_MESSAGES) -# endif -# else -# define dgettext(domain, msgid) (msgid) -# define gettext(msgid) (msgid) -# endif -#endif -#ifndef N_ -# define N_(msgid) (msgid) -#endif - -#if _LIBC - 0 -#include <bits/libc-lock.h> -#else -#ifdef HAVE_CTHREADS_H -#include <cthreads.h> -#endif -#endif /* _LIBC */ - -#include <argp.h> -#include "argp-namefrob.h" - -/* Getopt return values. */ -#define KEY_END (-1) /* The end of the options. */ -#define KEY_ARG 1 /* A non-option argument. */ -#define KEY_ERR '?' /* An error parsing the options. */ - -/* The meta-argument used to prevent any further arguments being interpreted - as options. */ -#define QUOTE "--" - -/* The number of bits we steal in a long-option value for our own use. */ -#define GROUP_BITS CHAR_BIT - -/* The number of bits available for the user value. */ -#define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS) -#define USER_MASK ((1 << USER_BITS) - 1) - -/* EZ alias for ARGP_ERR_UNKNOWN. */ -#define EBADKEY ARGP_ERR_UNKNOWN - -/* Default options. */ - -/* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep - for one second intervals, decrementing _ARGP_HANG until it's zero. Thus - you can force the program to continue by attaching a debugger and setting - it to 0 yourself. */ -volatile int _argp_hang; - -#define OPT_PROGNAME -2 -#define OPT_USAGE -3 -#define OPT_HANG -4 - -static const struct argp_option argp_default_options[] = -{ - {"help", '?', 0, 0, N_("Give this help list"), -1}, - {"usage", OPT_USAGE, 0, 0, N_("Give a short usage message")}, - {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")}, - {"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN, - N_("Hang for SECS seconds (default 3600)")}, - {0, 0} -}; - -static error_t -argp_default_parser (int key, char *arg, struct argp_state *state) -{ - switch (key) - { - case '?': - __argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP); - break; - case OPT_USAGE: - __argp_state_help (state, state->out_stream, - ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); - break; - - case OPT_PROGNAME: /* Set the program name. */ - program_invocation_name = arg; - - /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka - __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined - to be that, so we have to be a bit careful here.] */ - arg = strrchr (arg, '/'); - if (arg) - program_invocation_short_name = arg + 1; - else - program_invocation_short_name = program_invocation_name; - - /* Update what we use for messages. */ - state->name = program_invocation_short_name; - - if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS)) - == ARGP_PARSE_ARGV0) - /* Update what getopt uses too. */ - state->argv[0] = program_invocation_name; - - break; - - case OPT_HANG: - _argp_hang = atoi (arg ? arg : "3600"); - while (_argp_hang-- > 0) - __sleep (1); - break; - - default: - return EBADKEY; - } - return 0; -} - -static const struct argp argp_default_argp = - {argp_default_options, &argp_default_parser, NULL, NULL, NULL, NULL, "libc"}; - - -static const struct argp_option argp_version_options[] = -{ - {"version", 'V', 0, 0, N_("Print program version"), -1}, - {0, 0} -}; - -static error_t -argp_version_parser (int key, char *arg, struct argp_state *state) -{ - switch (key) - { - case 'V': - if (argp_program_version_hook) - (*argp_program_version_hook) (state->out_stream, state); - else if (argp_program_version) - fprintf (state->out_stream, "%s\n", argp_program_version); - else - __argp_error (state, dgettext (state->root_argp->argp_domain, - "(PROGRAM ERROR) No version known!?")); - if (! (state->flags & ARGP_NO_EXIT)) - exit (0); - break; - default: - return EBADKEY; - } - return 0; -} - -static const struct argp argp_version_argp = - {argp_version_options, &argp_version_parser, NULL, NULL, NULL, NULL, "libc"}; - -/* Returns the offset into the getopt long options array LONG_OPTIONS of a - long option with called NAME, or -1 if none is found. Passing NULL as - NAME will return the number of options. */ -static int -find_long_option (struct option *long_options, const char *name) -{ - struct option *l = long_options; - while (l->name != NULL) - if (name != NULL && strcmp (l->name, name) == 0) - return l - long_options; - else - l++; - if (name == NULL) - return l - long_options; - else - return -1; -} - -/* If we can, we regulate access to getopt, which is non-reentrant, with a - mutex. Since the case we're trying to guard against is two different - threads interfering, and it's possible that someone might want to call - argp_parse recursively (they're careful), we use a recursive lock if - possible. */ - -#if _LIBC - 0 - -__libc_lock_define_initialized_recursive (static, getopt_lock) -#define LOCK_GETOPT __libc_lock_lock_recursive (getopt_lock) -#define UNLOCK_GETOPT __libc_lock_unlock_recursive (getopt_lock) - -#else /* !_LIBC */ -#ifdef HAVE_CTHREADS_H - -static struct mutex getopt_lock = MUTEX_INITIALIZER; -#define LOCK_GETOPT mutex_lock (&getopt_lock) -#define UNLOCK_GETOPT mutex_unlock (&getopt_lock) - -#else /* !HAVE_CTHREADS_H */ - -#define LOCK_GETOPT (void)0 -#define UNLOCK_GETOPT (void)0 - -#endif /* HAVE_CTHREADS_H */ -#endif /* _LIBC */ - -/* This hack to allow programs that know what's going on to call argp - recursively. If someday argp is changed not to use the non-reentrant - getopt interface, we can get rid of this shit. XXX */ -void -_argp_unlock_xxx (void) -{ - UNLOCK_GETOPT; -} - -/* The state of a `group' during parsing. Each group corresponds to a - particular argp structure from the tree of such descending from the top - level argp passed to argp_parse. */ -struct group -{ - /* This group's parsing function. */ - argp_parser_t parser; - - /* Which argp this group is from. */ - const struct argp *argp; - - /* Points to the point in SHORT_OPTS corresponding to the end of the short - options for this group. We use it to determine from which group a - particular short options is from. */ - char *short_end; - - /* The number of non-option args sucessfully handled by this parser. */ - unsigned args_processed; - - /* This group's parser's parent's group. */ - struct group *parent; - unsigned parent_index; /* And the our position in the parent. */ - - /* These fields are swapped into and out of the state structure when - calling this group's parser. */ - void *input, **child_inputs; - void *hook; -}; - -/* Call GROUP's parser with KEY and ARG, swapping any group-specific info - from STATE before calling, and back into state afterwards. If GROUP has - no parser, EBADKEY is returned. */ -static error_t -group_parse (struct group *group, struct argp_state *state, int key, char *arg) -{ - if (group->parser) - { - error_t err; - state->hook = group->hook; - state->input = group->input; - state->child_inputs = group->child_inputs; - state->arg_num = group->args_processed; - err = (*group->parser)(key, arg, state); - group->hook = state->hook; - return err; - } - else - return EBADKEY; -} - -struct parser -{ - const struct argp *argp; - - /* SHORT_OPTS is the getopt short options string for the union of all the - groups of options. */ - char *short_opts; - /* LONG_OPTS is the array of getop long option structures for the union of - all the groups of options. */ - struct option *long_opts; - - /* States of the various parsing groups. */ - struct group *groups; - /* The end of the GROUPS array. */ - struct group *egroup; - /* An vector containing storage for the CHILD_INPUTS field in all groups. */ - void **child_inputs; - - /* True if we think using getopt is still useful; if false, then - remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is - cleared whenever getopt returns KEY_END, but may be set again if the user - moves the next argument pointer backwards. */ - int try_getopt; - - /* State block supplied to parsing routines. */ - struct argp_state state; - - /* Memory used by this parser. */ - void *storage; -}; - -/* The next usable entries in the various parser tables being filled in by - convert_options. */ -struct parser_convert_state -{ - struct parser *parser; - char *short_end; - struct option *long_end; - void **child_inputs_end; -}; - -/* Converts all options in ARGP (which is put in GROUP) and ancestors - into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and - CVT->LONG_END are the points at which new options are added. Returns the - next unused group entry. CVT holds state used during the conversion. */ -static struct group * -convert_options (const struct argp *argp, - struct group *parent, unsigned parent_index, - struct group *group, struct parser_convert_state *cvt) -{ - /* REAL is the most recent non-alias value of OPT. */ - const struct argp_option *real = argp->options; - const struct argp_child *children = argp->children; - - if (real || argp->parser) - { - const struct argp_option *opt; - - if (real) - for (opt = real; !__option_is_end (opt); opt++) - { - if (! (opt->flags & OPTION_ALIAS)) - /* OPT isn't an alias, so we can use values from it. */ - real = opt; - - if (! (real->flags & OPTION_DOC)) - /* A real option (not just documentation). */ - { - if (__option_is_short (opt)) - /* OPT can be used as a short option. */ - { - *cvt->short_end++ = opt->key; - if (real->arg) - { - *cvt->short_end++ = ':'; - if (real->flags & OPTION_ARG_OPTIONAL) - *cvt->short_end++ = ':'; - } - *cvt->short_end = '\0'; /* keep 0 terminated */ - } - - if (opt->name - && find_long_option (cvt->parser->long_opts, opt->name) < 0) - /* OPT can be used as a long option. */ - { - cvt->long_end->name = opt->name; - cvt->long_end->has_arg = - (real->arg - ? (real->flags & OPTION_ARG_OPTIONAL - ? optional_argument - : required_argument) - : no_argument); - cvt->long_end->flag = 0; - /* we add a disambiguating code to all the user's - values (which is removed before we actually call - the function to parse the value); this means that - the user loses use of the high 8 bits in all his - values (the sign of the lower bits is preserved - however)... */ - cvt->long_end->val = - ((opt->key | real->key) & USER_MASK) - + (((group - cvt->parser->groups) + 1) << USER_BITS); - - /* Keep the LONG_OPTS list terminated. */ - (++cvt->long_end)->name = NULL; - } - } - } - - group->parser = argp->parser; - group->argp = argp; - group->short_end = cvt->short_end; - group->args_processed = 0; - group->parent = parent; - group->parent_index = parent_index; - group->input = 0; - group->hook = 0; - group->child_inputs = 0; - - if (children) - /* Assign GROUP's CHILD_INPUTS field some space from - CVT->child_inputs_end.*/ - { - unsigned num_children = 0; - while (children[num_children].argp) - num_children++; - group->child_inputs = cvt->child_inputs_end; - cvt->child_inputs_end += num_children; - } - - parent = group++; - } - else - parent = 0; - - if (children) - { - unsigned index = 0; - while (children->argp) - group = - convert_options (children++->argp, parent, index++, group, cvt); - } - - return group; -} - -/* Find the merged set of getopt options, with keys appropiately prefixed. */ -static void -parser_convert (struct parser *parser, const struct argp *argp, int flags) -{ - struct parser_convert_state cvt; - - cvt.parser = parser; - cvt.short_end = parser->short_opts; - cvt.long_end = parser->long_opts; - cvt.child_inputs_end = parser->child_inputs; - - if (flags & ARGP_IN_ORDER) - *cvt.short_end++ = '-'; - else if (flags & ARGP_NO_ARGS) - *cvt.short_end++ = '+'; - *cvt.short_end = '\0'; - - cvt.long_end->name = NULL; - - parser->argp = argp; - - if (argp) - parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt); - else - parser->egroup = parser->groups; /* No parsers at all! */ -} - -/* Lengths of various parser fields which we will allocated. */ -struct parser_sizes -{ - size_t short_len; /* Getopt short options string. */ - size_t long_len; /* Getopt long options vector. */ - size_t num_groups; /* Group structures we allocate. */ - size_t num_child_inputs; /* Child input slots. */ -}; - -/* For ARGP, increments the NUM_GROUPS field in SZS by the total number of - argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by - the maximum lengths of the resulting merged getopt short options string and - long-options array, respectively. */ -static void -calc_sizes (const struct argp *argp, struct parser_sizes *szs) -{ - const struct argp_child *child = argp->children; - const struct argp_option *opt = argp->options; - - if (opt || argp->parser) - { - szs->num_groups++; - if (opt) - { - int num_opts = 0; - while (!__option_is_end (opt++)) - num_opts++; - szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */ - szs->long_len += num_opts; - } - } - - if (child) - while (child->argp) - { - calc_sizes ((child++)->argp, szs); - szs->num_child_inputs++; - } -} - -/* Initializes PARSER to parse ARGP in a manner described by FLAGS. */ -static error_t -parser_init (struct parser *parser, const struct argp *argp, - int argc, char **argv, int flags, void *input) -{ - error_t err = 0; - struct group *group; - struct parser_sizes szs; - - szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1; - szs.long_len = 0; - szs.num_groups = 0; - szs.num_child_inputs = 0; - - if (argp) - calc_sizes (argp, &szs); - - /* Lengths of the various bits of storage used by PARSER. */ -#define GLEN (szs.num_groups + 1) * sizeof (struct group) -#define CLEN (szs.num_child_inputs * sizeof (void *)) -#define LLEN ((szs.long_len + 1) * sizeof (struct option)) -#define SLEN (szs.short_len + 1) - - parser->storage = malloc (GLEN + CLEN + LLEN + SLEN); - if (! parser->storage) - return ENOMEM; - - parser->groups = parser->storage; - parser->child_inputs = parser->storage + GLEN; - parser->long_opts = parser->storage + GLEN + CLEN; - parser->short_opts = parser->storage + GLEN + CLEN + LLEN; - - memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *)); - parser_convert (parser, argp, flags); - - memset (&parser->state, 0, sizeof (struct argp_state)); - parser->state.root_argp = parser->argp; - parser->state.argc = argc; - parser->state.argv = argv; - parser->state.flags = flags; - parser->state.err_stream = stderr; - parser->state.out_stream = stdout; - parser->state.next = 0; /* Tell getopt to initialize. */ - parser->state.pstate = parser; - - parser->try_getopt = 1; - - /* Call each parser for the first time, giving it a chance to propagate - values to child parsers. */ - if (parser->groups < parser->egroup) - parser->groups->input = input; - for (group = parser->groups; - group < parser->egroup && (!err || err == EBADKEY); - group++) - { - if (group->parent) - /* If a child parser, get the initial input value from the parent. */ - group->input = group->parent->child_inputs[group->parent_index]; - - if (!group->parser - && group->argp->children && group->argp->children->argp) - /* For the special case where no parsing function is supplied for an - argp, propagate its input to its first child, if any (this just - makes very simple wrapper argps more convenient). */ - group->child_inputs[0] = group->input; - - err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0); - } - if (err == EBADKEY) - err = 0; /* Some parser didn't understand. */ - - if (err) - return err; - - /* Getopt is (currently) non-reentrant. */ - LOCK_GETOPT; - - if (parser->state.flags & ARGP_NO_ERRS) - { - opterr = 0; - if (parser->state.flags & ARGP_PARSE_ARGV0) - /* getopt always skips ARGV[0], so we have to fake it out. As long - as OPTERR is 0, then it shouldn't actually try to access it. */ - parser->state.argv--, parser->state.argc++; - } - else - opterr = 1; /* Print error messages. */ - - if (parser->state.argv == argv && argv[0]) - /* There's an argv[0]; use it for messages. */ - { - char *short_name = strrchr (argv[0], '/'); - parser->state.name = short_name ? short_name + 1 : argv[0]; - } - else - parser->state.name = program_invocation_short_name; - - return 0; -} - -/* Free any storage consumed by PARSER (but not PARSER itself). */ -static error_t -parser_finalize (struct parser *parser, - error_t err, int arg_ebadkey, int *end_index) -{ - struct group *group; - - UNLOCK_GETOPT; - - if (err == EBADKEY && arg_ebadkey) - /* Suppress errors generated by unparsed arguments. */ - err = 0; - - if (! err) - { - if (parser->state.next == parser->state.argc) - /* We successfully parsed all arguments! Call all the parsers again, - just a few more times... */ - { - for (group = parser->groups; - group < parser->egroup && (!err || err==EBADKEY); - group++) - if (group->args_processed == 0) - err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0); - for (group = parser->egroup - 1; - group >= parser->groups && (!err || err==EBADKEY); - group--) - err = group_parse (group, &parser->state, ARGP_KEY_END, 0); - - if (err == EBADKEY) - err = 0; /* Some parser didn't understand. */ - - /* Tell the user that all arguments are parsed. */ - if (end_index) - *end_index = parser->state.next; - } - else if (end_index) - /* Return any remaining arguments to the user. */ - *end_index = parser->state.next; - else - /* No way to return the remaining arguments, they must be bogus. */ - { - if (!(parser->state.flags & ARGP_NO_ERRS) - && parser->state.err_stream) - fprintf (parser->state.err_stream, - dgettext (parser->argp->argp_domain, - "%s: Too many arguments\n"), - parser->state.name); - err = EBADKEY; - } - } - - /* Okay, we're all done, with either an error or success; call the parsers - to indicate which one. */ - - if (err) - { - /* Maybe print an error message. */ - if (err == EBADKEY) - /* An appropriate message describing what the error was should have - been printed earlier. */ - __argp_state_help (&parser->state, parser->state.err_stream, - ARGP_HELP_STD_ERR); - - /* Since we didn't exit, give each parser an error indication. */ - for (group = parser->groups; group < parser->egroup; group++) - group_parse (group, &parser->state, ARGP_KEY_ERROR, 0); - } - else - /* Notify parsers of success, and propagate back values from parsers. */ - { - /* We pass over the groups in reverse order so that child groups are - given a chance to do there processing before passing back a value to - the parent. */ - for (group = parser->egroup - 1 - ; group >= parser->groups && (!err || err == EBADKEY) - ; group--) - err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0); - if (err == EBADKEY) - err = 0; /* Some parser didn't understand. */ - } - - /* Call parsers once more, to do any final cleanup. Errors are ignored. */ - for (group = parser->egroup - 1; group >= parser->groups; group--) - group_parse (group, &parser->state, ARGP_KEY_FINI, 0); - - if (err == EBADKEY) - err = EINVAL; - - free (parser->storage); - - return err; -} - -/* Call the user parsers to parse the non-option argument VAL, at the current - position, returning any error. The state NEXT pointer is assumed to have - been adjusted (by getopt) to point after this argument; this function will - adjust it correctly to reflect however many args actually end up being - consumed. */ -static error_t -parser_parse_arg (struct parser *parser, char *val) -{ - /* Save the starting value of NEXT, first adjusting it so that the arg - we're parsing is again the front of the arg vector. */ - int index = --parser->state.next; - error_t err = EBADKEY; - struct group *group; - int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */ - - /* Try to parse the argument in each parser. */ - for (group = parser->groups - ; group < parser->egroup && err == EBADKEY - ; group++) - { - parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */ - key = ARGP_KEY_ARG; - err = group_parse (group, &parser->state, key, val); - - if (err == EBADKEY) - /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */ - { - parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */ - key = ARGP_KEY_ARGS; - err = group_parse (group, &parser->state, key, 0); - } - } - - if (! err) - { - if (key == ARGP_KEY_ARGS) - /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't - changed by the user, *all* arguments should be considered - consumed. */ - parser->state.next = parser->state.argc; - - if (parser->state.next > index) - /* Remember that we successfully processed a non-option - argument -- but only if the user hasn't gotten tricky and set - the clock back. */ - (--group)->args_processed += (parser->state.next - index); - else - /* The user wants to reparse some args, give getopt another try. */ - parser->try_getopt = 1; - } - - return err; -} - -/* Call the user parsers to parse the option OPT, with argument VAL, at the - current position, returning any error. */ -static error_t -parser_parse_opt (struct parser *parser, int opt, char *val) -{ - /* The group key encoded in the high bits; 0 for short opts or - group_number + 1 for long opts. */ - int group_key = opt >> USER_BITS; - error_t err = EBADKEY; - - if (group_key == 0) - /* A short option. By comparing OPT's position in SHORT_OPTS to the - various starting positions in each group's SHORT_END field, we can - determine which group OPT came from. */ - { - struct group *group; - char *short_index = strchr (parser->short_opts, opt); - - if (short_index) - for (group = parser->groups; group < parser->egroup; group++) - if (group->short_end > short_index) - { - err = group_parse (group, &parser->state, opt, optarg); - break; - } - } - else - /* A long option. We use shifts instead of masking for extracting - the user value in order to preserve the sign. */ - err = - group_parse (&parser->groups[group_key - 1], &parser->state, - (opt << GROUP_BITS) >> GROUP_BITS, optarg); - - if (err == EBADKEY) - /* At least currently, an option not recognized is an error in the - parser, because we pre-compute which parser is supposed to deal - with each option. */ - { - static const char bad_key_err[] = - N_("(PROGRAM ERROR) Option should have been recognized!?"); - if (group_key == 0) - __argp_error (&parser->state, "-%c: %s", opt, - dgettext (parser->argp->argp_domain, bad_key_err)); - else - { - struct option *long_opt = parser->long_opts; - while (long_opt->val != opt && long_opt->name) - long_opt++; - __argp_error (&parser->state, "--%s: %s", - long_opt->name ? long_opt->name : "???", - dgettext (parser->argp->argp_domain, bad_key_err)); - } - } - - return err; -} - -/* Parse the next argument in PARSER (as indicated by PARSER->state.next). - Any error from the parsers is returned, and *ARGP_EBADKEY indicates - whether a value of EBADKEY is due to an unrecognized argument (which is - generally not fatal). */ -static error_t -parser_parse_next (struct parser *parser, int *arg_ebadkey) -{ - int opt; - error_t err = 0; - - if (parser->state.quoted && parser->state.next < parser->state.quoted) - /* The next argument pointer has been moved to before the quoted - region, so pretend we never saw the quoting `--', and give getopt - another chance. If the user hasn't removed it, getopt will just - process it again. */ - parser->state.quoted = 0; - - if (parser->try_getopt && !parser->state.quoted) - /* Give getopt a chance to parse this. */ - { - optind = parser->state.next; /* Put it back in OPTIND for getopt. */ - optopt = KEY_END; /* Distinguish KEY_ERR from a real option. */ - if (parser->state.flags & ARGP_LONG_ONLY) - opt = getopt_long_only (parser->state.argc, parser->state.argv, - parser->short_opts, parser->long_opts, 0); - else - opt = getopt_long (parser->state.argc, parser->state.argv, - parser->short_opts, parser->long_opts, 0); - parser->state.next = optind; /* And see what getopt did. */ - - if (opt == KEY_END) - /* Getopt says there are no more options, so stop using - getopt; we'll continue if necessary on our own. */ - { - parser->try_getopt = 0; - if (parser->state.next > 1 - && strcmp (parser->state.argv[parser->state.next - 1], QUOTE) - == 0) - /* Not only is this the end of the options, but it's a - `quoted' region, which may have args that *look* like - options, so we definitely shouldn't try to use getopt past - here, whatever happens. */ - parser->state.quoted = parser->state.next; - } - else if (opt == KEY_ERR && optopt != KEY_END) - /* KEY_ERR can have the same value as a valid user short - option, but in the case of a real error, getopt sets OPTOPT - to the offending character, which can never be KEY_END. */ - { - *arg_ebadkey = 0; - return EBADKEY; - } - } - else - opt = KEY_END; - - if (opt == KEY_END) - { - /* We're past what getopt considers the options. */ - if (parser->state.next >= parser->state.argc - || (parser->state.flags & ARGP_NO_ARGS)) - /* Indicate that we're done. */ - { - *arg_ebadkey = 1; - return EBADKEY; - } - else - /* A non-option arg; simulate what getopt might have done. */ - { - opt = KEY_ARG; - optarg = parser->state.argv[parser->state.next++]; - } - } - - if (opt == KEY_ARG) - /* A non-option argument; try each parser in turn. */ - err = parser_parse_arg (parser, optarg); - else - err = parser_parse_opt (parser, opt, optarg); - - if (err == EBADKEY) - *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG); - - return err; -} - -/* Parse the options strings in ARGC & ARGV according to the argp in ARGP. - FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the - index in ARGV of the first unparsed option is returned in it. If an - unknown option is present, EINVAL is returned; if some parser routine - returned a non-zero value, it is returned; otherwise 0 is returned. */ -error_t -__argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags, - int *end_index, void *input) -{ - error_t err; - struct parser parser; - - /* If true, then err == EBADKEY is a result of a non-option argument failing - to be parsed (which in some cases isn't actually an error). */ - int arg_ebadkey = 0; - - if (! (flags & ARGP_NO_HELP)) - /* Add our own options. */ - { - struct argp_child *child = alloca (4 * sizeof (struct argp_child)); - struct argp *top_argp = alloca (sizeof (struct argp)); - - /* TOP_ARGP has no options, it just serves to group the user & default - argps. */ - memset (top_argp, 0, sizeof (*top_argp)); - top_argp->children = child; - - memset (child, 0, 4 * sizeof (struct argp_child)); - - if (argp) - (child++)->argp = argp; - (child++)->argp = &argp_default_argp; - if (argp_program_version || argp_program_version_hook) - (child++)->argp = &argp_version_argp; - child->argp = 0; - - argp = top_argp; - } - - /* Construct a parser for these arguments. */ - err = parser_init (&parser, argp, argc, argv, flags, input); - - if (! err) - /* Parse! */ - { - while (! err) - err = parser_parse_next (&parser, &arg_ebadkey); - err = parser_finalize (&parser, err, arg_ebadkey, end_index); - } - - return err; -} -#ifdef weak_alias -weak_alias (__argp_parse, argp_parse) -#endif - -/* Return the input field for ARGP in the parser corresponding to STATE; used - by the help routines. */ -void * -__argp_input (const struct argp *argp, const struct argp_state *state) -{ - if (state) - { - struct group *group; - struct parser *parser = state->pstate; - - for (group = parser->groups; group < parser->egroup; group++) - if (group->argp == argp) - return group->input; - } - - return 0; -} -#ifdef weak_alias -weak_alias (__argp_input, _argp_input) -#endif diff --git a/newlib/libc/sys/linux/argp/argp-pv.c b/newlib/libc/sys/linux/argp/argp-pv.c deleted file mode 100644 index 5987956a9..000000000 --- a/newlib/libc/sys/linux/argp/argp-pv.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Default definition for ARGP_PROGRAM_VERSION. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* If set by the user program to a non-zero value, then a default option - --version is added (unless the ARGP_NO_HELP flag is used), which will - print this this string followed by a newline and exit (unless the - ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ -const char *argp_program_version; diff --git a/newlib/libc/sys/linux/argp/argp-pvh.c b/newlib/libc/sys/linux/argp/argp-pvh.c deleted file mode 100644 index 8a8fd309d..000000000 --- a/newlib/libc/sys/linux/argp/argp-pvh.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Default definition for ARGP_PROGRAM_VERSION_HOOK. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <argp.h> - -/* If set by the user program to a non-zero value, then a default option - --version is added (unless the ARGP_NO_HELP flag is used), which calls - this function with a stream to print the version to and a pointer to the - current parsing state, and then exits (unless the ARGP_NO_EXIT flag is - used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ -void (*argp_program_version_hook) (FILE *stream, struct argp_state *state); diff --git a/newlib/libc/sys/linux/argp/argp-xinl.c b/newlib/libc/sys/linux/argp/argp-xinl.c deleted file mode 100644 index 0d64b1efb..000000000 --- a/newlib/libc/sys/linux/argp/argp-xinl.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Real definitions for extern inline functions in argp.h - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <features.h> - -#ifndef __USE_EXTERN_INLINES -# define __USE_EXTERN_INLINES 1 -#endif -#define ARGP_EI -#undef __OPTIMIZE__ -#define __OPTIMIZE__ -#include <argp.h> - -/* Add weak aliases. */ -#if _LIBC - 0 && defined (weak_alias) - -weak_alias (__argp_usage, argp_usage) -weak_alias (__option_is_short, _option_is_short) -weak_alias (__option_is_end, _option_is_end) - -#endif diff --git a/newlib/libc/sys/linux/bp-checks.h b/newlib/libc/sys/linux/bp-checks.h deleted file mode 100644 index efbb84716..000000000 --- a/newlib/libc/sys/linux/bp-checks.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Bounded-pointer checking macros for C. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Greg McGary <greg@mcgary.org> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _bp_checks_h_ -#define _bp_checks_h_ 1 - -#if __BOUNDED_POINTERS__ - -# define BOUNDS_VIOLATED (__builtin_trap (), 0) - -/* Verify that pointer's value >= low. Return pointer value. */ -# define CHECK_BOUNDS_LOW(ARG) \ - (((__ptrvalue (ARG) < __ptrlow (ARG)) && BOUNDS_VIOLATED), \ - __ptrvalue (ARG)) - -/* Verify that pointer's value < high. Return pointer value. */ -# define CHECK_BOUNDS_HIGH(ARG) \ - (((__ptrvalue (ARG) > __ptrhigh (ARG)) && BOUNDS_VIOLATED), \ - __ptrvalue (ARG)) - -# define _CHECK_N(ARG, N, COND) \ - (((COND) \ - && (__ptrvalue (ARG) < __ptrlow (ARG) \ - || __ptrvalue (ARG) + (N) > __ptrhigh (ARG)) \ - && BOUNDS_VIOLATED), \ - __ptrvalue (ARG)) - -extern void *__unbounded __ubp_memchr (const void *__unbounded, int, unsigned); - -# define _CHECK_STRING(ARG, COND) \ - (((COND) \ - && (__ptrvalue (ARG) < __ptrlow (ARG) \ - || !__ubp_memchr (__ptrvalue (ARG), '\0', \ - (__ptrhigh (ARG) - __ptrvalue (ARG)))) \ - && BOUNDS_VIOLATED), \ - __ptrvalue (ARG)) - -/* Check bounds of a pointer seated to an array of N objects. */ -# define CHECK_N(ARG, N) _CHECK_N ((ARG), (N), 1) -/* Same as CHECK_N, but tolerate ARG == NULL. */ -# define CHECK_N_NULL_OK(ARG, N) _CHECK_N ((ARG), (N), __ptrvalue (ARG)) - -/* Check bounds of a pointer seated to a single object. */ -# define CHECK_1(ARG) CHECK_N ((ARG), 1) -/* Same as CHECK_1, but tolerate ARG == NULL. */ -# define CHECK_1_NULL_OK(ARG) CHECK_N_NULL_OK ((ARG), 1) - -/* Check for NUL-terminator within string's bounds. */ -# define CHECK_STRING(ARG) _CHECK_STRING ((ARG), 1) -/* Same as CHECK_STRING, but tolerate ARG == NULL. */ -# define CHECK_STRING_NULL_OK(ARG) _CHECK_STRING ((ARG), __ptrvalue (ARG)) - -/* Check bounds of signal syscall args with type sigset_t. */ -# define CHECK_SIGSET(SET) CHECK_N ((SET), _NSIG / (8 * sizeof *(SET))) -/* Same as CHECK_SIGSET, but tolerate SET == NULL. */ -# define CHECK_SIGSET_NULL_OK(SET) CHECK_N_NULL_OK ((SET), _NSIG / (8 * sizeof *(SET))) - -# if defined (_IOC_SIZESHIFT) && defined (_IOC_SIZEBITS) -/* Extract the size of the ioctl data and check its bounds. */ -# define CHECK_IOCTL(ARG, CMD) \ - CHECK_N ((const char *) (ARG), \ - (((CMD) >> _IOC_SIZESHIFT) & ((1 << _IOC_SIZEBITS) - 1))) -# else -/* We don't know the size of the ioctl data, so the best we can do - is check that the first byte is within bounds. */ -# define CHECK_IOCTL(ARG, CMD) CHECK_1 ((const char *) ARG) -# endif - -/* Check bounds of `struct flock *' for the locking fcntl commands. */ -# define CHECK_FCNTL(ARG, CMD) \ - (((CMD) == F_GETLK || (CMD) == F_SETLK || (CMD) == F_SETLKW) \ - ? CHECK_1 ((struct flock *) ARG) : (unsigned long) (ARG)) - -/* Check bounds of an array of mincore residency-status flags that - cover a region of NBYTES. Such a vector occupies one byte per page - of memory. */ -# define CHECK_N_PAGES(ARG, NBYTES) \ - ({ int _page_size_ = sysconf (_SC_PAGE_SIZE); \ - CHECK_N ((const char *) (ARG), \ - ((NBYTES) + _page_size_ - 1) / _page_size_); }) - -/* Return a bounded pointer with value PTR that satisfies CHECK_N (PTR, N). */ -# define BOUNDED_N(PTR, N) \ - ({ __typeof (PTR) __bounded _p_; \ - __ptrvalue _p_ = __ptrlow _p_ = __ptrvalue (PTR); \ - __ptrhigh _p_ = __ptrvalue _p_ + (N); \ - _p_; }) - -#else /* !__BOUNDED_POINTERS__ */ - -/* Do nothing if not compiling with -fbounded-pointers. */ - -# define BOUNDS_VIOLATED -# define CHECK_BOUNDS_LOW(ARG) (ARG) -# define CHECK_BOUNDS_HIGH(ARG) (ARG) -# define CHECK_1(ARG) (ARG) -# define CHECK_1_NULL_OK(ARG) (ARG) -# define CHECK_N(ARG, N) (ARG) -# define CHECK_N_NULL_OK(ARG, N) (ARG) -# define CHECK_STRING(ARG) (ARG) -# define CHECK_SIGSET(SET) (SET) -# define CHECK_SIGSET_NULL_OK(SET) (SET) -# define CHECK_IOCTL(ARG, CMD) (ARG) -# define CHECK_FCNTL(ARG, CMD) (ARG) -# define CHECK_N_PAGES(ARG, NBYTES) (ARG) -# define BOUNDED_N(PTR, N) (PTR) - -#endif /* !__BOUNDED_POINTERS__ */ - -#define BOUNDED_1(PTR) BOUNDED_N (PTR, 1) - -#endif /* _bp_checks_h_ */ diff --git a/newlib/libc/sys/linux/brk.c b/newlib/libc/sys/linux/brk.c deleted file mode 100644 index 91bb367e7..000000000 --- a/newlib/libc/sys/linux/brk.c +++ /dev/null @@ -1,41 +0,0 @@ -/* libc/sys/linux/brk.c - Change data segment size */ - -/* Written 2000 by Werner Almesberger */ - - -#include <stddef.h> /* for NULL */ -#include <sys/types.h> -#include <sys/unistd.h> -#include <machine/syscall.h> - - -static char *curr_brk = NULL; - - -#define __NR___brk __NR_brk /* Linux brk ain't no brk(2) */ - -static _syscall1(void *,__brk,void *,end_data_segment) - - -int brk(void *end_data_segment) -{ - char *new_brk; - - new_brk = __brk(end_data_segment); - if (new_brk != end_data_segment) return -1; - curr_brk = new_brk; - return 0; -} - - -void *sbrk(ptrdiff_t increment) /* SHOULD be ptrdiff_t */ -{ - char *old_brk,*new_brk; - - if (!curr_brk) curr_brk = __brk(NULL); - new_brk = __brk(curr_brk+increment); - if (new_brk != curr_brk+increment) return (void *) -1; - old_brk = curr_brk; - curr_brk = new_brk; - return old_brk; -} diff --git a/newlib/libc/sys/linux/calloc.c b/newlib/libc/sys/linux/calloc.c deleted file mode 100644 index 818e05a75..000000000 --- a/newlib/libc/sys/linux/calloc.c +++ /dev/null @@ -1 +0,0 @@ -/* dummy file to override one object in stdlib directory */ diff --git a/newlib/libc/sys/linux/callocr.c b/newlib/libc/sys/linux/callocr.c deleted file mode 100644 index bff43b8c3..000000000 --- a/newlib/libc/sys/linux/callocr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void * -_calloc_r (struct _reent *ptr, size_t size, size_t len) -{ - return calloc (size, len); -} diff --git a/newlib/libc/sys/linux/cfreer.c b/newlib/libc/sys/linux/cfreer.c deleted file mode 100644 index c7e6c2564..000000000 --- a/newlib/libc/sys/linux/cfreer.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void -_cfree_r (struct _reent *ptr, void *mem) -{ - return cfree (mem); -} diff --git a/newlib/libc/sys/linux/cfspeed.c b/newlib/libc/sys/linux/cfspeed.c deleted file mode 100644 index e935bf178..000000000 --- a/newlib/libc/sys/linux/cfspeed.c +++ /dev/null @@ -1,88 +0,0 @@ -/* `struct termios' speed frobnication functions. Linux version. - Copyright (C) 1991, 92, 93, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified by Jeff Johnston, May 27, 2002 to remove kernel hack - as we simply ignore a cfisetspeed of 0 instead of treating it specially */ - -#include <stddef.h> -#include <errno.h> -#include <termios.h> - -/* Return the output baud rate stored in *TERMIOS_P. */ -speed_t -cfgetospeed (termios_p) - const struct termios *termios_p; -{ - return termios_p->c_cflag & (CBAUD | CBAUDEX); -} - -/* Return the input baud rate stored in *TERMIOS_P. - For Linux there is no difference between input and output - speed. */ -speed_t -cfgetispeed (termios_p) - const struct termios *termios_p; -{ - return termios_p->c_cflag & (CBAUD | CBAUDEX); -} - -/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -int -cfsetospeed (termios_p, speed) - struct termios *termios_p; - speed_t speed; -{ - if ((speed & ~CBAUD) != 0 - && (speed < B57600 || speed > __MAX_BAUD)) - { - errno = (EINVAL); - return -1; - } - - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - - return 0; -} - -/* Set the input baud rate stored in *TERMIOS_P to SPEED. - Although for Linux there is no difference between input and output - speed, the numerical 0 is a special case for the input baud rate. It - should set the input baud rate to the output baud rate so we do - nothing. */ -int -cfsetispeed (termios_p, speed) - struct termios *termios_p; - speed_t speed; -{ - if ((speed & ~CBAUD) != 0 - && (speed < B57600 || speed > __MAX_BAUD)) - { - errno = (EINVAL); - return -1; - } - - if (speed != 0) - { - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - } - - return 0; -} diff --git a/newlib/libc/sys/linux/clock_getres.c b/newlib/libc/sys/linux/clock_getres.c deleted file mode 100644 index 8bf648f51..000000000 --- a/newlib/libc/sys/linux/clock_getres.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <stdint.h> -#include <time.h> -#include <unistd.h> -#include <sys/param.h> -#include <libc-internal.h> - - -#if HP_TIMING_AVAIL -/* Clock frequency of the processor. */ -static long int nsec; -#endif - - -/* Get resolution of clock. */ -int -clock_getres (clockid_t clock_id, struct timespec *res) -{ - int retval = -1; - - switch (clock_id) - { - case CLOCK_REALTIME: - { - long int clk_tck = sysconf (_SC_CLK_TCK); - - if (__builtin_expect (clk_tck != -1, 1)) - { - /* This implementation assumes that the realtime clock has a - resolution higher than 1 second. This is the case for any - reasonable implementation. */ - res->tv_sec = 0; - res->tv_nsec = 1000000000 / clk_tck; - - retval = 0; - } - } - break; - -#if HP_TIMING_AVAIL - case CLOCK_PROCESS_CPUTIME_ID: - case CLOCK_THREAD_CPUTIME_ID: - { - if (__builtin_expect (nsec == 0, 0)) - { - hp_timing_t freq; - - /* This can only happen if we haven't initialized the `freq' - variable yet. Do this now. We don't have to protect this - code against multiple execution since all of them should - lead to the same result. */ - freq = __get_clockfreq (); - if (__builtin_expect (freq == 0, 0)) - /* Something went wrong. */ - break; - - nsec = MAX (UINT64_C (1000000000) / freq, 1); - } - - /* File in the values. The seconds are always zero (unless we - have a 1Hz machine). */ - res->tv_sec = 0; - res->tv_nsec = nsec; - - retval = 0; - } - break; -#endif - - default: - __set_errno (EINVAL); - break; - } - - return retval; -} diff --git a/newlib/libc/sys/linux/clock_gettime.c b/newlib/libc/sys/linux/clock_gettime.c deleted file mode 100644 index a86786bb2..000000000 --- a/newlib/libc/sys/linux/clock_gettime.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <stdint.h> -#include <time.h> -#include <sys/time.h> -#include <libc-internal.h> -#include <hp-timing.h> - - -#if HP_TIMING_AVAIL -/* Clock frequency of the processor. We make it a 64-bit variable - because some jokers are already playing with processors with more - than 4GHz. */ -static hp_timing_t freq; - - -/* We need the starting time for the process. */ -extern hp_timing_t _dl_cpuclock_offset; - - -/* This function is defined in the thread library. */ -extern int __pthread_clock_gettime (hp_timing_t freq, struct timespec *tp) - __attribute__ ((__weak__)); -#endif - - -/* Get current value of CLOCK and store it in TP. */ -int -clock_gettime (clockid_t clock_id, struct timespec *tp) -{ - struct timeval tv; - int retval = -1; - - switch (clock_id) - { - case CLOCK_REALTIME: - retval = gettimeofday (&tv, NULL); - if (retval == 0) - /* Convert into `timespec'. */ - TIMEVAL_TO_TIMESPEC (&tv, tp); - break; - -#if HP_TIMING_AVAIL - case CLOCK_PROCESS_CPUTIME_ID: - case CLOCK_THREAD_CPUTIME_ID: - { - hp_timing_t tsc; - - if (__builtin_expect (freq == 0, 0)) - { - /* This can only happen if we haven't initialized the `freq' - variable yet. Do this now. We don't have to protect this - code against multiple execution since all of them should - lead to the same result. */ - freq = __get_clockfreq (); - if (__builtin_expect (freq == 0, 0)) - /* Something went wrong. */ - break; - } - - if (clock_id == CLOCK_THREAD_CPUTIME_ID - && __pthread_clock_gettime != NULL) - { - retval = __pthread_clock_gettime (freq, tp); - break; - } - - /* Get the current counter. */ - HP_TIMING_NOW (tsc); - - /* Compute the offset since the start time of the process. */ - tsc -= _dl_cpuclock_offset; - - /* Compute the seconds. */ - tp->tv_sec = tsc / freq; - - /* And the nanoseconds. This computation should be stable until - we get machines with about 16GHz frequency. */ - tp->tv_nsec = ((tsc % freq) * UINT64_C (1000000000)) / freq; - - retval = 0; - } - break; -#endif - - default: - __set_errno (EINVAL); - break; - } - - return retval; -} diff --git a/newlib/libc/sys/linux/clock_settime.c b/newlib/libc/sys/linux/clock_settime.c deleted file mode 100644 index 79a9b564a..000000000 --- a/newlib/libc/sys/linux/clock_settime.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <time.h> -#include <sys/time.h> -#include <libc-internal.h> - - -#if HP_TIMING_AVAIL -/* Clock frequency of the processor. We make it a 64-bit variable - because some jokers are already playing with processors with more - than 4GHz. */ -static hp_timing_t freq; - - -/* We need the starting time for the process. */ -extern hp_timing_t _dl_cpuclock_offset; - - -/* This function is defined in the thread library. */ -extern void __pthread_clock_settime (hp_timing_t offset) - __attribute__ ((__weak__)); -#endif - - -/* Set CLOCK to value TP. */ -int -clock_settime (clockid_t clock_id, const struct timespec *tp) -{ - struct timeval tv; - int retval; - - /* Make sure the time cvalue is OK. */ - if (tp->tv_nsec < 0 || tp->tv_nsec >= 1000000000) - { - __set_errno (EINVAL); - return -1; - } - - switch (clock_id) - { - case CLOCK_REALTIME: - TIMESPEC_TO_TIMEVAL (&tv, tp); - - retval = settimeofday (&tv, NULL); - break; - -#if HP_TIMING_AVAIL - case CLOCK_PROCESS_CPUTIME_ID: - case CLOCK_THREAD_CPUTIME_ID: - { - hp_timing_t tsc; - hp_timing_t usertime; - - /* First thing is to get the current time. */ - HP_TIMING_NOW (tsc); - - if (__builtin_expect (freq == 0, 0)) - { - /* This can only happen if we haven't initialized the `freq' - variable yet. Do this now. We don't have to protect this - code against multiple execution since all of them should - lead to the same result. */ - freq = __get_clockfreq (); - if (__builtin_expect (freq == 0, 0)) - { - /* Something went wrong. */ - retval = -1; - break; - } - } - - /* Convert the user-provided time into CPU ticks. */ - usertime = tp->tv_sec * freq + (tp->tv_nsec * freq) / 1000000000ull; - - /* Determine the offset and use it as the new base value. */ - if (clock_id != CLOCK_THREAD_CPUTIME_ID - || __pthread_clock_settime == NULL) - _dl_cpuclock_offset = tsc - usertime; - else - __pthread_clock_settime (tsc - usertime); - - retval = 0; - } - break; -#endif - - default: - __set_errno (EINVAL); - retval = -1; - break; - } - - return retval; -} diff --git a/newlib/libc/sys/linux/cmath/Makefile.am b/newlib/libc/sys/linux/cmath/Makefile.am deleted file mode 100644 index 6c47f2149..000000000 --- a/newlib/libc/sys/linux/cmath/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -## Process this file with automake to generate Makefile.in - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -LIB_SOURCES = \ - s_cacos.c s_casinf.c s_catanh.c s_ccosh.c s_clog.c s_cpowf.c s_csinh.c s_ctan.c \ - s_cacosf.c s_casinh.c s_catanhf.c s_ccoshf.c s_clog10.c s_csinhf.c s_ctanf.c \ - s_cacosh.c s_casinhf.c s_clog10f.c s_cproj.c s_ctanh.c \ - s_cacoshf.c s_cprojf.c s_ctanhf.c \ - s_cexp.c s_clogf.c s_csqrt.c \ - s_catan.c s_ccos.c s_cexpf.c s_csin.c s_csqrtf.c \ - s_casin.c s_catanf.c s_ccosf.c s_cpow.c s_csinf.c - -libcmath_la_LDFLAGS = -Xcompiler -nostdlib - -if USE_LIBTOOL -noinst_LTLIBRARIES = libcmath.la -libcmath_la_SOURCES = $(LIB_SOURCES) -noinst_DATA = objectlist.awk.in -else -noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(LIB_SOURCES) -noinst_DATA = -endif # USE_LIBTOOL - -include $(srcdir)/../../../../Makefile.shared diff --git a/newlib/libc/sys/linux/cmath/Makefile.in b/newlib/libc/sys/linux/cmath/Makefile.in deleted file mode 100644 index fee3d914d..000000000 --- a/newlib/libc/sys/linux/cmath/Makefile.in +++ /dev/null @@ -1,390 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AR = @AR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DLLTOOL = @DLLTOOL@ -EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBTOOL = @LIBTOOL@ -LINUX_MACH_LIB = @LINUX_MACH_LIB@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -aext = @aext@ -libm_machine_dir = @libm_machine_dir@ -machine_dir = @machine_dir@ -newlib_basedir = @newlib_basedir@ -oext = @oext@ -sys_dir = @sys_dir@ - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -LIB_SOURCES = \ - s_cacos.c s_casinf.c s_catanh.c s_ccosh.c s_clog.c s_cpowf.c s_csinh.c s_ctan.c \ - s_cacosf.c s_casinh.c s_catanhf.c s_ccoshf.c s_clog10.c s_csinhf.c s_ctanf.c \ - s_cacosh.c s_casinhf.c s_clog10f.c s_cproj.c s_ctanh.c \ - s_cacoshf.c s_cprojf.c s_ctanhf.c \ - s_cexp.c s_clogf.c s_csqrt.c \ - s_catan.c s_ccos.c s_cexpf.c s_csin.c s_csqrtf.c \ - s_casin.c s_catanf.c s_ccosf.c s_cpow.c s_csinf.c - - -libcmath_la_LDFLAGS = -Xcompiler -nostdlib - -@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libcmath.la -@USE_LIBTOOL_TRUE@libcmath_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) -@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in -@USE_LIBTOOL_FALSE@noinst_DATA = -@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a -@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) -mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -lib_a_LIBADD = -@USE_LIBTOOL_FALSE@lib_a_OBJECTS = s_cacos.$(OBJEXT) s_casinf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_catanh.$(OBJEXT) s_ccosh.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_clog.$(OBJEXT) s_cpowf.$(OBJEXT) s_csinh.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_ctan.$(OBJEXT) s_cacosf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_casinh.$(OBJEXT) s_catanhf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_ccoshf.$(OBJEXT) s_clog10.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_csinhf.$(OBJEXT) s_ctanf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_cacosh.$(OBJEXT) s_casinhf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_clog10f.$(OBJEXT) s_cproj.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_ctanh.$(OBJEXT) s_cacoshf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_cprojf.$(OBJEXT) s_ctanhf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_cexp.$(OBJEXT) s_clogf.$(OBJEXT) s_csqrt.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_catan.$(OBJEXT) s_ccos.$(OBJEXT) s_cexpf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_csin.$(OBJEXT) s_csqrtf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_casin.$(OBJEXT) s_catanf.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_ccosf.$(OBJEXT) s_cpow.$(OBJEXT) s_csinf.$(OBJEXT) -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libcmath_la_LIBADD = -@USE_LIBTOOL_TRUE@libcmath_la_OBJECTS = s_cacos.lo s_casinf.lo \ -@USE_LIBTOOL_TRUE@s_catanh.lo s_ccosh.lo s_clog.lo s_cpowf.lo \ -@USE_LIBTOOL_TRUE@s_csinh.lo s_ctan.lo s_cacosf.lo s_casinh.lo \ -@USE_LIBTOOL_TRUE@s_catanhf.lo s_ccoshf.lo s_clog10.lo s_csinhf.lo \ -@USE_LIBTOOL_TRUE@s_ctanf.lo s_cacosh.lo s_casinhf.lo s_clog10f.lo \ -@USE_LIBTOOL_TRUE@s_cproj.lo s_ctanh.lo s_cacoshf.lo s_cprojf.lo \ -@USE_LIBTOOL_TRUE@s_ctanhf.lo s_cexp.lo s_clogf.lo s_csqrt.lo \ -@USE_LIBTOOL_TRUE@s_catan.lo s_ccos.lo s_cexpf.lo s_csin.lo s_csqrtf.lo \ -@USE_LIBTOOL_TRUE@s_casin.lo s_catanf.lo s_ccosf.lo s_cpow.lo \ -@USE_LIBTOOL_TRUE@s_csinf.lo -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(noinst_DATA) - -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -SOURCES = $(lib_a_SOURCES) $(libcmath_la_SOURCES) -OBJECTS = $(lib_a_OBJECTS) $(libcmath_la_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared - cd $(top_srcdir) && $(AUTOMAKE) --cygnus cmath/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) - -rm -f lib.a - $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) - $(RANLIB) lib.a - -mostlyclean-noinstLTLIBRARIES: - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - -distclean-noinstLTLIBRARIES: - -maintainer-clean-noinstLTLIBRARIES: - -libcmath.la: $(libcmath_la_OBJECTS) $(libcmath_la_DEPENDENCIES) - $(LINK) $(libcmath_la_LDFLAGS) $(libcmath_la_OBJECTS) $(libcmath_la_LIBADD) $(LIBS) - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = cmath - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: -check: check-am -installcheck-am: -installcheck: installcheck-am -install-info-am: -install-info: install-info-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-noinstLTLIBRARIES clean-tags clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-noinstLTLIBRARIES \ - distclean-tags distclean-generic clean-am - -rm -f libtool - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-noinstLTLIBRARIES \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ -distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ -maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-info-am install-info \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all installdirs \ -mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -objectlist.awk.in: $(noinst_LTLIBRARIES) - -rm -f objectlist.awk.in - for i in `ls *.lo` ; \ - do \ - echo $$i `pwd`/$$i >> objectlist.awk.in ; \ - done - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/newlib/libc/sys/linux/cmath/math_private.h b/newlib/libc/sys/linux/cmath/math_private.h deleted file mode 100644 index 6c4a472cf..000000000 --- a/newlib/libc/sys/linux/cmath/math_private.h +++ /dev/null @@ -1,356 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * from: @(#)fdlibm.h 5.1 93/09/24 - * $Id$ - */ - -#ifndef _MATH_PRIVATE_H_ -#define _MATH_PRIVATE_H_ - -#include <endian.h> -#include <sys/types.h> -#include <machine/weakalias.h> -#include <machine/huge_val.h> - -#define INFINITY HUGE_VALF - -#define __nan(x) nan() -#define __isnan isnan -#define __isinf isinf -#define __copysignf copysignf -#define __copysign copysign -#define __isnanf isnanf -#define __isinff isinff -#define __nanf(x) nanf() -#define feraiseexcept(x) /* nothing */ -#define __sincos sincos -#define __sincosf sincosf - -int __signbitd (double x); -int __signbitf (float x); - -/* The original fdlibm code used statements like: - n0 = ((*(int*)&one)>>29)^1; * index of high word * - ix0 = *(n0+(int*)&x); * high word of x * - ix1 = *((1-n0)+(int*)&x); * low word of x * - to dig two 32 bit words out of the 64 bit IEEE floating point - value. That is non-ANSI, and, moreover, the gcc instruction - scheduler gets it wrong. We instead use the following macros. - Unlike the original code, we determine the endianness at compile - time, not at run time; I don't see much benefit to selecting - endianness at run time. */ - -/* A union which permits us to convert between a double and two 32 bit - ints. */ - -#if __FLOAT_WORD_ORDER == BIG_ENDIAN - -typedef union -{ - double value; - struct - { - u_int32_t msw; - u_int32_t lsw; - } parts; -} ieee_double_shape_type; - -#endif - -#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN - -typedef union -{ - double value; - struct - { - u_int32_t lsw; - u_int32_t msw; - } parts; -} ieee_double_shape_type; - -#endif - -/* Get two 32 bit ints from a double. */ - -#define EXTRACT_WORDS(ix0,ix1,d) \ -do { \ - ieee_double_shape_type ew_u; \ - ew_u.value = (d); \ - (ix0) = ew_u.parts.msw; \ - (ix1) = ew_u.parts.lsw; \ -} while (0) - -/* Get the more significant 32 bit int from a double. */ - -#define GET_HIGH_WORD(i,d) \ -do { \ - ieee_double_shape_type gh_u; \ - gh_u.value = (d); \ - (i) = gh_u.parts.msw; \ -} while (0) - -/* Get the less significant 32 bit int from a double. */ - -#define GET_LOW_WORD(i,d) \ -do { \ - ieee_double_shape_type gl_u; \ - gl_u.value = (d); \ - (i) = gl_u.parts.lsw; \ -} while (0) - -/* Set a double from two 32 bit ints. */ - -#define INSERT_WORDS(d,ix0,ix1) \ -do { \ - ieee_double_shape_type iw_u; \ - iw_u.parts.msw = (ix0); \ - iw_u.parts.lsw = (ix1); \ - (d) = iw_u.value; \ -} while (0) - -/* Set the more significant 32 bits of a double from an int. */ - -#define SET_HIGH_WORD(d,v) \ -do { \ - ieee_double_shape_type sh_u; \ - sh_u.value = (d); \ - sh_u.parts.msw = (v); \ - (d) = sh_u.value; \ -} while (0) - -/* Set the less significant 32 bits of a double from an int. */ - -#define SET_LOW_WORD(d,v) \ -do { \ - ieee_double_shape_type sl_u; \ - sl_u.value = (d); \ - sl_u.parts.lsw = (v); \ - (d) = sl_u.value; \ -} while (0) - -/* A union which permits us to convert between a float and a 32 bit - int. */ - -typedef union -{ - float value; - u_int32_t word; -} ieee_float_shape_type; - -/* Get a 32 bit int from a float. */ - -#define GET_FLOAT_WORD(i,d) \ -do { \ - ieee_float_shape_type gf_u; \ - gf_u.value = (d); \ - (i) = gf_u.word; \ -} while (0) - -/* Set a float from a 32 bit int. */ - -#define SET_FLOAT_WORD(d,i) \ -do { \ - ieee_float_shape_type sf_u; \ - sf_u.word = (i); \ - (d) = sf_u.value; \ -} while (0) - -#if 0 -/* ieee style elementary functions */ -extern double __ieee754_sqrt (double); -extern double __ieee754_acos (double); -extern double __ieee754_acosh (double); -extern double __ieee754_log (double); -extern double __ieee754_atanh (double); -extern double __ieee754_asin (double); -extern double __ieee754_atan2 (double,double); -extern double __ieee754_exp (double); -extern double __ieee754_exp2 (double); -extern double __ieee754_exp10 (double); -extern double __ieee754_cosh (double); -extern double __ieee754_fmod (double,double); -extern double __ieee754_pow (double,double); -extern double __ieee754_lgamma_r (double,int *); -extern double __ieee754_gamma_r (double,int *); -extern double __ieee754_lgamma (double); -extern double __ieee754_gamma (double); -extern double __ieee754_log10 (double); -extern double __ieee754_log2 (double); -extern double __ieee754_sinh (double); -extern double __ieee754_hypot (double,double); -extern double __ieee754_j0 (double); -extern double __ieee754_j1 (double); -extern double __ieee754_y0 (double); -extern double __ieee754_y1 (double); -extern double __ieee754_jn (int,double); -extern double __ieee754_yn (int,double); -extern double __ieee754_remainder (double,double); -extern int32_t __ieee754_rem_pio2 (double,double*); -extern double __ieee754_scalb (double,double); -#endif - -/* This is necessary because the hardware accelerated version of libm - does not provide the __ieee754 functions. */ -#define __ieee754_sinh sinh -#define __ieee754_hypot hypot -#define __ieee754_hypotf hypotf -#define __ieee754_logf logf -#define __ieee754_log10 log10 -#define __ieee754_exp exp -#define __ieee754_cosh cosh -#define __ieee754_expf expf -#define __ieee754_log10f log10f -#define __ieee754_atan2 atan2 -#define __ieee754_sqrtf sqrtf -#define __ieee754_sinhf sinhf -#define __ieee754_log log -#define __ieee754_sqrt sqrt -#define __ieee754_coshf coshf -#define __ieee754_atan2f atan2f - -/* fdlibm kernel function */ -extern double __kernel_standard (double,double,int); -extern double __kernel_sin (double,double,int); -extern double __kernel_cos (double,double); -extern double __kernel_tan (double,double,int); -extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*); - -/* internal functions. */ -extern double __copysign (double x, double __y); - - -/* ieee style elementary float functions */ -extern float __ieee754_sqrtf (float); -extern float __ieee754_acosf (float); -extern float __ieee754_acoshf (float); -extern float __ieee754_logf (float); -extern float __ieee754_atanhf (float); -extern float __ieee754_asinf (float); -extern float __ieee754_atan2f (float,float); -extern float __ieee754_expf (float); -extern float __ieee754_exp2f (float); -extern float __ieee754_exp10f (float); -extern float __ieee754_coshf (float); -extern float __ieee754_fmodf (float,float); -extern float __ieee754_powf (float,float); -extern float __ieee754_lgammaf_r (float,int *); -extern float __ieee754_gammaf_r (float,int *); -extern float __ieee754_lgammaf (float); -extern float __ieee754_gammaf (float); -extern float __ieee754_log10f (float); -extern float __ieee754_log2f (float); -extern float __ieee754_sinhf (float); -extern float __ieee754_hypotf (float,float); -extern float __ieee754_j0f (float); -extern float __ieee754_j1f (float); -extern float __ieee754_y0f (float); -extern float __ieee754_y1f (float); -extern float __ieee754_jnf (int,float); -extern float __ieee754_ynf (int,float); -extern float __ieee754_remainderf (float,float); -extern int32_t __ieee754_rem_pio2f (float,float*); -extern float __ieee754_scalbf (float,float); - - -/* float versions of fdlibm kernel functions */ -extern float __kernel_sinf (float,float,int); -extern float __kernel_cosf (float,float); -extern float __kernel_tanf (float,float,int); -extern int __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*); - - -/* ieee style elementary long double functions */ -extern long double __ieee754_sqrtl (long double); -extern long double __ieee754_acosl (long double); -extern long double __ieee754_acoshl (long double); -extern long double __ieee754_logl (long double); -extern long double __ieee754_atanhl (long double); -extern long double __ieee754_asinl (long double); -extern long double __ieee754_atan2l (long double,long double); -extern long double __ieee754_expl (long double); -extern long double __ieee754_exp2l (long double); -extern long double __ieee754_exp10l (long double); -extern long double __ieee754_coshl (long double); -extern long double __ieee754_fmodl (long double,long double); -extern long double __ieee754_powl (long double,long double); -extern long double __ieee754_lgammal_r (long double,int *); -extern long double __ieee754_gammal_r (long double,int *); -extern long double __ieee754_lgammal (long double); -extern long double __ieee754_gammal (long double); -extern long double __ieee754_log10l (long double); -extern long double __ieee754_log2l (long double); -extern long double __ieee754_sinhl (long double); -extern long double __ieee754_hypotl (long double,long double); -extern long double __ieee754_j0l (long double); -extern long double __ieee754_j1l (long double); -extern long double __ieee754_y0l (long double); -extern long double __ieee754_y1l (long double); -extern long double __ieee754_jnl (int,long double); -extern long double __ieee754_ynl (int,long double); -extern long double __ieee754_remainderl (long double,long double); -extern int __ieee754_rem_pio2l (long double,long double*); -extern long double __ieee754_scalbl (long double,long double); - -/* long double versions of fdlibm kernel functions */ -extern long double __kernel_sinl (long double,long double,int); -extern long double __kernel_cosl (long double,long double); -extern long double __kernel_tanl (long double,long double,int); -extern void __kernel_sincosl (long double,long double, - long double *,long double *, int); -extern int __kernel_rem_pio2l (long double*,long double*,int,int, - int,const int*); - -#ifndef NO_LONG_DOUBLE -/* prototypes required to compile the ldbl-96 support without warnings */ -extern int __finitel (long double); -extern int __ilogbl (long double); -extern int __isinfl (long double); -extern int __isnanl (long double); -extern long double __atanl (long double); -extern long double __copysignl (long double, long double); -extern long double __expm1l (long double); -extern long double __floorl (long double); -extern long double __frexpl (long double, int *); -extern long double __ldexpl (long double, int); -extern long double __log1pl (long double); -extern long double __nanl (const char *); -extern long double __rintl (long double); -extern long double __scalbnl (long double, int); -extern long double __sqrtl (long double x); -extern long double fabsl (long double x); -extern void __sincosl (long double, long double *, long double *); -extern long double __logbl (long double x); -extern long double __significandl (long double x); -#endif - -/* Prototypes for functions of the IBM Accurate Mathematical Library. */ -extern double __exp1 (double __x, double __xx, double __error); -extern double __sin (double __x); -extern double __cos (double __x); -extern int __branred (double __x, double *__a, double *__aa); -extern void __doasin (double __x, double __dx, double __v[]); -extern void __dubsin (double __x, double __dx, double __v[]); -extern void __dubcos (double __x, double __dx, double __v[]); -extern double __halfulp (double __x, double __y); -extern double __sin32 (double __x, double __res, double __res1); -extern double __cos32 (double __x, double __res, double __res1); -extern double __mpsin (double __x, double __dx); -extern double __mpcos (double __x, double __dx); -extern double __mpsin1 (double __x); -extern double __mpcos1 (double __x); -extern double __slowexp (double __x); -extern double __slowpow (double __x, double __y, double __z); -extern void __docos (double __x, double __dx, double __v[]); - -#endif /* _MATH_PRIVATE_H_ */ diff --git a/newlib/libc/sys/linux/cmath/s_cacos.c b/newlib/libc/sys/linux/cmath/s_cacos.c deleted file mode 100644 index f9864472b..000000000 --- a/newlib/libc/sys/linux/cmath/s_cacos.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Return cosine of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ double -__cacos (__complex__ double x) -{ - __complex__ double y; - __complex__ double res; - - y = __casin (x); - - __real__ res = (double) M_PI_2 - __real__ y; - __imag__ res = -__imag__ y; - - return res; -} -weak_alias (__cacos, cacos) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacos, __cacosl) -weak_alias (__cacos, cacosl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_cacosf.c b/newlib/libc/sys/linux/cmath/s_cacosf.c deleted file mode 100644 index bf01890ad..000000000 --- a/newlib/libc/sys/linux/cmath/s_cacosf.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Return cosine of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ float -__cacosf (__complex__ float x) -{ - __complex__ float y; - __complex__ float res; - - y = __casinf (x); - - __real__ res = (float) M_PI_2 - __real__ y; - __imag__ res = -__imag__ y; - - return res; -} -weak_alias (__cacosf, cacosf) diff --git a/newlib/libc/sys/linux/cmath/s_cacosh.c b/newlib/libc/sys/linux/cmath/s_cacosh.c deleted file mode 100644 index 6ca3426b5..000000000 --- a/newlib/libc/sys/linux/cmath/s_cacosh.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Return arc hyperbole cosine for double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ double -__cacosh (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - - if (rcls == FP_NAN) - __imag__ res = __nan (""); - else - __imag__ res = __copysign ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PI - M_PI_4 : M_PI_4) - : M_PI_2), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - - if (icls >= FP_ZERO) - __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0, - __imag__ x); - else - __imag__ res = __nan (""); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysign (M_PI_2, __imag__ x); - } - else - { - __complex__ double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrt (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clog (y); - } - - return res; -} -weak_alias (__cacosh, cacosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacosh, __cacoshl) -weak_alias (__cacosh, cacoshl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_cacoshf.c b/newlib/libc/sys/linux/cmath/s_cacoshf.c deleted file mode 100644 index 69054cde3..000000000 --- a/newlib/libc/sys/linux/cmath/s_cacoshf.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Return arc hyperbole cosine for float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ float -__cacoshf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - - if (rcls == FP_NAN) - __imag__ res = __nanf (""); - else - __imag__ res = __copysignf ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PI - M_PI_4 : M_PI_4) - : M_PI_2), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - - if (icls >= FP_ZERO) - __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0, - __imag__ x); - else - __imag__ res = __nanf (""); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysignf (M_PI_2, __imag__ x); - } - else - { -#if 1 - __complex__ float y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtf (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogf (y); -#else - float re2 = __real__ x * __real__ x; - float im2 = __imag__ x * __imag__ x; - float sq = re2 - im2 - 1.0; - float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2); - float a = __ieee754_sqrtf ((sq + ro) / 2.0); - float b = __ieee754_sqrtf ((-sq + ro) / 2.0); - - __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a - + im2 + __imag__ x * 2 * b - + ro); - __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a); -#endif - } - - return res; -} -weak_alias (__cacoshf, cacoshf) diff --git a/newlib/libc/sys/linux/cmath/s_cacoshl.c b/newlib/libc/sys/linux/cmath/s_cacoshl.c deleted file mode 100644 index 3d0cd7f2a..000000000 --- a/newlib/libc/sys/linux/cmath/s_cacoshl.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Return arc hyperbole cosine for long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ long double -__cacoshl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - - if (rcls == FP_NAN) - __imag__ res = __nanl (""); - else - __imag__ res = __copysignl ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PIl - M_PI_4l : M_PI_4l) - : M_PI_2l), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - - if (icls >= FP_ZERO) - __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0, - __imag__ x); - else - __imag__ res = __nanl (""); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysignl (M_PI_2l, __imag__ x); - } - else - { - __complex__ long double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtl (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogl (y); - } - - return res; -} -weak_alias (__cacoshl, cacoshl) diff --git a/newlib/libc/sys/linux/cmath/s_cacosl.c b/newlib/libc/sys/linux/cmath/s_cacosl.c deleted file mode 100644 index d4bbfec87..000000000 --- a/newlib/libc/sys/linux/cmath/s_cacosl.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Return cosine of complex long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ long double -__cacosl (__complex__ long double x) -{ - __complex__ long double y; - __complex__ long double res; - - y = __casinl (x); - - __real__ res = M_PI_2l - __real__ y; - __imag__ res = -__imag__ y; - - return res; -} -weak_alias (__cacosl, cacosl) diff --git a/newlib/libc/sys/linux/cmath/s_casin.c b/newlib/libc/sys/linux/cmath/s_casin.c deleted file mode 100644 index 4c164b534..000000000 --- a/newlib/libc/sys/linux/cmath/s_casin.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Return arc sine of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ double -__casin (__complex__ double x) -{ - __complex__ double res; - - if (isnan (__real__ x) || isnan (__imag__ x)) - { - if (__real__ x == 0.0) - { - res = x; - } - else if (__isinf (__real__ x) || __isinf (__imag__ x)) - { - __real__ res = __nan (""); - __imag__ res = __copysign (HUGE_VAL, __imag__ x); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else - { - __complex__ double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __casinh (y); - - __real__ res = __imag__ y; - __imag__ res = -__real__ y; - } - - return res; -} -weak_alias (__casin, casin) -#ifdef NO_LONG_DOUBLE -strong_alias (__casin, __casinl) -weak_alias (__casin, casinl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_casinf.c b/newlib/libc/sys/linux/cmath/s_casinf.c deleted file mode 100644 index 09e52b400..000000000 --- a/newlib/libc/sys/linux/cmath/s_casinf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Return arc sine of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - - -__complex__ float -__casinf (__complex__ float x) -{ - __complex__ float res; - - if (isnan (__real__ x) || isnan (__imag__ x)) - { - if (__real__ x == 0.0) - { - res = x; - } - else if (__isinff (__real__ x) || __isinff (__imag__ x)) - { - __real__ res = __nanf (""); - __imag__ res = __copysignf (HUGE_VALF, __imag__ x); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else - { - __complex__ float y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __casinhf (y); - - __real__ res = __imag__ y; - __imag__ res = -__real__ y; - } - - return res; -} -weak_alias (__casinf, casinf) diff --git a/newlib/libc/sys/linux/cmath/s_casinh.c b/newlib/libc/sys/linux/cmath/s_casinh.c deleted file mode 100644 index 30b9dbb18..000000000 --- a/newlib/libc/sys/linux/cmath/s_casinh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Return arc hyperbole sine for double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ double -__casinh (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysign (HUGE_VAL, __real__ x); - - if (rcls == FP_NAN) - __imag__ res = __nan (""); - else - __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4, - __imag__ x); - } - else if (rcls <= FP_INFINITE) - { - __real__ res = __real__ x; - if ((rcls == FP_INFINITE && icls >= FP_ZERO) - || (rcls == FP_NAN && icls == FP_ZERO)) - __imag__ res = __copysign (0.0, __imag__ x); - else - __imag__ res = __nan (""); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - __complex__ double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrt (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clog (y); - } - - return res; -} -weak_alias (__casinh, casinh) -#ifdef NO_LONG_DOUBLE -strong_alias (__casinh, __casinhl) -weak_alias (__casinh, casinhl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_casinhf.c b/newlib/libc/sys/linux/cmath/s_casinhf.c deleted file mode 100644 index f9fc4e73c..000000000 --- a/newlib/libc/sys/linux/cmath/s_casinhf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole sine for float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ float -__casinhf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignf (HUGE_VALF, __real__ x); - - if (rcls == FP_NAN) - __imag__ res = __nanf (""); - else - __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4, - __imag__ x); - } - else if (rcls <= FP_INFINITE) - { - __real__ res = __real__ x; - if ((rcls == FP_INFINITE && icls >= FP_ZERO) - || (rcls == FP_NAN && icls == FP_ZERO)) - __imag__ res = __copysignf (0.0, __imag__ x); - else - __imag__ res = __nanf (""); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - __complex__ float y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtf (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogf (y); - } - - return res; -} -weak_alias (__casinhf, casinhf) diff --git a/newlib/libc/sys/linux/cmath/s_casinhl.c b/newlib/libc/sys/linux/cmath/s_casinhl.c deleted file mode 100644 index b48c60932..000000000 --- a/newlib/libc/sys/linux/cmath/s_casinhl.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole sine for long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ long double -__casinhl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignl (HUGE_VALL, __real__ x); - - if (rcls == FP_NAN) - __imag__ res = __nanl (""); - else - __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l, - __imag__ x); - } - else if (rcls <= FP_INFINITE) - { - __real__ res = __real__ x; - if ((rcls == FP_INFINITE && icls >= FP_ZERO) - || (rcls == FP_NAN && icls == FP_ZERO)) - __imag__ res = __copysignl (0.0, __imag__ x); - else - __imag__ res = __nanl (""); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - __complex__ long double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtl (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogl (y); - } - - return res; -} -weak_alias (__casinhl, casinhl) diff --git a/newlib/libc/sys/linux/cmath/s_casinl.c b/newlib/libc/sys/linux/cmath/s_casinl.c deleted file mode 100644 index d6b7a8087..000000000 --- a/newlib/libc/sys/linux/cmath/s_casinl.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Return arc sine of complex long double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ long double -__casinl (__complex__ long double x) -{ - __complex__ long double res; - - if (isnan (__real__ x) || isnan (__imag__ x)) - { - if (__real__ x == 0.0) - { - res = x; - } - else if (__isinfl (__real__ x) || __isinfl (__imag__ x)) - { - __real__ res = __nanl (""); - __imag__ res = __copysignl (HUGE_VALL, __imag__ x); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else - { - __complex__ long double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __casinhl (y); - - __real__ res = __imag__ y; - __imag__ res = -__real__ y; - } - - return res; -} -weak_alias (__casinl, casinl) diff --git a/newlib/libc/sys/linux/cmath/s_catan.c b/newlib/libc/sys/linux/cmath/s_catan.c deleted file mode 100644 index 1d0673ad6..000000000 --- a/newlib/libc/sys/linux/cmath/s_catan.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Return arc tangent of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__catan (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (rcls == FP_INFINITE) - { - __real__ res = __copysign (M_PI_2, __real__ x); - __imag__ res = __copysign (0.0, __imag__ x); - } - else if (icls == FP_INFINITE) - { - if (rcls >= FP_ZERO) - __real__ res = __copysign (M_PI_2, __real__ x); - else - __real__ res = __nan (""); - __imag__ res = __copysign (0.0, __imag__ x); - } - else if (icls == FP_ZERO || icls == FP_INFINITE) - { - __real__ res = __nan (""); - __imag__ res = __copysign (0.0, __imag__ x); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - double r2, num, den; - - r2 = __real__ x * __real__ x; - - den = 1 - r2 - __imag__ x * __imag__ x; - - __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den); - - num = __imag__ x + 1.0; - num = r2 + num * num; - - den = __imag__ x - 1.0; - den = r2 + den * den; - - __imag__ res = 0.25 * __ieee754_log (num / den); - } - - return res; -} -weak_alias (__catan, catan) -#ifdef NO_LONG_DOUBLE -strong_alias (__catan, __catanl) -weak_alias (__catan, catanl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_catanf.c b/newlib/libc/sys/linux/cmath/s_catanf.c deleted file mode 100644 index cc9e5ea7a..000000000 --- a/newlib/libc/sys/linux/cmath/s_catanf.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Return arc tangent of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__catanf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (rcls == FP_INFINITE) - { - __real__ res = __copysignf (M_PI_2, __real__ x); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else if (icls == FP_INFINITE) - { - if (rcls >= FP_ZERO) - __real__ res = __copysignf (M_PI_2, __real__ x); - else - __real__ res = __nanf (""); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else if (icls == FP_ZERO || icls == FP_INFINITE) - { - __real__ res = __nanf (""); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - float r2, num, den; - - r2 = __real__ x * __real__ x; - - den = 1 - r2 - __imag__ x * __imag__ x; - - __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den); - - num = __imag__ x + 1.0; - num = r2 + num * num; - - den = __imag__ x - 1.0; - den = r2 + den * den; - - __imag__ res = 0.25 * __ieee754_logf (num / den); - } - - return res; -} -weak_alias (__catanf, catanf) diff --git a/newlib/libc/sys/linux/cmath/s_catanh.c b/newlib/libc/sys/linux/cmath/s_catanh.c deleted file mode 100644 index e15c073f9..000000000 --- a/newlib/libc/sys/linux/cmath/s_catanh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Return arc hyperbole tangent for double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__catanh (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysign (0.0, __real__ x); - __imag__ res = __copysign (M_PI_2, __imag__ x); - } - else if (rcls == FP_INFINITE || rcls == FP_ZERO) - { - __real__ res = __copysign (0.0, __real__ x); - if (icls >= FP_ZERO) - __imag__ res = __copysign (M_PI_2, __imag__ x); - else - __imag__ res = __nan (""); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - double i2, num, den; - - i2 = __imag__ x * __imag__ x; - - num = 1.0 + __real__ x; - num = i2 + num * num; - - den = 1.0 - __real__ x; - den = i2 + den * den; - - __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den)); - - den = 1 - __real__ x * __real__ x - i2; - - __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den); - } - - return res; -} -weak_alias (__catanh, catanh) -#ifdef NO_LONG_DOUBLE -strong_alias (__catanh, __catanhl) -weak_alias (__catanh, catanhl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_catanhf.c b/newlib/libc/sys/linux/cmath/s_catanhf.c deleted file mode 100644 index 30a5a1b8a..000000000 --- a/newlib/libc/sys/linux/cmath/s_catanhf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole tangent for float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__catanhf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignf (0.0, __real__ x); - __imag__ res = __copysignf (M_PI_2, __imag__ x); - } - else if (rcls == FP_INFINITE || rcls == FP_ZERO) - { - __real__ res = __copysignf (0.0, __real__ x); - if (icls >= FP_ZERO) - __imag__ res = __copysignf (M_PI_2, __imag__ x); - else - __imag__ res = __nanf (""); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - float i2, num, den; - - i2 = __imag__ x * __imag__ x; - - num = 1.0 + __real__ x; - num = i2 + num * num; - - den = 1.0 - __real__ x; - den = i2 + den * den; - - __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den)); - - den = 1 - __real__ x * __real__ x - i2; - - __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den); - } - - return res; -} -weak_alias (__catanhf, catanhf) diff --git a/newlib/libc/sys/linux/cmath/s_catanhl.c b/newlib/libc/sys/linux/cmath/s_catanhl.c deleted file mode 100644 index c3fb0ce5f..000000000 --- a/newlib/libc/sys/linux/cmath/s_catanhl.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole tangent for long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__catanhl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignl (0.0, __real__ x); - __imag__ res = __copysignl (M_PI_2l, __imag__ x); - } - else if (rcls == FP_INFINITE || rcls == FP_ZERO) - { - __real__ res = __copysignl (0.0, __real__ x); - if (icls >= FP_ZERO) - __imag__ res = __copysignl (M_PI_2l, __imag__ x); - else - __imag__ res = __nanl (""); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - long double i2, num, den; - - i2 = __imag__ x * __imag__ x; - - num = 1.0 + __real__ x; - num = i2 + num * num; - - den = 1.0 - __real__ x; - den = i2 + den * den; - - __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den)); - - den = 1 - __real__ x * __real__ x - i2; - - __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den); - } - - return res; -} -weak_alias (__catanhl, catanhl) diff --git a/newlib/libc/sys/linux/cmath/s_catanl.c b/newlib/libc/sys/linux/cmath/s_catanl.c deleted file mode 100644 index 6cb45e5be..000000000 --- a/newlib/libc/sys/linux/cmath/s_catanl.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Return arc tangent of complex long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__catanl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (rcls == FP_INFINITE) - { - __real__ res = __copysignl (M_PI_2l, __real__ x); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else if (icls == FP_INFINITE) - { - if (rcls >= FP_ZERO) - __real__ res = __copysignl (M_PI_2l, __real__ x); - else - __real__ res = __nanl (""); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else if (icls == FP_ZERO || icls == FP_INFINITE) - { - __real__ res = __nanl (""); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - long double r2, num, den; - - r2 = __real__ x * __real__ x; - - den = 1 - r2 - __imag__ x * __imag__ x; - - __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den); - - num = __imag__ x + 1.0; - num = r2 + num * num; - - den = __imag__ x - 1.0; - den = r2 + den * den; - - __imag__ res = 0.25 * __ieee754_logl (num / den); - } - - return res; -} -weak_alias (__catanl, catanl) diff --git a/newlib/libc/sys/linux/cmath/s_cbrtl.c b/newlib/libc/sys/linux/cmath/s_cbrtl.c deleted file mode 100644 index d668e377a..000000000 --- a/newlib/libc/sys/linux/cmath/s_cbrtl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <math.h> -#include <stdio.h> -#include <errno.h> - -long double -__cbrtl(long double x) -{ - fputs ("__cbrtl not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -weak_alias (__cbrtl, cbrtl) -stub_warning (cbrtl) -#include <stub-tag.h> diff --git a/newlib/libc/sys/linux/cmath/s_ccos.c b/newlib/libc/sys/linux/cmath/s_ccos.c deleted file mode 100644 index e65ea38a5..000000000 --- a/newlib/libc/sys/linux/cmath/s_ccos.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return cosine of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> -#include "math_private.h" - -__complex__ double -__ccos (__complex__ double x) -{ - __complex__ double res; - - if (!isfinite (__real__ x) || __isnan (__imag__ x)) - { - if (__real__ x == 0.0 || __imag__ x == 0.0) - { - __real__ res = __nan (""); - __imag__ res = 0.0; - -#ifdef FE_INVALID - if (__isinf (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else if (__isinf (__imag__ x)) - { - __real__ res = HUGE_VAL; - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (__isinf (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (isfinite (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __complex__ double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - res = __ccosh (y); - } - - return res; -} -weak_alias (__ccos, ccos) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccos, __ccosl) -weak_alias (__ccos, ccosl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_ccosf.c b/newlib/libc/sys/linux/cmath/s_ccosf.c deleted file mode 100644 index 016d8062b..000000000 --- a/newlib/libc/sys/linux/cmath/s_ccosf.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Return cosine of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> -#include "math_private.h" - -__complex__ float -__ccosf (__complex__ float x) -{ - __complex__ float res; - - if (!isfinite (__real__ x) || __isnanf (__imag__ x)) - { - if (__real__ x == 0.0 || __imag__ x == 0.0) - { - __real__ res = __nanf (""); - __imag__ res = 0.0; - -#ifdef FE_INVALID - if (__isinff (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else if (__isinff (__imag__ x)) - { - __real__ res = HUGE_VALF; - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (__isinff (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (isfinite (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __complex__ float y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - res = __ccoshf (y); - } - - return res; -} -weak_alias (__ccosf, ccosf) diff --git a/newlib/libc/sys/linux/cmath/s_ccosh.c b/newlib/libc/sys/linux/cmath/s_ccosh.c deleted file mode 100644 index f5b29db24..000000000 --- a/newlib/libc/sys/linux/cmath/s_ccosh.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Complex cosine hyperbole function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__ccosh (__complex__ double x) -{ - __complex__ double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double sinh_val = __ieee754_sinh (__real__ x); - double cosh_val = __ieee754_cosh (__real__ x); - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = cosh_val * cosix; - __imag__ retval = sinh_val * sinix; - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan (""); - __real__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __imag__ x * __copysign (1.0, __real__ x); - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysign (HUGE_VAL, cosix); - __imag__ retval = (__copysign (HUGE_VAL, sinix) - * __copysign (1.0, __real__ x)); - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan (""); - } - - return retval; -} -weak_alias (__ccosh, ccosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccosh, __ccoshl) -weak_alias (__ccosh, ccoshl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_ccoshf.c b/newlib/libc/sys/linux/cmath/s_ccoshf.c deleted file mode 100644 index 339b6bc1c..000000000 --- a/newlib/libc/sys/linux/cmath/s_ccoshf.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Complex cosine hyperbole function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__ccoshf (__complex__ float x) -{ - __complex__ float retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float sinh_val = __ieee754_sinhf (__real__ x); - float cosh_val = __ieee754_coshf (__real__ x); - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = cosh_val * cosix; - __imag__ retval = sinh_val * sinix; - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf (""); - __real__ retval = __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VALF; - __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x); - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignf (HUGE_VALF, cosix); - __imag__ retval = (__copysignf (HUGE_VALF, sinix) - * __copysignf (1.0, __real__ x)); - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALF; - __imag__ retval = __nanf ("") + __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf (""); - } - - return retval; -} -weak_alias (__ccoshf, ccoshf) diff --git a/newlib/libc/sys/linux/cmath/s_ccoshl.c b/newlib/libc/sys/linux/cmath/s_ccoshl.c deleted file mode 100644 index 61ffb49ca..000000000 --- a/newlib/libc/sys/linux/cmath/s_ccoshl.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Complex cosine hyperbole function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__ccoshl (__complex__ long double x) -{ - __complex__ long double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinh_val = __ieee754_sinhl (__real__ x); - long double cosh_val = __ieee754_coshl (__real__ x); - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = cosh_val * cosix; - __imag__ retval = sinh_val * sinix; - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl (""); - __real__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VALL; - __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x); - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignl (HUGE_VALL, cosix); - __imag__ retval = (__copysignl (HUGE_VALL, sinix) - * __copysignl (1.0, __real__ x)); - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALL; - __imag__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl (""); - } - - return retval; -} -weak_alias (__ccoshl, ccoshl) diff --git a/newlib/libc/sys/linux/cmath/s_ccosl.c b/newlib/libc/sys/linux/cmath/s_ccosl.c deleted file mode 100644 index 4ebe2c347..000000000 --- a/newlib/libc/sys/linux/cmath/s_ccosl.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Return cosine of complex long double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - - -__complex__ long double -__ccosl (__complex__ long double x) -{ - __complex__ long double res; - - if (!isfinite (__real__ x) || __isnanl (__imag__ x)) - { - if (__real__ x == 0.0 || __imag__ x == 0.0) - { - __real__ res = __nanl (""); - __imag__ res = 0.0; - -#ifdef FE_INVALID - if (__isinfl (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else if (__isinfl (__imag__ x)) - { - __real__ res = HUGE_VALL; - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (__isinfl (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (isfinite (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __complex__ long double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - res = __ccoshl (y); - } - - return res; -} -weak_alias (__ccosl, ccosl) diff --git a/newlib/libc/sys/linux/cmath/s_cexp.c b/newlib/libc/sys/linux/cmath/s_cexp.c deleted file mode 100644 index 5a299b768..000000000 --- a/newlib/libc/sys/linux/cmath/s_cexp.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Return value of complex exponential function for double complex value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__cexp (__complex__ double x) -{ - __complex__ double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double exp_val = __ieee754_exp (__real__ x); - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - if (isfinite (exp_val)) - { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - else - { - __real__ retval = __copysign (exp_val, cosix); - __imag__ retval = __copysign (exp_val, sinix); - } - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double value = signbit (__real__ x) ? 0.0 : HUGE_VAL; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysign (value, cosix); - __imag__ retval = __copysign (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VAL; - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysign (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN. */ - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); -#endif - } - - return retval; -} -weak_alias (__cexp, cexp) -#ifdef NO_LONG_DOUBLE -strong_alias (__cexp, __cexpl) -weak_alias (__cexp, cexpl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_cexpf.c b/newlib/libc/sys/linux/cmath/s_cexpf.c deleted file mode 100644 index 93bfe2049..000000000 --- a/newlib/libc/sys/linux/cmath/s_cexpf.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Return value of complex exponential function for float complex value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__cexpf (__complex__ float x) -{ - __complex__ float retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float exp_val = __ieee754_expf (__real__ x); - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - if (isfinite (exp_val)) - { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - else - { - __real__ retval = __copysignf (exp_val, cosix); - __imag__ retval = __copysignf (exp_val, sinix); - } - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float value = signbit (__real__ x) ? 0.0 : HUGE_VALF; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignf (value, cosix); - __imag__ retval = __copysignf (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VALF; - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysignf (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN. */ - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); -#endif - } - - return retval; -} -weak_alias (__cexpf, cexpf) diff --git a/newlib/libc/sys/linux/cmath/s_cexpl.c b/newlib/libc/sys/linux/cmath/s_cexpl.c deleted file mode 100644 index cf6bc974a..000000000 --- a/newlib/libc/sys/linux/cmath/s_cexpl.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Return value of complex exponential function for long double complex value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__cexpl (__complex__ long double x) -{ - __complex__ long double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double exp_val = __ieee754_expl (__real__ x); - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - if (isfinite (exp_val)) - { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - else - { - __real__ retval = __copysignl (exp_val, cosix); - __imag__ retval = __copysignl (exp_val, sinix); - } - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignl (value, cosix); - __imag__ retval = __copysignl (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VALL; - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysignl (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN. */ - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); -#endif - } - - return retval; -} -weak_alias (__cexpl, cexpl) diff --git a/newlib/libc/sys/linux/cmath/s_clog.c b/newlib/libc/sys/linux/cmath/s_clog.c deleted file mode 100644 index f796024b4..000000000 --- a/newlib/libc/sys/linux/cmath/s_clog.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__clog (__complex__ double x) -{ - __complex__ double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log (__ieee754_hypot (__real__ x, - __imag__ x)); - __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nan (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; - else - __real__ result = __nan (""); - } - - return result; -} -weak_alias (__clog, clog) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog, __clogl) -weak_alias (__clog, clogl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_clog10.c b/newlib/libc/sys/linux/cmath/s_clog10.c deleted file mode 100644 index 62c2ca724..000000000 --- a/newlib/libc/sys/linux/cmath/s_clog10.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__clog10 (__complex__ double x) -{ - __complex__ double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x, - __imag__ x)); - __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nan (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; - else - __real__ result = __nan (""); - } - - return result; -} -weak_alias (__clog10, clog10) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog10, __clog10l) -weak_alias (__clog10, clog10l) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_clog10f.c b/newlib/libc/sys/linux/cmath/s_clog10f.c deleted file mode 100644 index 6d60c5fc2..000000000 --- a/newlib/libc/sys/linux/cmath/s_clog10f.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__clog10f (__complex__ float x) -{ - __complex__ float result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysignf (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsf (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x, - __imag__ x)); - __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanf (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALF; - else - __real__ result = __nanf (""); - } - - return result; -} -weak_alias (__clog10f, clog10f) diff --git a/newlib/libc/sys/linux/cmath/s_clog10l.c b/newlib/libc/sys/linux/cmath/s_clog10l.c deleted file mode 100644 index f901543d0..000000000 --- a/newlib/libc/sys/linux/cmath/s_clog10l.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__clog10l (__complex__ long double x) -{ - __complex__ long double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PIl : 0.0; - __imag__ result = __copysignl (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsl (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x, - __imag__ x)); - __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanl (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALL; - else - __real__ result = __nanl (""); - } - - return result; -} -weak_alias (__clog10l, clog10l) diff --git a/newlib/libc/sys/linux/cmath/s_clogf.c b/newlib/libc/sys/linux/cmath/s_clogf.c deleted file mode 100644 index c7151f2e5..000000000 --- a/newlib/libc/sys/linux/cmath/s_clogf.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__clogf (__complex__ float x) -{ - __complex__ float result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysignf (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsf (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x, - __imag__ x)); - __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanf (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALF; - else - __real__ result = __nanf (""); - } - - return result; -} -weak_alias (__clogf, clogf) diff --git a/newlib/libc/sys/linux/cmath/s_clogl.c b/newlib/libc/sys/linux/cmath/s_clogl.c deleted file mode 100644 index 43118f768..000000000 --- a/newlib/libc/sys/linux/cmath/s_clogl.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__clogl (__complex__ long double x) -{ - __complex__ long double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PIl : 0.0; - __imag__ result = __copysignl (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsl (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x, - __imag__ x)); - __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanl (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALL; - else - __real__ result = __nanl (""); - } - - return result; -} -weak_alias (__clogl, clogl) diff --git a/newlib/libc/sys/linux/cmath/s_cpow.c b/newlib/libc/sys/linux/cmath/s_cpow.c deleted file mode 100644 index 9018a8a65..000000000 --- a/newlib/libc/sys/linux/cmath/s_cpow.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Complex power of double values. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ double -__cpow (__complex__ double x, __complex__ double c) -{ - return __cexp (c * __clog (x)); -} -weak_alias (__cpow, cpow) -#ifdef NO_LONG_DOUBLE -strong_alias (__cpow, __cpowl) -weak_alias (__cpow, cpowl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_cpowf.c b/newlib/libc/sys/linux/cmath/s_cpowf.c deleted file mode 100644 index b0c032422..000000000 --- a/newlib/libc/sys/linux/cmath/s_cpowf.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Complex power of float values. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ float -__cpowf (__complex__ float x, __complex__ float c) -{ - return __cexpf (c * __clogf (x)); -} -weak_alias (__cpowf, cpowf) diff --git a/newlib/libc/sys/linux/cmath/s_cpowl.c b/newlib/libc/sys/linux/cmath/s_cpowl.c deleted file mode 100644 index 4c358b3eb..000000000 --- a/newlib/libc/sys/linux/cmath/s_cpowl.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Complex power of long double values. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - - -__complex__ long double -__cpowl (__complex__ long double x, __complex__ long double c) -{ - return __cexpl (c * __clogl (x)); -} -weak_alias (__cpowl, cpowl) diff --git a/newlib/libc/sys/linux/cmath/s_cproj.c b/newlib/libc/sys/linux/cmath/s_cproj.c deleted file mode 100644 index 6c9e41704..000000000 --- a/newlib/libc/sys/linux/cmath/s_cproj.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Compute projection of complex double value to Riemann sphere. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ double -__cproj (__complex__ double x) -{ - __complex__ double res; - - if (isnan (__real__ x) && isnan (__imag__ x)) - return x; - else if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - __real__ res = INFINITY; - __imag__ res = __copysign (0.0, __imag__ x); - } - else - { - double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0; - - __real__ res = (2.0 * __real__ x) / den; - __imag__ res = (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__cproj, cproj) -#ifdef NO_LONG_DOUBLE -strong_alias (__cproj, __cprojl) -weak_alias (__cproj, cprojl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_cprojf.c b/newlib/libc/sys/linux/cmath/s_cprojf.c deleted file mode 100644 index a302078b5..000000000 --- a/newlib/libc/sys/linux/cmath/s_cprojf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Compute projection of complex float value to Riemann sphere. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> -#include "math_private.h" - -__complex__ float -__cprojf (__complex__ float x) -{ - __complex__ float res; - - if (isnan (__real__ x) && isnan (__imag__ x)) - return x; - else if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - __real__ res = INFINITY; - __imag__ res = __copysignf (0.0, __imag__ x); - } - else - { - float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0; - - __real__ res = (2.0 * __real__ x) / den; - __imag__ res = (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__cprojf, cprojf) diff --git a/newlib/libc/sys/linux/cmath/s_cprojl.c b/newlib/libc/sys/linux/cmath/s_cprojl.c deleted file mode 100644 index c70cdc47d..000000000 --- a/newlib/libc/sys/linux/cmath/s_cprojl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Compute projection of complex long double value to Riemann sphere. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - - -__complex__ long double -__cprojl (__complex__ long double x) -{ - __complex__ long double res; - - if (isnan (__real__ x) && isnan (__imag__ x)) - return x; - else if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - __real__ res = INFINITY; - __imag__ res = __copysignl (0.0, __imag__ x); - } - else - { - long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x - + 1.0); - - __real__ res = (2.0 * __real__ x) / den; - __imag__ res = (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__cprojl, cprojl) diff --git a/newlib/libc/sys/linux/cmath/s_csin.c b/newlib/libc/sys/linux/cmath/s_csin.c deleted file mode 100644 index eb380e2c3..000000000 --- a/newlib/libc/sys/linux/cmath/s_csin.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Complex sine function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__csin (__complex__ double x) -{ - __complex__ double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabs (__real__ x); - - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - double sinh_val = __ieee754_sinh (__imag__ x); - double cosh_val = __ieee754_cosh (__imag__ x); - double sinix, cosix; - - __sincos (__real__ x, &sinix, &cosix); - - __real__ retval = cosh_val * sinix; - __imag__ retval = sinh_val * cosix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = __nan (""); - __imag__ retval = __imag__ x; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (icls == FP_INFINITE) - { - /* Imaginary part is infinite. */ - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __imag__ x; - } - else if (rcls > FP_ZERO) - { - /* Real part is finite. */ - double sinix, cosix; - - __sincos (__real__ x, &sinix, &cosix); - - __real__ retval = __copysign (HUGE_VAL, sinix); - __imag__ retval = __copysign (HUGE_VAL, cosix); - - if (negate) - __real__ retval = -__real__ retval; - if (signbit (__imag__ x)) - __imag__ retval = -__imag__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = __nan (""); - __imag__ retval = HUGE_VAL; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - if (rcls == FP_ZERO) - __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); - else - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - } - - return retval; -} -weak_alias (__csin, csin) -#ifdef NO_LONG_DOUBLE -strong_alias (__csin, __csinl) -weak_alias (__csin, csinl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_csinf.c b/newlib/libc/sys/linux/cmath/s_csinf.c deleted file mode 100644 index b7278810d..000000000 --- a/newlib/libc/sys/linux/cmath/s_csinf.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Complex sine function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__csinf (__complex__ float x) -{ - __complex__ float retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsf (__real__ x); - - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - float sinh_val = __ieee754_sinhf (__imag__ x); - float cosh_val = __ieee754_coshf (__imag__ x); - float sinix, cosix; - - __sincosf (__real__ x, &sinix, &cosix); - - __real__ retval = cosh_val * sinix; - __imag__ retval = sinh_val * cosix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = __nanf (""); - __imag__ retval = __imag__ x; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (icls == FP_INFINITE) - { - /* Imaginary part is infinite. */ - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __imag__ x; - } - else if (rcls > FP_ZERO) - { - /* Real part is finite. */ - float sinix, cosix; - - __sincosf (__real__ x, &sinix, &cosix); - - __real__ retval = __copysignf (HUGE_VALF, sinix); - __imag__ retval = __copysignf (HUGE_VALF, cosix); - - if (negate) - __real__ retval = -__real__ retval; - if (signbit (__imag__ x)) - __imag__ retval = -__imag__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = __nanf (""); - __imag__ retval = HUGE_VALF; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - if (rcls == FP_ZERO) - __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); - else - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - } - - return retval; -} -weak_alias (__csinf, csinf) diff --git a/newlib/libc/sys/linux/cmath/s_csinh.c b/newlib/libc/sys/linux/cmath/s_csinh.c deleted file mode 100644 index f0e0cc61f..000000000 --- a/newlib/libc/sys/linux/cmath/s_csinh.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Complex sine hyperbole function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__csinh (__complex__ double x) -{ - __complex__ double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabs (__real__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double sinh_val = __ieee754_sinh (__real__ x); - double cosh_val = __ieee754_cosh (__real__ x); - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = sinh_val * cosix; - __imag__ retval = cosh_val * sinix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = negate ? -HUGE_VAL : HUGE_VAL; - __imag__ retval = __imag__ x; - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysign (HUGE_VAL, cosix); - __imag__ retval = __copysign (HUGE_VAL, sinix); - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan (""); - } - - return retval; -} -weak_alias (__csinh, csinh) -#ifdef NO_LONG_DOUBLE -strong_alias (__csinh, __csinhl) -weak_alias (__csinh, csinhl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_csinhf.c b/newlib/libc/sys/linux/cmath/s_csinhf.c deleted file mode 100644 index 5cf80d0f9..000000000 --- a/newlib/libc/sys/linux/cmath/s_csinhf.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Complex sine hyperbole function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__csinhf (__complex__ float x) -{ - __complex__ float retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsf (__real__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float sinh_val = __ieee754_sinhf (__real__ x); - float cosh_val = __ieee754_coshf (__real__ x); - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = sinh_val * cosix; - __imag__ retval = cosh_val * sinix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __nanf ("") + __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = negate ? -HUGE_VALF : HUGE_VALF; - __imag__ retval = __imag__ x; - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignf (HUGE_VALF, cosix); - __imag__ retval = __copysignf (HUGE_VALF, sinix); - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALF; - __imag__ retval = __nanf ("") + __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf (""); - } - - return retval; -} -weak_alias (__csinhf, csinhf) diff --git a/newlib/libc/sys/linux/cmath/s_csinhl.c b/newlib/libc/sys/linux/cmath/s_csinhl.c deleted file mode 100644 index 226075634..000000000 --- a/newlib/libc/sys/linux/cmath/s_csinhl.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Complex sine hyperbole function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__csinhl (__complex__ long double x) -{ - __complex__ long double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsl (__real__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinh_val = __ieee754_sinhl (__real__ x); - long double cosh_val = __ieee754_coshl (__real__ x); - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = sinh_val * cosix; - __imag__ retval = cosh_val * sinix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = negate ? -HUGE_VALL : HUGE_VALL; - __imag__ retval = __imag__ x; - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignl (HUGE_VALL, cosix); - __imag__ retval = __copysignl (HUGE_VALL, sinix); - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALL; - __imag__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl (""); - } - - return retval; -} -weak_alias (__csinhl, csinhl) diff --git a/newlib/libc/sys/linux/cmath/s_csinl.c b/newlib/libc/sys/linux/cmath/s_csinl.c deleted file mode 100644 index f7a1c4360..000000000 --- a/newlib/libc/sys/linux/cmath/s_csinl.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Complex sine function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__csinl (__complex__ long double x) -{ - __complex__ long double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsl (__real__ x); - - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - long double sinh_val = __ieee754_sinhl (__imag__ x); - long double cosh_val = __ieee754_coshl (__imag__ x); - long double sinix, cosix; - - __sincosl (__real__ x, &sinix, &cosix); - - __real__ retval = cosh_val * sinix; - __imag__ retval = sinh_val * cosix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = __nanl (""); - __imag__ retval = __imag__ x; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (icls == FP_INFINITE) - { - /* Imaginary part is infinite. */ - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __imag__ x; - } - else if (rcls > FP_ZERO) - { - /* Real part is finite. */ - long double sinix, cosix; - - __sincosl (__real__ x, &sinix, &cosix); - - __real__ retval = __copysignl (HUGE_VALL, sinix); - __imag__ retval = __copysignl (HUGE_VALL, cosix); - - if (negate) - __real__ retval = -__real__ retval; - if (signbit (__imag__ x)) - __imag__ retval = -__imag__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = __nanl (""); - __imag__ retval = HUGE_VALL; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - if (rcls == FP_ZERO) - __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); - else - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - } - - return retval; -} -weak_alias (__csinl, csinl) diff --git a/newlib/libc/sys/linux/cmath/s_csqrt.c b/newlib/libc/sys/linux/cmath/s_csqrt.c deleted file mode 100644 index 0bb6690b1..000000000 --- a/newlib/libc/sys/linux/cmath/s_csqrt.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Complex square root of double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__csqrt (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nan ("") : 0; - __imag__ res = __copysign (HUGE_VAL, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nan ("") : __copysign (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else - { - if (icls == FP_ZERO) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysign (__ieee754_sqrt (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabs (__ieee754_sqrt (__real__ x)); - __imag__ res = __copysign (0.0, __imag__ x); - } - } - else if (rcls == FP_ZERO) - { - double r = __ieee754_sqrt (0.5 * fabs (__imag__ x)); - - __real__ res = __copysign (r, __imag__ x); - __imag__ res = r; - } - else - { - double d, r, s; - - d = __ieee754_hypot (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x); - s = (0.5 * __imag__ x) / r; - } - else - { - s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x); - r = fabs ((0.5 * __imag__ x) / s); - } - - __real__ res = r; - __imag__ res = __copysign (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrt, csqrt) -#ifdef NO_LONG_DOUBLE -strong_alias (__csqrt, __csqrtl) -weak_alias (__csqrt, csqrtl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_csqrtf.c b/newlib/libc/sys/linux/cmath/s_csqrtf.c deleted file mode 100644 index f7b18368b..000000000 --- a/newlib/libc/sys/linux/cmath/s_csqrtf.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Complex square root of float value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__csqrtf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nanf ("") : 0; - __imag__ res = __copysignf (HUGE_VALF, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nanf ("") : __copysignf (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else - { - if (icls == FP_ZERO) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabsf (__ieee754_sqrtf (__real__ x)); - __imag__ res = __copysignf (0.0, __imag__ x); - } - } - else if (rcls == FP_ZERO) - { - float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x)); - - __real__ res = __copysignf (r, __imag__ x); - __imag__ res = r; - } - else - { - float d, r, s; - - d = __ieee754_hypotf (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x); - s = (0.5f * __imag__ x) / r; - } - else - { - s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x); - r = fabsf ((0.5f * __imag__ x) / s); - } - - __real__ res = r; - __imag__ res = __copysignf (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrtf, csqrtf) diff --git a/newlib/libc/sys/linux/cmath/s_csqrtl.c b/newlib/libc/sys/linux/cmath/s_csqrtl.c deleted file mode 100644 index 8e27750a0..000000000 --- a/newlib/libc/sys/linux/cmath/s_csqrtl.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Complex square root of long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__csqrtl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nanl ("") : 0; - __imag__ res = __copysignl (HUGE_VALL, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nanl ("") : __copysignl (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else - { - if (icls == FP_ZERO) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabsl (__ieee754_sqrtl (__real__ x)); - __imag__ res = __copysignl (0.0, __imag__ x); - } - } - else if (rcls == FP_ZERO) - { - long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x)); - - __real__ res = __copysignl (r, __imag__ x); - __imag__ res = r; - } - else - { - long double d, r, s; - - d = __ieee754_hypotl (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x); - s = (0.5L * __imag__ x) / r; - } - else - { - s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x); - r = fabsl ((0.5L * __imag__ x) / s); - } - - __real__ res = r; - __imag__ res = __copysignl (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrtl, csqrtl) diff --git a/newlib/libc/sys/linux/cmath/s_ctan.c b/newlib/libc/sys/linux/cmath/s_ctan.c deleted file mode 100644 index 6a09fe465..000000000 --- a/newlib/libc/sys/linux/cmath/s_ctan.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Complex tangent function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__ctan (__complex__ double x) -{ - __complex__ double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinf (__imag__ x)) - { - __real__ res = __copysign (0.0, __real__ x); - __imag__ res = __copysign (1.0, __imag__ x); - } - else if (__real__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (__isinf (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - double sin2rx, cos2rx; - double den; - - __sincos (2.0 * __real__ x, &sin2rx, &cos2rx); - - den = cos2rx + __ieee754_cosh (2.0 * __imag__ x); - - __real__ res = sin2rx / den; - __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__ctan, ctan) -#ifdef NO_LONG_DOUBLE -strong_alias (__ctan, __ctanl) -weak_alias (__ctan, ctanl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_ctanf.c b/newlib/libc/sys/linux/cmath/s_ctanf.c deleted file mode 100644 index 89bc84741..000000000 --- a/newlib/libc/sys/linux/cmath/s_ctanf.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex tangent function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__ctanf (__complex__ float x) -{ - __complex__ float res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinff (__imag__ x)) - { - __real__ res = __copysignf (0.0, __real__ x); - __imag__ res = __copysignf (1.0, __imag__ x); - } - else if (__real__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (__isinff (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - float sin2rx, cos2rx; - float den; - - __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx); - - den = cos2rx + __ieee754_coshf (2.0 * __imag__ x); - - __real__ res = sin2rx / den; - __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__ctanf, ctanf) diff --git a/newlib/libc/sys/linux/cmath/s_ctanh.c b/newlib/libc/sys/linux/cmath/s_ctanh.c deleted file mode 100644 index 971cd9040..000000000 --- a/newlib/libc/sys/linux/cmath/s_ctanh.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Complex hyperbole tangent for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ double -__ctanh (__complex__ double x) -{ - __complex__ double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinf (__real__ x)) - { - __real__ res = __copysign (1.0, __real__ x); - __imag__ res = __copysign (0.0, __imag__ x); - } - else if (__imag__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (__isinf (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - double sin2ix, cos2ix; - double den; - - __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix); - - den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix); - - __real__ res = __ieee754_sinh (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; - } - - return res; -} -weak_alias (__ctanh, ctanh) -#ifdef NO_LONG_DOUBLE -strong_alias (__ctanh, __ctanhl) -weak_alias (__ctanh, ctanhl) -#endif diff --git a/newlib/libc/sys/linux/cmath/s_ctanhf.c b/newlib/libc/sys/linux/cmath/s_ctanhf.c deleted file mode 100644 index b9e3c57fc..000000000 --- a/newlib/libc/sys/linux/cmath/s_ctanhf.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex hyperbole tangent for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ float -__ctanhf (__complex__ float x) -{ - __complex__ float res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinff (__real__ x)) - { - __real__ res = __copysignf (1.0, __real__ x); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else if (__imag__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (__isinff (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - float sin2ix, cos2ix; - float den; - - __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix); - - den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix); - - __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; - } - - return res; -} -weak_alias (__ctanhf, ctanhf) diff --git a/newlib/libc/sys/linux/cmath/s_ctanhl.c b/newlib/libc/sys/linux/cmath/s_ctanhl.c deleted file mode 100644 index 7bf6b3919..000000000 --- a/newlib/libc/sys/linux/cmath/s_ctanhl.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex hyperbole tangent for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__ctanhl (__complex__ long double x) -{ - __complex__ long double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinfl (__real__ x)) - { - __real__ res = __copysignl (1.0, __real__ x); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else if (__imag__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (__isinfl (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - long double sin2ix, cos2ix; - long double den; - - __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix); - - den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix); - - __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; - } - - return res; -} -weak_alias (__ctanhl, ctanhl) diff --git a/newlib/libc/sys/linux/cmath/s_ctanl.c b/newlib/libc/sys/linux/cmath/s_ctanl.c deleted file mode 100644 index fa153e9b3..000000000 --- a/newlib/libc/sys/linux/cmath/s_ctanl.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex tangent function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <complex.h> -#include <fenv.h> -#include <math.h> - -#include "math_private.h" - - -__complex__ long double -__ctanl (__complex__ long double x) -{ - __complex__ long double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinfl (__imag__ x)) - { - __real__ res = __copysignl (0.0, __real__ x); - __imag__ res = __copysignl (1.0, __imag__ x); - } - else if (__real__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (__isinfl (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - long double sin2rx, cos2rx; - long double den; - - __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx); - - den = cos2rx + __ieee754_coshl (2.0 * __imag__ x); - - __real__ res = sin2rx / den; - __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__ctanl, ctanl) diff --git a/newlib/libc/sys/linux/config.h b/newlib/libc/sys/linux/config.h deleted file mode 100644 index 76b438c85..000000000 --- a/newlib/libc/sys/linux/config.h +++ /dev/null @@ -1,16 +0,0 @@ -#define HAVE_WEAK_SYMBOLS 1 -#define HAVE_GNU_LD 1 -#define HAVE_ELF 1 -#define __ASSUME_REALTIME_SIGNALS 1 -#define ASM_GLOBAL_DIRECTIVE .global - -#define TEMP_FAILURE_RETRY(expression) \ - (__extension__ \ - ({ long int __result; \ - do __result = (long int) (expression); \ - while (__result == -1L && errno == EINTR); \ - __result; })) - -#define UINT32_C(c) c ## U - -#include <machine/sysdep.h> diff --git a/newlib/libc/sys/linux/configure b/newlib/libc/sys/linux/configure deleted file mode 100755 index 5a8a2c5ed..000000000 --- a/newlib/libc/sys/linux/configure +++ /dev/null @@ -1,3439 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-multilib build many library versions (default)" -ac_help="$ac_help - --enable-target-optspace optimize for space" -ac_help="$ac_help - --enable-malloc-debugging indicate malloc debugging requested" -ac_help="$ac_help - --enable-newlib-mb enable multibyte support" -ac_help="$ac_help - --enable-newlib-multithread enable support for multiple threads" -ac_help="$ac_help - --enable-newlib-elix-level supply desired elix library level (1-4)" -ac_help="$ac_help - --disable-newlib-io-float disable printf/scanf family float support" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-shared[=PKGS] build shared libraries [default=yes]" -ac_help="$ac_help - --enable-static[=PKGS] build static libraries [default=yes]" -ac_help="$ac_help - --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" -ac_help="$ac_help - --disable-libtool-lock avoid locking (might break parallel builds)" -ac_help="$ac_help - --with-pic try to use only PIC/non-PIC objects [default=use both]" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -sitefile= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=linux.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi - fi -else - CONFIG_SITE="$sitefile" -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -ac_aux_dir= -for ac_dir in ../../../.. $srcdir/../../../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in ../../../.. $srcdir/../../../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:598: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:651: checking whether build environment is sane" >&5 -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } - fi - - test "$2" = conftestfile - ) -then - # Ok. - : -else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:708: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:741: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 746 "configure" -#include "confdefs.h" - -int main() { - -#ifndef __CYGWIN__ -#define __CYGWIN__ __CYGWIN32__ -#endif -return __CYGWIN__; -; return 0; } -EOF -if { (eval echo configure:757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:774: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 779 "configure" -#include "confdefs.h" - -int main() { -return __MINGW32__; -; return 0; } -EOF -if { (eval echo configure:786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes - -# Check whether --enable-multilib or --disable-multilib was given. -if test "${enable_multilib+set}" = set; then - enableval="$enable_multilib" - case "${enableval}" in - yes) multilib=yes ;; - no) multilib=no ;; - *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; - esac -else - multilib=yes -fi - -# Check whether --enable-target-optspace or --disable-target-optspace was given. -if test "${enable_target_optspace+set}" = set; then - enableval="$enable_target_optspace" - case "${enableval}" in - yes) target_optspace=yes ;; - no) target_optspace=no ;; - *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; - esac -else - target_optspace= -fi - -# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. -if test "${enable_malloc_debugging+set}" = set; then - enableval="$enable_malloc_debugging" - case "${enableval}" in - yes) malloc_debugging=yes ;; - no) malloc_debugging=no ;; - *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;; - esac -else - malloc_debugging= -fi - -# Check whether --enable-newlib-mb or --disable-newlib-mb was given. -if test "${enable_newlib_mb+set}" = set; then - enableval="$enable_newlib_mb" - case "${enableval}" in - yes) newlib_mb=yes ;; - no) newlib_mb=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; - esac -else - newlib_mb= -fi - -# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given. -if test "${enable_newlib_multithread+set}" = set; then - enableval="$enable_newlib_multithread" - case "${enableval}" in - yes) newlib_multithread=yes ;; - no) newlib_multithread=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;; - esac -else - newlib_multithread=yes -fi - -# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given. -if test "${enable_newlib_elix_level+set}" = set; then - enableval="$enable_newlib_elix_level" - case "${enableval}" in - 0) newlib_elix_level=0 ;; - 1) newlib_elix_level=1 ;; - 2) newlib_elix_level=2 ;; - 3) newlib_elix_level=3 ;; - 4) newlib_elix_level=4 ;; - *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;; - esac -else - newlib_elix_level=0 -fi - -# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given. -if test "${enable_newlib_io_float+set}" = set; then - enableval="$enable_newlib_io_float" - case "${enableval}" in - yes) newlib_io_float=yes ;; - no) newlib_io_float=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;; - esac -else - newlib_io_float=yes -fi - - - -test -z "${with_target_subdir}" && with_target_subdir=. - -if test "${srcdir}" = "."; then - if test "${with_target_subdir}" != "."; then - newlib_basedir="${srcdir}/${with_multisrctop}../../../.." - else - newlib_basedir="${srcdir}/${with_multisrctop}../../.." - fi -else - newlib_basedir="${srcdir}/../../.." -fi - - - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:933: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:954: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:972: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - - -PACKAGE=newlib - -VERSION=1.10.0 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <<EOF -#define PACKAGE "$PACKAGE" -EOF - -cat >> confdefs.h <<EOF -#define VERSION "$VERSION" -EOF - - - -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1015: checking for working aclocal" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal - echo "$ac_t""found" 1>&6 -else - ACLOCAL="$missing_dir/missing aclocal" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1028: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 -else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1041: checking for working automake" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake - echo "$ac_t""found" 1>&6 -else - AUTOMAKE="$missing_dir/missing automake" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1054: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 -else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1067: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 -fi - - - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1092: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1122: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1171: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1195: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1226: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ac_tool_prefix}as" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - -# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1258: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" -fi -fi -AR="$ac_cv_prog_AR" -if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1290: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1322: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - RANLIB=":" -fi -fi - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1367: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1421: checking whether to enable maintainer-specific portions of Makefiles" >&5 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - MAINT=$MAINTAINER_MODE_TRUE - - - -# We need AC_EXEEXT to keep automake happy in cygnus mode. However, -# at least currently, we never actually build a program, so we never -# need to use $(EXEEXT). Moreover, the test for EXEEXT normally -# fails, because we are probably configuring with a cross compiler -# which can't create executables. So we include AC_EXEEXT to keep -# automake happy, but we don't execute it, since we don't care about -# the result. -if false; then - - -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1455: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:1465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - -fi - -. ${newlib_basedir}/configure.host - -newlib_cflags="${newlib_cflags} -fno-builtin" - -NEWLIB_CFLAGS=${newlib_cflags} - - -LDFLAGS=${ldflags} - - - - -if test x${newlib_elix_level} = x0; then - ELIX_LEVEL_0_TRUE= - ELIX_LEVEL_0_FALSE='#' -else - ELIX_LEVEL_0_TRUE='#' - ELIX_LEVEL_0_FALSE= -fi - - -if test x${newlib_elix_level} = x1; then - ELIX_LEVEL_1_TRUE= - ELIX_LEVEL_1_FALSE='#' -else - ELIX_LEVEL_1_TRUE='#' - ELIX_LEVEL_1_FALSE= -fi - - -if test x${newlib_elix_level} = x2; then - ELIX_LEVEL_2_TRUE= - ELIX_LEVEL_2_FALSE='#' -else - ELIX_LEVEL_2_TRUE='#' - ELIX_LEVEL_2_FALSE= -fi - - -if test x${newlib_elix_level} = x3; then - ELIX_LEVEL_3_TRUE= - ELIX_LEVEL_3_FALSE='#' -else - ELIX_LEVEL_3_TRUE='#' - ELIX_LEVEL_3_FALSE= -fi - - -if test x${newlib_elix_level} = x4; then - ELIX_LEVEL_4_TRUE= - ELIX_LEVEL_4_FALSE='#' -else - ELIX_LEVEL_4_TRUE='#' - ELIX_LEVEL_4_FALSE= -fi - - - -if test x${use_libtool} = xyes; then - USE_LIBTOOL_TRUE= - USE_LIBTOOL_FALSE='#' -else - USE_LIBTOOL_TRUE='#' - USE_LIBTOOL_FALSE= -fi - -# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we -# use oext, which is set in configure.host based on the target platform. -OBJEXT=${oext} - - - - - - - - - - - -if test "${use_libtool}" = "yes"; then - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_shared=yes -fi - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_static=yes -fi - -# Check whether --enable-fast-install or --disable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_fast_install=yes -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1641: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1671: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1722: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1754: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1765 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1796: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1801: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1810: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1829: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1872: checking for ld used by GCC" >&5 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1902: checking for GNU ld" >&5 -else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1905: checking for non-GNU ld" >&5 -fi -if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1940: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi -fi - -echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - -echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1957: checking for $LD option to reload object files" >&5 -if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - lt_cv_ld_reload_flag='-r' -fi - -echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" - -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1969: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi - -NM="$lt_cv_path_NM" -echo "$ac_t""$NM" 1>&6 - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2007: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:2028: checking how to recognise dependant libraries" >&5 -if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* |pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.012) - lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd* ) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - case $host_cpu in - hppa*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - esac - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' - fi - ;; - -newsos6) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv5uw[78]* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; -esac - -fi - -echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method - -echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:2201: checking for object suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftest* -echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:2207: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_objext" 1>&6 -OBJEXT=$ac_cv_objext -ac_objext=$ac_cv_objext - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:2231: checking for ${ac_tool_prefix}file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:2293: checking for file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2364: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2396: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - RANLIB=":" -fi -fi - -# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2431: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_STRIP"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2463: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="strip" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" -fi -fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - STRIP=":" -fi -fi - - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - -libtool_flags="$libtool_flags --enable-win32-dll" -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - : -fi - -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Check whether --with-pic or --without-pic was given. -if test "${with_pic+set}" = set; then - withval="$with_pic" - pic_mode="$withval" -else - pic_mode=default -fi - -test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" -test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 2530 "configure"' > conftest.$ac_ext - if { (eval echo configure:2531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case "`/usr/bin/file conftest.o`" in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2568: checking whether the C compiler needs -belf" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - - cat > conftest.$ac_ext <<EOF -#line 2581 "configure" -#include "confdefs.h" - -int main() { - -; return 0; } -EOF -if { (eval echo configure:2588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_cc_needs_belf=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_needs_belf=no -fi -rm -f conftest* - ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -fi - -echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -*-*-cygwin* | *-*-mingw* | *-*-pw32*) - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2618: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_DLLTOOL"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2650: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="dlltool" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - DLLTOOL="false" -fi -fi - - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2685: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ac_tool_prefix}as" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_AS"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2717: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="as" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - AS="false" -fi -fi - - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2752: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -OBJDUMP="$ac_cv_prog_OBJDUMP" -if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_OBJDUMP"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2784: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="objdump" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false" -fi -fi -OBJDUMP="$ac_cv_prog_OBJDUMP" -if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - OBJDUMP="false" -fi -fi - - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one - echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 -echo "configure:2820: checking if libtool should supply DllMain function" >&5 -if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2825 "configure" -#include "confdefs.h" - -int main() { -extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); - DllMain (0, 0, 0); -; return 0; } -EOF -if { (eval echo configure:2833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_need_dllmain=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_need_dllmain=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$lt_cv_need_dllmain" 1>&6 - - case $host/$CC in - *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) - # old mingw systems require "-dll" to link a DLL, while more recent ones - # require "-mdll" - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdll" - echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 -echo "configure:2854: checking how to link DLLs" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2859 "configure" -#include "confdefs.h" - -int main() { - -; return 0; } -EOF -if { (eval echo configure:2866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_cc_dll_switch=-mdll -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_dll_switch=-dll -fi -rm -f conftest* -fi - -echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6 - CFLAGS="$SAVE_CFLAGS" ;; - *-*-cygwin* | *-*-pw32*) - # cygwin systems need to pass --dll to the linker, and not link - # crt.o which will require a WinMain@16 definition. - lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; - esac - ;; - -esac - - -# Save cache, so that ltconfig can load it -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } - -# Reload cache, that may have been modified by ltconfig -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log - - - - - - -for ac_prog in mawk gawk nawk awk -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2980: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AWK" && break -done - -fi - -LINUX_MACH_LIB= -if test -n "${machine_dir}"; then - if test "${use_libtool}" = "yes"; then - LINUX_MACH_LIB=machine/${machine_dir}/liblinux${machine_dir}.${aext} - else - LINUX_MACH_LIB=machine/lib.${aext} - fi -fi - - - -subdirs="machine $EXTRA_DIRS" - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile cmath/Makefile argp/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@newlib_basedir@%$newlib_basedir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g -s%@AS@%$AS%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g -s%@EXEEXT@%$EXEEXT%g -s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g -s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g -s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g -s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g -s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g -s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g -s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g -s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g -s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g -s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g -s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g -s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g -s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g -s%@OBJEXT@%$OBJEXT%g -s%@oext@%$oext%g -s%@aext@%$aext%g -s%@libm_machine_dir@%$libm_machine_dir%g -s%@machine_dir@%$machine_dir%g -s%@sys_dir@%$sys_dir%g -s%@LN_S@%$LN_S%g -s%@STRIP@%$STRIP%g -s%@DLLTOOL@%$DLLTOOL%g -s%@OBJDUMP@%$OBJDUMP%g -s%@LIBTOOL@%$LIBTOOL%g -s%@AWK@%$AWK%g -s%@LINUX_MACH_LIB@%$LINUX_MACH_LIB%g -s%@subdirs@%$subdirs%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile cmath/Makefile argp/Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - -if test "$no_recursion" != yes; then - - # Remove --cache-file and --srcdir arguments so they do not pile up. - ac_sub_configure_args= - ac_prev= - for ac_arg in $ac_configure_args; do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case "$ac_arg" in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; - esac - done - - for ac_config_dir in machine $EXTRA_DIRS; do - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - if test ! -d $srcdir/$ac_config_dir; then - continue - fi - - echo configuring in $ac_config_dir - - case "$srcdir" in - .) ;; - *) - if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; - else - { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } - fi - ;; - esac - - ac_popdir=`pwd` - cd $ac_config_dir - - # A "../" for each directory in /$ac_config_dir. - ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` - - case "$srcdir" in - .) # No --srcdir option. We are building in place. - ac_sub_srcdir=$srcdir ;; - /*) # Absolute path. - ac_sub_srcdir=$srcdir/$ac_config_dir ;; - *) # Relative path. - ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; - esac - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_sub_srcdir/configure; then - ac_sub_configure=$ac_sub_srcdir/configure - elif test -f $ac_sub_srcdir/configure.in; then - ac_sub_configure=$ac_configure - else - echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - - # Make the cache file name correct relative to the subdirectory. - case "$cache_file" in - /*) ac_sub_cache_file=$cache_file ;; - *) # Relative path. - ac_sub_cache_file="$ac_dots$cache_file" ;; - esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" - # The eval makes quoting arguments work. - if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir - then : - else - { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } - fi - fi - - cd $ac_popdir - done -fi - diff --git a/newlib/libc/sys/linux/configure.in b/newlib/libc/sys/linux/configure.in deleted file mode 100644 index 857c6f9e7..000000000 --- a/newlib/libc/sys/linux/configure.in +++ /dev/null @@ -1,35 +0,0 @@ -dnl This is the newlib/libc/sys/linux configure.in file. -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.5) -AC_INIT(linux.c) - -dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. -AC_CONFIG_AUX_DIR(../../../..) - -NEWLIB_CONFIGURE(../../..) - -dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and -dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first -dnl line of the macro which fail because appropriate LDFLAGS are not set. - -if test "${use_libtool}" = "yes"; then -AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL -AC_PROG_AWK -fi - -LINUX_MACH_LIB= -if test -n "${machine_dir}"; then - if test "${use_libtool}" = "yes"; then - LINUX_MACH_LIB=machine/${machine_dir}/liblinux${machine_dir}.${aext} - else - LINUX_MACH_LIB=machine/lib.${aext} - fi -fi -AC_SUBST(LINUX_MACH_LIB) - - -AC_CONFIG_SUBDIRS(machine $EXTRA_DIRS) - -AC_OUTPUT(Makefile cmath/Makefile argp/Makefile) diff --git a/newlib/libc/sys/linux/confstr.c b/newlib/libc/sys/linux/confstr.c deleted file mode 100644 index 6b566b308..000000000 --- a/newlib/libc/sys/linux/confstr.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 1991, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define _GNU_SOURCE 1 - -#include <stddef.h> -#include <errno.h> -#include <unistd.h> -#include <string.h> -#include <confstr.h> - -/* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes - of BUF with the value corresponding to NAME and zero-terminate BUF. - Return the number of bytes required to hold NAME's entire value. */ -size_t -confstr (name, buf, len) - int name; - char *buf; - size_t len; -{ - const char *string; - size_t string_len; - - switch (name) - { - case _CS_PATH: - { - static const char cs_path[] = CS_PATH; - string = cs_path; - string_len = sizeof (cs_path); - } - break; - - case _CS_V6_WIDTH_RESTRICTED_ENVS: - /* We have to return a newline-separated list of named of - programming environements in which the widths of blksize_t, - cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t, - ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and - wint_t types are no greater than the width of type long. - - Currently this means all environment which the system allows. */ - { - static const char restenvs[] = -#if _POSIX_V6_ILP32_OFF32 > 0 - "_POSIX_V6_ILP32_OFF32" -#endif -#if _POSIX_V6_ILP32_OFFBIG > 0 -# if _POSIX_V6_ILP32_OFF32 > 0 - "\n" -# endif - "_POSIX_V6_ILP32_OFFBIG" -#endif -#if _POSIX_V6_LP64_OFF64 > 0 -# if _POSIX_V6_ILP32_OFF32 > 0 || _POSIX_V6_ILP32_OFFBIG > 0 - "\n" -# endif - "_POSIX_V6_LP64_OFF64" -#endif -#if _POSIX_V6_LPBIG_OFFBIG > 0 -# if _POSIX_V6_ILP32_OFF32 > 0 || _POSIX_V6_ILP32_OFFBIG > 0 \ - || _POSIX_V6_LP64_OFF64 > 0 - "\n" -# endif - "_POSIX_V6_LPBIG_OFFBIG" -#endif - ; - string = restenvs; - string_len = sizeof (restenvs); - } - break; - - case _CS_XBS5_ILP32_OFFBIG_CFLAGS: - case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: - case _CS_LFS_CFLAGS: -#if _XBS5_LP64_OFF64 == -1 && _XBS5_LPBIG_OFFBIG == -1 && _XBS5_ILP32_OFFBIG == 1 - /* Signal that we want the new ABI. */ - { - static const char file_offset[] = "-D_FILE_OFFSET_BITS=64"; - string = file_offset; - string_len = sizeof (file_offset); - } - break; -#endif - /* FALLTHROUGH */ - - case _CS_LFS_LINTFLAGS: - case _CS_LFS_LDFLAGS: - case _CS_LFS_LIBS: - case _CS_LFS64_CFLAGS: - case _CS_LFS64_LINTFLAGS: - case _CS_LFS64_LDFLAGS: - case _CS_LFS64_LIBS: - - case _CS_XBS5_ILP32_OFF32_CFLAGS: - case _CS_XBS5_ILP32_OFF32_LDFLAGS: - case _CS_XBS5_ILP32_OFF32_LIBS: - case _CS_XBS5_ILP32_OFF32_LINTFLAGS: - case _CS_XBS5_ILP32_OFFBIG_LDFLAGS: - case _CS_XBS5_ILP32_OFFBIG_LIBS: - case _CS_XBS5_ILP32_OFFBIG_LINTFLAGS: - case _CS_XBS5_LP64_OFF64_CFLAGS: - case _CS_XBS5_LP64_OFF64_LDFLAGS: - case _CS_XBS5_LP64_OFF64_LIBS: - case _CS_XBS5_LP64_OFF64_LINTFLAGS: - case _CS_XBS5_LPBIG_OFFBIG_CFLAGS: - case _CS_XBS5_LPBIG_OFFBIG_LDFLAGS: - case _CS_XBS5_LPBIG_OFFBIG_LIBS: - case _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS: - - case _CS_POSIX_V6_ILP32_OFF32_CFLAGS: - case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: - case _CS_POSIX_V6_ILP32_OFF32_LIBS: - case _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: - case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: - case _CS_POSIX_V6_ILP32_OFFBIG_LIBS: - case _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: - case _CS_POSIX_V6_LP64_OFF64_CFLAGS: - case _CS_POSIX_V6_LP64_OFF64_LDFLAGS: - case _CS_POSIX_V6_LP64_OFF64_LIBS: - case _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: - case _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: - case _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: - case _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: - case _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: - /* GNU libc does not require special actions to use LFS functions. */ - string = ""; - string_len = 1; - break; - - default: - __set_errno (EINVAL); - return 0; - } - - if (len > 0 && buf != NULL) - { - if (string_len <= len) - memcpy (buf, string, string_len); - else - { - memcpy (buf, string, len - 1); - buf[len - 1] = '\0'; - } - } - return string_len; -} diff --git a/newlib/libc/sys/linux/confstr.h b/newlib/libc/sys/linux/confstr.h deleted file mode 100644 index 15859c3b2..000000000 --- a/newlib/libc/sys/linux/confstr.h +++ /dev/null @@ -1 +0,0 @@ -#define CS_PATH "/bin:/usr/bin" diff --git a/newlib/libc/sys/linux/crt1.c b/newlib/libc/sys/linux/crt1.c deleted file mode 100644 index 018e9a2d4..000000000 --- a/newlib/libc/sys/linux/crt1.c +++ /dev/null @@ -1,3 +0,0 @@ -/* dummy crt1.c file to override the one normally used by - gcc which refers to glibc variables that don't exist in - newlib. */ diff --git a/newlib/libc/sys/linux/ctermid.c b/newlib/libc/sys/linux/ctermid.c deleted file mode 100644 index 05914ffad..000000000 --- a/newlib/libc/sys/linux/ctermid.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ctermid */ - -#include <stdio.h> -#include <string.h> - -static char devname[] = "/dev/tty"; - -char * -_DEFUN (ctermid, (buf), - char *buf) -{ - if (buf == NULL) - return devname; - - return strcpy (buf, "/dev/tty"); -} diff --git a/newlib/libc/sys/linux/fclean.c b/newlib/libc/sys/linux/fclean.c deleted file mode 100644 index 2fb11fc83..000000000 --- a/newlib/libc/sys/linux/fclean.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int -fclean (FILE *fp) -{ - return fflush (fp); -} diff --git a/newlib/libc/sys/linux/flockfile.c b/newlib/libc/sys/linux/flockfile.c deleted file mode 100644 index 4a6cbc461..000000000 --- a/newlib/libc/sys/linux/flockfile.c +++ /dev/null @@ -1,9 +0,0 @@ -/* stub to allow libpthread to override */ - -#include <stdio.h> -#include <machine/weakalias.h> - -void __libc_flockfile (FILE *fp) -{ -} -weak_alias(__libc_flockfile,flockfile) diff --git a/newlib/libc/sys/linux/fpathconf.c b/newlib/libc/sys/linux/fpathconf.c deleted file mode 100644 index 6d006a11b..000000000 --- a/newlib/libc/sys/linux/fpathconf.c +++ /dev/null @@ -1,303 +0,0 @@ -/* Linux specific extensions to fpathconf. - Copyright (C) 1991,95,96,98,99,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib July 19, 2002 by Jeff Johnston */ - -#include <errno.h> -#include <stddef.h> -#include <unistd.h> -#include <limits.h> -#include <sys/stat.h> -#include <sys/statfs.h> -#include <sys/statvfs.h> -#include <machine/weakalias.h> -#include "linux_fsinfo.h" - -/* The Linux kernel header mentioned this as a kind of generic value. */ -#define LINUX_LINK_MAX 127 - -static long int posix_fpathconf (int fd, int name); - -/* Get file-specific information about descriptor FD. */ -long int -__fpathconf (fd, name) - int fd; - int name; -{ - if (name == _PC_LINK_MAX) - { - struct statfs fsbuf; - - /* Determine the filesystem type. */ - if (__fstatfs (fd, &fsbuf) < 0) - { - if (errno == ENOSYS) - /* not possible, return the default value. */ - return LINUX_LINK_MAX; - - /* Some error occured. */ - return -1; - } - - switch (fsbuf.f_type) - { - case EXT2_SUPER_MAGIC: - return EXT2_LINK_MAX; - - case MINIX_SUPER_MAGIC: - case MINIX_SUPER_MAGIC2: - return MINIX_LINK_MAX; - - case MINIX2_SUPER_MAGIC: - case MINIX2_SUPER_MAGIC2: - return MINIX2_LINK_MAX; - - case XENIX_SUPER_MAGIC: - return XENIX_LINK_MAX; - - case SYSV4_SUPER_MAGIC: - case SYSV2_SUPER_MAGIC: - return SYSV_LINK_MAX; - - case COH_SUPER_MAGIC: - return COH_LINK_MAX; - - case UFS_MAGIC: - case UFS_CIGAM: - return UFS_LINK_MAX; - - case REISERFS_SUPER_MAGIC: - return REISERFS_LINK_MAX; - - default: - return LINUX_LINK_MAX; - } - } - - return posix_fpathconf (fd, name); -} - -/* Get file-specific information about descriptor FD. */ -static long int -posix_fpathconf (fd, name) - int fd; - int name; -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - - switch (name) - { - default: - __set_errno (EINVAL); - return -1; - - case _PC_LINK_MAX: -#ifdef LINK_MAX - return LINK_MAX; -#else - return -1; -#endif - - case _PC_MAX_CANON: -#ifdef MAX_CANON - return MAX_CANON; -#else - return -1; -#endif - - case _PC_MAX_INPUT: -#ifdef MAX_INPUT - return MAX_INPUT; -#else - return -1; -#endif - - case _PC_NAME_MAX: -#ifdef NAME_MAX - { - struct statfs buf; - int save_errno = errno; - - if (__fstatfs (fd, &buf) < 0) - { - if (errno == ENOSYS) - { - __set_errno (save_errno); - return NAME_MAX; - } - else if (errno == ENODEV) - __set_errno (EINVAL); - - return -1; - } - else - { -#ifdef _STATFS_F_NAMELEN - return buf.f_namelen; -#else -# ifdef _STATFS_F_NAME_MAX - return buf.f_name_max; -# else - return NAME_MAX; -# endif -#endif - } - } -#else - return -1; -#endif - - case _PC_PATH_MAX: -#ifdef PATH_MAX - return PATH_MAX; -#else - return -1; -#endif - - case _PC_PIPE_BUF: -#ifdef PIPE_BUF - return PIPE_BUF; -#else - return -1; -#endif - - case _PC_CHOWN_RESTRICTED: -#ifdef _POSIX_CHOWN_RESTRICTED - return _POSIX_CHOWN_RESTRICTED; -#else - return -1; -#endif - - case _PC_NO_TRUNC: -#ifdef _POSIX_NO_TRUNC - return _POSIX_NO_TRUNC; -#else - return -1; -#endif - - case _PC_VDISABLE: -#ifdef _POSIX_VDISABLE - return _POSIX_VDISABLE; -#else - return -1; -#endif - - case _PC_SYNC_IO: -#ifdef _POSIX_SYNC_IO - return _POSIX_SYNC_IO; -#else - return -1; -#endif - - case _PC_ASYNC_IO: -#ifdef _POSIX_ASYNC_IO - { - /* AIO is only allowed on regular files and block devices. */ - struct stat64 st; - - if (fstat64 (fd, &st) < 0 - || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) - return -1; - else - return 1; - } -#else - return -1; -#endif - - case _PC_PRIO_IO: -#ifdef _POSIX_PRIO_IO - return _POSIX_PRIO_IO; -#else - return -1; -#endif - - case _PC_SOCK_MAXBUF: -#ifdef SOCK_MAXBUF - return SOCK_MAXBUF; -#else - return -1; -#endif - - case _PC_FILESIZEBITS: -#ifdef FILESIZEBITS - return FILESIZEBITS; -#else - /* We let platforms with larger file sizes overwrite this value. */ - return 32; -#endif - - case _PC_REC_INCR_XFER_SIZE: - /* XXX It is not entirely clear what the limit is supposed to do. - What is incremented? */ - return -1; - - case _PC_REC_MAX_XFER_SIZE: - /* XXX It is not entirely clear what the limit is supposed to do. - In general there is no top limit of the number of bytes which - case be transported at once. */ - return -1; - - case _PC_REC_MIN_XFER_SIZE: - { - /* XXX It is not entirely clear what the limit is supposed to do. - I assume this is the block size of the filesystem. */ - struct statvfs64 sv; - - if (__fstatvfs64 (fd, &sv) < 0) - return -1; - return sv.f_bsize; - } - - case _PC_REC_XFER_ALIGN: - { - /* XXX It is not entirely clear what the limit is supposed to do. - I assume that the number should reflect the minimal block - alignment. */ - struct statvfs64 sv; - - if (__fstatvfs64 (fd, &sv) < 0) - return -1; - return sv.f_frsize; - } - - case _PC_ALLOC_SIZE_MIN: - { - /* XXX It is not entirely clear what the limit is supposed to do. - I assume that the number should reflect the minimal block - alignment. */ - struct statvfs64 sv; - - if (__fstatvfs64 (fd, &sv) < 0) - return -1; - return sv.f_frsize; - } - - case _PC_SYMLINK_MAX: - /* In general there are no limits. If a system has one it should - overwrite this case. */ - return -1; - } -} - -weak_alias (__fpathconf, fpathconf) diff --git a/newlib/libc/sys/linux/free.c b/newlib/libc/sys/linux/free.c deleted file mode 100644 index 818e05a75..000000000 --- a/newlib/libc/sys/linux/free.c +++ /dev/null @@ -1 +0,0 @@ -/* dummy file to override one object in stdlib directory */ diff --git a/newlib/libc/sys/linux/freer.c b/newlib/libc/sys/linux/freer.c deleted file mode 100644 index d8d7f9828..000000000 --- a/newlib/libc/sys/linux/freer.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void -_free_r (struct _reent *ptr, void *addr) -{ - free (addr); -} diff --git a/newlib/libc/sys/linux/fstab.c b/newlib/libc/sys/linux/fstab.c deleted file mode 100644 index f98f4b740..000000000 --- a/newlib/libc/sys/linux/fstab.c +++ /dev/null @@ -1,195 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fstab.h> -#include <mntent.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <bits/libc-lock.h> -#include <libc-symbols.h> - -#define BUFFER_SIZE 0x1fc0 - -struct fstab_state -{ - FILE *fs_fp; - char *fs_buffer; - struct mntent fs_mntres; - struct fstab fs_ret; -}; - -static struct fstab_state *fstab_init (int opt_rewind); -static struct mntent *fstab_fetch (struct fstab_state *state); -static struct fstab *fstab_convert (struct fstab_state *state); - -static struct fstab_state fstab_state; - - -int -setfsent (void) -{ - return fstab_init (1) != NULL; -} - - -struct fstab * -getfsent (void) -{ - struct fstab_state *state; - - state = fstab_init (0); - if (state == NULL) - return NULL; - if (fstab_fetch (state) == NULL) - return NULL; - return fstab_convert (state); -} - - -struct fstab * -getfsspec (name) - const char *name; -{ - struct fstab_state *state; - struct mntent *m; - - state = fstab_init (1); - if (state == NULL) - return NULL; - while ((m = fstab_fetch (state)) != NULL) - if (strcmp (m->mnt_fsname, name) == 0) - return fstab_convert (state); - return NULL; -} - - -struct fstab * -getfsfile (name) - const char *name; -{ - struct fstab_state *state; - struct mntent *m; - - state = fstab_init (1); - if (state == NULL) - return NULL; - while ((m = fstab_fetch (state)) != NULL) - if (strcmp (m->mnt_dir, name) == 0) - return fstab_convert (state); - return NULL; -} - - -void -endfsent () -{ - struct fstab_state *state; - - state = &fstab_state; - if (state->fs_fp != NULL) - { - (void) __endmntent (state->fs_fp); - state->fs_fp = NULL; - } -} - - -static struct fstab_state * -fstab_init (int opt_rewind) -{ - struct fstab_state *state; - char *buffer; - FILE *fp; - - state = &fstab_state; - - buffer = state->fs_buffer; - if (buffer == NULL) - { - buffer = (char *) malloc (BUFFER_SIZE); - if (buffer == NULL) - return NULL; - state->fs_buffer = buffer; - } - - fp = state->fs_fp; - if (fp != NULL) - { - if (opt_rewind) - rewind (fp); - } - else - { - fp = __setmntent (_PATH_FSTAB, "r"); - if (fp == NULL) - return NULL; - state->fs_fp = fp; - } - - return state; -} - - -static struct mntent * -fstab_fetch (struct fstab_state *state) -{ - return __getmntent_r (state->fs_fp, &state->fs_mntres, - state->fs_buffer, BUFFER_SIZE); -} - - -static struct fstab * -fstab_convert (struct fstab_state *state) -{ - struct mntent *m; - struct fstab *f; - - m = &state->fs_mntres; - f = &state->fs_ret; - - f->fs_spec = m->mnt_fsname; - f->fs_file = m->mnt_dir; - f->fs_vfstype = m->mnt_type; - f->fs_mntops = m->mnt_opts; - f->fs_type = (__hasmntopt (m, FSTAB_RW) ? FSTAB_RW : - __hasmntopt (m, FSTAB_RQ) ? FSTAB_RQ : - __hasmntopt (m, FSTAB_RO) ? FSTAB_RO : - __hasmntopt (m, FSTAB_SW) ? FSTAB_SW : - __hasmntopt (m, FSTAB_XX) ? FSTAB_XX : - "??"); - f->fs_freq = m->mnt_freq; - f->fs_passno = m->mnt_passno; - return f; -} - - -/* Make sure the memory is freed if the programs ends while in - memory-debugging mode and something actually was allocated. */ -static void -__attribute__ ((unused)) -fstab_free (void) -{ - char *buffer; - - buffer = fstab_state.fs_buffer; - if (buffer != NULL) - free ((void *) buffer); -} - -text_set_element (__libc_subfreeres, fstab_free); diff --git a/newlib/libc/sys/linux/fstatvfs.c b/newlib/libc/sys/linux/fstatvfs.c deleted file mode 100644 index e1a12603a..000000000 --- a/newlib/libc/sys/linux/fstatvfs.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define _GNU_SOURCE - -#include <errno.h> -#include <mntent.h> -#include <paths.h> -#include <string.h> -#include <sys/mount.h> -#include <sys/stat.h> -#include <sys/statfs.h> -#include <sys/statvfs.h> - - -int -fstatvfs (int fd, struct statvfs *buf) -{ - struct statfs fsbuf; - struct stat64 st; - - /* Get as much information as possible from the system. */ - if (__fstatfs (fd, &fsbuf) < 0) - return -1; - -#define STAT(st) fstat64 (fd, st) -#include "internal_statvfs.c" - - /* We signal success if the statfs call succeeded. */ - return 0; -} diff --git a/newlib/libc/sys/linux/fstatvfs64.c b/newlib/libc/sys/linux/fstatvfs64.c deleted file mode 100644 index 65c9e609b..000000000 --- a/newlib/libc/sys/linux/fstatvfs64.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Return information about the filesystem on which FD resides. - Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <sys/statvfs.h> -#include <string.h> -#include <machine/weakalias.h> - -/* Return information about the filesystem on which FD resides. */ -int -__fstatvfs64 (int fd, struct statvfs64 *buf) -{ - struct statvfs buf32; - - if (fstatvfs (fd, &buf32) < 0) - return -1; - - buf->f_bsize = buf32.f_bsize; - buf->f_frsize = buf32.f_frsize; - buf->f_blocks = buf32.f_blocks; - buf->f_bfree = buf32.f_bfree; - buf->f_bavail = buf32.f_bavail; - buf->f_files = buf32.f_files; - buf->f_ffree = buf32.f_ffree; - buf->f_favail = buf32.f_favail; - buf->f_fsid = buf32.f_fsid; - buf->f_flag = buf32.f_flag; - buf->f_namemax = buf32.f_namemax; - memcpy (buf->__f_spare, buf32.__f_spare, sizeof (buf32.__f_spare)); - - return 0; -} -weak_alias (__fstatvfs64, fstatvfs64) diff --git a/newlib/libc/sys/linux/ftok.c b/newlib/libc/sys/linux/ftok.c deleted file mode 100644 index 2f4b684b5..000000000 --- a/newlib/libc/sys/linux/ftok.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib by Jeff Johnston, June 10/2002 */ - -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/stat.h> - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 -#define STAT stat64 -#else -#define STAT stat -#endif - -key_t -ftok (pathname, proj_id) - const char *pathname; - int proj_id; -{ - struct STAT st; - key_t key; - - if (STAT (pathname, &st) < 0) - return (key_t) -1; - - key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) - | ((proj_id & 0xff) << 24)); - - return key; -} diff --git a/newlib/libc/sys/linux/ftw.c b/newlib/libc/sys/linux/ftw.c deleted file mode 100644 index a7f7259bc..000000000 --- a/newlib/libc/sys/linux/ftw.c +++ /dev/null @@ -1,640 +0,0 @@ -/* File tree walker functions. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib by Jeff Johnston, July 26, 2002 */ - -#define _GNU_SOURCE 1 - -#include <dirent.h> -#include <errno.h> -#include <ftw.h> -#include <search.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/param.h> -#include <sys/stat.h> - -extern struct dirent64 *__readdir64 (DIR *); - -/* #define NDEBUG 1 */ -#include <assert.h> - -/* Support for the LFS API version. */ -#ifndef FTW_NAME -# define FTW_NAME ftw -# define NFTW_NAME nftw -# define INO_T ino_t -# define STAT stat -# define LXSTAT lstat -# define XSTAT stat -# define FTW_FUNC_T __ftw_func_t -# define NFTW_FUNC_T __nftw_func_t -#endif - -#define dirfd(x) ((x)->dd_fd) - -struct dir_data -{ - DIR *stream; - char *content; -}; - -struct known_object -{ - dev_t dev; - INO_T ino; -}; - -struct ftw_data -{ - /* Array with pointers to open directory streams. */ - struct dir_data **dirstreams; - size_t actdir; - size_t maxdir; - - /* Buffer containing name of currently processed object. */ - char *dirbuf; - size_t dirbufsize; - - /* Passed as fourth argument to `nftw' callback. The `base' member - tracks the content of the `dirbuf'. */ - struct FTW ftw; - - /* Flags passed to `nftw' function. 0 for `ftw'. */ - int flags; - - /* Conversion array for flag values. It is the identity mapping for - `nftw' calls, otherwise it maps the values to those know by - `ftw'. */ - const int *cvt_arr; - - /* Callback function. We always use the `nftw' form. */ - NFTW_FUNC_T func; - - /* Device of starting point. Needed for FTW_MOUNT. */ - dev_t dev; - - /* Data structure for keeping fingerprints of already processed - object. This is needed when not using FTW_PHYS. */ - void *known_objects; -}; - - -/* Internally we use the FTW_* constants used for `nftw'. When the - process called `ftw' we must reduce the flag to the known flags - for `ftw'. */ -static const int nftw_arr[] = -{ - FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_SL, FTW_DP, FTW_SLN -}; - -static const int ftw_arr[] = -{ - FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_F, FTW_D, FTW_NS -}; - - -/* Forward declarations of local functions. */ -static int ftw_dir (struct ftw_data *data, struct STAT *st); - - -static int -object_compare (const void *p1, const void *p2) -{ - /* We don't need a sophisticated and useful comparison. We are only - interested in equality. However, we must be careful not to - accidentally compare `holes' in the structure. */ - const struct known_object *kp1 = p1, *kp2 = p2; - int cmp1; - cmp1 = (kp1->dev > kp2->dev) - (kp1->dev < kp2->dev); - if (cmp1 != 0) - return cmp1; - return (kp1->ino > kp2->ino) - (kp1->ino < kp2->ino); -} - - -static inline int -add_object (struct ftw_data *data, struct STAT *st) -{ - struct known_object *newp = malloc (sizeof (struct known_object)); - if (newp == NULL) - return -1; - newp->dev = st->st_dev; - newp->ino = st->st_ino; - return tsearch (newp, &data->known_objects, object_compare) ? 0 : -1; -} - - -static inline int -find_object (struct ftw_data *data, struct STAT *st) -{ - struct known_object obj = { dev: st->st_dev, ino: st->st_ino }; - return tfind (&obj, &data->known_objects, object_compare) != NULL; -} - - -static inline int -open_dir_stream (struct ftw_data *data, struct dir_data *dirp) -{ - int result = 0; - - if (data->dirstreams[data->actdir] != NULL) - { - /* Oh, oh. We must close this stream. Get all remaining - entries and store them as a list in the `content' member of - the `struct dir_data' variable. */ - size_t bufsize = 1024; - char *buf = malloc (bufsize); - - if (buf == NULL) - result = -1; - else - { - DIR *st = data->dirstreams[data->actdir]->stream; - struct dirent64 *d; - size_t actsize = 0; - - while ((d = __readdir64 (st)) != NULL) - { - size_t this_len = strlen (d->d_name); - if (actsize + this_len + 2 >= bufsize) - { - char *newp; - bufsize += MAX (1024, 2 * this_len); - newp = realloc (buf, bufsize); - if (newp == NULL) - { - /* No more memory. */ - int save_err = errno; - free (buf); - __set_errno (save_err); - result = -1; - break; - } - buf = newp; - } - - *((char *) mempcpy (buf + actsize, d->d_name, this_len)) - = '\0'; - actsize += this_len + 1; - } - - /* Terminate the list with an additional NUL byte. */ - buf[actsize++] = '\0'; - - /* Shrink the buffer to what we actually need. */ - data->dirstreams[data->actdir]->content = realloc (buf, actsize); - if (data->dirstreams[data->actdir]->content == NULL) - { - int save_err = errno; - free (buf); - __set_errno (save_err); - result = -1; - } - else - { - closedir (st); - data->dirstreams[data->actdir]->stream = NULL; - data->dirstreams[data->actdir] = NULL; - } - } - } - - /* Open the new stream. */ - if (result == 0) - { - assert (data->dirstreams[data->actdir] == NULL); - - dirp->stream = opendir (data->dirbuf); - if (dirp->stream == NULL) - result = -1; - else - { - dirp->content = NULL; - data->dirstreams[data->actdir] = dirp; - - if (++data->actdir == data->maxdir) - data->actdir = 0; - } - } - - return result; -} - - -static inline int -process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, - size_t namlen) -{ - struct STAT st; - int result = 0; - int flag = 0; - - if (name[0] == '.' && (name[1] == '\0' - || (name[1] == '.' && name[2] == '\0'))) - /* Don't process the "." and ".." entries. */ - return 0; - - if (data->dirbufsize < data->ftw.base + namlen + 2) - { - /* Enlarge the buffer. */ - char *newp; - - data->dirbufsize *= 2; - newp = realloc (data->dirbuf, data->dirbufsize); - if (newp == NULL) - return -1; - data->dirbuf = newp; - } - - *((char *) mempcpy (data->dirbuf + data->ftw.base, name, namlen)) = '\0'; - - if (((data->flags & FTW_PHYS) - ? LXSTAT (data->dirbuf, &st) - : XSTAT (data->dirbuf, &st)) < 0) - { - if (errno != EACCES && errno != ENOENT) - result = -1; - else if (!(data->flags & FTW_PHYS) - && LXSTAT (data->dirbuf, &st) == 0 - && S_ISLNK (st.st_mode)) - flag = FTW_SLN; - else - flag = FTW_NS; - } - else - { - if (S_ISDIR (st.st_mode)) - flag = FTW_D; - else if (S_ISLNK (st.st_mode)) - flag = FTW_SL; - else - flag = FTW_F; - } - - if (result == 0 - && (flag == FTW_NS - || !(data->flags & FTW_MOUNT) || st.st_dev == data->dev)) - { - if (flag == FTW_D) - { - if ((data->flags & FTW_PHYS) - || (!find_object (data, &st) - /* Remember the object. */ - && (result = add_object (data, &st)) == 0)) - { - result = ftw_dir (data, &st); - - if (result == 0 && (data->flags & FTW_CHDIR)) - { - /* Change back to current directory. */ - int done = 0; - if (dir->stream != NULL) - if (fchdir (dirfd (dir->stream)) == 0) - done = 1; - - if (!done) - { - if (data->ftw.base == 1) - { - if (chdir ("/") < 0) - result = -1; - } - else - { - /* Please note that we overwrite a slash. */ - data->dirbuf[data->ftw.base - 1] = '\0'; - - if (chdir (data->dirbuf) < 0) - result = -1; - - data->dirbuf[data->ftw.base - 1] = '/'; - } - } - } - } - } - else - result = (*data->func) (data->dirbuf, &st, data->cvt_arr[flag], - &data->ftw); - } - - return result; -} - - -static int -ftw_dir (struct ftw_data *data, struct STAT *st) -{ - struct dir_data dir; - struct dirent64 *d; - int previous_base = data->ftw.base; - int result; - char *startp; - - /* Open the stream for this directory. This might require that - another stream has to be closed. */ - result = open_dir_stream (data, &dir); - if (result != 0) - { - if (errno == EACCES) - /* We cannot read the directory. Signal this with a special flag. */ - result = (*data->func) (data->dirbuf, st, FTW_DNR, &data->ftw); - - return result; - } - - /* First, report the directory (if not depth-first). */ - if (!(data->flags & FTW_DEPTH)) - { - result = (*data->func) (data->dirbuf, st, FTW_D, &data->ftw); - if (result != 0) - return result; - } - - /* If necessary, change to this directory. */ - if (data->flags & FTW_CHDIR) - { - if (fchdir (dirfd (dir.stream)) < 0) - { - if (errno == ENOSYS) - { - if (chdir (data->dirbuf) < 0) - result = -1; - } - else - result = -1; - } - - if (result != 0) - { - int save_err = errno; - closedir (dir.stream); - __set_errno (save_err); - - if (data->actdir-- == 0) - data->actdir = data->maxdir - 1; - data->dirstreams[data->actdir] = NULL; - - return result; - } - } - - /* Next, update the `struct FTW' information. */ - ++data->ftw.level; - startp = strchr (data->dirbuf, '\0'); - /* There always must be a directory name. */ - assert (startp != data->dirbuf); - if (startp[-1] != '/') - *startp++ = '/'; - data->ftw.base = startp - data->dirbuf; - - while (dir.stream != NULL && (d = __readdir64 (dir.stream)) != NULL) - { - result = process_entry (data, &dir, d->d_name, strlen (d->d_name)); - if (result != 0) - break; - } - - if (dir.stream != NULL) - { - /* The stream is still open. I.e., we did not need more - descriptors. Simply close the stream now. */ - int save_err = errno; - - assert (dir.content == NULL); - - closedir (dir.stream); - __set_errno (save_err); - - if (data->actdir-- == 0) - data->actdir = data->maxdir - 1; - data->dirstreams[data->actdir] = NULL; - } - else - { - int save_err; - char *runp = dir.content; - - while (result == 0 && *runp != '\0') - { - char *endp = strchr (runp, '\0'); - - result = process_entry (data, &dir, runp, endp - runp); - - runp = endp + 1; - } - - save_err = errno; - free (dir.content); - __set_errno (save_err); - } - - /* Prepare the return, revert the `struct FTW' information. */ - data->dirbuf[data->ftw.base - 1] = '\0'; - --data->ftw.level; - data->ftw.base = previous_base; - - /* Finally, if we process depth-first report the directory. */ - if (result == 0 && (data->flags & FTW_DEPTH)) - result = (*data->func) (data->dirbuf, st, FTW_DP, &data->ftw); - - return result; -} - - -static int -ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, - int flags) -{ - struct ftw_data data; - struct STAT st; - int result = 0; - int save_err; - int len; - char *cwd = NULL; - char *cp; - - /* First make sure the parameters are reasonable. */ - if (dir[0] == '\0') - { - __set_errno (ENOENT); - return -1; - } - - if (access (dir, R_OK) != 0) - return -1; - - data.maxdir = descriptors < 1 ? 1 : descriptors; - data.actdir = 0; - data.dirstreams = (struct dir_data **) alloca (data.maxdir - * sizeof (struct dir_data *)); - memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *)); - -#ifdef PATH_MAX - data.dirbufsize = MAX (2 * strlen (dir), PATH_MAX); -#else - data.dirbufsize = 2 * strlen (dir); -#endif - data.dirbuf = (char *) malloc (data.dirbufsize); - if (data.dirbuf == NULL) - return -1; - len = strlen (dir); - cp = mempcpy (data.dirbuf, dir, len); - /* Strip trailing slashes. */ - while (cp > data.dirbuf + 1 && cp[-1] == '/') - --cp; - *cp = '\0'; - - data.ftw.level = 0; - - /* Find basename. */ - while (cp > data.dirbuf && cp[-1] != '/') - --cp; - data.ftw.base = cp - data.dirbuf; - - data.flags = flags; - - /* This assignment might seem to be strange but it is what we want. - The trick is that the first three arguments to the `ftw' and - `nftw' callback functions are equal. Therefore we can call in - every case the callback using the format of the `nftw' version - and get the correct result since the stack layout for a function - call in C allows this. */ - data.func = (NFTW_FUNC_T) func; - - /* Since we internally use the complete set of FTW_* values we need - to reduce the value range before calling a `ftw' callback. */ - data.cvt_arr = is_nftw ? nftw_arr : ftw_arr; - - /* No object known so far. */ - data.known_objects = NULL; - - /* Now go to the directory containing the initial file/directory. */ - if ((flags & FTW_CHDIR) && data.ftw.base > 0) - { - /* GNU extension ahead. */ - cwd = getcwd (NULL, 0); - if (cwd == NULL) - result = -1; - else - { - /* Change to the directory the file is in. In data.dirbuf - we have a writable copy of the file name. Just NUL - terminate it for now and change the directory. */ - if (data.ftw.base == 1) - /* I.e., the file is in the root directory. */ - result = chdir ("/"); - else - { - char ch = data.dirbuf[data.ftw.base - 1]; - data.dirbuf[data.ftw.base - 1] = '\0'; - result = chdir (data.dirbuf); - data.dirbuf[data.ftw.base - 1] = ch; - } - } - } - - /* Get stat info for start directory. */ - if (result == 0) - { - if (((flags & FTW_PHYS) - ? LXSTAT (data.dirbuf, &st) - : XSTAT (data.dirbuf, &st)) < 0) - { - if (errno == EACCES) - result = (*data.func) (data.dirbuf, &st, FTW_NS, &data.ftw); - else if (!(flags & FTW_PHYS) - && errno == ENOENT - && LXSTAT (dir, &st) == 0 - && S_ISLNK (st.st_mode)) - result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN], - &data.ftw); - else - /* No need to call the callback since we cannot say anything - about the object. */ - result = -1; - } - else - { - if (S_ISDIR (st.st_mode)) - { - /* Remember the device of the initial directory in case - FTW_MOUNT is given. */ - data.dev = st.st_dev; - - /* We know this directory now. */ - if (!(flags & FTW_PHYS)) - result = add_object (&data, &st); - - if (result == 0) - result = ftw_dir (&data, &st); - } - else - { - int flag = S_ISLNK (st.st_mode) ? FTW_SL : FTW_F; - - result = (*data.func) (data.dirbuf, &st, data.cvt_arr[flag], - &data.ftw); - } - } - } - - /* Return to the start directory (if necessary). */ - if (cwd != NULL) - { - int save_err = errno; - chdir (cwd); - free (cwd); - __set_errno (save_err); - } - - /* Free all memory. */ - save_err = errno; - tdestroy (data.known_objects, free); - free (data.dirbuf); - __set_errno (save_err); - - return result; -} - - - -/* Entry points. */ - -int -FTW_NAME (path, func, descriptors) - const char *path; - FTW_FUNC_T func; - int descriptors; -{ - return ftw_startup (path, 0, func, descriptors, 0); -} - -int -NFTW_NAME (path, func, descriptors, flags) - const char *path; - NFTW_FUNC_T func; - int descriptors; - int flags; -{ - return ftw_startup (path, 1, func, descriptors, flags); -} diff --git a/newlib/libc/sys/linux/ftw64.c b/newlib/libc/sys/linux/ftw64.c deleted file mode 100644 index 216549ac3..000000000 --- a/newlib/libc/sys/linux/ftw64.c +++ /dev/null @@ -1,30 +0,0 @@ -/* File tree walker functions. LFS version. - Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define FTW_NAME ftw64 -#define NFTW_NAME nftw64 -#define INO_T ino64_t -#define STAT stat64 -#define LXSTAT lstat64 -#define XSTAT stat64 -#define FTW_FUNC_T __ftw64_func_t -#define NFTW_FUNC_T __nftw64_func_t - -#include "ftw.c" diff --git a/newlib/libc/sys/linux/funlockfile.c b/newlib/libc/sys/linux/funlockfile.c deleted file mode 100644 index 82466d30a..000000000 --- a/newlib/libc/sys/linux/funlockfile.c +++ /dev/null @@ -1,9 +0,0 @@ -/* stub to allow libpthread to override */ - -#include <stdio.h> -#include <machine/weakalias.h> - -void __libc_funlockfile (FILE *fp) -{ -} -weak_alias(__libc_funlockfile,funlockfile) diff --git a/newlib/libc/sys/linux/getdate.c b/newlib/libc/sys/linux/getdate.c deleted file mode 100644 index 5c056c750..000000000 --- a/newlib/libc/sys/linux/getdate.c +++ /dev/null @@ -1,325 +0,0 @@ -/* Convert a string representation of time to a time value. - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* -FUNCTION -<<getdate>>,<<getdate_r>>---convert a string representation of time to a time value - -INDEX - getdate -INDEX - getdate_r - -ANSI_SYNOPSIS - #include <time.h> - struct tm *getdate(const char *<[string]>); - int getdate_r(const char *<[string]>, struct tm *<[res]>); - -TRAD_SYNOPSIS - #include <time.h> - struct tm *getdate(<[string]>); - const char *<[string]>; - - int getdate_r(<[string]>, <[res]>); - const char *<[string]>; - struct tm *<[res]>; - -DESCRIPTION -<<getdate>> reads a file which is specified by the environment variable: -DATEMSK. This file contains a number of formats valid for input to the -<<strptime>> function. The input <[string]> is used as input to the format -strings and the first valid match that occurs is used. The resultant -time struct is returned. If an error occurs, the value <<getdate_err>> is -set to one of the following values. - - 1 the DATEMSK environment variable is null or undefined, - 2 the template file cannot be opened for reading, - 3 failed to get file status information, - 4 the template file is not a regular file, - 5 an error is encountered while reading the template file, - 6 memory allication failed (not enough memory available), - 7 there is no line in the template that matches the input, - 8 invalid input specification - -The <<getdate_r>> routine is similar, except that it returns the error -code and has the <[res]> time struct pointer passed in. <<getdate>> is -non-reentrant. Applications that wish to be reentrant should use -<<getdate_r>> instead of <<getdate>>. - -RETURNS -<<getdate>> returns a pointer to the traditional time representation -(<<struct tm>>). <<getdate_r>> returns 0 if successful, otherwise it -returns the error code. - -PORTABILITY -<<getdate>> is defined by the Single Unix specification. -<<getdate_r>> is a reentrant extension. - -<<getdate>> and <<getdate_r>> optionally require <<stat>> and <<access>>. -*/ - - -/* Modified for newlib by Jeff Johnston, June 19/2002 */ - -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <unistd.h> -#include <sys/stat.h> - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 -# define STAT stat64 -#else -# define STAT stat -#endif - -#define TM_YEAR_BASE 1900 - -extern ssize_t __getline (char **, size_t *, FILE *); - -/* Prototypes for local functions. */ -static int first_wday (int year, int mon, int wday); -static int check_mday (int year, int mon, int mday); - -#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) - -/* Error code is set to one of the following values to indicate an error. - 1 the DATEMSK environment variable is null or undefined, - 2 the template file cannot be opened for reading, - 3 failed to get file status information, - 4 the template file is not a regular file, - 5 an error is encountered while reading the template file, - 6 memory allication failed (not enough memory available), - 7 there is no line in the template that matches the input, - 8 invalid input specification Example: February 31 or a time is - specified that can not be represented in a time_t (representing - the time in seconds since 00:00:00 UTC, January 1, 1970) */ - -/* Returns the first weekday WDAY of month MON in the year YEAR. */ -static int -first_wday (int year, int mon, int wday) -{ - struct tm tm; - - if (wday == INT_MIN) - return 1; - - memset (&tm, 0, sizeof (struct tm)); - tm.tm_year = year; - tm.tm_mon = mon; - tm.tm_mday = 1; - mktime (&tm); - - return (1 + (wday - tm.tm_wday + 7) % 7); -} - - -/* Returns 1 if MDAY is a valid day of the month in month MON of year - YEAR, and 0 if it is not. */ -static int -check_mday (int year, int mon, int mday) -{ - switch (mon) - { - case 0: - case 2: - case 4: - case 6: - case 7: - case 9: - case 11: - if (mday >= 1 && mday <= 31) - return 1; - break; - case 3: - case 5: - case 8: - case 10: - if (mday >= 1 && mday <= 30) - return 1; - break; - case 1: - if (mday >= 1 && mday <= (isleap (year) ? 29 : 28)) - return 1; - break; - } - - return 0; -} - - -int -getdate_r (const char *string, struct tm *tp) -{ - FILE *fp; - char *line; - size_t len; - char *datemsk; - char *result = NULL; - time_t timer; - struct tm tm; - struct STAT st; - int mday_ok = 0; - - datemsk = getenv ("DATEMSK"); - if (datemsk == NULL || *datemsk == '\0') - return 1; - - if (STAT (datemsk, &st) < 0) - return 3; - - if (!S_ISREG (st.st_mode)) - return 4; - - if (access (datemsk, R_OK) < 0) - return 2; - - /* Open the template file. */ - fp = fopen (datemsk, "r"); - if (fp == NULL) - return 2; - - line = NULL; - len = 0; - do - { - ssize_t n; - - n = __getline (&line, &len, fp); - if (n < 0) - break; - if (line[n - 1] == '\n') - line[n - 1] = '\0'; - - /* Do the conversion. */ - tp->tm_year = tp->tm_mon = tp->tm_mday = tp->tm_wday = INT_MIN; - tp->tm_hour = tp->tm_sec = tp->tm_min = INT_MIN; - tp->tm_isdst = -1; - result = strptime (string, line, tp); - if (result && *result == '\0') - break; - } - while (!__sfeof (fp)); - - /* Free the buffer. */ - free (line); - - /* Check for errors. */ - if (__sferror (fp)) - { - fclose (fp); - return 5; - } - - /* Close template file. */ - fclose (fp); - - if (result == NULL || *result != '\0') - return 7; - - /* Get current time. */ - time (&timer); - localtime_r (&timer, &tm); - - /* If only the weekday is given, today is assumed if the given day - is equal to the current day and next week if it is less. */ - if (tp->tm_wday >= 0 && tp->tm_wday <= 6 && tp->tm_year == INT_MIN - && tp->tm_mon == INT_MIN && tp->tm_mday == INT_MIN) - { - tp->tm_year = tm.tm_year; - tp->tm_mon = tm.tm_mon; - tp->tm_mday = tm.tm_mday + (tp->tm_wday - tm.tm_wday + 7) % 7; - mday_ok = 1; - } - - /* If only the month is given, the current month is assumed if the - given month is equal to the current month and next year if it is - less and no year is given (the first day of month is assumed if - no day is given. */ - if (tp->tm_mon >= 0 && tp->tm_mon <= 11 && tp->tm_mday == INT_MIN) - { - if (tp->tm_year == INT_MIN) - tp->tm_year = tm.tm_year + (((tp->tm_mon - tm.tm_mon) < 0) ? 1 : 0); - tp->tm_mday = first_wday (tp->tm_year, tp->tm_mon, tp->tm_wday); - mday_ok = 1; - } - - /* If no hour, minute and second are given the current hour, minute - and second are assumed. */ - if (tp->tm_hour == INT_MIN && tp->tm_min == INT_MIN && tp->tm_sec == INT_MIN) - { - tp->tm_hour = tm.tm_hour; - tp->tm_min = tm.tm_min; - tp->tm_sec = tm.tm_sec; - } - - /* If no date is given, today is assumed if the given hour is - greater than the current hour and tomorrow is assumed if - it is less. */ - if (tp->tm_hour >= 0 && tp->tm_hour <= 23 - && tp->tm_year == INT_MIN && tp->tm_mon == INT_MIN - && tp->tm_mday == INT_MIN && tp->tm_wday == INT_MIN) - { - tp->tm_year = tm.tm_year; - tp->tm_mon = tm.tm_mon; - tp->tm_mday = tm.tm_mday + ((tp->tm_hour - tm.tm_hour) < 0 ? 1 : 0); - mday_ok = 1; - } - - /* Fill in the gaps. */ - if (tp->tm_year == INT_MIN) - tp->tm_year = tm.tm_year; - if (tp->tm_hour == INT_MIN) - tp->tm_hour = 0; - if (tp->tm_min == INT_MIN) - tp->tm_min = 0; - if (tp->tm_sec == INT_MIN) - tp->tm_sec = 0; - - /* Check if the day of month is within range, and if the time can be - represented in a time_t. We make use of the fact that the mktime - call normalizes the struct tm. */ - if ((!mday_ok && !check_mday (TM_YEAR_BASE + tp->tm_year, tp->tm_mon, - tp->tm_mday)) - || mktime (tp) == (time_t) -1) - return 8; - - return 0; -} - -#ifndef _REENT_ONLY -struct tm * -getdate (const char *string) -{ - /* Buffer returned by getdate. */ - static struct tm tmbuf; - int errval = getdate_r (string, &tmbuf); - - if (errval != 0) - { - getdate_err = errval; - return NULL; - } - - return &tmbuf; -} -#endif /* _REENT_ONLY */ diff --git a/newlib/libc/sys/linux/getdate_err.c b/newlib/libc/sys/linux/getdate_err.c deleted file mode 100644 index e90b74b83..000000000 --- a/newlib/libc/sys/linux/getdate_err.c +++ /dev/null @@ -1,18 +0,0 @@ -/* The getdate_err variable is stored in the reentrancy structure. This - function returns its address for use by the getdate_err macro defined in - time.h. */ - -#include <errno.h> -#include <reent.h> - -#ifndef _REENT_ONLY - -int * -__getdate_err () -{ - struct _reent *ptr = _REENT; - _REENT_CHECK_MISC(ptr); - return _REENT_GETDATE_ERR_P(ptr); -} - -#endif diff --git a/newlib/libc/sys/linux/gethostname.c b/newlib/libc/sys/linux/gethostname.c deleted file mode 100644 index ef526916f..000000000 --- a/newlib/libc/sys/linux/gethostname.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <errno.h> -#include <string.h> -#include <unistd.h> -#include <sys/utsname.h> -#include <machine/weakalias.h> - -int -__gethostname (char *name, size_t len) -{ - struct utsname nodebuf; - size_t nodelen; - - if (uname (&nodebuf)) - return -1; - - nodelen = strlen (nodebuf.nodename) + 1; - if (len < nodelen) - memcpy (name, nodebuf.nodename, len); - else - memcpy (name, nodebuf.nodename, nodelen); - - if (nodelen > len) - { - errno = ENAMETOOLONG; - return -1; - } - return 0; -} -weak_alias(__gethostname, gethostname) diff --git a/newlib/libc/sys/linux/getopt.c b/newlib/libc/sys/linux/getopt.c deleted file mode 100644 index cc035d641..000000000 --- a/newlib/libc/sys/linux/getopt.c +++ /dev/null @@ -1,1249 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. - Ditto for AIX 3.2 and <stdlib.h>. */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include <stdio.h> - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include <gnu-versions.h> -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include <stdlib.h> -# include <unistd.h> -#endif /* GNU C library. */ - -#ifdef VMS -# include <unixlib.h> -# if HAVE_STRING_H - 0 -# include <string.h> -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. */ -# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC -# include <libintl.h> -# ifndef _ -# define _(msgid) gettext (msgid) -# endif -# else -# define _(msgid) (msgid) -# endif -# if defined _LIBC && defined USE_IN_LIBIO -# include <wchar.h> -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -int optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include <string.h> -# define my_index strchr -#else - -# if HAVE_STRING_H -# include <string.h> -# else -# include <strings.h> -# endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Stored original parameters. - XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ -extern int __libc_argc; -extern char **__libc_argv; - -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -# ifdef USE_NONOPTION_FLAGS -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; -# endif - -# ifdef USE_NONOPTION_FLAGS -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -# else -# define SWAP_FLAGS(ch1, ch2) -# endif -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#if defined _LIBC && defined USE_NONOPTION_FLAGS - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#if defined _LIBC && defined USE_NONOPTION_FLAGS - if (posixly_correct == NULL - && argc == __libc_argc && argv == __libc_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int print_errors = opterr; - if (optstring[0] == ':') - print_errors = 0; - - if (argc < 1) - return -1; - - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#if defined _LIBC && defined USE_NONOPTION_FLAGS -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else if (long_only - || pfound->has_arg != p->has_arg - || pfound->flag != p->flag - || pfound->val != p->val) - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - __asprintf (&buf, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#else - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); -#endif - } - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; -#endif - - if (argv[optind - 1][1] == '-') - { - /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("\ -%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); -#else - fprintf (stderr, _("\ -%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); -#endif - } - else - { - /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("\ -%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], - pfound->name); -#else - fprintf (stderr, _("\ -%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); -#endif - } - -#if defined _LIBC && defined USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#endif - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - __asprintf (&buf, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#else - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); -#endif - } - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; -#endif - - if (argv[optind][1] == '-') - { - /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); -#else - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); -#endif - } - else - { - /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); -#else - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); -#endif - } - -#if defined _LIBC && defined USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#endif - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; -#endif - - if (posixly_correct) - { - /* 1003.2 specifies the format of this message. */ -#if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: illegal option -- %c\n"), - argv[0], c); -#else - fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); -#endif - } - else - { -#if defined _LIBC && defined USE_IN_LIBIO - __asprintf (&buf, _("%s: invalid option -- %c\n"), - argv[0], c); -#else - fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); -#endif - } - -#if defined _LIBC && defined USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#endif - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - __asprintf (&buf, _("%s: option requires an argument -- %c\n"), - argv[0], c); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#else - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); -#endif - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#else - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); -#endif - } - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - __asprintf (&buf, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#else - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); -#endif - } - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - __asprintf (&buf, _("\ -%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#else - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); -#endif - } - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - __asprintf (&buf, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s", buf); - else - fputs (buf, stderr); - - free (buf); -#else - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); -#endif - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/newlib/libc/sys/linux/getopt1.c b/newlib/libc/sys/linux/getopt1.c deleted file mode 100644 index 2f149bcc4..000000000 --- a/newlib/libc/sys/linux/getopt1.c +++ /dev/null @@ -1,185 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include <stdio.h> - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include <gnu-versions.h> -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include <stdlib.h> -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - - -#ifdef TEST - -#include <stdio.h> - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/newlib/libc/sys/linux/getreent.c b/newlib/libc/sys/linux/getreent.c deleted file mode 100644 index 2d842073a..000000000 --- a/newlib/libc/sys/linux/getreent.c +++ /dev/null @@ -1,12 +0,0 @@ -/* default function used by _REENT when not using multithreading */ - -#include <reent.h> -#include <machine/weakalias.h> - -struct _reent * -__libc_getreent (void) -{ - return _impure_ptr; -} -weak_alias(__libc_getreent,__getreent) - diff --git a/newlib/libc/sys/linux/getrlimit64.c b/newlib/libc/sys/linux/getrlimit64.c deleted file mode 100644 index dcd67cf56..000000000 --- a/newlib/libc/sys/linux/getrlimit64.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <sys/resource.h> -#include <sys/types.h> - -/* Put the soft and hard limits for RESOURCE in *RLIMITS. - Returns 0 if successful, -1 if not (and sets errno). */ -int -getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits) -{ - struct rlimit rlimits32; - - if (__getrlimit (resource, &rlimits32) < 0) - return -1; - - if (rlimits32.rlim_cur == RLIM_INFINITY) - rlimits->rlim_cur = RLIM64_INFINITY; - else - rlimits->rlim_cur = rlimits32.rlim_cur; - if (rlimits32.rlim_max == RLIM_INFINITY) - rlimits->rlim_max = RLIM64_INFINITY; - else - rlimits->rlim_max = rlimits32.rlim_max; - - return 0; -} diff --git a/newlib/libc/sys/linux/getwd.c b/newlib/libc/sys/linux/getwd.c deleted file mode 100644 index 72db33830..000000000 --- a/newlib/libc/sys/linux/getwd.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <string.h> -#include <unistd.h> -#include <errno.h> - -char * -getwd (char *buf) -{ - char tmp[MAXPATHLEN]; - - if (buf == NULL) - { - errno = EINVAL; - return NULL; - } - - if (getcwd (tmp, MAXPATHLEN) == NULL) - return NULL; - - return strncpy (buf, tmp, MAXPATHLEN); -} diff --git a/newlib/libc/sys/linux/hp-timing.h b/newlib/libc/sys/linux/hp-timing.h deleted file mode 100644 index 0507f444c..000000000 --- a/newlib/libc/sys/linux/hp-timing.h +++ /dev/null @@ -1 +0,0 @@ -#include <machine/hp-timing.h> diff --git a/newlib/libc/sys/linux/ids.c b/newlib/libc/sys/linux/ids.c deleted file mode 100644 index f3a95b123..000000000 --- a/newlib/libc/sys/linux/ids.c +++ /dev/null @@ -1,26 +0,0 @@ -/* libc/sys/linux/ids.c - System calls related to user and group ids */ - -/* Written 2000 by Werner Almesberger */ - - -#include <sys/types.h> -#include <sys/unistd.h> -#include <machine/syscall.h> - - -_syscall1(int,setfsuid,uid_t,uid) -_syscall0(uid_t,getuid) -_syscall1(int,setfsgid,gid_t,gid) -_syscall0(gid_t,getgid) -_syscall0(uid_t,geteuid) -_syscall0(gid_t,getegid) -_syscall3(int,setresuid,uid_t,ruid,uid_t,euid,uid_t,suid) -_syscall3(int,syslog,int,type,char *,bufp,int,len) - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL > 3 -_syscall2(int,getgroups,int,size,gid_t *,list) -_syscall1(int,setgid,gid_t,gid) -_syscall1(int,setuid,uid_t,uid) -#endif - -weak_alias(__libc_getuid,__getuid); diff --git a/newlib/libc/sys/linux/include/argp.h b/newlib/libc/sys/linux/include/argp.h deleted file mode 100644 index e58258a3c..000000000 --- a/newlib/libc/sys/linux/include/argp.h +++ /dev/null @@ -1,570 +0,0 @@ -/* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader <miles@gnu.ai.mit.edu>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ARGP_H -#define _ARGP_H - -#include <stdio.h> -#include <ctype.h> -#include <getopt.h> - -#define __need_error_t -#include <errno.h> - -char *program_invocation_name; -char *program_invocation_short_name; - -#ifndef __const -# define __const const -#endif - -#ifndef __error_t_defined -typedef int error_t; -# define __error_t_defined -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* A description of a particular option. A pointer to an array of - these is passed in the OPTIONS field of an argp structure. Each option - entry can correspond to one long option and/or one short option; more - names for the same option can be added by following an entry in an option - array with options having the OPTION_ALIAS flag set. */ -struct argp_option -{ - /* The long option name. For more than one name for the same option, you - can use following options with the OPTION_ALIAS flag set. */ - __const char *name; - - /* What key is returned for this option. If > 0 and printable, then it's - also accepted as a short option. */ - int key; - - /* If non-NULL, this is the name of the argument associated with this - option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ - __const char *arg; - - /* OPTION_ flags. */ - int flags; - - /* The doc string for this option. If both NAME and KEY are 0, This string - will be printed outdented from the normal option column, making it - useful as a group header (it will be the first thing printed in its - group); in this usage, it's conventional to end the string with a `:'. */ - __const char *doc; - - /* The group this option is in. In a long help message, options are sorted - alphabetically within each group, and the groups presented in the order - 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with - if this field 0 will inherit the group number of the previous entry, or - zero if it's the first one, unless its a group header (NAME and KEY both - 0), in which case, the previous entry + 1 is the default. Automagic - options such as --help are put into group -1. */ - int group; -}; - -/* The argument associated with this option is optional. */ -#define OPTION_ARG_OPTIONAL 0x1 - -/* This option isn't displayed in any help messages. */ -#define OPTION_HIDDEN 0x2 - -/* This option is an alias for the closest previous non-alias option. This - means that it will be displayed in the same help entry, and will inherit - fields other than NAME and KEY from the aliased option. */ -#define OPTION_ALIAS 0x4 - -/* This option isn't actually an option (and so should be ignored by the - actual option parser), but rather an arbitrary piece of documentation that - should be displayed in much the same manner as the options. If this flag - is set, then the option NAME field is displayed unmodified (e.g., no `--' - prefix is added) at the left-margin (where a *short* option would normally - be displayed), and the documentation string in the normal place. For - purposes of sorting, any leading whitespace and puncuation is ignored, - except that if the first non-whitespace character is not `-', this entry - is displayed after all options (and OPTION_DOC entries with a leading `-') - in the same group. */ -#define OPTION_DOC 0x8 - -/* This option shouldn't be included in `long' usage messages (but is still - included in help messages). This is mainly intended for options that are - completely documented in an argp's ARGS_DOC field, in which case including - the option in the generic usage list would be redundant. For instance, - if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to - distinguish these two cases, -x should probably be marked - OPTION_NO_USAGE. */ -#define OPTION_NO_USAGE 0x10 - -struct argp; /* fwd declare this type */ -struct argp_state; /* " */ -struct argp_child; /* " */ - -/* The type of a pointer to an argp parsing function. */ -typedef error_t (*argp_parser_t) (int key, char *arg, - struct argp_state *state); - -/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such - returns will simply be ignored. For user keys, this error will be turned - into EINVAL (if the call to argp_parse is such that errors are propagated - back to the user instead of exiting); returning EINVAL itself would result - in an immediate stop to parsing in *all* cases. */ -#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ - -/* Special values for the KEY argument to an argument parsing function. - ARGP_ERR_UNKNOWN should be returned if they aren't understood. - - The sequence of keys to a parsing function is either (where each - uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): - - INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all - or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed - or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized - - The third case is where every parser returned ARGP_KEY_UNKNOWN for an - argument, in which case parsing stops at that argument (returning the - unparsed arguments to the caller of argp_parse if requested, or stopping - with an error message if not). - - If an error occurs (either detected by argp, or because the parsing - function returned an error value), then the parser is called with - ARGP_KEY_ERROR, and no further calls are made. */ - -/* This is not an option at all, but rather a command line argument. If a - parser receiving this key returns success, the fact is recorded, and the - ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the - argument, a parser function decrements the NEXT field of the state it's - passed, the option won't be considered processed; this is to allow you to - actually modify the argument (perhaps into an option), and have it - processed again. */ -#define ARGP_KEY_ARG 0 -/* There are remaining arguments not parsed by any parser, which may be found - starting at (STATE->argv + STATE->next). If success is returned, but - STATE->next left untouched, it's assumed that all arguments were consume, - otherwise, the parser should adjust STATE->next to reflect any arguments - consumed. */ -#define ARGP_KEY_ARGS 0x1000006 -/* There are no more command line arguments at all. */ -#define ARGP_KEY_END 0x1000001 -/* Because it's common to want to do some special processing if there aren't - any non-option args, user parsers are called with this key if they didn't - successfully process any non-option arguments. Called just before - ARGP_KEY_END (where more general validity checks on previously parsed - arguments can take place). */ -#define ARGP_KEY_NO_ARGS 0x1000002 -/* Passed in before any parsing is done. Afterwards, the values of each - element of the CHILD_INPUT field, if any, in the state structure is - copied to each child's state to be the initial value of the INPUT field. */ -#define ARGP_KEY_INIT 0x1000003 -/* Use after all other keys, including SUCCESS & END. */ -#define ARGP_KEY_FINI 0x1000007 -/* Passed in when parsing has successfully been completed (even if there are - still arguments remaining). */ -#define ARGP_KEY_SUCCESS 0x1000004 -/* Passed in if an error occurs. */ -#define ARGP_KEY_ERROR 0x1000005 - -/* An argp structure contains a set of options declarations, a function to - deal with parsing one, documentation string, a possible vector of child - argp's, and perhaps a function to filter help output. When actually - parsing options, getopt is called with the union of all the argp - structures chained together through their CHILD pointers, with conflicts - being resolved in favor of the first occurrence in the chain. */ -struct argp -{ - /* An array of argp_option structures, terminated by an entry with both - NAME and KEY having a value of 0. */ - __const struct argp_option *options; - - /* What to do with an option from this structure. KEY is the key - associated with the option, and ARG is any associated argument (NULL if - none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be - returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then - parsing is stopped immediately, and that value is returned from - argp_parse(). For special (non-user-supplied) values of KEY, see the - ARGP_KEY_ definitions below. */ - argp_parser_t parser; - - /* A string describing what other arguments are wanted by this program. It - is only used by argp_usage to print the `Usage:' message. If it - contains newlines, the strings separated by them are considered - alternative usage patterns, and printed on separate lines (lines after - the first are prefix by ` or: ' instead of `Usage:'). */ - __const char *args_doc; - - /* If non-NULL, a string containing extra text to be printed before and - after the options in a long help message (separated by a vertical tab - `\v' character). */ - __const char *doc; - - /* A vector of argp_children structures, terminated by a member with a 0 - argp field, pointing to child argps should be parsed with this one. Any - conflicts are resolved in favor of this argp, or early argps in the - CHILDREN list. This field is useful if you use libraries that supply - their own argp structure, which you want to use in conjunction with your - own. */ - __const struct argp_child *children; - - /* If non-zero, this should be a function to filter the output of help - messages. KEY is either a key from an option, in which case TEXT is - that option's help text, or a special key from the ARGP_KEY_HELP_ - defines, below, describing which other help text TEXT is. The function - should return either TEXT, if it should be used as-is, a replacement - string, which should be malloced, and will be freed by argp, or NULL, - meaning `print nothing'. The value for TEXT is *after* any translation - has been done, so if any of the replacement text also needs translation, - that should be done by the filter function. INPUT is either the input - supplied to argp_parse, or NULL, if argp_help was called directly. */ - char *(*help_filter) (int __key, __const char *__text, void *__input); - - /* If non-zero the strings used in the argp library are translated using - the domain described by this string. Otherwise the currently installed - default domain is used. */ - const char *argp_domain; -}; - -/* Possible KEY arguments to a help filter function. */ -#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ -#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ -#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ -#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; - TEXT is NULL for this key. */ -/* Explanatory note emitted when duplicate option arguments have been - suppressed. */ -#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 -#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ - -/* When an argp has a non-zero CHILDREN field, it should point to a vector of - argp_child structures, each of which describes a subsidiary argp. */ -struct argp_child -{ - /* The child parser. */ - __const struct argp *argp; - - /* Flags for this child. */ - int flags; - - /* If non-zero, an optional header to be printed in help output before the - child options. As a side-effect, a non-zero value forces the child - options to be grouped together; to achieve this effect without actually - printing a header string, use a value of "". */ - __const char *header; - - /* Where to group the child options relative to the other (`consolidated') - options in the parent argp; the values are the same as the GROUP field - in argp_option structs, but all child-groupings follow parent options at - a particular group level. If both this field and HEADER are zero, then - they aren't grouped at all, but rather merged with the parent options - (merging the child's grouping levels with the parents). */ - int group; -}; - -/* Parsing state. This is provided to parsing functions called by argp, - which may examine and, as noted, modify fields. */ -struct argp_state -{ - /* The top level ARGP being parsed. */ - __const struct argp *root_argp; - - /* The argument vector being parsed. May be modified. */ - int argc; - char **argv; - - /* The index in ARGV of the next arg that to be parsed. May be modified. */ - int next; - - /* The flags supplied to argp_parse. May be modified. */ - unsigned flags; - - /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the - number of the current arg, starting at zero, and incremented after each - such call returns. At all other times, this is the number of such - arguments that have been processed. */ - unsigned arg_num; - - /* If non-zero, the index in ARGV of the first argument following a special - `--' argument (which prevents anything following being interpreted as an - option). Only set once argument parsing has proceeded past this point. */ - int quoted; - - /* An arbitrary pointer passed in from the user. */ - void *input; - /* Values to pass to child parsers. This vector will be the same length as - the number of children for the current parser. */ - void **child_inputs; - - /* For the parser's use. Initialized to 0. */ - void *hook; - - /* The name used when printing messages. This is initialized to ARGV[0], - or PROGRAM_INVOCATION_NAME if that is unavailable. */ - char *name; - - /* Streams used when argp prints something. */ - FILE *err_stream; /* For errors; initialized to stderr. */ - FILE *out_stream; /* For information; initialized to stdout. */ - - void *pstate; /* Private, for use by argp. */ -}; - -/* Flags for argp_parse (note that the defaults are those that are - convenient for program command line parsing): */ - -/* Don't ignore the first element of ARGV. Normally (and always unless - ARGP_NO_ERRS is set) the first element of the argument vector is - skipped for option parsing purposes, as it corresponds to the program name - in a command line. */ -#define ARGP_PARSE_ARGV0 0x01 - -/* Don't print error messages for unknown options to stderr; unless this flag - is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program - name in the error messages. This flag implies ARGP_NO_EXIT (on the - assumption that silent exiting upon errors is bad behaviour). */ -#define ARGP_NO_ERRS 0x02 - -/* Don't parse any non-option args. Normally non-option args are parsed by - calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg - as the value. Since it's impossible to know which parse function wants to - handle it, each one is called in turn, until one returns 0 or an error - other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the - argp_parse returns prematurely (but with a return value of 0). If all - args have been parsed without error, all parsing functions are called one - last time with a key of ARGP_KEY_END. This flag needn't normally be set, - as the normal behavior is to stop parsing as soon as some argument can't - be handled. */ -#define ARGP_NO_ARGS 0x04 - -/* Parse options and arguments in the same order they occur on the command - line -- normally they're rearranged so that all options come first. */ -#define ARGP_IN_ORDER 0x08 - -/* Don't provide the standard long option --help, which causes usage and - option help information to be output to stdout, and exit (0) called. */ -#define ARGP_NO_HELP 0x10 - -/* Don't exit on errors (they may still result in error messages). */ -#define ARGP_NO_EXIT 0x20 - -/* Use the gnu getopt `long-only' rules for parsing arguments. */ -#define ARGP_LONG_ONLY 0x40 - -/* Turns off any message-printing/exiting options. */ -#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) - -/* Parse the options strings in ARGC & ARGV according to the options in ARGP. - FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the - index in ARGV of the first unparsed option is returned in it. If an - unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser - routine returned a non-zero value, it is returned; otherwise 0 is - returned. This function may also call exit unless the ARGP_NO_HELP flag - is set. INPUT is a pointer to a value to be passed in to the parser. */ -extern error_t argp_parse (__const struct argp *__restrict __argp, - int __argc, char **__restrict __argv, - unsigned __flags, int *__restrict __arg_index, - void *__restrict __input) __THROW; -extern error_t __argp_parse (__const struct argp *__restrict __argp, - int __argc, char **__restrict __argv, - unsigned __flags, int *__restrict __arg_index, - void *__restrict __input) __THROW; - -/* Global variables. */ - -/* If defined or set by the user program to a non-zero value, then a default - option --version is added (unless the ARGP_NO_HELP flag is used), which - will print this string followed by a newline and exit (unless the - ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ -extern __const char *argp_program_version; - -/* If defined or set by the user program to a non-zero value, then a default - option --version is added (unless the ARGP_NO_HELP flag is used), which - calls this function with a stream to print the version to and a pointer to - the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is - used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ -extern void (*argp_program_version_hook) (FILE *__restrict __stream, - struct argp_state *__restrict - __state); - -/* If defined or set by the user program, it should point to string that is - the bug-reporting address for the program. It will be printed by - argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various - standard help messages), embedded in a sentence that says something like - `Report bugs to ADDR.'. */ -extern __const char *argp_program_bug_address; - -/* The exit status that argp will use when exiting due to a parsing error. - If not defined or set by the user program, this defaults to EX_USAGE from - <sysexits.h>. */ -extern error_t argp_err_exit_status; - -/* Flags for argp_help. */ -#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ -#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ -#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ -#define ARGP_HELP_LONG 0x08 /* a long help message. */ -#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ -#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ -#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) -#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ -#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to - reflect ARGP_LONG_ONLY mode. */ - -/* These ARGP_HELP flags are only understood by argp_state_help. */ -#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ -#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ - -/* The standard thing to do after a program command line parsing error, if an - error message has already been printed. */ -#define ARGP_HELP_STD_ERR \ - (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) -/* The standard thing to do after a program command line parsing error, if no - more specific error message has been printed. */ -#define ARGP_HELP_STD_USAGE \ - (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) -/* The standard thing to do in response to a --help option. */ -#define ARGP_HELP_STD_HELP \ - (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \ - | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) - -/* Output a usage message for ARGP to STREAM. FLAGS are from the set - ARGP_HELP_*. */ -extern void argp_help (__const struct argp *__restrict __argp, - FILE *__restrict __stream, - unsigned __flags, char *__restrict __name) __THROW; -extern void __argp_help (__const struct argp *__restrict __argp, - FILE *__restrict __stream, unsigned __flags, - char *__name) __THROW; - -/* The following routines are intended to be called from within an argp - parsing routine (thus taking an argp_state structure as the first - argument). They may or may not print an error message and exit, depending - on the flags in STATE -- in any case, the caller should be prepared for - them *not* to exit, and should return an appropiate error after calling - them. [argp_usage & argp_error should probably be called argp_state_..., - but they're used often enough that they should be short] */ - -/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are - from the set ARGP_HELP_*. */ -extern void argp_state_help (__const struct argp_state *__restrict __state, - FILE *__restrict __stream, - unsigned int __flags) __THROW; -extern void __argp_state_help (__const struct argp_state *__restrict __state, - FILE *__restrict __stream, - unsigned int __flags) __THROW; - -/* Possibly output the standard usage message for ARGP to stderr and exit. */ -extern void argp_usage (__const struct argp_state *__state) __THROW; -extern void __argp_usage (__const struct argp_state *__state) __THROW; - -/* If appropriate, print the printf string FMT and following args, preceded - by the program name and `:', to stderr, and followed by a `Try ... --help' - message, then exit (1). */ -extern void argp_error (__const struct argp_state *__restrict __state, - __const char *__restrict __fmt, ...) __THROW - __attribute__ ((__format__ (__printf__, 2, 3))); -extern void __argp_error (__const struct argp_state *__restrict __state, - __const char *__restrict __fmt, ...) __THROW - __attribute__ ((__format__ (__printf__, 2, 3))); - -/* Similar to the standard gnu error-reporting function error(), but will - respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print - to STATE->err_stream. This is useful for argument parsing code that is - shared between program startup (when exiting is desired) and runtime - option parsing (when typically an error code is returned instead). The - difference between this function and argp_error is that the latter is for - *parsing errors*, and the former is for other problems that occur during - parsing but don't reflect a (syntactic) problem with the input. */ -extern void argp_failure (__const struct argp_state *__restrict __state, - int __status, int __errnum, - __const char *__restrict __fmt, ...) __THROW - __attribute__ ((__format__ (__printf__, 4, 5))); -extern void __argp_failure (__const struct argp_state *__restrict __state, - int __status, int __errnum, - __const char *__restrict __fmt, ...) __THROW - __attribute__ ((__format__ (__printf__, 4, 5))); - -/* Returns true if the option OPT is a valid short option. */ -extern int _option_is_short (__const struct argp_option *__opt) __THROW; -extern int __option_is_short (__const struct argp_option *__opt) __THROW; - -/* Returns true if the option OPT is in fact the last (unused) entry in an - options array. */ -extern int _option_is_end (__const struct argp_option *__opt) __THROW; -extern int __option_is_end (__const struct argp_option *__opt) __THROW; - -/* Return the input field for ARGP in the parser corresponding to STATE; used - by the help routines. */ -extern void *_argp_input (__const struct argp *__restrict __argp, - __const struct argp_state *__restrict __state) - __THROW; -extern void *__argp_input (__const struct argp *__restrict __argp, - __const struct argp_state *__restrict __state) - __THROW; - -#ifdef __USE_EXTERN_INLINES - -# if !_LIBC -# define __argp_usage argp_usage -# define __argp_state_help argp_state_help -# define __option_is_short _option_is_short -# define __option_is_end _option_is_end -# endif - -# ifndef ARGP_EI -# define ARGP_EI extern __inline__ -# endif - -ARGP_EI void -__argp_usage (__const struct argp_state *__state) __THROW -{ - __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); -} - -ARGP_EI int -__option_is_short (__const struct argp_option *__opt) __THROW -{ - if (__opt->flags & OPTION_DOC) - return 0; - else - { - int __key = __opt->key; - return __key > 0 && isprint (__key); - } -} - -ARGP_EI int -__option_is_end (__const struct argp_option *__opt) __THROW -{ - return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; -} - -# if !_LIBC -# undef __argp_usage -# undef __argp_state_help -# undef __option_is_short -# undef __option_is_end -# endif -#endif /* Use extern inlines. */ - -#ifdef __cplusplus -} -#endif - -#endif /* argp.h */ diff --git a/newlib/libc/sys/linux/include/bp-sym.h b/newlib/libc/sys/linux/include/bp-sym.h deleted file mode 100644 index 249a4bd66..000000000 --- a/newlib/libc/sys/linux/include/bp-sym.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __BP_SYM_H__ -#define __BP_SYM_H__ - -#define BP_SYM(NAME) NAME - -#endif diff --git a/newlib/libc/sys/linux/include/cmathcalls.h b/newlib/libc/sys/linux/include/cmathcalls.h deleted file mode 100644 index c680c6d8e..000000000 --- a/newlib/libc/sys/linux/include/cmathcalls.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Prototype declarations for complex math functions; - helper file for <complex.h>. - Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* NOTE: Because of the special way this file is used by <complex.h>, this - file must NOT be protected from multiple inclusion as header files - usually are. - - This file provides prototype declarations for the math functions. - Most functions are declared using the macro: - - __MATHCALL (NAME, (ARGS...)); - - This means there is a function `NAME' returning `double' and a function - `NAMEf' returning `float'. Each place `_Mdouble_' appears in the - prototype, that is actually `double' in the prototype for `NAME' and - `float' in the prototype for `NAMEf'. Reentrant variant functions are - called `NAME_r' and `NAMEf_r'. - - Functions returning other types like `int' are declared using the macro: - - __MATHDECL (TYPE, NAME, (ARGS...)); - - This is just like __MATHCALL but for a function returning `TYPE' - instead of `_Mdouble_'. In all of these cases, there is still - both a `NAME' and a `NAMEf' that takes `float' arguments. */ - -#ifndef _COMPLEX_H -#error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead." -#endif - -#define _Mdouble_complex_ _Mdouble_ _Complex - - -/* Trigonometric functions. */ - -/* Arc cosine of Z. */ -__MATHCALL (cacos, (_Mdouble_complex_ __z)); -/* Arc sine of Z. */ -__MATHCALL (casin, (_Mdouble_complex_ __z)); -/* Arc tangent of Z. */ -__MATHCALL (catan, (_Mdouble_complex_ __z)); - -/* Cosine of Z. */ -__MATHCALL (ccos, (_Mdouble_complex_ __z)); -/* Sine of Z. */ -__MATHCALL (csin, (_Mdouble_complex_ __z)); -/* Tangent of Z. */ -__MATHCALL (ctan, (_Mdouble_complex_ __z)); - - -/* Hyperbolic functions. */ - -/* Hyperbolic arc cosine of Z. */ -__MATHCALL (cacosh, (_Mdouble_complex_ __z)); -/* Hyperbolic arc sine of Z. */ -__MATHCALL (casinh, (_Mdouble_complex_ __z)); -/* Hyperbolic arc tangent of Z. */ -__MATHCALL (catanh, (_Mdouble_complex_ __z)); - -/* Hyperbolic cosine of Z. */ -__MATHCALL (ccosh, (_Mdouble_complex_ __z)); -/* Hyperbolic sine of Z. */ -__MATHCALL (csinh, (_Mdouble_complex_ __z)); -/* Hyperbolic tangent of Z. */ -__MATHCALL (ctanh, (_Mdouble_complex_ __z)); - - -/* Exponential and logarithmic functions. */ - -/* Exponential function of Z. */ -__MATHCALL (cexp, (_Mdouble_complex_ __z)); - -/* Natural logarithm of Z. */ -__MATHCALL (clog, (_Mdouble_complex_ __z)); - -#ifdef __USE_GNU -/* The base 10 logarithm is not defined by the standard but to implement - the standard C++ library it is handy. */ -__MATHCALL (clog10, (_Mdouble_complex_ __z)); -#endif - -/* Power functions. */ - -/* Return X to the Y power. */ -__MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); - -/* Return the square root of Z. */ -__MATHCALL (csqrt, (_Mdouble_complex_ __z)); - - -/* Absolute value, conjugates, and projection. */ - -/* Absolute value of Z. */ -__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); - -/* Argument value of Z. */ -__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); - -/* Complex conjugate of Z. */ -__MATHCALL (conj, (_Mdouble_complex_ __z)); - -/* Projection of Z onto the Riemann sphere. */ -__MATHCALL (cproj, (_Mdouble_complex_ __z)); - - -/* Decomposing complex values. */ - -/* Imaginary part of Z. */ -__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); - -/* Real part of Z. */ -__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); - - -/* Now some optimized versions. GCC has handy notations for these - functions. Recent GCC handles these as builtin functions so does - not need inlines. */ -#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ - -/* Imaginary part of Z. */ -extern __inline _Mdouble_ -__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW -{ - return __imag__ __z; -} - -/* Real part of Z. */ -extern __inline _Mdouble_ -__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW -{ - return __real__ __z; -} - -/* Complex conjugate of Z. */ -extern __inline _Mdouble_complex_ -__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW -{ - return __extension__ ~__z; -} - -#endif diff --git a/newlib/libc/sys/linux/include/complex.h b/newlib/libc/sys/linux/include/complex.h deleted file mode 100644 index daa465674..000000000 --- a/newlib/libc/sys/linux/include/complex.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* - * ISO C99: 7.3 Complex arithmetic <complex.h> - */ - -#ifndef _COMPLEX_H -#define _COMPLEX_H 1 - -#include <sys/types.h> -#include <features.h> - -__BEGIN_DECLS - -#define __CONCAT(x,y) x ## y -/* We might need to add support for more compilers here. But since ISO - C99 is out hopefully all maintained compilers will soon provide the data - types `float complex' and `double complex'. */ -#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) -# define _Complex __complex__ -#endif - -#define complex _Complex - -/* Narrowest imaginary unit. This depends on the floating-point - evaluation method. - XXX This probably has to go into a gcc related file. */ -#define _Complex_I (__extension__ 1.0iF) - -/* Another more descriptive name is `I'. - XXX Once we have the imaginary support switch this to _Imaginary_I. */ -#undef I -#define I _Complex_I - -/* The file <bits/cmathcalls.h> contains the prototypes for all the - actual math functions. These macros are used for those prototypes, - so we can easily declare each function as both `name' and `__name', - and can declare the float versions `namef' and `__namef'. */ - -#define __MATHCALL(function, args) \ - __MATHDECL (_Mdouble_complex_,function, args) -#define __MATHDECL(type, function, args) \ - __MATHDECL_1(type, function, args); \ - __MATHDECL_1(type, __CONCAT(__,function), args) -#define __MATHDECL_1(type, function, args) \ - extern type __MATH_PRECNAME(function) args __THROW - -#define _Mdouble_ double -#define __MATH_PRECNAME(name) name -#include <cmathcalls.h> -#undef _Mdouble_ -#undef __MATH_PRECNAME - -/* Now the float versions. */ -#ifndef _Mfloat_ -# define _Mfloat_ float -#endif -#define _Mdouble_ _Mfloat_ -#ifdef __STDC__ -# define __MATH_PRECNAME(name) name##f -#else -# define __MATH_PRECNAME(name) name/**/f -#endif -#include <cmathcalls.h> -#undef _Mdouble_ -#undef __MATH_PRECNAME - -#if 0 -/* And the long double versions. It is non-critical to define them - here unconditionally since `long double' is required in ISO C99. */ -#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH -# ifndef _Mlong_double_ -# define _Mlong_double_ long double -# endif -# define _Mdouble_ _Mlong_double_ -# ifdef __STDC__ -# define __MATH_PRECNAME(name) name##l -# else -# define __MATH_PRECNAME(name) name/**/l -# endif -# include <cmathcalls.h> -#endif -#endif -#undef _Mdouble_ -#undef __MATH_PRECNAME -#undef __MATHDECL_1 -#undef __MATHDECL -#undef __MATHCALL - -__END_DECLS - -#endif /* complex.h */ diff --git a/newlib/libc/sys/linux/include/getopt.h b/newlib/libc/sys/linux/include/getopt.h deleted file mode 100644 index 994f86001..000000000 --- a/newlib/libc/sys/linux/include/getopt.h +++ /dev/null @@ -1,27 +0,0 @@ -/* libc/sys/linux/include/getopt.h - Extended command line parsing */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _NEWLIB_GETOPT_H -#define _NEWLIB_GETOPT_H - -#include <unistd.h> - - -enum { no_argument, required_argument, optional_argument }; - -struct option { - const char *name; - int has_arg; - int *flag; - int val; -}; - -int getopt_long(int argc,char *const argv[],const char *optstring, - const struct option *longopts,int *longindex); - -int getopt_long_only(int argc,char *const argv[],const char *optstring, - const struct option *longopts,int *longindex); - -#endif diff --git a/newlib/libc/sys/linux/include/limits.h b/newlib/libc/sys/linux/include/limits.h deleted file mode 100644 index 45cd6f253..000000000 --- a/newlib/libc/sys/linux/include/limits.h +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* - * ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types <limits.h> - */ - -#ifndef _LIBC_LIMITS_H_ -#define _LIBC_LIMITS_H_ 1 - -#include <features.h> - - -/* Maximum length of any multibyte character in any locale. - We define this value here since the gcc header does not define - the correct value. */ -#define MB_LEN_MAX 16 - - -/* If we are not using GNU CC we have to define all the symbols ourself. - Otherwise use gcc's definitions (see below). */ -#if !defined __GNUC__ || __GNUC__ < 2 - -/* We only protect from multiple inclusion here, because all the other - #include's protect themselves, and in GCC 2 we may #include_next through - multiple copies of this file before we get to GCC's. */ -# ifndef _LIMITS_H -# define _LIMITS_H 1 - -#include <bits/wordsize.h> - -/* We don't have #include_next. - Define ANSI <limits.h> for standard 32-bit words. */ - -/* These assume 8-bit `char's, 16-bit `short int's, - and 32-bit `int's and `long int's. */ - -/* Number of bits in a `char'. */ -# define CHAR_BIT 8 - -/* Minimum and maximum values a `signed char' can hold. */ -# define SCHAR_MIN (-128) -# define SCHAR_MAX 127 - -/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ -# define UCHAR_MAX 255 - -/* Minimum and maximum values a `char' can hold. */ -# ifdef __CHAR_UNSIGNED__ -# define CHAR_MIN 0 -# define CHAR_MAX UCHAR_MAX -# else -# define CHAR_MIN SCHAR_MIN -# define CHAR_MAX SCHAR_MAX -# endif - -/* Minimum and maximum values a `signed short int' can hold. */ -# define SHRT_MIN (-32768) -# define SHRT_MAX 32767 - -/* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */ -# define USHRT_MAX 65535 - -/* Minimum and maximum values a `signed int' can hold. */ -# define INT_MIN (-INT_MAX - 1) -# define INT_MAX 2147483647 - -/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ -# define UINT_MAX 4294967295U - -/* Minimum and maximum values a `signed long int' can hold. */ -# if __WORDSIZE == 64 -# define LONG_MAX 9223372036854775807L -# else -# define LONG_MAX 2147483647L -# endif -# define LONG_MIN (-LONG_MAX - 1L) - -/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */ -# if __WORDSIZE == 64 -# define ULONG_MAX 18446744073709551615UL -# else -# define ULONG_MAX 4294967295UL -# endif - -# ifdef __USE_ISOC99 - -/* Minimum and maximum values a `signed long long int' can hold. */ -# define LLONG_MAX 9223372036854775807LL -# define LLONG_MIN (-LLONG_MAX - 1LL) - -/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ -# define ULLONG_MAX 18446744073709551615ULL - -# endif /* ISO C99 */ - -# endif /* limits.h */ -#endif /* GCC 2. */ - -#endif /* !_LIBC_LIMITS_H_ */ - - /* Get the compiler's limits.h, which defines almost all the ISO constants. - - We put this #include_next outside the double inclusion check because - it should be possible to include this file more than once and still get - the definitions from gcc's header. */ -#if defined __GNUC__ && !defined _GCC_LIMITS_H_ -/* `_GCC_LIMITS_H_' is what GCC's file defines. */ -# include_next <limits.h> - -/* The <limits.h> files in some gcc versions don't define LLONG_MIN, - LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for - ages are available. */ -# ifdef __USE_ISOC99 -# ifndef LLONG_MIN -# define LLONG_MIN LONG_LONG_MIN -# endif -# ifndef LLONG_MAX -# define LLONG_MAX LONG_LONG_MAX -# endif -# ifndef ULLONG_MAX -# define ULLONG_MAX ULONG_LONG_MAX -# endif -# endif -#endif - -#ifdef __USE_POSIX -/* POSIX adds things to <limits.h>. */ -# include <bits/posix1_lim.h> -#endif - -#ifdef __USE_POSIX2 -# include <bits/posix2_lim.h> -#endif - -#ifdef __USE_XOPEN -# include <bits/xopen_lim.h> -#endif diff --git a/newlib/libc/sys/linux/include/malloc.h b/newlib/libc/sys/linux/include/malloc.h deleted file mode 100644 index 7a7bcdbde..000000000 --- a/newlib/libc/sys/linux/include/malloc.h +++ /dev/null @@ -1,266 +0,0 @@ -/* Prototypes and definition for malloc implementation. - Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _MALLOC_H -#define _MALLOC_H 1 - -#include <features.h> - -/* - `ptmalloc', a malloc implementation for multiple threads without - lock contention, by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>. - See the files `ptmalloc.c' or `COPYRIGHT' for copying conditions. - - VERSION 2.6.4-pt Wed Dec 4 00:35:54 MET 1996 - - This work is mainly derived from malloc-2.6.4 by Doug Lea - <dl@cs.oswego.edu>, which is available from: - - ftp://g.oswego.edu/pub/misc/malloc.c - - This trimmed-down header file only provides function prototypes and - the exported data structures. For more detailed function - descriptions and compile-time options, see the source file - `ptmalloc.c'. -*/ - -#if defined(__STDC__) || defined (__cplusplus) -# include <stddef.h> -# define __malloc_ptr_t void * -#else -# undef size_t -# define size_t unsigned int -# undef ptrdiff_t -# define ptrdiff_t int -# define __malloc_ptr_t char * -#endif - -#ifdef _LIBC -/* Used by GNU libc internals. */ -# define __malloc_size_t size_t -# define __malloc_ptrdiff_t ptrdiff_t -#elif !defined __attribute_malloc__ -# define __attribute_malloc__ -#endif - -#ifdef __GNUC__ - -/* GCC can always grok prototypes. For C++ programs we add throw() - to help it optimize the function calls. But this works only with - gcc 2.8.x and egcs. */ -# if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8) -# define __THROW throw () -# else -# define __THROW -# endif -# define __MALLOC_P(args) args __THROW -/* This macro will be used for functions which might take C++ callback - functions. */ -# define __MALLOC_PMT(args) args - -#else /* Not GCC. */ - -# define __THROW - -# if (defined __STDC__ && __STDC__) || defined __cplusplus - -# define __MALLOC_P(args) args -# define __MALLOC_PMT(args) args - -# else /* Not ANSI C or C++. */ - -# define __MALLOC_P(args) () /* No prototypes. */ -# define __MALLOC_PMT(args) () - -# endif /* ANSI C or C++. */ - -#endif /* GCC. */ - -#ifndef NULL -# ifdef __cplusplus -# define NULL 0 -# else -# define NULL ((__malloc_ptr_t) 0) -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -struct _reent; - -/* Nonzero if the malloc is already initialized. */ -#ifdef _LIBC -/* In the GNU libc we rename the global variable - `__malloc_initialized' to `__libc_malloc_initialized'. */ -# define __malloc_initialized __libc_malloc_initialized -#endif -extern int __malloc_initialized; - -/* Initialize global configuration. Not needed with GNU libc. */ -#ifndef __GLIBC__ -extern void ptmalloc_init __MALLOC_P ((void)); -#endif - -/* Allocate SIZE bytes of memory. */ -extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__; -extern __malloc_ptr_t _malloc_r __MALLOC_P ((struct _reent * __r, size_t __size)) __attribute_malloc__; - -/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ -extern __malloc_ptr_t calloc __MALLOC_P ((size_t __nmemb, size_t __size)) - __attribute_malloc__; -extern __malloc_ptr_t _calloc_r __MALLOC_P ((struct _reent * __r, - size_t __nmemb, size_t __size)) - __attribute_malloc__; - -/* Re-allocate the previously allocated block in __ptr, making the new - block SIZE bytes long. */ -extern __malloc_ptr_t realloc __MALLOC_P ((__malloc_ptr_t __ptr, - size_t __size)) - __attribute_malloc__; -extern __malloc_ptr_t _realloc_r __MALLOC_P ((struct _reent * __r, - __malloc_ptr_t __ptr, - size_t __size)) - __attribute_malloc__; - -/* Free a block allocated by `malloc', `realloc' or `calloc'. */ -extern void free __MALLOC_P ((__malloc_ptr_t __ptr)); -extern void _free_r __MALLOC_P ((struct _reent * __r, __malloc_ptr_t __ptr)); - -/* Free a block allocated by `calloc'. */ -extern void cfree __MALLOC_P ((__malloc_ptr_t __ptr)); - -/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ -extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size)); -extern __malloc_ptr_t _memalign_r __MALLOC_P ((struct _reent *__r, - size_t __alignment, - size_t __size)); - -/* Allocate SIZE bytes on a page boundary. */ -extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__; -extern __malloc_ptr_t _valloc_r __MALLOC_P ((struct _reent *__r, - size_t __size)) - __attribute_malloc__; - -/* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up - __size to nearest pagesize. */ -extern __malloc_ptr_t pvalloc __MALLOC_P ((size_t __size)) - __attribute_malloc__; -extern __malloc_ptr_t _pvalloc_r __MALLOC_P ((struct _reent *__r, - size_t __size)) - __attribute_malloc__; - -/* Underlying allocation function; successive calls should return - contiguous pieces of memory. */ -extern __malloc_ptr_t (*__morecore) __MALLOC_PMT ((ptrdiff_t __size)); - -/* Default value of `__morecore'. */ -extern __malloc_ptr_t __default_morecore __MALLOC_P ((ptrdiff_t __size)) - __attribute_malloc__; - -/* SVID2/XPG mallinfo structure */ -struct mallinfo { - int arena; /* total space allocated from system */ - int ordblks; /* number of non-inuse chunks */ - int smblks; /* unused -- always zero */ - int hblks; /* number of mmapped regions */ - int hblkhd; /* total space in mmapped regions */ - int usmblks; /* unused -- always zero */ - int fsmblks; /* unused -- always zero */ - int uordblks; /* total allocated space */ - int fordblks; /* total non-inuse space */ - int keepcost; /* top-most, releasable (via malloc_trim) space */ -}; - -/* Returns a copy of the updated current mallinfo. */ -extern struct mallinfo mallinfo __MALLOC_P ((void)); -extern struct mallinfo _mallinfo_r __MALLOC_P ((struct _reent *__r)); - -/* SVID2/XPG mallopt options */ -#ifndef M_MXFAST -# define M_MXFAST 1 /* UNUSED in this malloc */ -#endif -#ifndef M_NLBLKS -# define M_NLBLKS 2 /* UNUSED in this malloc */ -#endif -#ifndef M_GRAIN -# define M_GRAIN 3 /* UNUSED in this malloc */ -#endif -#ifndef M_KEEP -# define M_KEEP 4 /* UNUSED in this malloc */ -#endif - -/* mallopt options that actually do something */ -#define M_TRIM_THRESHOLD -1 -#define M_TOP_PAD -2 -#define M_MMAP_THRESHOLD -3 -#define M_MMAP_MAX -4 -#define M_CHECK_ACTION -5 - -/* General SVID/XPG interface to tunable parameters. */ -extern int mallopt __MALLOC_P ((int __param, int __val)); -extern int _mallopt_r __MALLOC_P ((struct _reent *__r, int __param, int __val)); - -/* Release all but __pad bytes of freed top-most memory back to the - system. Return 1 if successful, else 0. */ -extern int malloc_trim __MALLOC_P ((size_t __pad)); - -/* Report the number of usable allocated bytes associated with allocated - chunk __ptr. */ -extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr)); - -/* Prints brief summary statistics on stderr. */ -extern void malloc_stats __MALLOC_P ((void)); -extern void _malloc_stats_r __MALLOC_P ((struct _reent *__r)); - -/* Record the state of all malloc variables in an opaque data structure. */ -extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void)); - -/* Restore the state of all malloc variables from data obtained with - malloc_get_state(). */ -extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr)); - -#if defined __GLIBC__ || defined MALLOC_HOOKS -/* Called once when malloc is initialized; redefining this variable in - the application provides the preferred way to set up the hook - pointers. */ -extern void (*__malloc_initialize_hook) __MALLOC_PMT ((void)); -/* Hooks for debugging and user-defined versions. */ -extern void (*__free_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr, - __const __malloc_ptr_t)); -extern __malloc_ptr_t (*__malloc_hook) __MALLOC_PMT ((size_t __size, - __const __malloc_ptr_t)); -extern __malloc_ptr_t (*__realloc_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr, - size_t __size, - __const __malloc_ptr_t)); -extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __alignment, - size_t __size, - __const __malloc_ptr_t)); -extern void (*__after_morecore_hook) __MALLOC_PMT ((void)); - -/* Activate a standard set of debugging hooks. */ -extern void __malloc_check_init __MALLOC_P ((void)); -#endif - -#ifdef __cplusplus -}; /* end of extern "C" */ -#endif - -#endif /* malloc.h */ diff --git a/newlib/libc/sys/linux/include/mcheck.h b/newlib/libc/sys/linux/include/mcheck.h deleted file mode 100644 index 39e396d38..000000000 --- a/newlib/libc/sys/linux/include/mcheck.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib, July 9, 2002 by Jeff Johnston */ - -#ifndef _MCHECK_H -#define _MCHECK_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* Return values for `mprobe': these are the kinds of inconsistencies that - `mcheck' enables detection of. */ -enum mcheck_status - { - MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */ - MCHECK_OK, /* Block is fine. */ - MCHECK_FREE, /* Block freed twice. */ - MCHECK_HEAD, /* Memory before the block was clobbered. */ - MCHECK_TAIL /* Memory after the block was clobbered. */ - }; - - -/* Activate a standard collection of debugging hooks. This must be called - before `malloc' is ever called. ABORTFUNC is called with an error code - (see enum above) when an inconsistency is detected. If ABORTFUNC is - null, the standard function prints on stderr and then calls `abort'. */ -extern int mcheck (void (*__abortfunc) (enum mcheck_status)); - -/* Similar to `mcheck´ but performs checks for all block whenever one of - the memory handling functions is called. This can be very slow. */ -extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status)); - -/* Force check of all blocks now. */ -extern void mcheck_check_all (void); - -/* Check for aberrations in a particular malloc'd block. You must have - called `mcheck' already. These are the same checks that `mcheck' does - when you free or reallocate a block. */ -extern enum mcheck_status mprobe (void *__ptr); - -#ifdef __cplusplus -} -#endif - -#endif /* mcheck.h */ diff --git a/newlib/libc/sys/linux/include/mqueue.h b/newlib/libc/sys/linux/include/mqueue.h deleted file mode 100644 index 1cdc095ec..000000000 --- a/newlib/libc/sys/linux/include/mqueue.h +++ /dev/null @@ -1,34 +0,0 @@ -/* libc/sys/linux/include/mqueue.h - message queue functions */ - -/* Copyright 2002, Red Hat Inc. - all rights reserved */ - -#ifndef __MQUEUE_H -#define __MQUEUE_H - -#include <sys/types.h> -#define __need_sigevent_t 1 -#include <bits/siginfo.h> - -/* message queue types */ -typedef int mqd_t; - -struct mq_attr { - long mq_flags; /* message queue flags */ - long mq_maxmsg; /* maximum number of messages */ - long mq_msgsize; /* maximum message size */ - long mq_curmsgs; /* number of messages currently queued */ -}; - -#define MQ_PRIO_MAX 16 - -/* prototypes */ -mqd_t mq_open (const char *__name, int __oflag, ...); -int mq_close (mqd_t __msgid); -int mq_send (mqd_t __msgid, const char *__msg, size_t __msg_len, unsigned int __msg_prio); -ssize_t mq_receive (mqd_t __msgid, char *__msg, size_t __msg_len, unsigned int *__msg_prio); -int mq_notify (mqd_t __msgid, const struct sigevent *__notification); -int mq_unlink (const char *__name); -int mq_getattr (mqd_t __msgid, struct mq_attr *__mqstat); -int mq_setattr (mqd_t __msgid, const struct mq_attr *__mqstat, struct mq_attr *__omqattr); - -#endif /* __MQUEUE_H */ diff --git a/newlib/libc/sys/linux/include/paths.h b/newlib/libc/sys/linux/include/paths.h deleted file mode 100644 index a87831e74..000000000 --- a/newlib/libc/sys/linux/include/paths.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)paths.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _PATHS_H_ -#define _PATHS_H_ - -/* Default search path. */ -#define _PATH_DEFPATH "/usr/bin:/bin" -/* All standard utilities path. */ -#define _PATH_STDPATH \ - "/usr/bin:/bin:/usr/sbin:/sbin" - -#define _PATH_BSHELL "/bin/sh" -#define _PATH_CONSOLE "/dev/console" -#define _PATH_CSHELL "/bin/csh" -#define _PATH_DEVDB "/var/run/dev.db" -#define _PATH_DEVNULL "/dev/null" -#define _PATH_DRUM "/dev/drum" -#define _PATH_KLOG "/proc/kmsg" -#define _PATH_KMEM "/dev/kmem" -#define _PATH_LASTLOG "/var/log/lastlog" -#define _PATH_MAILDIR "/var/mail" -#define _PATH_MAN "/usr/share/man" -#define _PATH_MEM "/dev/mem" -#define _PATH_MNTTAB "/etc/fstab" -#define _PATH_MOUNTED "/etc/mtab" -#define _PATH_NOLOGIN "/etc/nologin" -#define _PATH_PRESERVE "/var/lib" -#define _PATH_RWHODIR "/var/spool/rwho" -#define _PATH_SENDMAIL "/usr/sbin/sendmail" -#define _PATH_SHADOW "/etc/shadow" -#define _PATH_SHELLS "/etc/shells" -#define _PATH_TTY "/dev/tty" -#define _PATH_UNIX "/boot/vmlinux" -#define _PATH_UTMP "/var/run/utmp" -#define _PATH_VI "/bin/vi" -#define _PATH_WTMP "/var/log/wtmp" - -/* Provide trailing slash, since mostly used for building pathnames. */ -#define _PATH_DEV "/dev/" -#define _PATH_TMP "/tmp/" -#define _PATH_VARDB "/var/db/" -#define _PATH_VARRUN "/var/run/" -#define _PATH_VARTMP "/var/tmp/" - -#endif /* !_PATHS_H_ */ diff --git a/newlib/libc/sys/linux/include/pthread.h b/newlib/libc/sys/linux/include/pthread.h deleted file mode 100644 index d7addbe46..000000000 --- a/newlib/libc/sys/linux/include/pthread.h +++ /dev/null @@ -1,682 +0,0 @@ -/* Linuxthreads - a simple clone()-based implementation of Posix */ -/* threads for Linux. */ -/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ -/* */ -/* This program is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU Library General Public License */ -/* as published by the Free Software Foundation; either version 2 */ -/* of the License, or (at your option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU Library General Public License for more details. */ - -#ifndef _PTHREAD_H -#define _PTHREAD_H 1 - -#include <features.h> - -#include <sched.h> -#include <time.h> - -#define __need_sigset_t -#include <signal.h> -#include <bits/pthreadtypes.h> -#include <bits/initspin.h> - - -__BEGIN_DECLS - -/* Initializers. */ - -#define PTHREAD_MUTEX_INITIALIZER \ - {0, 0, 0, PTHREAD_MUTEX_TIMED_NP, __LOCK_INITIALIZER} -#ifdef __USE_GNU -# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ - {0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __LOCK_INITIALIZER} -# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ - {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __LOCK_INITIALIZER} -# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ - {0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __LOCK_INITIALIZER} -#endif - -#define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER, 0} - -#ifdef __USE_UNIX98 -# define PTHREAD_RWLOCK_INITIALIZER \ - { __LOCK_INITIALIZER, 0, NULL, NULL, NULL, \ - PTHREAD_RWLOCK_DEFAULT_NP, PTHREAD_PROCESS_PRIVATE } -#endif -#ifdef __USE_GNU -# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ - { __LOCK_INITIALIZER, 0, NULL, NULL, NULL, \ - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, PTHREAD_PROCESS_PRIVATE } -#endif - -/* Values for attributes. */ - -enum -{ - PTHREAD_CREATE_JOINABLE, -#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE - PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED -}; - -enum -{ - PTHREAD_INHERIT_SCHED, -#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED - PTHREAD_EXPLICIT_SCHED -#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED -}; - -enum -{ - PTHREAD_SCOPE_SYSTEM, -#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM - PTHREAD_SCOPE_PROCESS -#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS -}; - -enum -{ - PTHREAD_MUTEX_TIMED_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_ADAPTIVE_NP -#ifdef __USE_UNIX98 - , - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL -#endif -#ifdef __USE_GNU - /* For compatibility. */ - , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_ADAPTIVE_NP -#endif -}; - -enum -{ - PTHREAD_PROCESS_PRIVATE, -#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE - PTHREAD_PROCESS_SHARED -#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED -}; - -#ifdef __USE_UNIX98 -enum -{ - PTHREAD_RWLOCK_PREFER_READER_NP, - PTHREAD_RWLOCK_PREFER_WRITER_NP, - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, - PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_WRITER_NP -}; -#endif /* Unix98 */ - -#define PTHREAD_ONCE_INIT 0 - -/* Special constants */ - -#ifdef __USE_XOPEN2K -/* -1 is distinct from 0 and all errno constants */ -# define PTHREAD_BARRIER_SERIAL_THREAD -1 -#endif - -/* Cleanup buffers */ - -struct _pthread_cleanup_buffer -{ - void (*__routine) (void *); /* Function to call. */ - void *__arg; /* Its argument. */ - int __canceltype; /* Saved cancellation type. */ - struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */ -}; - -/* Cancellation */ - -enum -{ - PTHREAD_CANCEL_ENABLE, -#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE - PTHREAD_CANCEL_DISABLE -#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE -}; -enum -{ - PTHREAD_CANCEL_DEFERRED, -#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED - PTHREAD_CANCEL_ASYNCHRONOUS -#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS -}; -#define PTHREAD_CANCELED ((void *) -1) - - -/* Function for handling threads. */ - -/* Create a thread with given attributes ATTR (or default attributes - if ATTR is NULL), and call function START_ROUTINE with given - arguments ARG. */ -extern int pthread_create (pthread_t *__restrict __thread1, - __const pthread_attr_t *__restrict __attr, - void *(*__start_routine) (void *), - void *__restrict __arg) __THROW; - -/* Obtain the identifier of the current thread. */ -extern pthread_t pthread_self (void) __THROW; - -/* Compare two thread identifiers. */ -extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW; - -/* Terminate calling thread. */ -extern void pthread_exit (void *__retval) - __THROW __attribute__ ((__noreturn__)); - -/* Make calling thread wait for termination of the thread TH. The - exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN - is not NULL. */ -extern int pthread_join (pthread_t __th, void **__thread_return) __THROW; - -/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. - The resources of TH will therefore be freed immediately when it - terminates, instead of waiting for another thread to perform PTHREAD_JOIN - on it. */ -extern int pthread_detach (pthread_t __th) __THROW; - - -/* Functions for handling attributes. */ - -/* Initialize thread attribute *ATTR with default attributes - (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, - no user-provided stack). */ -extern int pthread_attr_init (pthread_attr_t *__attr) __THROW; - -/* Destroy thread attribute *ATTR. */ -extern int pthread_attr_destroy (pthread_attr_t *__attr) __THROW; - -/* Set the `detachstate' attribute in *ATTR according to DETACHSTATE. */ -extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, - int __detachstate) __THROW; - -/* Return in *DETACHSTATE the `detachstate' attribute in *ATTR. */ -extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr, - int *__detachstate) __THROW; - -/* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ -extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, - __const struct sched_param *__restrict - __param) __THROW; - -/* Return in *PARAM the scheduling parameters of *ATTR. */ -extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict - __attr, - struct sched_param *__restrict __param) - __THROW; - -/* Set scheduling policy in *ATTR according to POLICY. */ -extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) - __THROW; - -/* Return in *POLICY the scheduling policy of *ATTR. */ -extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict - __attr, int *__restrict __policy) - __THROW; - -/* Set scheduling inheritance mode in *ATTR according to INHERIT. */ -extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, - int __inherit) __THROW; - -/* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ -extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict - __attr, int *__restrict __inherit) - __THROW; - -/* Set scheduling contention scope in *ATTR according to SCOPE. */ -extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) - __THROW; - -/* Return in *SCOPE the scheduling contention scope of *ATTR. */ -extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr, - int *__restrict __scope) __THROW; - -#ifdef __USE_UNIX98 -/* Set the size of the guard area at the bottom of the thread. */ -extern int pthread_attr_setguardsize (pthread_attr_t *__attr, - size_t __guardsize) __THROW; - -/* Get the size of the guard area at the bottom of the thread. */ -extern int pthread_attr_getguardsize (__const pthread_attr_t *__restrict - __attr, size_t *__restrict __guardsize) - __THROW; -#endif - -/* Set the starting address of the stack of the thread to be created. - Depending on whether the stack grows up or down the value must either - be higher or lower than all the address in the memory block. The - minimal size of the block must be PTHREAD_STACK_SIZE. */ -extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, - void *__stackaddr) __THROW; - -/* Return the previously set address for the stack. */ -extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict - __attr, void **__restrict __stackaddr) - __THROW; - -#ifdef __USE_XOPEN2K -/* The following two interfaces are intended to replace the last two. They - require setting the address as well as the size since only setting the - address will make the implementation on some architectures impossible. */ -extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, - size_t __stacksize) __THROW; - -/* Return the previously set address for the stack. */ -extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr, - void **__restrict __stackaddr, - size_t *__restrict __stacksize) __THROW; -#endif - -/* Add information about the minimum stack size needed for the thread - to be started. This size must never be less than PTHREAD_STACK_SIZE - and must also not exceed the system limits. */ -extern int pthread_attr_setstacksize (pthread_attr_t *__attr, - size_t __stacksize) __THROW; - -/* Return the currently used minimal stack size. */ -extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict - __attr, size_t *__restrict __stacksize) - __THROW; - -#ifdef __USE_GNU -/* Get thread attributes corresponding to the already running thread TH. */ -extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW; -#endif - -/* Functions for scheduling control. */ - -/* Set the scheduling parameters for TARGET_THREAD according to POLICY - and *PARAM. */ -extern int pthread_setschedparam (pthread_t __target_thread, int __policy, - __const struct sched_param *__param) - __THROW; - -/* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ -extern int pthread_getschedparam (pthread_t __target_thread, - int *__restrict __policy, - struct sched_param *__restrict __param) - __THROW; - -#ifdef __USE_UNIX98 -/* Determine level of concurrency. */ -extern int pthread_getconcurrency (void) __THROW; - -/* Set new concurrency level to LEVEL. */ -extern int pthread_setconcurrency (int __level) __THROW; -#endif - -#ifdef __USE_GNU -/* Yield the processor to another thread or process. - This function is similar to the POSIX `sched_yield' function but - might be differently implemented in the case of a m-on-n thread - implementation. */ -extern int pthread_yield (void) __THROW; -#endif - -/* Functions for mutex handling. */ - -/* Initialize MUTEX using attributes in *MUTEX_ATTR, or use the - default values if later is NULL. */ -extern int pthread_mutex_init (pthread_mutex_t *__restrict __mutex, - __const pthread_mutexattr_t *__restrict - __mutex_attr) __THROW; - -/* Destroy MUTEX. */ -extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW; - -/* Try to lock MUTEX. */ -extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROW; - -/* Wait until lock for MUTEX becomes available and lock it. */ -extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW; - -#ifdef __USE_XOPEN2K -/* Wait until lock becomes available, or specified time passes. */ -extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, - __const struct timespec *__restrict - __abstime) __THROW; -#endif - -/* Unlock MUTEX. */ -extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW; - - -/* Functions for handling mutex attributes. */ - -/* Initialize mutex attribute object ATTR with default attributes - (kind is PTHREAD_MUTEX_TIMED_NP). */ -extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) __THROW; - -/* Destroy mutex attribute object ATTR. */ -extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) __THROW; - -/* Get the process-shared flag of the mutex attribute ATTR. */ -extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t * - __restrict __attr, - int *__restrict __pshared) __THROW; - -/* Set the process-shared flag of the mutex attribute ATTR. */ -extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, - int __pshared) __THROW; - -#ifdef __USE_UNIX98 -/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL, - PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or - PTHREAD_MUTEX_DEFAULT). */ -extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) - __THROW; - -/* Return in *KIND the mutex kind attribute in *ATTR. */ -extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict - __attr, int *__restrict __kind) __THROW; -#endif - - -/* Functions for handling conditional variables. */ - -/* Initialize condition variable COND using attributes ATTR, or use - the default values if later is NULL. */ -extern int pthread_cond_init (pthread_cond_t *__restrict __cond, - __const pthread_condattr_t *__restrict - __cond_attr) __THROW; - -/* Destroy condition variable COND. */ -extern int pthread_cond_destroy (pthread_cond_t *__cond) __THROW; - -/* Wake up one thread waiting for condition variable COND. */ -extern int pthread_cond_signal (pthread_cond_t *__cond) __THROW; - -/* Wake up all threads waiting for condition variables COND. */ -extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW; - -/* Wait for condition variable COND to be signaled or broadcast. - MUTEX is assumed to be locked before. */ -extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, - pthread_mutex_t *__restrict __mutex) __THROW; - -/* Wait for condition variable COND to be signaled or broadcast until - ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an - absolute time specification; zero is the beginning of the epoch - (00:00:00 GMT, January 1, 1970). */ -extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, - pthread_mutex_t *__restrict __mutex, - __const struct timespec *__restrict - __abstime) __THROW; - -/* Functions for handling condition variable attributes. */ - -/* Initialize condition variable attribute ATTR. */ -extern int pthread_condattr_init (pthread_condattr_t *__attr) __THROW; - -/* Destroy condition variable attribute ATTR. */ -extern int pthread_condattr_destroy (pthread_condattr_t *__attr) __THROW; - -/* Get the process-shared flag of the condition variable attribute ATTR. */ -extern int pthread_condattr_getpshared (__const pthread_condattr_t * - __restrict __attr, - int *__restrict __pshared) __THROW; - -/* Set the process-shared flag of the condition variable attribute ATTR. */ -extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, - int __pshared) __THROW; - - -#ifdef __USE_UNIX98 -/* Functions for handling read-write locks. */ - -/* Initialize read-write lock RWLOCK using attributes ATTR, or use - the default values if later is NULL. */ -extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, - __const pthread_rwlockattr_t *__restrict - __attr) __THROW; - -/* Destroy read-write lock RWLOCK. */ -extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) __THROW; - -/* Acquire read lock for RWLOCK. */ -extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROW; - -/* Try to acquire read lock for RWLOCK. */ -extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROW; - -#ifdef __USE_XOPEN2K -/* Try to acquire read lock for RWLOCK or return after specfied time. */ -extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, - __const struct timespec *__restrict - __abstime) __THROW; -#endif - -/* Acquire write lock for RWLOCK. */ -extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROW; - -/* Try to acquire write lock for RWLOCK. */ -extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROW; - -#ifdef __USE_XOPEN2K -/* Try to acquire write lock for RWLOCK or return after specfied time. */ -extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, - __const struct timespec *__restrict - __abstime) __THROW; -#endif - -/* Unlock RWLOCK. */ -extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROW; - - -/* Functions for handling read-write lock attributes. */ - -/* Initialize attribute object ATTR with default values. */ -extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) __THROW; - -/* Destroy attribute object ATTR. */ -extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) __THROW; - -/* Return current setting of process-shared attribute of ATTR in PSHARED. */ -extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t * - __restrict __attr, - int *__restrict __pshared) __THROW; - -/* Set process-shared attribute of ATTR to PSHARED. */ -extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, - int __pshared) __THROW; - -/* Return current setting of reader/writer preference. */ -extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *__attr, - int *__pref) __THROW; - -/* Set reader/write preference. */ -extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, - int __pref) __THROW; -#endif - -#ifdef __USE_XOPEN2K -/* The IEEE Std. 1003.1j-2000 introduces functions to implement - spinlocks. */ - -/* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can - be shared between different processes. */ -extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) - __THROW; - -/* Destroy the spinlock LOCK. */ -extern int pthread_spin_destroy (pthread_spinlock_t *__lock) __THROW; - -/* Wait until spinlock LOCK is retrieved. */ -extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROW; - -/* Try to lock spinlock LOCK. */ -extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW; - -/* Release spinlock LOCK. */ -extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW; - - -/* Barriers are a also a new feature in 1003.1j-2000. */ - -extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, - __const pthread_barrierattr_t *__restrict - __attr, unsigned int __count) __THROW; - -extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) __THROW; - -extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) __THROW; - -extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) __THROW; - -extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t * - __restrict __attr, - int *__restrict __pshared) __THROW; - -extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, - int __pshared) __THROW; - -extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW; -#endif - - -/* Functions for handling thread-specific data. */ - -/* Create a key value identifying a location in the thread-specific - data area. Each thread maintains a distinct thread-specific data - area. DESTR_FUNCTION, if non-NULL, is called with the value - associated to that key when the key is destroyed. - DESTR_FUNCTION is not called if the value associated is NULL when - the key is destroyed. */ -extern int pthread_key_create (pthread_key_t *__key, - void (*__destr_function) (void *)) __THROW; - -/* Destroy KEY. */ -extern int pthread_key_delete (pthread_key_t __key) __THROW; - -/* Store POINTER in the thread-specific data slot identified by KEY. */ -extern int pthread_setspecific (pthread_key_t __key, - __const void *__pointer) __THROW; - -/* Return current value of the thread-specific data slot identified by KEY. */ -extern void *pthread_getspecific (pthread_key_t __key) __THROW; - - -/* Functions for handling initialization. */ - -/* Guarantee that the initialization function INIT_ROUTINE will be called - only once, even if pthread_once is executed several times with the - same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or - extern variable initialized to PTHREAD_ONCE_INIT. */ -extern int pthread_once (pthread_once_t *__once_control, - void (*__init_routine) (void)) __THROW; - - -/* Functions for handling cancellation. */ - -/* Set cancelability state of current thread to STATE, returning old - state in *OLDSTATE if OLDSTATE is not NULL. */ -extern int pthread_setcancelstate (int __state, int *__oldstate) __THROW; - -/* Set cancellation state of current thread to TYPE, returning the old - type in *OLDTYPE if OLDTYPE is not NULL. */ -extern int pthread_setcanceltype (int __type, int *__oldtype) __THROW; - -/* Cancel THREAD immediately or at the next possibility. */ -extern int pthread_cancel (pthread_t __thread1) __THROW; - -/* Test for pending cancellation for the current thread and terminate - the thread as per pthread_exit(PTHREAD_CANCELED) if it has been - cancelled. */ -extern void pthread_testcancel (void) __THROW; - - -/* Install a cleanup handler: ROUTINE will be called with arguments ARG - when the thread is cancelled or calls pthread_exit. ROUTINE will also - be called with arguments ARG when the matching pthread_cleanup_pop - is executed with non-zero EXECUTE argument. - pthread_cleanup_push and pthread_cleanup_pop are macros and must always - be used in matching pairs at the same nesting level of braces. */ - -#define pthread_cleanup_push(routine,arg) \ - { struct _pthread_cleanup_buffer _buffer; \ - _pthread_cleanup_push (&_buffer, (routine), (arg)); - -extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, - void (*__routine) (void *), - void *__arg) __THROW; - -/* Remove a cleanup handler installed by the matching pthread_cleanup_push. - If EXECUTE is non-zero, the handler function is called. */ - -#define pthread_cleanup_pop(execute) \ - _pthread_cleanup_pop (&_buffer, (execute)); } - -extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer, - int __execute) __THROW; - -/* Install a cleanup handler as pthread_cleanup_push does, but also - saves the current cancellation type and set it to deferred cancellation. */ - -#ifdef __USE_GNU -# define pthread_cleanup_push_defer_np(routine,arg) \ - { struct _pthread_cleanup_buffer _buffer; \ - _pthread_cleanup_push_defer (&_buffer, (routine), (arg)); - -extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer, - void (*__routine) (void *), - void *__arg) __THROW; - -/* Remove a cleanup handler as pthread_cleanup_pop does, but also - restores the cancellation type that was in effect when the matching - pthread_cleanup_push_defer was called. */ - -# define pthread_cleanup_pop_restore_np(execute) \ - _pthread_cleanup_pop_restore (&_buffer, (execute)); } - -extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer, - int __execute) __THROW; -#endif - - -#ifdef __USE_XOPEN2K -/* Get ID of CPU-time clock for thread THREAD_ID. */ -extern int pthread_getcpuclockid (pthread_t __thread_id, - clockid_t *__clock_id) __THROW; -#endif - - -/* Functions for handling signals. */ -#include <bits/sigthread.h> - - -/* Functions for handling process creation and process execution. */ - -/* Install handlers to be called when a new process is created with FORK. - The PREPARE handler is called in the parent process just before performing - FORK. The PARENT handler is called in the parent process just after FORK. - The CHILD handler is called in the child process. Each of the three - handlers can be NULL, meaning that no handler needs to be called at that - point. - PTHREAD_ATFORK can be called several times, in which case the PREPARE - handlers are called in LIFO order (last added with PTHREAD_ATFORK, - first called before FORK), and the PARENT and CHILD handlers are called - in FIFO (first added, first called). */ - -extern int pthread_atfork (void (*__prepare) (void), - void (*__parent) (void), - void (*__child) (void)) __THROW; - -/* Terminate all threads in the program except the calling process. - Should be called just before invoking one of the exec*() functions. */ - -extern void pthread_kill_other_threads_np (void) __THROW; - -__END_DECLS - -#endif /* pthread.h */ diff --git a/newlib/libc/sys/linux/include/setjmp.h b/newlib/libc/sys/linux/include/setjmp.h deleted file mode 100644 index f07dbab6d..000000000 --- a/newlib/libc/sys/linux/include/setjmp.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - setjmp.h - stubs for future use. -*/ - -#ifndef _SETJMP_H_ -#ifdef __cplusplus -extern "C" { -#endif -#define _SETJMP_H_ - -#include "_ansi.h" -#include <machine/setjmp.h> -#include <signal.h> /* for sigset_t and sigprocmask */ - -typedef struct __sigjmpbuf -{ - __jmp_buf __buf; - int __is_mask_saved; - sigset_t __saved_mask; -} sigjmp_buf; - -typedef __jmp_buf jmp_buf; - -void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); -int _EXFUN(setjmp,(jmp_buf __jmpb)); -void _EXFUN(siglongjmp,(sigjmp_buf __jmpb, int __retval)); -int _EXFUN(sigsetjmp,(sigjmp_buf __jmpb, int __savemask)); - -/* sigsetjmp is implemented as macro using setjmp */ - -#define sigsetjmp(__jmpb, __savemask) \ - ( __jmpb.__is_mask_saved = __savemask && \ - (sigprocmask (SIG_BLOCK, NULL, &__jmpb.__saved_mask) == 0), \ - setjmp (__jmpb.__buf) ) - -#ifdef __cplusplus -} -#endif -#endif /* _SETJMP_H_ */ - diff --git a/newlib/libc/sys/linux/include/stdint.h b/newlib/libc/sys/linux/include/stdint.h deleted file mode 100644 index 5c89acd22..000000000 --- a/newlib/libc/sys/linux/include/stdint.h +++ /dev/null @@ -1,18 +0,0 @@ -/* libc/sys/linux/include/stdint.h - Standard integer types */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _NEWLIB_STDINT_H -#define _NEWLIB_STDINT_H - -/* - * FIXME: linux/types.h defines various types that rightfully belong into - * stdint.h. So we have no choice but to include linux/types.h directly, even - * if this causes name space pollution. Note: we have to go via sys/types.h - * in order to resolve some other compatibility issues. - */ - -#include <sys/types.h> - -#endif diff --git a/newlib/libc/sys/linux/include/time.h b/newlib/libc/sys/linux/include/time.h deleted file mode 100644 index 8b4b28460..000000000 --- a/newlib/libc/sys/linux/include/time.h +++ /dev/null @@ -1,228 +0,0 @@ -/* - * time.h - * - * Struct and function declarations for dealing with time. - */ - -#ifndef _TIME_H_ - -#include "_ansi.h" -#include <sys/reent.h> -#include <sys/linux_time.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef NULL -#define NULL 0 -#endif - -/* Get _CLOCKS_PER_SEC_ */ -#include <machine/time.h> -#include <sys/types.h> - -/* Time Value Specification Structures, P1003.1b-1993, p. 261 */ -#ifndef _STRUCT_TIMESPEC -#define _STRUCT_TIMESPEC -struct timespec { - time_t tv_sec; /* Seconds */ - long tv_nsec; /* Nanoseconds */ -}; -#endif /* !_STRUCT_TIMESPEC */ - -#ifndef __need_timespec - -#define _TIME_H_ 1 - -#ifndef _CLOCKS_PER_SEC_ -#define _CLOCKS_PER_SEC_ 1000 -#endif - -#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_ -#define CLK_TCK CLOCKS_PER_SEC -#define __need_size_t -#include <stddef.h> - -struct tm -{ - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; -}; - -#ifndef __timer_t_defined -# define __timer_t_defined 1 -typedef __timer_t timer_t; -#endif - -clock_t _EXFUN(clock, (void)); -double _EXFUN(difftime, (time_t _time2, time_t _time1)); -time_t _EXFUN(mktime, (struct tm *_timeptr)); -time_t _EXFUN(time, (time_t *_timer)); -#ifndef _REENT_ONLY -char *_EXFUN(asctime, (const struct tm *_tblock)); -char *_EXFUN(ctime, (const time_t *_time)); -struct tm *_EXFUN(gmtime, (const time_t *_timer)); -struct tm *_EXFUN(localtime,(const time_t *_timer)); -#endif -size_t _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t)); - -char *_EXFUN(asctime_r, (const struct tm *, char *)); -char *_EXFUN(ctime_r, (const time_t *, char *)); -struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *)); -struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); - -#ifndef __STRICT_ANSI__ -char *_EXFUN(strptime, (const char *, const char *, struct tm *)); -_VOID _EXFUN(tzset, (_VOID)); -_VOID _EXFUN(_tzset_r, (struct _reent *)); - -/* getdate functions */ - -#ifndef _REENT_ONLY -#define getdate_err (*__getdate_err()) -int *_EXFUN(__getdate_err,(_VOID)); - -struct tm * _EXFUN(getdate, (const char *)); -/* getdate_err is set to one of the following values to indicate the error. - 1 the DATEMSK environment variable is null or undefined, - 2 the template file cannot be opened for reading, - 3 failed to get file status information, - 4 the template file is not a regular file, - 5 an error is encountered while reading the template file, - 6 memory allication failed (not enough memory available), - 7 there is no line in the template that matches the input, - 8 invalid input specification */ -#endif /* !_REENT_ONLY */ - -/* getdate_r returns the error code as above */ -int _EXFUN(getdate_r, (const char *, struct tm *)); - -/* defines for the opengroup specifications Derived from Issue 1 of the SVID. */ -extern __IMPORT time_t _timezone; -extern __IMPORT int _daylight; -extern __IMPORT char *_tzname[2]; - -/* POSIX defines the external tzname being defined in time.h */ -#ifndef tzname -#define tzname _tzname -#endif - -#endif /* !__STRICT_ANSI__ */ - -#include <sys/features.h> - -#if defined(_POSIX_TIMERS) - -#include <signal.h> - -/* Clocks, P1003.1b-1993, p. 263 */ - -int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp)); -int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp)); -int _EXFUN(clock_getres, (clockid_t clock_id, struct timespec *res)); - -/* Create a Per-Process Timer, P1003.1b-1993, p. 264 */ - -int _EXFUN(timer_create, - (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)); - -/* Delete a Per_process Timer, P1003.1b-1993, p. 266 */ - -int _EXFUN(timer_delete, (timer_t timerid)); - -/* Per-Process Timers, P1003.1b-1993, p. 267 */ - -int _EXFUN(timer_settime, - (timer_t timerid, int flags, const struct itimerspec *value, - struct itimerspec *ovalue)); -int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value)); -int _EXFUN(timer_getoverrun, (timer_t timerid)); - -/* High Resolution Sleep, P1003.1b-1993, p. 269 */ - -int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp)); - -#endif /* _POSIX_TIMERS */ - -/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */ - -/* values for the clock enable attribute */ - -#define CLOCK_ENABLED 1 /* clock is enabled, i.e. counting execution time */ -#define CLOCK_DISABLED 0 /* clock is disabled */ - -/* values for the pthread cputime_clock_allowed attribute */ - -#define CLOCK_ALLOWED 1 /* If a thread is created with this value a */ - /* CPU-time clock attached to that thread */ - /* shall be accessible. */ -#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */ - /* thread shall not have a CPU-time clock */ - /* accessible. */ - -/* Manifest Constants, P1003.1b-1993, p. 262 */ - -#define CLOCK_REALTIME (clockid_t)1 - -/* Flag indicating time is "absolute" with respect to the clock - associated with a time. */ - -#define TIMER_ABSTIME 4 - -/* Manifest Constants, P1003.4b/D8, p. 55 */ - -#if defined(_POSIX_CPUTIME) - -/* When used in a clock or timer function call, this is interpreted as - the identifier of the CPU_time clock associated with the PROCESS - making the function call. */ - -#define CLOCK_PROCESS_CPUTIME_ID (clockid_t)2 - -#endif - -#if defined(_POSIX_THREAD_CPUTIME) - -/* When used in a clock or timer function call, this is interpreted as - the identifier of the CPU_time clock associated with the THREAD - making the function call. */ - -#define CLOCK_THREAD_CPUTIME_ID (clockid_t)3 - -#endif - -#if defined(_POSIX_CPUTIME) - -/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */ - -int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id)); - -#endif /* _POSIX_CPUTIME */ - -#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME) - -/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */ - -int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr)); -int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr)); - -#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */ - -#ifdef __cplusplus -} -#endif - -#endif /* ! __need_timespec */ - -#undef __need_timespec - -#endif /* _TIME_H_ */ - diff --git a/newlib/libc/sys/linux/include/unistd.h b/newlib/libc/sys/linux/include/unistd.h deleted file mode 100644 index e2f562a3a..000000000 --- a/newlib/libc/sys/linux/include/unistd.h +++ /dev/null @@ -1,20 +0,0 @@ -/* libc/sys/linux/include/unistd.h - Various standard functions */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _NEWLIB_UNISTD_H -#define _NEWLIB_UNISTD_H - -#include <sys/types.h> -#include <sys/unistd.h> - -/* Declare some missing goodies */ - -extern char *optarg; -extern int optind, opterr, optopt; - - -int readlink(const char *path, char *buf, size_t bufsiz); - -#endif diff --git a/newlib/libc/sys/linux/inode.c b/newlib/libc/sys/linux/inode.c deleted file mode 100644 index ed468c19b..000000000 --- a/newlib/libc/sys/linux/inode.c +++ /dev/null @@ -1,97 +0,0 @@ -/* libc/sys/linux/inode.c - Inode-related system calls */ - -/* Written 2000 by Werner Almesberger */ - - -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/utime.h> -#include <linux/dirent.h> -#include <machine/syscall.h> - -#define _LIBC 1 -#include <sys/lock.h> - - -#define __NR___umask __NR_umask - -_syscall2(int,link,const char *,oldpath,const char *,newpath) -_syscall1(int,unlink,const char *,pathname) -_syscall1(int,chdir,const char *,path) -_syscall1(int,fchdir,int,fd) -_syscall2(int,access,const char *,filename,int,mode) -_syscall2(int,mkdir,const char *,pathname,mode_t,mode) -_syscall1(int,rmdir,const char *,pathname) -_syscall1(int,chroot,const char *,path) -_syscall2(int,stat,const char *,file_name,struct stat *,buf) -_syscall2(int,statfs,const char *,file_name,struct statfs *,buf) -_syscall2(int,fstat,int,filedes,struct stat *,buf) -_syscall2(int,fstatfs,int,filedes,struct statfs *,buf) -_syscall3(int,getdents,int,fd,struct dirent *,dirp,unsigned int,count) - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 -_syscall2(int,chmod,const char *,path,mode_t,mode) -_syscall3(int,chown,const char *,path,uid_t,owner,gid_t,group) -_syscall2(int,fchmod,int,filedes,mode_t,mode) -_syscall2(int,lstat,const char *,file_name,struct stat *,buf) -_syscall3(int,readlink,const char *,path,char *,buf,size_t,bufsiz) -_syscall2(int,symlink,const char *,oldpath,const char *,newpath) -_syscall2(int,utime,const char *,filename,const struct utimbuf *,buf) -#endif - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 -_syscall1(int,pipe,int *,filedes) -#endif - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4 -_syscall3(int,mknod,const char *,pathname,mode_t,mode,dev_t,dev) -#endif - -weak_alias(__libc_statfs,__statfs) -weak_alias(__libc_fstatfs,__fstatfs) - -static _syscall3(int,fchown32,int,fd,uid_t,owner,gid_t,group) - -int -fchown (int fd, uid_t owner, gid_t group) -{ - return __libc_fchown32 (fd, owner, group); -} - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 - -__LOCK_INIT(static, umask_lock); - -_syscall1(mode_t,__umask,mode_t,mask) - -mode_t -umask (mode_t mask) -{ - mode_t old_mask; - - /* we need to lock so as to not interfere with getumask */ - __lock_acquire(umask_lock); - old_mask = __umask (mask); - __lock_release(umask_lock); - - return old_mask; -} - -mode_t -getumask (void) -{ - mode_t mask; - - __lock_acquire(umask_lock); - - mask = __umask (0); - mask = __umask (mask); - - __lock_release(umask_lock); - - return mask; -} - -#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 2 */ diff --git a/newlib/libc/sys/linux/internal_statvfs.c b/newlib/libc/sys/linux/internal_statvfs.c deleted file mode 100644 index 9efb7c227..000000000 --- a/newlib/libc/sys/linux/internal_statvfs.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - - /* Now fill in the fields we have information for. */ - buf->f_bsize = fsbuf.f_bsize; - /* Linux does not support f_frsize, so set it to the full block size. */ - buf->f_frsize = fsbuf.f_bsize; - buf->f_blocks = fsbuf.f_blocks; - buf->f_bfree = fsbuf.f_bfree; - buf->f_bavail = fsbuf.f_bavail; - buf->f_files = fsbuf.f_files; - buf->f_ffree = fsbuf.f_ffree; - if (sizeof (buf->f_fsid) == sizeof (fsbuf.f_fsid)) - buf->f_fsid = (fsbuf.f_fsid.__val[0] - | ((unsigned long int) fsbuf.f_fsid.__val[1] - << (8 * (sizeof (buf->f_fsid) - - sizeof (fsbuf.f_fsid.__val[0]))))); - else - /* We cannot help here. The statvfs element is not large enough to - contain both words of the statfs f_fsid field. */ - buf->f_fsid = fsbuf.f_fsid.__val[0]; -#ifdef _STATVFSBUF_F_UNUSED - buf->__f_unused = 0; -#endif - buf->f_namemax = fsbuf.f_namelen; - memset (buf->__f_spare, '\0', 6 * sizeof (int)); - - /* What remains to do is to fill the fields f_favail and f_flag. */ - - /* XXX I have no idea how to compute f_favail. Any idea??? */ - buf->f_favail = buf->f_ffree; - - /* Determining the flags is tricky. We have to read /proc/mounts or - the /etc/mtab file and search for the entry which matches the given - file. The way we can test for matching filesystem is using the - device number. */ - buf->f_flag = 0; - if (STAT (&st) >= 0) - { - int save_errno = errno; - struct mntent mntbuf; - FILE *mtab; - - mtab = __setmntent ("/proc/mounts", "r"); - if (mtab == NULL) - mtab = __setmntent (_PATH_MOUNTED, "r"); - - if (mtab != NULL) - { - char tmpbuf[1024]; - - while (__getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf))) - { - struct stat64 fsst; - - /* Find out about the device the current entry is for. */ - if (stat64 (mntbuf.mnt_dir, &fsst) >= 0 - && st.st_dev == fsst.st_dev) - { - /* Bingo, we found the entry for the device FD is on. - Now interpret the option string. */ - char *cp = mntbuf.mnt_opts; - char *opt; - - while ((opt = strsep (&cp, ",")) != NULL) - if (strcmp (opt, "ro") == 0) - buf->f_flag |= ST_RDONLY; - else if (strcmp (opt, "nosuid") == 0) - buf->f_flag |= ST_NOSUID; - else if (strcmp (opt, "noexec") == 0) - buf->f_flag |= ST_NOEXEC; - else if (strcmp (opt, "nodev") == 0) - buf->f_flag |= ST_NODEV; - else if (strcmp (opt, "sync") == 0) - buf->f_flag |= ST_SYNCHRONOUS; - else if (strcmp (opt, "mand") == 0) - buf->f_flag |= ST_MANDLOCK; - else if (strcmp (opt, "noatime") == 0) - buf->f_flag |= ST_NOATIME; - else if (strcmp (opt, "nodiratime") == 0) - buf->f_flag |= ST_NODIRATIME; - - /* We can stop looking for more entries. */ - break; - } - } - - /* Close the file. */ - __endmntent (mtab); - } - - errno = (save_errno); - } diff --git a/newlib/libc/sys/linux/io.c b/newlib/libc/sys/linux/io.c deleted file mode 100644 index d6731144a..000000000 --- a/newlib/libc/sys/linux/io.c +++ /dev/null @@ -1,84 +0,0 @@ -/* libc/sys/linux/io.c - Basic input/output system calls */ - -/* Written 2000 by Werner Almesberger */ - - -#define __KERNEL_PROTOTYPES - -#include <stdarg.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <poll.h> -#include <machine/syscall.h> - - -#define __NR___ioctl __NR_ioctl -#define __NR___flock __NR_flock -#define __NR___mknod __NR_mknod - -_syscall3(ssize_t,read,int,fd,void *,buf,size_t,count) -_syscall3(ssize_t,write,int,fd,const void *,buf,size_t,count) -_syscall3(int,open,const char *,file,int,flag,mode_t,mode) -_syscall1(int,close,int,fd) -_syscall3(off_t,lseek,int,fd,off_t,offset,int,count) -_syscall0(int,sync) -_syscall1(int,dup,int,fd) -_syscall2(int,dup2,int,oldfd,int,newfd) -_syscall3(int,fcntl,int,fd,int,cmd,long,arg) -_syscall1(int,fdatasync,int,fd) -_syscall1(int,fsync,int,fd) -_syscall3(int,poll,struct pollfd *,fds,nfds_t,nfds,int,timeout) - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 -_syscall3(ssize_t,readv,int,fd,const struct iovec *,vec,int,count) -_syscall3(ssize_t,writev,int,fd,const struct iovec *,buf,int,count) -#endif - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4 -_syscall2(int,ftruncate,int,fd,off_t,len) -_syscall2(int,truncate,const char *,path,off_t,len) -#endif - -static _syscall3(int,__ioctl,int,fd,int,request,void *,arg) - -int ioctl(int fd,int request,...) -{ - va_list ap; - int res; - - va_start(ap,request); - res = __ioctl(fd,request,va_arg(ap,void *)); - va_end(ap); - return res; -} - -static _syscall2(long,__flock,unsigned int,fd,unsigned int,cmd) - -int flock(int fd,int operation) -{ - return __flock(fd,operation); -} - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 - -static _syscall3(int,__mknod,const char *,path,mode_t,mode,dev_t *,dev) - -int mkfifo(const char *path, mode_t mode) -{ - dev_t dev = 0; - return __mknod(path, mode | S_IFIFO, &dev); -} -#endif - -weak_alias(__libc_close,__close); -weak_alias(__libc_fcntl,__fcntl); -weak_alias(__libc_lseek,__lseek); -weak_alias(__libc_open,__open); -weak_alias(__libc_read,__read); -weak_alias(__libc_write,__write); -weak_alias(__libc_poll,__poll); - diff --git a/newlib/libc/sys/linux/io64.c b/newlib/libc/sys/linux/io64.c deleted file mode 100644 index 7f87c1e9b..000000000 --- a/newlib/libc/sys/linux/io64.c +++ /dev/null @@ -1,68 +0,0 @@ -/* libc/sys/linux/io64.c - large file input/output system calls */ - -/* Copyright 2002, Red Hat Inc. */ - - -#define __KERNEL_PROTOTYPES - -#include <stdarg.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <machine/syscall.h> - -#define __NR___truncate64 __NR_truncate64 -#define __NR___ftruncate64 __NR_ftruncate64 - -_syscall2(int,fstat64,int,fd,struct stat64 *,st) -_syscall2(int,lstat64,const char *,name,struct stat64 *,st) -_syscall2(int,stat64,const char *,name,struct stat64 *,st) - -static _syscall3(int,__truncate64,const char *,name,int,high,int,low) - -int __libc_truncate64(const char *name, off64_t length) -{ - return __truncate64(name,(length >> 32), (length & 0xffffffff)); -} -weak_alias(__libc_truncate64,truncate64) - -static _syscall3(int,__ftruncate64,int,fd,int,high,int,low); - -int __libc_ftruncate64(int fd, off64_t length) -{ - return __ftruncate64(fd,(length >> 32),(length & 0xffffffff)); -} -weak_alias(__libc_ftruncate64,ftruncate64) - -static _syscall5(void,_llseek,int,fd,off_t,hi,off_t,lo,loff_t *,pos,int,whence) - -loff_t __libc_lseek64(int fd, loff_t offset, int whence) -{ - loff_t pos; - __libc__llseek(fd, offset >> 32, offset & 0xffffffff, &pos, whence); - return pos; -} -weak_alias(__libc_lseek64,lseek64); -weak_alias(__libc_lseek64,_lseek64); - -int __libc_open64(const char *path, int oflag, ...) -{ - mode_t mode = 0; - if (oflag & O_CREAT) - { - va_list list; - va_start(list, oflag); - mode = va_arg(list, int); - va_end(list); - } - return __libc_open(path, oflag | O_LARGEFILE, mode); -} -weak_alias(__libc_open64,open64); -weak_alias(__libc_open64,_open64); -weak_alias(__libc_open64,__open64); -weak_alias(__libc_fstat64,_fstat64); - - diff --git a/newlib/libc/sys/linux/ipc.c b/newlib/libc/sys/linux/ipc.c deleted file mode 100644 index 31e225255..000000000 --- a/newlib/libc/sys/linux/ipc.c +++ /dev/null @@ -1,87 +0,0 @@ -/* libc/sys/linux/ipc.c - IPC semaphore and message queue functions */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <sys/types.h> -#include <sys/sem.h> -#include <sys/msg.h> -#include <stdarg.h> - -#include <machine/syscall.h> - -#define IPC_64 0x100 - -#define IPCOP_semop 1 -#define IPCOP_semget 2 -#define IPCOP_semctl 3 -#define IPCOP_msgsnd 11 -#define IPCOP_msgrcv 12 -#define IPCOP_msgget 13 -#define IPCOP_msgctl 14 - -static _syscall5(int,ipc,int,op,int,arg1,int,arg2,int,arg3,void *,arg4); - -int -semget (key_t key, int nsems, int semflgs) -{ - return __libc_ipc(IPCOP_semget, (int)key, nsems, semflgs, NULL); -} - -int -semctl (int semid, int semnum, int cmd, ...) -{ - va_list va; - union semun { - int val; - struct semid_ds *buf; - unsigned short *array; - } arg; - - va_start (va, cmd); - - arg = va_arg (va, union semun); - - va_end (va); - - return __libc_ipc(IPCOP_semctl, semid, semnum, cmd | IPC_64, &arg); -} - -int -semop (int semid, struct sembuf *sops, size_t nsems) -{ - return __libc_ipc(IPCOP_semop, semid, (int)nsems, 0, sops); -} - -int -msgget (key_t key, int msgflg) -{ - return __libc_ipc(IPCOP_msgget, (int)key, msgflg, 0, NULL); -} - -int -msgctl (int msqid, int cmd, struct msqid_ds *buf) -{ - return __libc_ipc(IPCOP_msgctl, msqid, cmd | IPC_64, 0, buf); -} - -int -msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) -{ - return __libc_ipc(IPCOP_msgsnd, msqid, (int)msgsz, msgflg, (void *)msgp); -} - -int -msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) -{ - /* last argument must contain multiple args */ - struct { - void *msgp; - long int msgtyp; - } args; - - args.msgp = msgp; - args.msgtyp = msgtyp; - - return (ssize_t)__libc_ipc(IPCOP_msgrcv, msqid, (int)msgsz, msgflg, &args); -} - diff --git a/newlib/libc/sys/linux/kernel_sigaction.h b/newlib/libc/sys/linux/kernel_sigaction.h deleted file mode 100644 index d005cbce9..000000000 --- a/newlib/libc/sys/linux/kernel_sigaction.h +++ /dev/null @@ -1,19 +0,0 @@ -/* This is the sigaction structure from the Linux 2.1.20 kernel. */ - -#define HAVE_SA_RESTORER - -struct old_kernel_sigaction { - __sighandler_t k_sa_handler; - unsigned long sa_mask; - unsigned long sa_flags; - void (*sa_restorer) (void); -}; - -/* This is the sigaction structure from the Linux 2.1.68 kernel. */ - -struct kernel_sigaction { - __sighandler_t k_sa_handler; - unsigned long sa_flags; - void (*sa_restorer) (void); - sigset_t sa_mask; -}; diff --git a/newlib/libc/sys/linux/libc-internal.h b/newlib/libc/sys/linux/libc-internal.h deleted file mode 100644 index 8369ffec2..000000000 --- a/newlib/libc/sys/linux/libc-internal.h +++ /dev/null @@ -1,29 +0,0 @@ -/* This file contains a number of internal prototype declarations that - don't fit anywhere else. */ - -#ifndef _LIBC_INTERNAL -# define _LIBC_INTERNAL 1 - -#include <hp-timing.h> - -/* Initialize the `__libc_enable_secure' flag. */ -extern void __libc_init_secure (void); - -/* This function will be called from _init in init-first.c. */ -extern void __libc_global_ctors (void); - -/* Discover the tick frequency of the machine if something goes wrong, - we return 0, an impossible hertz. */ -extern int __profile_frequency (void); - -/* Hooks for the instrumenting functions. */ -extern void __cyg_profile_func_enter (void *this_fn, void *call_site); -extern void __cyg_profile_func_exit (void *this_fn, void *call_site); - -/* Get frequency of the system processor. */ -extern hp_timing_t __get_clockfreq (void); - -/* Free all allocated resources. */ -extern void __libc_freeres (void); - -#endif /* _LIBC_INTERNAL */ diff --git a/newlib/libc/sys/linux/libc-symbols.h b/newlib/libc/sys/linux/libc-symbols.h deleted file mode 100644 index 97b672643..000000000 --- a/newlib/libc/sys/linux/libc-symbols.h +++ /dev/null @@ -1,352 +0,0 @@ -/* Support macros for making weak and strong aliases for symbols, - and for using symbol sets and linker warnings with GNU ld. - Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _LIBC_SYMBOLS_H -#define _LIBC_SYMBOLS_H 1 - -/* This file's macros are included implicitly in the compilation of every - file in the C library by -imacros. - - We include config.h which is generated by configure. - It should define for us the following symbols: - - * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. - * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. - * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, - and for symbol set and warning messages extensions in a.out and ELF. - * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. - * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. - * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. - - */ - -/* This is defined for the compilation of all C library code. features.h - tests this to avoid inclusion of stubs.h while compiling the library, - before stubs.h has been generated. Some library code that is shared - with other packages also tests this symbol to see if it is being - compiled as part of the C library. We must define this before including - config.h, because it makes some definitions conditional on whether libc - itself is being compiled, or just some generator program. */ -#define _LIBC 1 - -/* Enable declarations of GNU extensions, since we are compiling them. */ -#define _GNU_SOURCE 1 -/* And we also need the data for the reentrant functions. */ -#define _REENTRANT 1 - -#include <config.h> - -/* The symbols in all the user (non-_) macros are C symbols. - HAVE_GNU_LD without HAVE_ELF implies a.out. */ - -#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE -# define HAVE_WEAK_SYMBOLS -#endif - -#ifndef __SYMBOL_PREFIX -# ifdef NO_UNDERSCORES -# define __SYMBOL_PREFIX -# else -# define __SYMBOL_PREFIX "_" -# endif -#endif - -#ifndef C_SYMBOL_NAME -# ifdef NO_UNDERSCORES -# define C_SYMBOL_NAME(name) name -# else -# define C_SYMBOL_NAME(name) _##name -# endif -#endif - -#ifndef ASM_LINE_SEP -# define ASM_LINE_SEP ; -#endif - -#ifndef C_SYMBOL_DOT_NAME -# define C_SYMBOL_DOT_NAME(name) .##name -#endif - -#ifndef __ASSEMBLER__ -/* GCC understands weak symbols and aliases; use its interface where - possible, instead of embedded assembly language. */ - -/* Define ALIASNAME as a strong alias for NAME. */ -# define strong_alias(name, aliasname) _strong_alias(name, aliasname) -# define _strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); - -/* This comes between the return type and function name in - a function definition to make that definition weak. */ -# define weak_function __attribute__ ((weak)) -# define weak_const_function __attribute__ ((weak, __const__)) - -# ifdef HAVE_WEAK_SYMBOLS - -/* Define ALIASNAME as a weak alias for NAME. - If weak aliases are not available, this defines a strong alias. */ -# define weak_alias(name, aliasname) _weak_alias (name, aliasname) -# define _weak_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); - -/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ -# define weak_extern(symbol) _weak_extern (symbol) -# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE -# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); -# else -# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); -# endif - -# else - -# define weak_alias(name, aliasname) strong_alias(name, aliasname) -# define weak_extern(symbol) /* Nothing. */ - -# endif - -#else /* __ASSEMBLER__ */ - -# ifdef HAVE_ASM_SET_DIRECTIVE -# define strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) -# else -# ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) -# else -# define strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) -# endif -# endif - -# ifdef HAVE_WEAK_SYMBOLS -# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE -# define weak_alias(original, alias) \ - .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) -# define weak_extern(symbol) \ - .weakext C_SYMBOL_NAME (symbol) - -# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ - -# ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define weak_alias(original, alias) \ - .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) -# else -# define weak_alias(original, alias) \ - .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) -# endif - -# define weak_extern(symbol) \ - .weak C_SYMBOL_NAME (symbol) - -# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ - -# else /* ! HAVE_WEAK_SYMBOLS */ - -# define weak_alias(original, alias) strong_alias(original, alias) -# define weak_extern(symbol) /* Nothing */ -# endif /* ! HAVE_WEAK_SYMBOLS */ - -#endif /* __ASSEMBLER__ */ - -/* On some platforms we can make internal function calls (i.e., calls of - functions not exported) a bit faster by using a different calling - convention. */ -#ifndef internal_function -# define internal_function /* empty */ -#endif - -/* Prepare for the case that `__builtin_expect' is not available. */ -#ifndef HAVE_BUILTIN_EXPECT -# define __builtin_expect(expr, val) (expr) -#endif - -/* Determine the return address. */ -#define RETURN_ADDRESS(nr) \ - __builtin_extract_return_addr (__builtin_return_address (nr)) - -/* When a reference to SYMBOL is encountered, the linker will emit a - warning message MSG. */ -#ifdef HAVE_GNU_LD -# ifdef HAVE_ELF - -/* We want the .gnu.warning.SYMBOL section to be unallocated. */ -# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE -# define __make_section_unallocated(section_string) \ - asm (".section " section_string "\n\t.previous"); -# elif defined HAVE_ASM_POPSECTION_DIRECTIVE -# define __make_section_unallocated(section_string) \ - asm (".pushsection " section_string "\n\t.popsection"); -# else -# define __make_section_unallocated(section_string) -# endif - -/* Tacking on "\n\t#" to the section name makes gcc put it's bogus - section attributes on what looks like a comment to the assembler. */ -# ifdef HAVE_SECTION_QUOTES -# define link_warning(symbol, msg) \ - __make_section_unallocated (".gnu.warning." #symbol) \ - static const char __evoke_link_warning_##symbol[] \ - __attribute__ ((section (".gnu.warning." #symbol "\"\n\t#\""))) = msg; -# else -# define link_warning(symbol, msg) \ - __make_section_unallocated (".gnu.warning." #symbol) \ - static const char __evoke_link_warning_##symbol[] \ - __attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg; -# endif -# else /* Not ELF: a.out */ -# ifdef HAVE_XCOFF -/* XCOFF does not support .stabs. - The native aix linker will remove the .stab and .stabstr sections - The gnu linker will have a fatal error if there is a relocation for - symbol in the .stab section. Silently disable this macro. */ -# define link_warning(symbol, msg) -# else -# define link_warning(symbol, msg) \ - asm (".stabs \"" msg "\",30,0,0,0\n\t" \ - ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); -# endif /* XCOFF */ -# endif -#else -/* We will never be heard; they will all die horribly. */ -# define link_warning(symbol, msg) -#endif - -/* A canned warning for sysdeps/stub functions. */ -#define stub_warning(name) \ - link_warning (name, \ - "warning: " #name " is not implemented and will always fail") - -/* - -*/ - -#ifdef HAVE_GNU_LD - -/* Symbol set support macros. */ - -# ifdef HAVE_ELF - -/* Make SYMBOL, which is in the text segment, an element of SET. */ -# define text_set_element(set, symbol) _elf_set_element(set, symbol) -/* Make SYMBOL, which is in the data segment, an element of SET. */ -# define data_set_element(set, symbol) _elf_set_element(set, symbol) -/* Make SYMBOL, which is in the bss segment, an element of SET. */ -# define bss_set_element(set, symbol) _elf_set_element(set, symbol) - -/* These are all done the same way in ELF. - There is a new section created for each set. */ -# ifdef SHARED -/* When building a shared library, make the set section writable, - because it will need to be relocated at run time anyway. */ -# define _elf_set_element(set, symbol) \ - static const void *__elf_set_##set##_element_##symbol##__ \ - __attribute__ ((unused, section (#set))) = &(symbol) -# else -# define _elf_set_element(set, symbol) \ - static const void *const __elf_set_##set##_element_##symbol##__ \ - __attribute__ ((unused, section (#set))) = &(symbol) -# endif - -/* Define SET as a symbol set. This may be required (it is in a.out) to - be able to use the set's contents. */ -# define symbol_set_define(set) symbol_set_declare(set) - -/* Declare SET for use in this module, if defined in another module. */ -# define symbol_set_declare(set) \ - extern void *const __start_##set __attribute__ ((__weak__)); \ - extern void *const __stop_##set __attribute__ ((__weak__)); \ - weak_extern (__start_##set) weak_extern (__stop_##set) - -/* Return a pointer (void *const *) to the first element of SET. */ -# define symbol_set_first_element(set) (&__start_##set) - -/* Return true iff PTR (a void *const *) has been incremented - past the last element in SET. */ -# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set) - -# else /* Not ELF: a.out. */ - -# ifdef HAVE_XCOFF -/* XCOFF does not support .stabs. - The native aix linker will remove the .stab and .stabstr sections - The gnu linker will have a fatal error if there is a relocation for - symbol in the .stab section. Silently disable these macros. */ -# define text_set_element(set, symbol) -# define data_set_element(set, symbol) -# define bss_set_element(set, symbol) -# else -# define text_set_element(set, symbol) \ - asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) -# define data_set_element(set, symbol) \ - asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) -# define bss_set_element(set, symbol) ?error Must use initialized data. -# endif /* XCOFF */ -# define symbol_set_define(set) void *const (set)[1]; -# define symbol_set_declare(set) extern void *const (set)[1]; - -# define symbol_set_first_element(set) &(set)[1] -# define symbol_set_end_p(set, ptr) (*(ptr) == 0) - -# endif /* ELF. */ -#else -/* We cannot do anything in generial. */ -# define text_set_element(set, symbol) asm ("") -# define data_set_element(set, symbol) asm ("") -# define bss_set_element(set, symbol) asm ("") -# define symbol_set_define(set) void *const (set)[1]; -# define symbol_set_declare(set) extern void *const (set)[1]; - -# define symbol_set_first_element(set) &(set)[1] -# define symbol_set_end_p(set, ptr) (*(ptr) == 0) -#endif /* Have GNU ld. */ - -#if DO_VERSIONING -# define symbol_version(real, name, version) \ - _symbol_version(real, name, version) -# define default_symbol_version(real, name, version) \ - _default_symbol_version(real, name, version) -# ifdef __ASSEMBLER__ -# define _symbol_version(real, name, version) \ - .symver real, name##@##version -# define _default_symbol_version(real, name, version) \ - .symver real, name##@##@##version -# else -# define _symbol_version(real, name, version) \ - __asm__ (".symver " #real "," #name "@" #version) -# define _default_symbol_version(real, name, version) \ - __asm__ (".symver " #real "," #name "@@" #version) -# endif -#else -# define symbol_version(real, name, version) -# define default_symbol_version(real, name, version) \ - strong_alias(real, name) -#endif - -#endif /* libc-symbols.h */ diff --git a/newlib/libc/sys/linux/libc-tsd.h b/newlib/libc/sys/linux/libc-tsd.h deleted file mode 100644 index 7a532ea74..000000000 --- a/newlib/libc/sys/linux/libc-tsd.h +++ /dev/null @@ -1,44 +0,0 @@ -/* libc-internal interface for thread-specific data. LinuxThreads version. - Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _BITS_LIBC_TSD_H -#define _BITS_LIBC_TSD_H 1 - - -/* Fast thread-specific data internal to libc. */ -enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0, - _LIBC_TSD_KEY_DL_ERROR, - _LIBC_TSD_KEY_RPC_VARS, - _LIBC_TSD_KEY_N }; - -extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW; -extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t, - __const void *) __THROW; - -#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data; -#define __libc_tsd_get(KEY) \ - (__libc_internal_tsd_get != NULL \ - ? __libc_internal_tsd_get (_LIBC_TSD_KEY_##KEY) \ - : __libc_tsd_##KEY##_data) -#define __libc_tsd_set(KEY, VALUE) \ - (__libc_internal_tsd_set != NULL \ - ? __libc_internal_tsd_set (_LIBC_TSD_KEY_##KEY, (VALUE)) \ - : ((__libc_tsd_##KEY##_data = (VALUE)), 0)) - -#endif /* bits/libc-tsd.h */ diff --git a/newlib/libc/sys/linux/libintl.h b/newlib/libc/sys/linux/libintl.h deleted file mode 100644 index 203a2c852..000000000 --- a/newlib/libc/sys/linux/libintl.h +++ /dev/null @@ -1,9 +0,0 @@ -/* temporary internal libintl.h to ignore message translation for now */ - -#ifndef _LIBINTL_H -#define _LIBINTL_H 1 - -#undef _ -#define _(x) (x) - -#endif diff --git a/newlib/libc/sys/linux/linux.c b/newlib/libc/sys/linux/linux.c deleted file mode 100644 index ae11c3ffb..000000000 --- a/newlib/libc/sys/linux/linux.c +++ /dev/null @@ -1,14 +0,0 @@ -/* libc/sys/linux/linux.c - System-specific system calls */ - -/* Written 2000 by Werner Almesberger */ - - -/* - * Most system call wrappers have moved to utilities; future fate of this file - * is guided by glibc/autoconf compatibility and FFS - */ - -#include <machine/syscall.h> - - -/* _syscall1(int,delete_module,const char *,name) */ diff --git a/newlib/libc/sys/linux/linux_fsinfo.h b/newlib/libc/sys/linux/linux_fsinfo.h deleted file mode 100644 index 692abe5de..000000000 --- a/newlib/libc/sys/linux/linux_fsinfo.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Constants from kernel header for various FSes. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _LINUX_FSINFO_H -#define _LINUX_FSINFO_H 1 - -/* These definitions come from the kernel headers. But we cannot - include the headers here because of type clashes. If new - filesystem types will become available we have to add the - appropriate definitions here.*/ - -/* Constants that identify the `adfs' filesystem. */ -#define ADFS_SUPER_MAGIC 0xadf5 - -/* Constants that identify the `affs' filesystem. */ -#define AFFS_SUPER_MAGIC 0xadff - -/* Constants that identify the `bfs' filesystem. */ -#define BFS_MAGIC 0x1BADFACE - -/* Constants that identify the `coda' filesystem. */ -#define CODA_SUPER_MAGIC 0x73757245 - -/* Constants that identify the `coherent' filesystem. */ -#define COH_SUPER_MAGIC 0x012ff7b7 - -/* Constant that identifies the `devfs' filesystem. */ -#define DEVFS_SUPER_MAGIC 0x1373 - -/* Constant that identifies the `devpts' filesystem. */ -#define DEVPTS_SUPER_MAGIC 0x1cd1 - -/* Constant that identifies the `efs' filesystem. */ -#define EFS_SUPER_MAGIC 0x414A53 - -/* Constant that identifies the `ext2' and `ext3' filesystems. */ -#define EXT2_SUPER_MAGIC 0xef53 - -/* Constant that identifies the `hpfs' filesystem. */ -#define HPFS_SUPER_MAGIC 0xf995e849 - -/* Constant that identifies the `iso9660' filesystem. */ -#define ISOFS_SUPER_MAGIC 0x9660 - -/* Constants that identify the `minix2' filesystem. */ -#define MINIX2_SUPER_MAGIC 0x2468 -#define MINIX2_SUPER_MAGIC2 0x2478 - -/* Constants that identify the `minix' filesystem. */ -#define MINIX_SUPER_MAGIC 0x137f -#define MINIX_SUPER_MAGIC2 0x138F - -/* Constants that identify the `msdos' filesystem. */ -#define MSDOS_SUPER_MAGIC 0x4d44 - -/* Constants that identify the `ncp' filesystem. */ -#define NCP_SUPER_MAGIC 0x564c - -/* Constants that identify the `nfs' filesystem. */ -#define NFS_SUPER_MAGIC 0x6969 - -/* Constants that identify the `proc' filesystem. */ -#define PROC_SUPER_MAGIC 0x9fa0 - -/* Constants that identify the `qnx4' filesystem. */ -#define QNX4_SUPER_MAGIC 0x002f - -/* Constants that identify the `reiser' filesystem. */ -#define REISERFS_SUPER_MAGIC 0x52654973 - -/* Constants that identify the `smb' filesystem. */ -#define SMB_SUPER_MAGIC 0x517b - -/* Constants that identify the `sysV' filesystem. */ -#define SYSV2_SUPER_MAGIC 0x012ff7b6 -#define SYSV4_SUPER_MAGIC 0x012ff7b5 - -/* Constants that identify the `ufs' filesystem. */ -#define UFS_MAGIC 0x00011954 -#define UFS_CIGAM 0x54190100 /* byteswapped MAGIC */ - -/* Constants that identify the `xenix' filesystem. */ -#define XENIX_SUPER_MAGIC 0x012ff7b4 - -/* Constant that identifies the `shm' filesystem. */ -#define SHMFS_SUPER_MAGIC 0x01021994 - -/* Maximum link counts. */ -#define COH_LINK_MAX 10000 -#define EXT2_LINK_MAX 32000 -#define MINIX2_LINK_MAX 65530 -#define MINIX_LINK_MAX 250 -#define REISERFS_LINK_MAX 64535 -#define SYSV_LINK_MAX 126 /* 127? 251? */ -#define UFS_LINK_MAX EXT2_LINK_MAX -#define XENIX_LINK_MAX 126 /* ?? */ - -#endif /* linux_fsinfo.h */ diff --git a/newlib/libc/sys/linux/machine/Makefile.am b/newlib/libc/sys/linux/machine/Makefile.am deleted file mode 100644 index 3f10b8fbf..000000000 --- a/newlib/libc/sys/linux/machine/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -## Process this file with automake to generate Makefile.in - -AUTOMAKE_OPTIONS = cygnus - -SUBDIRS = $(machine_dir) . - -noinst_DATA = $(CRT0) - -$(CRT0): $(machine_dir)/$(CRT0) - rm -f $@ - ln $(machine_dir)/$(CRT0) $@ >/dev/null 2>/dev/null \ - || cp $(machine_dir)/$(CRT0) $@ - -$(machine_dir)/$(CRT0): ; @true - -CLEANFILES = $(CRT0) - -doc: - -ACLOCAL_AMFLAGS = -I ../../../.. -CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libc/sys/linux/machine/Makefile.in b/newlib/libc/sys/linux/machine/Makefile.in deleted file mode 100644 index d56668de1..000000000 --- a/newlib/libc/sys/linux/machine/Makefile.in +++ /dev/null @@ -1,371 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AR = @AR@ -AS = @AS@ -CC = @CC@ -CPP = @CPP@ -CRT0 = @CRT0@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DLLTOOL = @DLLTOOL@ -EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -aext = @aext@ -libm_machine_dir = @libm_machine_dir@ -machine_dir = @machine_dir@ -newlib_basedir = @newlib_basedir@ -oext = @oext@ -sys_dir = @sys_dir@ - -AUTOMAKE_OPTIONS = cygnus - -SUBDIRS = $(machine_dir) . - -noinst_DATA = $(CRT0) - -CLEANFILES = $(CRT0) - -ACLOCAL_AMFLAGS = -I ../../../.. -CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../mkinstalldirs -CONFIG_CLEAN_FILES = -DATA = $(noinst_DATA) - -DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -all: all-redirect -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status - -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \ - ../../../../acinclude.m4 ../../../../aclocal.m4 \ - ../../../../libtool.m4 - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - -all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ - done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -rm -rf $(distdir) - GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist - -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive -check-am: -check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -install-info-am: -install-info: install-info-recursive -install-exec-am: -install-exec: install-exec-recursive - -install-data-am: -install-data: install-data-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: -uninstall: uninstall-recursive -all-am: Makefile $(DATA) -all-redirect: all-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: installdirs-recursive -installdirs-am: - - -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-recursive - -clean-am: clean-tags clean-generic mostlyclean-am - -clean: clean-recursive - -distclean-am: distclean-tags distclean-generic clean-am - -rm -f libtool - -distclean: distclean-recursive - -rm -f config.status - -maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-recursive - -rm -f config.status - -.PHONY: install-data-recursive uninstall-data-recursive \ -install-exec-recursive uninstall-exec-recursive installdirs-recursive \ -uninstalldirs-recursive all-recursive check-recursive \ -installcheck-recursive info-recursive dvi-recursive \ -mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-info-am \ -install-info install-exec-am install-exec install-data-am install-data \ -install-am install uninstall-am uninstall all-redirect all-am all \ -installdirs-am installdirs mostlyclean-generic distclean-generic \ -clean-generic maintainer-clean-generic clean mostlyclean distclean \ -maintainer-clean - - -$(CRT0): $(machine_dir)/$(CRT0) - rm -f $@ - ln $(machine_dir)/$(CRT0) $@ >/dev/null 2>/dev/null \ - || cp $(machine_dir)/$(CRT0) $@ - -$(machine_dir)/$(CRT0): ; @true - -doc: - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/newlib/libc/sys/linux/machine/aclocal.m4 b/newlib/libc/sys/linux/machine/aclocal.m4 deleted file mode 100644 index 2d16695b0..000000000 --- a/newlib/libc/sys/linux/machine/aclocal.m4 +++ /dev/null @@ -1,1181 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 - -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -dnl This provides configure definitions used by all the newlib -dnl configure.in files. - -dnl Basic newlib configury. This calls basic introductory stuff, -dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs -dnl configure.host. The only argument is the relative path to the top -dnl newlib directory. - -AC_DEFUN(NEWLIB_CONFIGURE, -[ -dnl Default to --enable-multilib -AC_ARG_ENABLE(multilib, -[ --enable-multilib build many library versions (default)], -[case "${enableval}" in - yes) multilib=yes ;; - no) multilib=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; - esac], [multilib=yes])dnl - -dnl Support --enable-target-optspace -AC_ARG_ENABLE(target-optspace, -[ --enable-target-optspace optimize for space], -[case "${enableval}" in - yes) target_optspace=yes ;; - no) target_optspace=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; - esac], [target_optspace=])dnl - -dnl Support --enable-malloc-debugging - currently only supported for Cygwin -AC_ARG_ENABLE(malloc-debugging, -[ --enable-malloc-debugging indicate malloc debugging requested], -[case "${enableval}" in - yes) malloc_debugging=yes ;; - no) malloc_debugging=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;; - esac], [malloc_debugging=])dnl - -dnl Support --enable-newlib-mb -AC_ARG_ENABLE(newlib-mb, -[ --enable-newlib-mb enable multibyte support], -[case "${enableval}" in - yes) newlib_mb=yes ;; - no) newlib_mb=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; - esac], [newlib_mb=])dnl - -dnl Support --enable-newlib-multithread -AC_ARG_ENABLE(newlib-multithread, -[ --enable-newlib-multithread enable support for multiple threads], -[case "${enableval}" in - yes) newlib_multithread=yes ;; - no) newlib_multithread=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; - esac], [newlib_multithread=yes])dnl - -dnl Support --enable-newlib-elix-level -AC_ARG_ENABLE(newlib-elix-level, -[ --enable-newlib-elix-level supply desired elix library level (1-4)], -[case "${enableval}" in - 0) newlib_elix_level=0 ;; - 1) newlib_elix_level=1 ;; - 2) newlib_elix_level=2 ;; - 3) newlib_elix_level=3 ;; - 4) newlib_elix_level=4 ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; - esac], [newlib_elix_level=0])dnl - -dnl Support --disable-newlib-io-float -AC_ARG_ENABLE(newlib-io-float, -[ --disable-newlib-io-float disable printf/scanf family float support], -[case "${enableval}" in - yes) newlib_io_float=yes ;; - no) newlib_io_float=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; - esac], [newlib_io_float=yes])dnl - - -dnl We may get other options which we don't document: -dnl --with-target-subdir, --with-multisrctop, --with-multisubdir - -test -z "[$]{with_target_subdir}" && with_target_subdir=. - -if test "[$]{srcdir}" = "."; then - if test "[$]{with_target_subdir}" != "."; then - newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" - else - newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" - fi -else - newlib_basedir="[$]{srcdir}/$1" -fi -AC_SUBST(newlib_basedir) - -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE(newlib, 1.10.0) - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - -AC_DEFUN(LIB_AC_PROG_CC, -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_PROG(CC, gcc, gcc) -if test -z "$CC"; then - AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -fi - -AC_PROG_CC_GNU - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -dnl Check whether -g works, even if CFLAGS is set, in case the package -dnl plays around with CFLAGS (such as to build both debugging and -dnl normal versions of a library), tasteless as that idea is. - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - AC_PROG_CC_G - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi -]) - -LIB_AC_PROG_CC - -AC_CHECK_TOOL(AS, as) -AC_CHECK_TOOL(AR, ar) -AC_CHECK_TOOL(RANLIB, ranlib, :) - -AC_PROG_INSTALL - -AM_MAINTAINER_MODE - -# We need AC_EXEEXT to keep automake happy in cygnus mode. However, -# at least currently, we never actually build a program, so we never -# need to use $(EXEEXT). Moreover, the test for EXEEXT normally -# fails, because we are probably configuring with a cross compiler -# which can't create executables. So we include AC_EXEEXT to keep -# automake happy, but we don't execute it, since we don't care about -# the result. -if false; then - AC_EXEEXT -fi - -. [$]{newlib_basedir}/configure.host - -newlib_cflags="[$]{newlib_cflags} -fno-builtin" - -NEWLIB_CFLAGS=${newlib_cflags} -AC_SUBST(NEWLIB_CFLAGS) - -LDFLAGS=${ldflags} -AC_SUBST(LDFLAGS) - -AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) -AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) -AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) -AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) -AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) - -AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) - -# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we -# use oext, which is set in configure.host based on the target platform. -OBJEXT=${oext} - -AC_SUBST(OBJEXT) -AC_SUBST(oext) -AC_SUBST(aext) - -AC_SUBST(libm_machine_dir) -AC_SUBST(machine_dir) -AC_SUBST(sys_dir) -]) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering - -# serial 1 - -AC_DEFUN(AM_MAINTAINER_MODE, -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT($USE_MAINTAINER_MODE) - AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) - -# Define a conditional. - -AC_DEFUN(AM_CONDITIONAL, -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - - -# serial 46 AC_PROG_LIBTOOL -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ -])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ -])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ -])])])])])]) - -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# Save cache, so that ltconfig can load it -AC_CACHE_SAVE - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Reload cache, that may have been modified by ltconfig -AC_CACHE_LOAD - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], -[libtool_flags="$libtool_flags --enable-dlopen"]) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[libtool_flags="$libtool_flags --enable-win32-dll"]) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -AC_ARG_WITH(pic, - [ --with-pic try to use only PIC/non-PIC objects [default=use both]], - pic_mode="$withval", pic_mode=default) -test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" -test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_SAVE - AC_LANG_C - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_RESTORE]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one - AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, - [AC_TRY_LINK([], - [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); - DllMain (0, 0, 0);], - [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) - - case $host/$CC in - *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) - # old mingw systems require "-dll" to link a DLL, while more recent ones - # require "-mdll" - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdll" - AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, - [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) - CFLAGS="$SAVE_CFLAGS" ;; - *-*-cygwin* | *-*-pw32*) - # cygwin systems need to pass --dll to the linker, and not link - # crt.o which will require a WinMain@16 definition. - lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; - esac - ;; - ]) -esac -]) - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_LIBTOOL_PICMODE - implement the --with-pic flag -# Usage: AC_LIBTOOL_PICMODE[(MODE)] -# Where MODE is either `yes' or `no'. If omitted, it defaults to -# `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default)]) - - -# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -]) - - -# AC_PATH_MAGIC - find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl -AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) - else - MAGIC_CMD=: - fi -fi -]) - - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - re_direlt=['/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$lt_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -AC_DEFUN([AC_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$lt_cv_prog_gnu_ld -]) - -# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker -# -- PORTME Some linkers may need a different reload flag. -AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], -[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, -[lt_cv_ld_reload_flag='-r']) -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" -]) - -# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependant libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* |pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.[012]) - lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd* ) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - case $host_cpu in - hppa*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - ia64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - esac - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] - else - [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] - fi - ;; - -newsos6) - [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -[sysv5uw[78]* | sysv4*uw2*)] - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - motorola) - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -]) - - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and INCLTDL are not -# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not -# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed -# with '${top_builddir}/' and INCLTDL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is -# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed -# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed -# with '${top_srcdir}/' (note the single quotes!). If your package is -# not flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -# If this macro is not defined by Autoconf, define it here. -ifdef([AC_PROVIDE_IFELSE], - [], - [define([AC_PROVIDE_IFELSE], - [ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - -# AC_LIBTOOL_CXX - enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) - -AC_DEFUN([_AC_LIBTOOL_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" -lt_save_CC="$CC" -lt_save_CFLAGS="$CFLAGS" -dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC -dnl is set to the C++ compiler. -AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" \ -file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ ---build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ -|| AC_MSG_ERROR([libtool tag configuration failed]) -CC="$lt_save_CC" -CFLAGS="$lt_save_CFLAGS" - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -# AC_LIBTOOL_GCJ - enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) - -AC_DEFUN([_AC_LIBTOOL_GCJ], -[AC_REQUIRE([AC_PROG_LIBTOOL]) -AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" -lt_save_CC="$CC" -lt_save_CFLAGS="$CFLAGS" -dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC -dnl is set to the C++ compiler. -AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" \ -file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ ---build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ -|| AC_MSG_ERROR([libtool tag configuration failed]) -CC="$lt_save_CC" -CFLAGS="$lt_save_CFLAGS" - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -dnl old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -dnl This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL])dnl - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - diff --git a/newlib/libc/sys/linux/machine/configure b/newlib/libc/sys/linux/machine/configure deleted file mode 100755 index 60cb7c170..000000000 --- a/newlib/libc/sys/linux/machine/configure +++ /dev/null @@ -1,3412 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-multilib build many library versions (default)" -ac_help="$ac_help - --enable-target-optspace optimize for space" -ac_help="$ac_help - --enable-malloc-debugging indicate malloc debugging requested" -ac_help="$ac_help - --enable-newlib-mb enable multibyte support" -ac_help="$ac_help - --enable-newlib-multithread enable support for multiple threads" -ac_help="$ac_help - --enable-newlib-elix-level supply desired elix library level (1-4)" -ac_help="$ac_help - --disable-newlib-io-float disable printf/scanf family float support" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-shared[=PKGS] build shared libraries [default=yes]" -ac_help="$ac_help - --enable-static[=PKGS] build static libraries [default=yes]" -ac_help="$ac_help - --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" -ac_help="$ac_help - --disable-libtool-lock avoid locking (might break parallel builds)" -ac_help="$ac_help - --with-pic try to use only PIC/non-PIC objects [default=use both]" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -sitefile= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=i386 - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi - fi -else - CONFIG_SITE="$sitefile" -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -ac_aux_dir= -for ac_dir in ../../../../.. $srcdir/../../../../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in ../../../../.. $srcdir/../../../../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:598: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:651: checking whether build environment is sane" >&5 -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } - fi - - test "$2" = conftestfile - ) -then - # Ok. - : -else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:708: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:741: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 746 "configure" -#include "confdefs.h" - -int main() { - -#ifndef __CYGWIN__ -#define __CYGWIN__ __CYGWIN32__ -#endif -return __CYGWIN__; -; return 0; } -EOF -if { (eval echo configure:757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:774: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 779 "configure" -#include "confdefs.h" - -int main() { -return __MINGW32__; -; return 0; } -EOF -if { (eval echo configure:786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes - -# Check whether --enable-multilib or --disable-multilib was given. -if test "${enable_multilib+set}" = set; then - enableval="$enable_multilib" - case "${enableval}" in - yes) multilib=yes ;; - no) multilib=no ;; - *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; - esac -else - multilib=yes -fi - -# Check whether --enable-target-optspace or --disable-target-optspace was given. -if test "${enable_target_optspace+set}" = set; then - enableval="$enable_target_optspace" - case "${enableval}" in - yes) target_optspace=yes ;; - no) target_optspace=no ;; - *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; - esac -else - target_optspace= -fi - -# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. -if test "${enable_malloc_debugging+set}" = set; then - enableval="$enable_malloc_debugging" - case "${enableval}" in - yes) malloc_debugging=yes ;; - no) malloc_debugging=no ;; - *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;; - esac -else - malloc_debugging= -fi - -# Check whether --enable-newlib-mb or --disable-newlib-mb was given. -if test "${enable_newlib_mb+set}" = set; then - enableval="$enable_newlib_mb" - case "${enableval}" in - yes) newlib_mb=yes ;; - no) newlib_mb=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; - esac -else - newlib_mb= -fi - -# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given. -if test "${enable_newlib_multithread+set}" = set; then - enableval="$enable_newlib_multithread" - case "${enableval}" in - yes) newlib_multithread=yes ;; - no) newlib_multithread=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;; - esac -else - newlib_multithread=yes -fi - -# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given. -if test "${enable_newlib_elix_level+set}" = set; then - enableval="$enable_newlib_elix_level" - case "${enableval}" in - 0) newlib_elix_level=0 ;; - 1) newlib_elix_level=1 ;; - 2) newlib_elix_level=2 ;; - 3) newlib_elix_level=3 ;; - 4) newlib_elix_level=4 ;; - *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;; - esac -else - newlib_elix_level=0 -fi - -# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given. -if test "${enable_newlib_io_float+set}" = set; then - enableval="$enable_newlib_io_float" - case "${enableval}" in - yes) newlib_io_float=yes ;; - no) newlib_io_float=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;; - esac -else - newlib_io_float=yes -fi - - - -test -z "${with_target_subdir}" && with_target_subdir=. - -if test "${srcdir}" = "."; then - if test "${with_target_subdir}" != "."; then - newlib_basedir="${srcdir}/${with_multisrctop}../../../../.." - else - newlib_basedir="${srcdir}/${with_multisrctop}../../../.." - fi -else - newlib_basedir="${srcdir}/../../../.." -fi - - - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:933: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:954: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:972: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - - -PACKAGE=newlib - -VERSION=1.10.0 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <<EOF -#define PACKAGE "$PACKAGE" -EOF - -cat >> confdefs.h <<EOF -#define VERSION "$VERSION" -EOF - - - -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1015: checking for working aclocal" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal - echo "$ac_t""found" 1>&6 -else - ACLOCAL="$missing_dir/missing aclocal" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1028: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 -else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1041: checking for working automake" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake - echo "$ac_t""found" 1>&6 -else - AUTOMAKE="$missing_dir/missing automake" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1054: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 -else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1067: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 -fi - - - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1092: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1122: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1171: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1195: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1226: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ac_tool_prefix}as" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - -# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1258: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" -fi -fi -AR="$ac_cv_prog_AR" -if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1290: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1322: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - RANLIB=":" -fi -fi - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1367: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1421: checking whether to enable maintainer-specific portions of Makefiles" >&5 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - MAINT=$MAINTAINER_MODE_TRUE - - - -# We need AC_EXEEXT to keep automake happy in cygnus mode. However, -# at least currently, we never actually build a program, so we never -# need to use $(EXEEXT). Moreover, the test for EXEEXT normally -# fails, because we are probably configuring with a cross compiler -# which can't create executables. So we include AC_EXEEXT to keep -# automake happy, but we don't execute it, since we don't care about -# the result. -if false; then - - -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1455: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:1465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - -fi - -. ${newlib_basedir}/configure.host - -newlib_cflags="${newlib_cflags} -fno-builtin" - -NEWLIB_CFLAGS=${newlib_cflags} - - -LDFLAGS=${ldflags} - - - - -if test x${newlib_elix_level} = x0; then - ELIX_LEVEL_0_TRUE= - ELIX_LEVEL_0_FALSE='#' -else - ELIX_LEVEL_0_TRUE='#' - ELIX_LEVEL_0_FALSE= -fi - - -if test x${newlib_elix_level} = x1; then - ELIX_LEVEL_1_TRUE= - ELIX_LEVEL_1_FALSE='#' -else - ELIX_LEVEL_1_TRUE='#' - ELIX_LEVEL_1_FALSE= -fi - - -if test x${newlib_elix_level} = x2; then - ELIX_LEVEL_2_TRUE= - ELIX_LEVEL_2_FALSE='#' -else - ELIX_LEVEL_2_TRUE='#' - ELIX_LEVEL_2_FALSE= -fi - - -if test x${newlib_elix_level} = x3; then - ELIX_LEVEL_3_TRUE= - ELIX_LEVEL_3_FALSE='#' -else - ELIX_LEVEL_3_TRUE='#' - ELIX_LEVEL_3_FALSE= -fi - - -if test x${newlib_elix_level} = x4; then - ELIX_LEVEL_4_TRUE= - ELIX_LEVEL_4_FALSE='#' -else - ELIX_LEVEL_4_TRUE='#' - ELIX_LEVEL_4_FALSE= -fi - - - -if test x${use_libtool} = xyes; then - USE_LIBTOOL_TRUE= - USE_LIBTOOL_FALSE='#' -else - USE_LIBTOOL_TRUE='#' - USE_LIBTOOL_FALSE= -fi - -# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we -# use oext, which is set in configure.host based on the target platform. -OBJEXT=${oext} - - - - - - - - - - -if test "${use_libtool}" = "yes"; then - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_shared=yes -fi - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_static=yes -fi - -# Check whether --enable-fast-install or --disable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_fast_install=yes -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1640: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1670: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1721: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1753: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1764 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1795: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1800: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1828: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1871: checking for ld used by GCC" >&5 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1901: checking for GNU ld" >&5 -else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1904: checking for non-GNU ld" >&5 -fi -if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1939: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi -fi - -echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - -echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1956: checking for $LD option to reload object files" >&5 -if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - lt_cv_ld_reload_flag='-r' -fi - -echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" - -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1968: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi - -NM="$lt_cv_path_NM" -echo "$ac_t""$NM" 1>&6 - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2006: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:2027: checking how to recognise dependant libraries" >&5 -if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* |pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.012) - lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd* ) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - case $host_cpu in - hppa*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - esac - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' - fi - ;; - -newsos6) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv5uw[78]* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; -esac - -fi - -echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method - -echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:2200: checking for object suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftest* -echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:2206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_objext" 1>&6 -OBJEXT=$ac_cv_objext -ac_objext=$ac_cv_objext - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:2230: checking for ${ac_tool_prefix}file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:2292: checking for file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2363: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2395: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - RANLIB=":" -fi -fi - -# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2430: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_STRIP"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2462: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="strip" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" -fi -fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - STRIP=":" -fi -fi - - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - -libtool_flags="$libtool_flags --enable-win32-dll" -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - : -fi - -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Check whether --with-pic or --without-pic was given. -if test "${with_pic+set}" = set; then - withval="$with_pic" - pic_mode="$withval" -else - pic_mode=default -fi - -test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" -test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 2529 "configure"' > conftest.$ac_ext - if { (eval echo configure:2530: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2549: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case "`/usr/bin/file conftest.o`" in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2567: checking whether the C compiler needs -belf" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - - cat > conftest.$ac_ext <<EOF -#line 2580 "configure" -#include "confdefs.h" - -int main() { - -; return 0; } -EOF -if { (eval echo configure:2587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_cc_needs_belf=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_needs_belf=no -fi -rm -f conftest* - ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -fi - -echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -*-*-cygwin* | *-*-mingw* | *-*-pw32*) - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2617: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_DLLTOOL"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2649: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="dlltool" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - DLLTOOL="false" -fi -fi - - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2684: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ac_tool_prefix}as" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_AS"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2716: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="as" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - AS="false" -fi -fi - - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2751: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -OBJDUMP="$ac_cv_prog_OBJDUMP" -if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_OBJDUMP"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2783: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="objdump" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false" -fi -fi -OBJDUMP="$ac_cv_prog_OBJDUMP" -if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - OBJDUMP="false" -fi -fi - - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one - echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 -echo "configure:2819: checking if libtool should supply DllMain function" >&5 -if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2824 "configure" -#include "confdefs.h" - -int main() { -extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); - DllMain (0, 0, 0); -; return 0; } -EOF -if { (eval echo configure:2832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_need_dllmain=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_need_dllmain=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$lt_cv_need_dllmain" 1>&6 - - case $host/$CC in - *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) - # old mingw systems require "-dll" to link a DLL, while more recent ones - # require "-mdll" - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdll" - echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 -echo "configure:2853: checking how to link DLLs" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2858 "configure" -#include "confdefs.h" - -int main() { - -; return 0; } -EOF -if { (eval echo configure:2865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_cc_dll_switch=-mdll -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_dll_switch=-dll -fi -rm -f conftest* -fi - -echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6 - CFLAGS="$SAVE_CFLAGS" ;; - *-*-cygwin* | *-*-pw32*) - # cygwin systems need to pass --dll to the linker, and not link - # crt.o which will require a WinMain@16 definition. - lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; - esac - ;; - -esac - - -# Save cache, so that ltconfig can load it -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } - -# Reload cache, that may have been modified by ltconfig -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log - - - - - - -fi - -if test -n "${machine_dir}"; then - subdirs="${machine_dir}" - -fi - -CRT0= -if test -n "${machine_dir}"; then - CRT0=crt0.o -fi - - - - -if test x${machine_dir} != x; then - HAVE_MACHINE_DIR_TRUE= - HAVE_MACHINE_DIR_FALSE='#' -else - HAVE_MACHINE_DIR_TRUE='#' - HAVE_MACHINE_DIR_FALSE= -fi - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@newlib_basedir@%$newlib_basedir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g -s%@AS@%$AS%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g -s%@EXEEXT@%$EXEEXT%g -s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g -s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g -s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g -s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g -s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g -s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g -s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g -s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g -s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g -s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g -s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g -s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g -s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g -s%@OBJEXT@%$OBJEXT%g -s%@oext@%$oext%g -s%@aext@%$aext%g -s%@libm_machine_dir@%$libm_machine_dir%g -s%@machine_dir@%$machine_dir%g -s%@sys_dir@%$sys_dir%g -s%@LN_S@%$LN_S%g -s%@STRIP@%$STRIP%g -s%@DLLTOOL@%$DLLTOOL%g -s%@OBJDUMP@%$OBJDUMP%g -s%@LIBTOOL@%$LIBTOOL%g -s%@subdirs@%$subdirs%g -s%@CRT0@%$CRT0%g -s%@HAVE_MACHINE_DIR_TRUE@%$HAVE_MACHINE_DIR_TRUE%g -s%@HAVE_MACHINE_DIR_FALSE@%$HAVE_MACHINE_DIR_FALSE%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - -if test "$no_recursion" != yes; then - - # Remove --cache-file and --srcdir arguments so they do not pile up. - ac_sub_configure_args= - ac_prev= - for ac_arg in $ac_configure_args; do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case "$ac_arg" in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; - esac - done - - for ac_config_dir in ${machine_dir}; do - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - if test ! -d $srcdir/$ac_config_dir; then - continue - fi - - echo configuring in $ac_config_dir - - case "$srcdir" in - .) ;; - *) - if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; - else - { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } - fi - ;; - esac - - ac_popdir=`pwd` - cd $ac_config_dir - - # A "../" for each directory in /$ac_config_dir. - ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` - - case "$srcdir" in - .) # No --srcdir option. We are building in place. - ac_sub_srcdir=$srcdir ;; - /*) # Absolute path. - ac_sub_srcdir=$srcdir/$ac_config_dir ;; - *) # Relative path. - ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; - esac - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_sub_srcdir/configure; then - ac_sub_configure=$ac_sub_srcdir/configure - elif test -f $ac_sub_srcdir/configure.in; then - ac_sub_configure=$ac_configure - else - echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - - # Make the cache file name correct relative to the subdirectory. - case "$cache_file" in - /*) ac_sub_cache_file=$cache_file ;; - *) # Relative path. - ac_sub_cache_file="$ac_dots$cache_file" ;; - esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" - # The eval makes quoting arguments work. - if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir - then : - else - { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } - fi - fi - - cd $ac_popdir - done -fi - diff --git a/newlib/libc/sys/linux/machine/configure.in b/newlib/libc/sys/linux/machine/configure.in deleted file mode 100644 index a9dc30c9d..000000000 --- a/newlib/libc/sys/linux/machine/configure.in +++ /dev/null @@ -1,32 +0,0 @@ -dnl This is the newlib/libc/sys configure.in file. -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.5) -AC_INIT(i386) - -dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. -AC_CONFIG_AUX_DIR(../../../../..) - -NEWLIB_CONFIGURE(../../../..) - -dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and -dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first -dnl line of the macro which fail because appropriate LDFLAGS are not set. -if test "${use_libtool}" = "yes"; then -AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL -fi - -if test -n "${machine_dir}"; then - AC_CONFIG_SUBDIRS(${machine_dir}) -fi - -CRT0= -if test -n "${machine_dir}"; then - CRT0=crt0.o -fi -AC_SUBST(CRT0) - -AM_CONDITIONAL(HAVE_MACHINE_DIR, test x${machine_dir} != x) - -AC_OUTPUT(Makefile) diff --git a/newlib/libc/sys/linux/machine/hp-timing.h b/newlib/libc/sys/linux/machine/hp-timing.h deleted file mode 100644 index 099342db8..000000000 --- a/newlib/libc/sys/linux/machine/hp-timing.h +++ /dev/null @@ -1,83 +0,0 @@ -/* High precision, low overhead timing functions. Generic version. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _HP_TIMING_H -#define _HP_TIMING_H 1 - - -/* There are no generic definitions for the times. We could write something - using the `gettimeofday' system call where available but the overhead of - the system call might be too high. - - In case a platform supports timers in the hardware the following macros - and types must be defined: - - - HP_TIMING_AVAIL: test for availability. - - - HP_TIMING_INLINE: this macro is non-zero if the functionality is not - implemented using function calls but instead uses some inlined code - which might simply consist of a few assembler instructions. We have to - know this since we might want to use the macros here in places where we - cannot make function calls. - - - hp_timing_t: This is the type for variables used to store the time - values. - - - HP_TIMING_ZERO: clear `hp_timing_t' object. - - - HP_TIMING_NOW: place timestamp for current time in variable given as - parameter. - - - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the - HP_TIMING_DIFF macro. - - - HP_TIMING_DIFF: compute difference between two times and store it - in a third. Source and destination might overlap. - - - HP_TIMING_ACCUM: add time difference to another variable. This might - be a bit more complicated to implement for some platforms as the - operation should be thread-safe and 64bit arithmetic on 32bit platforms - is not. - - - HP_TIMING_ACCUM_NT: this is the variant for situations where we know - there are no threads involved. - - - HP_TIMING_PRINT: write decimal representation of the timing value into - the given string. This operation need not be inline even though - HP_TIMING_INLINE is specified. - -*/ - -/* Provide dummy definitions. */ -#define HP_TIMING_AVAIL (0) -#define HP_TIMING_INLINE (0) -typedef int hp_timing_t; -#define HP_TIMING_ZERO(Var) -#define HP_TIMING_NOW(var) -#define HP_TIMING_DIFF_INIT() -#define HP_TIMING_DIFF(Diff, Start, End) -#define HP_TIMING_ACCUM(Sum, Diff) -#define HP_TIMING_ACCUM_NT(Sum, Diff) -#define HP_TIMING_PRINT(Buf, Len, Val) - -/* Since this implementation is not available we tell the user about it. */ -#define HP_TIMING_NONAVAIL 1 - -#endif /* hp-timing.h */ diff --git a/newlib/libc/sys/linux/machine/i386/Makefile.am b/newlib/libc/sys/linux/machine/i386/Makefile.am deleted file mode 100644 index 4a49d8fe0..000000000 --- a/newlib/libc/sys/linux/machine/i386/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -## Process this file with automake to generate Makefile.in - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -LIB_SOURCES = get_clockfreq.c getpagesize.c hp-timing.c setjmp.S sigaction.c dl-procinfo.c - -liblinuxi386_la_LDFLAGS = -Xcompiler -nostdlib - -if USE_LIBTOOL -noinst_LTLIBRARIES = liblinuxi386.la -liblinuxi386_la_SOURCES = $(LIB_SOURCES) -noinst_DATA = objectlist.awk.in -else -noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(LIB_SOURCES) -noinst_DATA = -endif # USE_LIBTOOL - -include $(srcdir)/../../../../../Makefile.shared - -all: crt0.o - -AM_CFLAGS = -I$(srcdir)/../.. -ACLOCAL_AMFLAGS = -I ../../../../.. -CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libc/sys/linux/machine/i386/Makefile.in b/newlib/libc/sys/linux/machine/i386/Makefile.in deleted file mode 100644 index 980544f8a..000000000 --- a/newlib/libc/sys/linux/machine/i386/Makefile.in +++ /dev/null @@ -1,413 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AR = @AR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DLLTOOL = @DLLTOOL@ -EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -aext = @aext@ -libm_machine_dir = @libm_machine_dir@ -machine_dir = @machine_dir@ -newlib_basedir = @newlib_basedir@ -oext = @oext@ -sys_dir = @sys_dir@ - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -LIB_SOURCES = get_clockfreq.c getpagesize.c hp-timing.c setjmp.S sigaction.c dl-procinfo.c - -liblinuxi386_la_LDFLAGS = -Xcompiler -nostdlib - -@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@liblinuxi386.la -@USE_LIBTOOL_TRUE@liblinuxi386_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) -@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in -@USE_LIBTOOL_FALSE@noinst_DATA = -@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a -@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) - -AM_CFLAGS = -I$(srcdir)/../.. -ACLOCAL_AMFLAGS = -I ../../../../.. -CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../../mkinstalldirs -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -lib_a_LIBADD = -@USE_LIBTOOL_FALSE@lib_a_OBJECTS = get_clockfreq.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@getpagesize.$(OBJEXT) hp-timing.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@setjmp.$(OBJEXT) sigaction.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@dl-procinfo.$(OBJEXT) -LTLIBRARIES = $(noinst_LTLIBRARIES) - -liblinuxi386_la_LIBADD = -@USE_LIBTOOL_TRUE@liblinuxi386_la_OBJECTS = get_clockfreq.lo \ -@USE_LIBTOOL_TRUE@getpagesize.lo hp-timing.lo setjmp.lo sigaction.lo \ -@USE_LIBTOOL_TRUE@dl-procinfo.lo -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(noinst_DATA) - -DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -SOURCES = $(lib_a_SOURCES) $(liblinuxi386_la_SOURCES) -OBJECTS = $(lib_a_OBJECTS) $(liblinuxi386_la_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../../Makefile.shared - cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status - -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \ - ../../../../../acinclude.m4 ../../../../../aclocal.m4 \ - ../../../../../libtool.m4 - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) - -rm -f lib.a - $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) - $(RANLIB) lib.a - -mostlyclean-noinstLTLIBRARIES: - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - -distclean-noinstLTLIBRARIES: - -maintainer-clean-noinstLTLIBRARIES: - -liblinuxi386.la: $(liblinuxi386_la_OBJECTS) $(liblinuxi386_la_DEPENDENCIES) - $(LINK) $(liblinuxi386_la_LDFLAGS) $(liblinuxi386_la_OBJECTS) $(liblinuxi386_la_LIBADD) $(LIBS) - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -rm -rf $(distdir) - GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist - -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: -check: check-am -installcheck-am: -installcheck: installcheck-am -install-info-am: -install-info: install-info-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-noinstLTLIBRARIES clean-tags clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-noinstLTLIBRARIES \ - distclean-tags distclean-generic clean-am - -rm -f libtool - -distclean: distclean-am - -rm -f config.status - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-noinstLTLIBRARIES \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -rm -f config.status - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ -distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ -maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-info-am install-info \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all installdirs \ -mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -objectlist.awk.in: $(noinst_LTLIBRARIES) - -rm -f objectlist.awk.in - for i in `ls *.lo` ; \ - do \ - echo $$i `pwd`/$$i >> objectlist.awk.in ; \ - done - -all: crt0.o - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/newlib/libc/sys/linux/machine/i386/aclocal.m4 b/newlib/libc/sys/linux/machine/i386/aclocal.m4 deleted file mode 100644 index 2d16695b0..000000000 --- a/newlib/libc/sys/linux/machine/i386/aclocal.m4 +++ /dev/null @@ -1,1181 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 - -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -dnl This provides configure definitions used by all the newlib -dnl configure.in files. - -dnl Basic newlib configury. This calls basic introductory stuff, -dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs -dnl configure.host. The only argument is the relative path to the top -dnl newlib directory. - -AC_DEFUN(NEWLIB_CONFIGURE, -[ -dnl Default to --enable-multilib -AC_ARG_ENABLE(multilib, -[ --enable-multilib build many library versions (default)], -[case "${enableval}" in - yes) multilib=yes ;; - no) multilib=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; - esac], [multilib=yes])dnl - -dnl Support --enable-target-optspace -AC_ARG_ENABLE(target-optspace, -[ --enable-target-optspace optimize for space], -[case "${enableval}" in - yes) target_optspace=yes ;; - no) target_optspace=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; - esac], [target_optspace=])dnl - -dnl Support --enable-malloc-debugging - currently only supported for Cygwin -AC_ARG_ENABLE(malloc-debugging, -[ --enable-malloc-debugging indicate malloc debugging requested], -[case "${enableval}" in - yes) malloc_debugging=yes ;; - no) malloc_debugging=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;; - esac], [malloc_debugging=])dnl - -dnl Support --enable-newlib-mb -AC_ARG_ENABLE(newlib-mb, -[ --enable-newlib-mb enable multibyte support], -[case "${enableval}" in - yes) newlib_mb=yes ;; - no) newlib_mb=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; - esac], [newlib_mb=])dnl - -dnl Support --enable-newlib-multithread -AC_ARG_ENABLE(newlib-multithread, -[ --enable-newlib-multithread enable support for multiple threads], -[case "${enableval}" in - yes) newlib_multithread=yes ;; - no) newlib_multithread=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; - esac], [newlib_multithread=yes])dnl - -dnl Support --enable-newlib-elix-level -AC_ARG_ENABLE(newlib-elix-level, -[ --enable-newlib-elix-level supply desired elix library level (1-4)], -[case "${enableval}" in - 0) newlib_elix_level=0 ;; - 1) newlib_elix_level=1 ;; - 2) newlib_elix_level=2 ;; - 3) newlib_elix_level=3 ;; - 4) newlib_elix_level=4 ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; - esac], [newlib_elix_level=0])dnl - -dnl Support --disable-newlib-io-float -AC_ARG_ENABLE(newlib-io-float, -[ --disable-newlib-io-float disable printf/scanf family float support], -[case "${enableval}" in - yes) newlib_io_float=yes ;; - no) newlib_io_float=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; - esac], [newlib_io_float=yes])dnl - - -dnl We may get other options which we don't document: -dnl --with-target-subdir, --with-multisrctop, --with-multisubdir - -test -z "[$]{with_target_subdir}" && with_target_subdir=. - -if test "[$]{srcdir}" = "."; then - if test "[$]{with_target_subdir}" != "."; then - newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" - else - newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" - fi -else - newlib_basedir="[$]{srcdir}/$1" -fi -AC_SUBST(newlib_basedir) - -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE(newlib, 1.10.0) - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - -AC_DEFUN(LIB_AC_PROG_CC, -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_PROG(CC, gcc, gcc) -if test -z "$CC"; then - AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -fi - -AC_PROG_CC_GNU - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -dnl Check whether -g works, even if CFLAGS is set, in case the package -dnl plays around with CFLAGS (such as to build both debugging and -dnl normal versions of a library), tasteless as that idea is. - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - AC_PROG_CC_G - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi -]) - -LIB_AC_PROG_CC - -AC_CHECK_TOOL(AS, as) -AC_CHECK_TOOL(AR, ar) -AC_CHECK_TOOL(RANLIB, ranlib, :) - -AC_PROG_INSTALL - -AM_MAINTAINER_MODE - -# We need AC_EXEEXT to keep automake happy in cygnus mode. However, -# at least currently, we never actually build a program, so we never -# need to use $(EXEEXT). Moreover, the test for EXEEXT normally -# fails, because we are probably configuring with a cross compiler -# which can't create executables. So we include AC_EXEEXT to keep -# automake happy, but we don't execute it, since we don't care about -# the result. -if false; then - AC_EXEEXT -fi - -. [$]{newlib_basedir}/configure.host - -newlib_cflags="[$]{newlib_cflags} -fno-builtin" - -NEWLIB_CFLAGS=${newlib_cflags} -AC_SUBST(NEWLIB_CFLAGS) - -LDFLAGS=${ldflags} -AC_SUBST(LDFLAGS) - -AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) -AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) -AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) -AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) -AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) - -AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) - -# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we -# use oext, which is set in configure.host based on the target platform. -OBJEXT=${oext} - -AC_SUBST(OBJEXT) -AC_SUBST(oext) -AC_SUBST(aext) - -AC_SUBST(libm_machine_dir) -AC_SUBST(machine_dir) -AC_SUBST(sys_dir) -]) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering - -# serial 1 - -AC_DEFUN(AM_MAINTAINER_MODE, -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT($USE_MAINTAINER_MODE) - AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) - -# Define a conditional. - -AC_DEFUN(AM_CONDITIONAL, -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - - -# serial 46 AC_PROG_LIBTOOL -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ -])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ -])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ -])])])])])]) - -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# Save cache, so that ltconfig can load it -AC_CACHE_SAVE - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Reload cache, that may have been modified by ltconfig -AC_CACHE_LOAD - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], -[libtool_flags="$libtool_flags --enable-dlopen"]) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[libtool_flags="$libtool_flags --enable-win32-dll"]) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -AC_ARG_WITH(pic, - [ --with-pic try to use only PIC/non-PIC objects [default=use both]], - pic_mode="$withval", pic_mode=default) -test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" -test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_SAVE - AC_LANG_C - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_RESTORE]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one - AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, - [AC_TRY_LINK([], - [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); - DllMain (0, 0, 0);], - [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) - - case $host/$CC in - *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) - # old mingw systems require "-dll" to link a DLL, while more recent ones - # require "-mdll" - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdll" - AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, - [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) - CFLAGS="$SAVE_CFLAGS" ;; - *-*-cygwin* | *-*-pw32*) - # cygwin systems need to pass --dll to the linker, and not link - # crt.o which will require a WinMain@16 definition. - lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; - esac - ;; - ]) -esac -]) - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_LIBTOOL_PICMODE - implement the --with-pic flag -# Usage: AC_LIBTOOL_PICMODE[(MODE)] -# Where MODE is either `yes' or `no'. If omitted, it defaults to -# `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default)]) - - -# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -]) - - -# AC_PATH_MAGIC - find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl -AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) - else - MAGIC_CMD=: - fi -fi -]) - - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - re_direlt=['/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$lt_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -AC_DEFUN([AC_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$lt_cv_prog_gnu_ld -]) - -# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker -# -- PORTME Some linkers may need a different reload flag. -AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], -[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, -[lt_cv_ld_reload_flag='-r']) -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" -]) - -# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependant libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* |pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.[012]) - lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd* ) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - case $host_cpu in - hppa*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - ia64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - esac - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] - else - [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] - fi - ;; - -newsos6) - [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -[sysv5uw[78]* | sysv4*uw2*)] - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - motorola) - lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -]) - - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and INCLTDL are not -# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not -# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed -# with '${top_builddir}/' and INCLTDL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is -# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed -# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed -# with '${top_srcdir}/' (note the single quotes!). If your package is -# not flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -# If this macro is not defined by Autoconf, define it here. -ifdef([AC_PROVIDE_IFELSE], - [], - [define([AC_PROVIDE_IFELSE], - [ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - -# AC_LIBTOOL_CXX - enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) - -AC_DEFUN([_AC_LIBTOOL_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" -lt_save_CC="$CC" -lt_save_CFLAGS="$CFLAGS" -dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC -dnl is set to the C++ compiler. -AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" \ -file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ ---build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ -|| AC_MSG_ERROR([libtool tag configuration failed]) -CC="$lt_save_CC" -CFLAGS="$lt_save_CFLAGS" - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -# AC_LIBTOOL_GCJ - enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) - -AC_DEFUN([_AC_LIBTOOL_GCJ], -[AC_REQUIRE([AC_PROG_LIBTOOL]) -AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" -lt_save_CC="$CC" -lt_save_CFLAGS="$CFLAGS" -dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC -dnl is set to the C++ compiler. -AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" \ -file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ ---build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ -|| AC_MSG_ERROR([libtool tag configuration failed]) -CC="$lt_save_CC" -CFLAGS="$lt_save_CFLAGS" - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -dnl old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -dnl This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL])dnl - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - diff --git a/newlib/libc/sys/linux/machine/i386/configure b/newlib/libc/sys/linux/machine/i386/configure deleted file mode 100755 index c29ca47b4..000000000 --- a/newlib/libc/sys/linux/machine/i386/configure +++ /dev/null @@ -1,3326 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-multilib build many library versions (default)" -ac_help="$ac_help - --enable-target-optspace optimize for space" -ac_help="$ac_help - --enable-malloc-debugging indicate malloc debugging requested" -ac_help="$ac_help - --enable-newlib-mb enable multibyte support" -ac_help="$ac_help - --enable-newlib-multithread enable support for multiple threads" -ac_help="$ac_help - --enable-newlib-elix-level supply desired elix library level (1-4)" -ac_help="$ac_help - --disable-newlib-io-float disable printf/scanf family float support" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-shared[=PKGS] build shared libraries [default=yes]" -ac_help="$ac_help - --enable-static[=PKGS] build static libraries [default=yes]" -ac_help="$ac_help - --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" -ac_help="$ac_help - --disable-libtool-lock avoid locking (might break parallel builds)" -ac_help="$ac_help - --with-pic try to use only PIC/non-PIC objects [default=use both]" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -sitefile= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=crt0.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi - fi -else - CONFIG_SITE="$sitefile" -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -ac_aux_dir= -for ac_dir in ../../../../../.. $srcdir/../../../../../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in ../../../../../.. $srcdir/../../../../../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:598: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:651: checking whether build environment is sane" >&5 -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } - fi - - test "$2" = conftestfile - ) -then - # Ok. - : -else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:708: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:741: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 746 "configure" -#include "confdefs.h" - -int main() { - -#ifndef __CYGWIN__ -#define __CYGWIN__ __CYGWIN32__ -#endif -return __CYGWIN__; -; return 0; } -EOF -if { (eval echo configure:757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:774: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 779 "configure" -#include "confdefs.h" - -int main() { -return __MINGW32__; -; return 0; } -EOF -if { (eval echo configure:786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes - -# Check whether --enable-multilib or --disable-multilib was given. -if test "${enable_multilib+set}" = set; then - enableval="$enable_multilib" - case "${enableval}" in - yes) multilib=yes ;; - no) multilib=no ;; - *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; - esac -else - multilib=yes -fi - -# Check whether --enable-target-optspace or --disable-target-optspace was given. -if test "${enable_target_optspace+set}" = set; then - enableval="$enable_target_optspace" - case "${enableval}" in - yes) target_optspace=yes ;; - no) target_optspace=no ;; - *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; - esac -else - target_optspace= -fi - -# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. -if test "${enable_malloc_debugging+set}" = set; then - enableval="$enable_malloc_debugging" - case "${enableval}" in - yes) malloc_debugging=yes ;; - no) malloc_debugging=no ;; - *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;; - esac -else - malloc_debugging= -fi - -# Check whether --enable-newlib-mb or --disable-newlib-mb was given. -if test "${enable_newlib_mb+set}" = set; then - enableval="$enable_newlib_mb" - case "${enableval}" in - yes) newlib_mb=yes ;; - no) newlib_mb=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; - esac -else - newlib_mb= -fi - -# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given. -if test "${enable_newlib_multithread+set}" = set; then - enableval="$enable_newlib_multithread" - case "${enableval}" in - yes) newlib_multithread=yes ;; - no) newlib_multithread=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;; - esac -else - newlib_multithread=yes -fi - -# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given. -if test "${enable_newlib_elix_level+set}" = set; then - enableval="$enable_newlib_elix_level" - case "${enableval}" in - 0) newlib_elix_level=0 ;; - 1) newlib_elix_level=1 ;; - 2) newlib_elix_level=2 ;; - 3) newlib_elix_level=3 ;; - 4) newlib_elix_level=4 ;; - *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;; - esac -else - newlib_elix_level=0 -fi - -# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given. -if test "${enable_newlib_io_float+set}" = set; then - enableval="$enable_newlib_io_float" - case "${enableval}" in - yes) newlib_io_float=yes ;; - no) newlib_io_float=no ;; - *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;; - esac -else - newlib_io_float=yes -fi - - - -test -z "${with_target_subdir}" && with_target_subdir=. - -if test "${srcdir}" = "."; then - if test "${with_target_subdir}" != "."; then - newlib_basedir="${srcdir}/${with_multisrctop}../../../../../.." - else - newlib_basedir="${srcdir}/${with_multisrctop}../../../../.." - fi -else - newlib_basedir="${srcdir}/../../../../.." -fi - - - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:933: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:954: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:972: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - - -PACKAGE=newlib - -VERSION=1.10.0 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <<EOF -#define PACKAGE "$PACKAGE" -EOF - -cat >> confdefs.h <<EOF -#define VERSION "$VERSION" -EOF - - - -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1015: checking for working aclocal" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal - echo "$ac_t""found" 1>&6 -else - ACLOCAL="$missing_dir/missing aclocal" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1028: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 -else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1041: checking for working automake" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake - echo "$ac_t""found" 1>&6 -else - AUTOMAKE="$missing_dir/missing automake" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1054: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 -else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1067: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 -fi - - - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1092: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1122: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1171: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1195: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1226: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ac_tool_prefix}as" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - -# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1258: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" -fi -fi -AR="$ac_cv_prog_AR" -if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1290: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1322: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - RANLIB=":" -fi -fi - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1367: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1421: checking whether to enable maintainer-specific portions of Makefiles" >&5 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - MAINT=$MAINTAINER_MODE_TRUE - - - -# We need AC_EXEEXT to keep automake happy in cygnus mode. However, -# at least currently, we never actually build a program, so we never -# need to use $(EXEEXT). Moreover, the test for EXEEXT normally -# fails, because we are probably configuring with a cross compiler -# which can't create executables. So we include AC_EXEEXT to keep -# automake happy, but we don't execute it, since we don't care about -# the result. -if false; then - - -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1455: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:1465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - -fi - -. ${newlib_basedir}/configure.host - -newlib_cflags="${newlib_cflags} -fno-builtin" - -NEWLIB_CFLAGS=${newlib_cflags} - - -LDFLAGS=${ldflags} - - - - -if test x${newlib_elix_level} = x0; then - ELIX_LEVEL_0_TRUE= - ELIX_LEVEL_0_FALSE='#' -else - ELIX_LEVEL_0_TRUE='#' - ELIX_LEVEL_0_FALSE= -fi - - -if test x${newlib_elix_level} = x1; then - ELIX_LEVEL_1_TRUE= - ELIX_LEVEL_1_FALSE='#' -else - ELIX_LEVEL_1_TRUE='#' - ELIX_LEVEL_1_FALSE= -fi - - -if test x${newlib_elix_level} = x2; then - ELIX_LEVEL_2_TRUE= - ELIX_LEVEL_2_FALSE='#' -else - ELIX_LEVEL_2_TRUE='#' - ELIX_LEVEL_2_FALSE= -fi - - -if test x${newlib_elix_level} = x3; then - ELIX_LEVEL_3_TRUE= - ELIX_LEVEL_3_FALSE='#' -else - ELIX_LEVEL_3_TRUE='#' - ELIX_LEVEL_3_FALSE= -fi - - -if test x${newlib_elix_level} = x4; then - ELIX_LEVEL_4_TRUE= - ELIX_LEVEL_4_FALSE='#' -else - ELIX_LEVEL_4_TRUE='#' - ELIX_LEVEL_4_FALSE= -fi - - - -if test x${use_libtool} = xyes; then - USE_LIBTOOL_TRUE= - USE_LIBTOOL_FALSE='#' -else - USE_LIBTOOL_TRUE='#' - USE_LIBTOOL_FALSE= -fi - -# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we -# use oext, which is set in configure.host based on the target platform. -OBJEXT=${oext} - - - - - - - - - - - -if test "${use_libtool}" = "yes"; then - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_shared=yes -fi - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_static=yes -fi - -# Check whether --enable-fast-install or --disable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_fast_install=yes -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1641: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1671: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1722: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1754: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1765 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1796: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1801: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1810: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1829: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1872: checking for ld used by GCC" >&5 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1902: checking for GNU ld" >&5 -else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1905: checking for non-GNU ld" >&5 -fi -if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1940: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi -fi - -echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - -echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1957: checking for $LD option to reload object files" >&5 -if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - lt_cv_ld_reload_flag='-r' -fi - -echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" - -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1969: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi - -NM="$lt_cv_path_NM" -echo "$ac_t""$NM" 1>&6 - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2007: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:2028: checking how to recognise dependant libraries" >&5 -if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* |pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.012) - lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd* ) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - case $host_cpu in - hppa*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - esac - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' - fi - ;; - -newsos6) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv5uw[78]* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; -esac - -fi - -echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method - -echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:2201: checking for object suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftest* -echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:2207: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_objext" 1>&6 -OBJEXT=$ac_cv_objext -ac_objext=$ac_cv_objext - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:2231: checking for ${ac_tool_prefix}file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:2293: checking for file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2364: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2396: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - RANLIB=":" -fi -fi - -# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2431: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_STRIP"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2463: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="strip" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" -fi -fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - STRIP=":" -fi -fi - - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - -libtool_flags="$libtool_flags --enable-win32-dll" -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - : -fi - -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Check whether --with-pic or --without-pic was given. -if test "${with_pic+set}" = set; then - withval="$with_pic" - pic_mode="$withval" -else - pic_mode=default -fi - -test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" -test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 2530 "configure"' > conftest.$ac_ext - if { (eval echo configure:2531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case "`/usr/bin/file conftest.o`" in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2568: checking whether the C compiler needs -belf" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - - cat > conftest.$ac_ext <<EOF -#line 2581 "configure" -#include "confdefs.h" - -int main() { - -; return 0; } -EOF -if { (eval echo configure:2588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_cc_needs_belf=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_needs_belf=no -fi -rm -f conftest* - ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -fi - -echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -*-*-cygwin* | *-*-mingw* | *-*-pw32*) - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2618: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_DLLTOOL"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2650: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="dlltool" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - DLLTOOL="false" -fi -fi - - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2685: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ac_tool_prefix}as" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_AS"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2717: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="as" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - AS="false" -fi -fi - - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2752: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -OBJDUMP="$ac_cv_prog_OBJDUMP" -if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_OBJDUMP"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2784: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="objdump" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false" -fi -fi -OBJDUMP="$ac_cv_prog_OBJDUMP" -if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - OBJDUMP="false" -fi -fi - - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one - echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 -echo "configure:2820: checking if libtool should supply DllMain function" >&5 -if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2825 "configure" -#include "confdefs.h" - -int main() { -extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); - DllMain (0, 0, 0); -; return 0; } -EOF -if { (eval echo configure:2833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_need_dllmain=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_need_dllmain=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$lt_cv_need_dllmain" 1>&6 - - case $host/$CC in - *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) - # old mingw systems require "-dll" to link a DLL, while more recent ones - # require "-mdll" - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdll" - echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 -echo "configure:2854: checking how to link DLLs" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2859 "configure" -#include "confdefs.h" - -int main() { - -; return 0; } -EOF -if { (eval echo configure:2866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_cc_dll_switch=-mdll -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_dll_switch=-dll -fi -rm -f conftest* -fi - -echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6 - CFLAGS="$SAVE_CFLAGS" ;; - *-*-cygwin* | *-*-pw32*) - # cygwin systems need to pass --dll to the linker, and not link - # crt.o which will require a WinMain@16 definition. - lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; - esac - ;; - -esac - - -# Save cache, so that ltconfig can load it -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ -AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ -objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ -deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } - -# Reload cache, that may have been modified by ltconfig -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log - - - - - - -for ac_prog in mawk gawk nawk awk -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2980: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AWK" && break -done - -fi - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@newlib_basedir@%$newlib_basedir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g -s%@AS@%$AS%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g -s%@EXEEXT@%$EXEEXT%g -s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g -s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g -s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g -s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g -s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g -s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g -s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g -s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g -s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g -s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g -s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g -s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g -s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g -s%@OBJEXT@%$OBJEXT%g -s%@oext@%$oext%g -s%@aext@%$aext%g -s%@libm_machine_dir@%$libm_machine_dir%g -s%@machine_dir@%$machine_dir%g -s%@sys_dir@%$sys_dir%g -s%@LN_S@%$LN_S%g -s%@STRIP@%$STRIP%g -s%@DLLTOOL@%$DLLTOOL%g -s%@OBJDUMP@%$OBJDUMP%g -s%@LIBTOOL@%$LIBTOOL%g -s%@AWK@%$AWK%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/newlib/libc/sys/linux/machine/i386/configure.in b/newlib/libc/sys/linux/machine/i386/configure.in deleted file mode 100644 index 9d068f804..000000000 --- a/newlib/libc/sys/linux/machine/i386/configure.in +++ /dev/null @@ -1,22 +0,0 @@ -dnl This is the newlib/libc/sys/linux/machine/i386 configure.in file. -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.5) -AC_INIT(crt0.c) - -dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. -AC_CONFIG_AUX_DIR(../../../../../..) - -NEWLIB_CONFIGURE(../../../../..) - -dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and -dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first -dnl line of the macro which fail because appropriate LDFLAGS are not set. - -if test "${use_libtool}" = "yes"; then -AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL -AC_PROG_AWK -fi - -AC_OUTPUT(Makefile) diff --git a/newlib/libc/sys/linux/machine/i386/crt0.c b/newlib/libc/sys/linux/machine/i386/crt0.c deleted file mode 100644 index 4364f61d4..000000000 --- a/newlib/libc/sys/linux/machine/i386/crt0.c +++ /dev/null @@ -1,45 +0,0 @@ -/* libc/sys/linux/crt0.c - Run-time initialization */ - -/* FIXME: This should be rewritten in assembler and - placed in a subdirectory specific to a platform. - There should also be calls to run constructors. */ - -/* Written 2000 by Werner Almesberger */ - - -#include <stdlib.h> -#include <time.h> -#include <string.h> - - -extern char **environ; - -extern int main(int argc,char **argv,char **envp); - -extern char _end; -extern char __bss_start; - -void _start(int args) -{ - /* - * The argument block begins above the current stack frame, because we - * have no return address. The calculation assumes that sizeof(int) == - * sizeof(void *). This is okay for i386 user space, but may be invalid in - * other cases. - */ - int *params = &args-1; - int argc = *params; - char **argv = (char **) (params+1); - - environ = argv+argc+1; - - /* Note: do not clear the .bss section. When running with shared - * libraries, certain data items such __mb_cur_max or environ - * may get placed in the .bss, even though they are initialized - * to non-zero values. Clearing the .bss will end up zeroing - * out their initial values. The .bss is already initialized - * by this time by Linux. */ - - tzset(); /* initialize timezone info */ - exit(main(argc,argv,environ)); -} diff --git a/newlib/libc/sys/linux/machine/i386/dl-procinfo.c b/newlib/libc/sys/linux/machine/i386/dl-procinfo.c deleted file mode 100644 index 75732b4e4..000000000 --- a/newlib/libc/sys/linux/machine/i386/dl-procinfo.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Data for Linux/i386 version of processor capability information. - Copyright (C) 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This information must be kept in sync with the _DL_HWCAP_COUNT and - _DL_PLATFORM_COUNT definitions in procinfo.h. */ - - -/* If anything should be added here check whether the size of each string - is still ok with the given array size. */ -const char _dl_x86_cap_flags[][7] = - { - "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", - "cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov", - "pat", "pse36", "psn", "19", "20", "21", "22", "mmx", - "osfxsr", "xmm", "xmm2", "27", "28", "29", "30", "amd3d" - }; - -const char _dl_x86_platforms[][5] = - { - "i386", "i486", "i586", "i686" - }; diff --git a/newlib/libc/sys/linux/machine/i386/dl-procinfo.h b/newlib/libc/sys/linux/machine/i386/dl-procinfo.h deleted file mode 100644 index d1658fafd..000000000 --- a/newlib/libc/sys/linux/machine/i386/dl-procinfo.h +++ /dev/null @@ -1,132 +0,0 @@ -/* Linux/i386 version of processor capability information handling macros. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _DL_PROCINFO_H -#define _DL_PROCINFO_H 1 - -#include <ldsodefs.h> - -/* If anything should be added here check whether the size of each string - is still ok with the given array size. */ -extern const char _dl_x86_cap_flags[][7]; -#define _DL_HWCAP_COUNT 32 - -extern const char _dl_x86_platforms[][5]; -#define _DL_PLATFORMS_COUNT 4 - -/* Start at 48 to reserve some space. */ -#define _DL_FIRST_PLATFORM 48 -/* Mask to filter out platforms. */ -#define _DL_HWCAP_PLATFORM (7ULL << _DL_FIRST_PLATFORM) - - -static inline int -__attribute__ ((unused)) -_dl_procinfo (int word) -{ - /* This table should match the information from arch/i386/kernel/setup.c - in the kernel sources. */ - int i; - - _dl_printf ("AT_HWCAP: "); - - for (i = 0; i < _DL_HWCAP_COUNT; ++i) - if (word & (1 << i)) - _dl_printf (" %s", _dl_x86_cap_flags[i]); - - _dl_printf ("\n"); - - return 0; -} - -static inline const char * -__attribute__ ((unused)) -_dl_hwcap_string (int idx) -{ - return _dl_x86_cap_flags[idx]; -}; - -static inline const char * -__attribute__ ((unused)) -_dl_platform_string (int idx) -{ - return _dl_x86_platforms [idx - _DL_FIRST_PLATFORM]; -}; - -enum -{ - HWCAP_I386_FPU = 1 << 0, - HWCAP_I386_VME = 1 << 1, - HWCAP_I386_DE = 1 << 2, - HWCAP_I386_PSE = 1 << 3, - HWCAP_I386_TSC = 1 << 4, - HWCAP_I386_MSR = 1 << 5, - HWCAP_I386_PAE = 1 << 6, - HWCAP_I386_MCE = 1 << 7, - HWCAP_I386_CX8 = 1 << 8, - HWCAP_I386_APIC = 1 << 9, - HWCAP_I386_SEP = 1 << 11, - HWCAP_I386_MTRR = 1 << 12, - HWCAP_I386_PGE = 1 << 13, - HWCAP_I386_MCA = 1 << 14, - HWCAP_I386_CMOV = 1 << 15, - HWCAP_I386_FCMOV = 1 << 16, - HWCAP_I386_MMX = 1 << 23, - HWCAP_I386_OSFXSR = 1 << 24, - HWCAP_I386_XMM = 1 << 25, - HWCAP_I386_XMM2 = 1 << 26, - HWCAP_I386_AMD3D = 1 << 31, - - /* XXX Which others to add here? */ - HWCAP_IMPORTANT = (HWCAP_I386_MMX) - -}; - -static inline int -__attribute__ ((unused)) -_dl_string_hwcap (const char *str) -{ - int i; - - for (i = 0; i < _DL_HWCAP_COUNT; i++) - { - if (strcmp (str, _dl_x86_cap_flags[i]) == 0) - return i; - } - return -1; -}; - - -static inline int -__attribute__ ((unused)) -_dl_string_platform (const char *str) -{ - int i; - - if (str != NULL) - for (i = 0; i < _DL_PLATFORMS_COUNT; ++i) - { - if (strcmp (str, _dl_x86_platforms[i]) == 0) - return _DL_FIRST_PLATFORM + i; - } - return -1; -}; - -#endif /* dl-procinfo.h */ diff --git a/newlib/libc/sys/linux/machine/i386/get_clockfreq.c b/newlib/libc/sys/linux/machine/i386/get_clockfreq.c deleted file mode 100644 index ea46ed427..000000000 --- a/newlib/libc/sys/linux/machine/i386/get_clockfreq.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Get frequency of the system processor. i386/Linux version. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <ctype.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> -#include <libc-internal.h> - -static -void *memmem (const void *a, size_t len1, const void *b, size_t len2) -{ - char *end, *start; - char *ptr1, *ptr2; - - if (len2 > len1) - return NULL; - - start = (char *)a; - end = start + len1; - - while (start < end) - { - size_t len = len2; - ptr1 = start; - ptr2 = (char *)b; - while (len > 0 && *ptr1++ == *ptr2++) - --len; - if (len == 0) - return start; - ++start; - } - - return NULL; -} - -hp_timing_t -__get_clockfreq (void) -{ - /* We read the information from the /proc filesystem. It contains at - least one line like - cpu MHz : 497.840237 - or also - cpu MHz : 497.841 - We search for this line and convert the number in an integer. */ - static hp_timing_t result; - int fd; - - /* If this function was called before, we know the result. */ - if (result != 0) - return result; - - fd = open ("/proc/cpuinfo", O_RDONLY); - if (__builtin_expect (fd != -1, 1)) - { - /* XXX AFAIK the /proc filesystem can generate "files" only up - to a size of 4096 bytes. */ - char buf[4096]; - ssize_t n; - - n = read (fd, buf, sizeof buf); - if (__builtin_expect (n, 1) > 0) - { - char *mhz = memmem (buf, n, "cpu MHz", 7); - - if (__builtin_expect (mhz != NULL, 1)) - { - char *endp = buf + n; - int seen_decpoint = 0; - int ndigits = 0; - - /* Search for the beginning of the string. */ - while (mhz < endp && (*mhz < '0' || *mhz > '9') && *mhz != '\n') - ++mhz; - - while (mhz < endp && *mhz != '\n') - { - if (*mhz >= '0' && *mhz <= '9') - { - result *= 10; - result += *mhz - '0'; - if (seen_decpoint) - ++ndigits; - } - else if (*mhz == '.') - seen_decpoint = 1; - - ++mhz; - } - - /* Compensate for missing digits at the end. */ - while (ndigits++ < 6) - result *= 10; - } - } - - close (fd); - } - - return result; -} diff --git a/newlib/libc/sys/linux/machine/i386/getpagesize.c b/newlib/libc/sys/linux/machine/i386/getpagesize.c deleted file mode 100644 index 3f80a7a38..000000000 --- a/newlib/libc/sys/linux/machine/i386/getpagesize.c +++ /dev/null @@ -1,6 +0,0 @@ -/* default pagesize */ -int __getpagesize () -{ - return 4096; -} - diff --git a/newlib/libc/sys/linux/machine/i386/hp-timing.c b/newlib/libc/sys/linux/machine/i386/hp-timing.c deleted file mode 100644 index c52099c73..000000000 --- a/newlib/libc/sys/linux/machine/i386/hp-timing.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Support for high precision, low overhead timing functions. i686 version. - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <hp-timing.h> - -/* We have to define the variable for the overhead. */ -hp_timing_t __libc_hp_timing_overhead; diff --git a/newlib/libc/sys/linux/machine/i386/hp-timing.h b/newlib/libc/sys/linux/machine/i386/hp-timing.h deleted file mode 100644 index a34965ec8..000000000 --- a/newlib/libc/sys/linux/machine/i386/hp-timing.h +++ /dev/null @@ -1,187 +0,0 @@ -/* High precision, low overhead timing functions. i686 version. - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib by Jeff Johnston - June 27, 2002 */ - -#ifndef _HP_TIMING_H -#define _HP_TIMING_H 1 - -#include <string.h> -#include <stdio.h> -#include <sys/param.h> - -#ifdef __i686__ - -/* The macros defined here use the timestamp counter in i586 and up versions - of the x86 processors. They provide a very accurate way to measure the - time with very little overhead. The time values themself have no real - meaning, only differences are interesting. - - This version is for the i686 processors. The difference to the i586 - version is that the timerstamp register is unconditionally used. This is - not the case for the i586 version where we have to perform runtime test - whether the processor really has this capability. We have to make this - distinction since the sysdeps/i386/i586 code is supposed to work on all - platforms while the i686 already contains i686-specific code. - - The list of macros we need includes the following: - - - HP_TIMING_AVAIL: test for availability. - - - HP_TIMING_INLINE: this macro is non-zero if the functionality is not - implemented using function calls but instead uses some inlined code - which might simply consist of a few assembler instructions. We have to - know this since we might want to use the macros here in places where we - cannot make function calls. - - - hp_timing_t: This is the type for variables used to store the time - values. - - - HP_TIMING_ZERO: clear `hp_timing_t' object. - - - HP_TIMING_NOW: place timestamp for current time in variable given as - parameter. - - - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the - HP_TIMING_DIFF macro. - - - HP_TIMING_DIFF: compute difference between two times and store it - in a third. Source and destination might overlap. - - - HP_TIMING_ACCUM: add time difference to another variable. This might - be a bit more complicated to implement for some platforms as the - operation should be thread-safe and 64bit arithmetic on 32bit platforms - is not. - - - HP_TIMING_ACCUM_NT: this is the variant for situations where we know - there are no threads involved. - - - HP_TIMING_PRINT: write decimal representation of the timing value into - the given string. This operation need not be inline even though - HP_TIMING_INLINE is specified. - -*/ - -/* We always assume having the timestamp register. */ -#define HP_TIMING_AVAIL (1) - -/* We indeed have inlined functions. */ -#define HP_TIMING_INLINE (1) - -/* We use 64bit values for the times. */ -typedef unsigned long long int hp_timing_t; - -/* Internal variable used to store the overhead of the measurement - opcodes. */ -extern hp_timing_t __libc_hp_timing_overhead; - -/* Set timestamp value to zero. */ -#define HP_TIMING_ZERO(Var) (Var) = (0) - -/* That's quite simple. Use the `rdtsc' instruction. Note that the value - might not be 100% accurate since there might be some more instructions - running in this moment. This could be changed by using a barrier like - 'cpuid' right before the `rdtsc' instruciton. But we are not interested - in accurate clock cycles here so we don't do this. */ -#define HP_TIMING_NOW(Var) __asm__ __volatile__ ("rdtsc" : "=A" (Var)) - -/* Use two 'rdtsc' instructions in a row to find out how long it takes. */ -#define HP_TIMING_DIFF_INIT() \ - do { \ - int __cnt = 5; \ - __libc_hp_timing_overhead = ~0ull; \ - do \ - { \ - hp_timing_t __t1, __t2; \ - HP_TIMING_NOW (__t1); \ - HP_TIMING_NOW (__t2); \ - if (__t2 - __t1 < __libc_hp_timing_overhead) \ - __libc_hp_timing_overhead = __t2 - __t1; \ - } \ - while (--__cnt > 0); \ - } while (0) - -/* It's simple arithmetic for us. */ -#define HP_TIMING_DIFF(Diff, Start, End) (Diff) = ((End) - (Start)) - -/* We have to jump through hoops to get this correctly implemented. */ -#define HP_TIMING_ACCUM(Sum, Diff) \ - do { \ - char __not_done; \ - hp_timing_t __oldval = (Sum); \ - hp_timing_t __diff = (Diff) - __libc_hp_timing_overhead; \ - do \ - { \ - hp_timing_t __newval = __oldval + __diff; \ - int __temp0, __temp1; \ - __asm__ __volatile__ ("xchgl %4, %%ebx\n\t" \ - "lock; cmpxchg8b %1\n\t" \ - "sete %0\n\t" \ - "movl %4, %%ebx" \ - : "=q" (__not_done), "=m" (Sum), \ - "=A" (__oldval), "=c" (__temp0), \ - "=SD" (__temp1) \ - : "1" (Sum), "2" (__oldval), \ - "3" (__newval >> 32), \ - "4" (__newval & 0xffffffff) \ - : "memory"); \ - } \ - while (__not_done); \ - } while (0) - -/* No threads, no extra work. */ -#define HP_TIMING_ACCUM_NT(Sum, Diff) (Sum) += (Diff) - -/* Print the time value. */ -#define HP_TIMING_PRINT(Buf, Len, Val) \ - do { \ - char __buf[20]; \ - char *__cp = __buf + sizeof (__buf); \ - int __len = (Len); \ - char *__dest = (Buf); \ - do { \ - *--__cp = Val % 10; \ - Val /= 10; \ - } while (Val > 0); \ - while (__len-- > 0 && __cp < __buf + sizeof (__buf)) \ - *__dest++ = *__cp++; \ - memcpy (__dest, " clock cycles", MIN (__len, sizeof (" clock cycles"))); \ - } while (0) - -#else /* !__i686__ */ - -/* Provide dummy definitions. */ -#define HP_TIMING_AVAIL (0) -#define HP_TIMING_INLINE (0) -typedef int hp_timing_t; -#define HP_TIMING_ZERO(Var) -#define HP_TIMING_NOW(var) -#define HP_TIMING_DIFF_INIT() -#define HP_TIMING_DIFF(Diff, Start, End) -#define HP_TIMING_ACCUM(Sum, Diff) -#define HP_TIMING_ACCUM_NT(Sum, Diff) -#define HP_TIMING_PRINT(Buf, Len, Val) - -/* Since this implementation is not available we tell the user about it. */ -#define HP_TIMING_NONAVAIL 1 - -#endif - -#endif /* hp-timing.h */ diff --git a/newlib/libc/sys/linux/machine/i386/huge_val.h b/newlib/libc/sys/linux/machine/i386/huge_val.h deleted file mode 100644 index 171517710..000000000 --- a/newlib/libc/sys/linux/machine/i386/huge_val.h +++ /dev/null @@ -1,56 +0,0 @@ -/* `HUGE_VAL' constants for ix86 (where it is infinity). - Used by <stdlib.h> and <math.h> functions for overflow. - Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <features.h> - -/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VALF (__extension__ 0x1.0p255f) -# define HUGE_VALL (__extension__ 0x1.0p32767L) - -# else - -# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } - -# define __huge_valf_t union { unsigned char __c[4]; float __f; } -# ifdef __GNUC__ -# define HUGE_VALF (__extension__ \ - ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f) -# else /* Not GCC. */ -static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; -# define HUGE_VALF (__huge_valf.__f) -# endif /* GCC. */ - - -# define __HUGE_VALL_bytes { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 } - -# define __huge_vall_t union { unsigned char __c[12]; long double __ld; } -# ifdef __GNUC__ -# define HUGE_VALL (__extension__ \ - ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld) -# else /* Not GCC. */ -static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes }; -# define HUGE_VALL (__huge_vall.__ld) -# endif /* GCC. */ - -# endif /* GCC 2.95 */ - diff --git a/newlib/libc/sys/linux/machine/i386/i386mach.h b/newlib/libc/sys/linux/machine/i386/i386mach.h deleted file mode 100644 index 23c32190d..000000000 --- a/newlib/libc/sys/linux/machine/i386/i386mach.h +++ /dev/null @@ -1,83 +0,0 @@ -/* This file was based on the modified setjmp.S performed by - * Joel Sherill (joel@OARcorp.com) which specified the use - * of the __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ macros. - ** - ** This file is distributed WITHOUT ANY WARRANTY; without even the implied - ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ - -/* These are predefined by new versions of GNU cpp. */ - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#define __REG_PREFIX__ % - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a##b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1(__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1(__REG_PREFIX__, x) - -#define eax REG(eax) -#define ebx REG(ebx) -#define ecx REG(ecx) -#define edx REG(edx) -#define esi REG(esi) -#define edi REG(edi) -#define ebp REG(ebp) -#define esp REG(esp) - -#define st0 REG(st) -#define st1 REG(st(1)) -#define st2 REG(st(2)) -#define st3 REG(st(3)) -#define st4 REG(st(4)) -#define st5 REG(st(5)) -#define st6 REG(st(6)) -#define st7 REG(st(7)) - -#define ax REG(ax) -#define bx REG(bx) -#define cx REG(cx) -#define dx REG(dx) - -#define ah REG(ah) -#define bh REG(bh) -#define ch REG(ch) -#define dh REG(dh) - -#define al REG(al) -#define bl REG(bl) -#define cl REG(cl) -#define dl REG(dl) - -#define mm1 REG(mm1) -#define mm2 REG(mm2) -#define mm3 REG(mm3) -#define mm4 REG(mm4) -#define mm5 REG(mm5) -#define mm6 REG(mm6) -#define mm7 REG(mm7) - -#ifdef _I386MACH_NEED_SOTYPE_FUNCTION -#define SOTYPE_FUNCTION(sym) .type SYM(sym),@function -#else -#define SOTYPE_FUNCTION(sym) -#endif - -#ifdef _I386MACH_ALLOW_HW_INTERRUPTS -#define __CLI -#define __STI -#else -#define __CLI cli -#define __STI sti -#endif diff --git a/newlib/libc/sys/linux/machine/i386/include/setjmp.h b/newlib/libc/sys/linux/machine/i386/include/setjmp.h deleted file mode 100644 index f080c3d9f..000000000 --- a/newlib/libc/sys/linux/machine/i386/include/setjmp.h +++ /dev/null @@ -1,6 +0,0 @@ -#define _JBLEN 9 -typedef long __jmp_buf[_JBLEN]; - -#define SP_INDEX 7 -#define _JMPBUF_UNWINDS(buf, address) \ - ((void *)(address) < (void *)(buf)[SP_INDEX]) diff --git a/newlib/libc/sys/linux/machine/i386/include/termios.h b/newlib/libc/sys/linux/machine/i386/include/termios.h deleted file mode 100644 index ffbbed8ce..000000000 --- a/newlib/libc/sys/linux/machine/i386/include/termios.h +++ /dev/null @@ -1 +0,0 @@ -#define __MAX_BAUD B4000000 diff --git a/newlib/libc/sys/linux/machine/i386/setjmp.S b/newlib/libc/sys/linux/machine/i386/setjmp.S deleted file mode 100644 index d276f55fb..000000000 --- a/newlib/libc/sys/linux/machine/i386/setjmp.S +++ /dev/null @@ -1,91 +0,0 @@ -/* This is file is a merger of SETJMP.S and LONGJMP.S */ -/* - * This file was modified to use the __USER_LABEL_PREFIX__ and - * __REGISTER_PREFIX__ macros defined by later versions of GNU cpp by - * Joel Sherrill (joel@OARcorp.com) - * Slight change: now includes i386mach.h for this (Werner Almesberger) - * - * Copyright (C) 1991 DJ Delorie - * All rights reserved. - * - * Redistribution and use in source and binary forms is permitted - * provided that the above copyright notice and following paragraph are - * duplicated in all such forms. - * - * This file is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ - - /* - ** jmp_buf: - ** eax ebx ecx edx esi edi ebp esp eip - ** 0 4 8 12 16 20 24 28 32 - */ - - #include "i386mach.h" - - .global SYM (setjmp) - .global SYM (__libc_longjmp) - .weak SYM (longjmp) - SOTYPE_FUNCTION(setjmp) - SOTYPE_FUNCTION(longjmp) - SOTYPE_FUNCTION(__libc_longjmp) - -SYM (setjmp): - - pushl ebp - movl esp,ebp - - pushl edi - movl 8 (ebp),edi - - movl eax,0 (edi) - movl ebx,4 (edi) - movl ecx,8 (edi) - movl edx,12 (edi) - movl esi,16 (edi) - - movl -4 (ebp),eax - movl eax,20 (edi) - - movl 0 (ebp),eax - movl eax,24 (edi) - - movl esp,eax - addl $12,eax - movl eax,28 (edi) - - movl 4 (ebp),eax - movl eax,32 (edi) - - popl edi - movl $0,eax - leave - ret - -SYM (__libc_longjmp): -SYM (longjmp): - .weak longjmp - pushl ebp - movl esp,ebp - - movl 8(ebp),edi /* get jmp_buf */ - movl 12(ebp),eax /* store retval in j->eax */ - movl eax,0(edi) - - movl 24(edi),ebp - - __CLI - movl 28(edi),esp - - pushl 32(edi) - - movl 0(edi),eax - movl 4(edi),ebx - movl 8(edi),ecx - movl 12(edi),edx - movl 16(edi),esi - movl 20(edi),edi - __STI - - ret diff --git a/newlib/libc/sys/linux/machine/i386/sigaction.c b/newlib/libc/sys/linux/machine/i386/sigaction.c deleted file mode 100644 index 6edcb0ae7..000000000 --- a/newlib/libc/sys/linux/machine/i386/sigaction.c +++ /dev/null @@ -1,114 +0,0 @@ -/* POSIX.1 `sigaction' call for Linux/i386. - Copyright (C) 1991, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <stddef.h> -#include <signal.h> -#include <string.h> - -#include <machine/syscall.h> - -/* The difference here is that the sigaction structure used in the - kernel is not the same as we use in the libc. Therefore we must - translate it here. */ -#include <kernel_sigaction.h> - -/* We do not globally define the SA_RESTORER flag so do it here. */ -#define SA_RESTORER 0x04000000 - -#define __NR___rt_sigaction __NR_rt_sigaction - -static _syscall4(int,__rt_sigaction,int,sig,const struct kernel_sigaction *,act, - struct kernel_sigaction *,oact,size_t,size) - -static void restore_rt (void) asm ("__restore_rt"); -static void restore (void) asm ("__restore"); - -/* If ACT is not NULL, change the action for SIG to *ACT. - If OACT is not NULL, put the old action for SIG in *OACT. */ -int -__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) -{ - int result; - struct kernel_sigaction kact, koact; - - if (act) - { - kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); - kact.sa_flags = act->sa_flags | SA_RESTORER; - - kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) - ? &restore_rt : &restore); - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - result = __rt_sigaction(sig, act ? (&kact) : NULL, - oact ? (&koact) : NULL, _NSIG / 8); - - if (oact && result >= 0) - { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); - oact->sa_flags = koact.sa_flags; - oact->sa_restorer = koact.sa_restorer; - } - return result; -} - -weak_alias (__libc_sigaction, __sigaction) -weak_alias (__libc_sigaction, sigaction) - -/* NOTE: Please think twice before making any changes to the bits of - code below. GDB needs some intimate knowledge about it to - recognize them as signal trampolines, and make backtraces through - signal handlers work right. Important are both the names - (__restore and __restore_rt) and the exact instruction sequence. - If you ever feel the need to make any changes, please notify the - appropriate GDB maintainer. */ - -#define RESTORE(name, syscall) RESTORE2 (name, syscall) -#define RESTORE2(name, syscall) \ -asm \ - ( \ - ".text\n" \ - " .align 16\n" \ - "__" #name ":\n" \ - " movl $" #syscall ", %eax\n" \ - " int $0x80" \ - ); - -/* The return code for realtime-signals. */ -RESTORE (restore_rt, __NR_rt_sigreturn) - -/* For the boring old signals. */ -# undef RESTORE2 -# define RESTORE2(name, syscall) \ -asm \ - ( \ - ".text\n" \ - " .align 8\n" \ - "__" #name ":\n" \ - " popl %eax\n" \ - " movl $" #syscall ", %eax\n" \ - " int $0x80" \ - ); - -RESTORE (restore, __NR_sigreturn) diff --git a/newlib/libc/sys/linux/machine/i386/sigstack.h b/newlib/libc/sys/linux/machine/i386/sigstack.h deleted file mode 100644 index fe6d2d10d..000000000 --- a/newlib/libc/sys/linux/machine/i386/sigstack.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _SIGSTACK_H - -#define _SIGSTACK_H - -#include <stddef.h> - -typedef struct sigaltstack - { - void *ss_sp; - int ss_flags; - size_t ss_size; - } stack_t; - -#endif /* _SIGSTACK_H */ diff --git a/newlib/libc/sys/linux/machine/i386/socketcall.h b/newlib/libc/sys/linux/machine/i386/socketcall.h deleted file mode 100644 index 07908767f..000000000 --- a/newlib/libc/sys/linux/machine/i386/socketcall.h +++ /dev/null @@ -1,63 +0,0 @@ -/* libc/sys/linux/machine/i386/socketcall.h - x86 linux socket system calls */ - -/* Copyright 2002, Red Hat Inc. */ - -#ifndef _SOCKETCALL_H - -#define _SOCKETCALL_H - -#include <machine/weakalias.h> -#include <sys/errno.h> -#include <asm/unistd.h> -#include "sockops.h" - -/* - * PIC uses %ebx, so we need to save it during system calls - */ - -#define __sockcall_base(type, name) \ -{ \ -long __res; \ -__asm__ volatile ("push %%ebx; movl %2,%%ebx; lea 8(%%ebp),%%ecx; int $0x80; pop %%ebx" \ - : "=a" (__res) \ - : "0" (__NR_socketcall),"r" (SOCK_##name)); \ -__syscall_return(type,__res); \ -} - -#undef _sockcall1 -#define _sockcall1(type,name,type1,arg1) \ -type __libc_##name(type1 arg1) \ -__sockcall_base(type,name) \ -weak_alias(__libc_##name,name) - -#undef _sockcall2 -#define _sockcall2(type,name,type1,arg1,type2,arg2) \ -type __libc_##name(type1 arg1, type2 arg2) \ -__sockcall_base(type,name) \ -weak_alias(__libc_##name,name) - -#undef _sockcall3 -#define _sockcall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type __libc_##name(type1 arg1, type2 arg2, type3 arg3) \ -__sockcall_base(type,name) \ -weak_alias(__libc_##name,name) - -#undef _sockcall4 -#define _sockcall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -__sockcall_base(type,name) \ -weak_alias(__libc_##name,name) - -#undef _sockcall5 -#define _sockcall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ -__sockcall_base(type,name) \ -weak_alias(__libc_##name,name) - -#undef _sockcall6 -#define _sockcall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ -type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ -__sockcall_base(type,name) \ -weak_alias(__libc_##name,name) - -#endif /* _SOCKETCALL_H */ diff --git a/newlib/libc/sys/linux/machine/i386/syscall.h b/newlib/libc/sys/linux/machine/i386/syscall.h deleted file mode 100644 index 380f1bcdf..000000000 --- a/newlib/libc/sys/linux/machine/i386/syscall.h +++ /dev/null @@ -1,175 +0,0 @@ -/* libc/sys/linux/machine/i386/syscall.h - x86 linux system calls */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef SYSCALL_H - -#include <machine/weakalias.h> -#include <sys/errno.h> -#include <asm/unistd.h> - - -/* - * Note: several system calls are for SysV or BSD compatibility, or are - * specific Linuxisms. Most of those system calls are not implemented in - * this library. - */ - - -#if defined(__PIC__) && defined(__i386__) - -/* - * PIC uses %ebx, so we need to save it during system calls - */ - -#undef __inline_syscall0 -#define __inline_syscall0(name,ret) \ -__asm__ volatile ("int $0x80" \ - : "=a" (ret) \ - : "0" (__NR_##name)); - -#undef __inline_syscall1 -#define __inline_syscall1(name,ret,arg1) \ -__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (ret) \ - : "0" (__NR_##name),"r" ((long)(arg1))); - -#undef __inline_syscall2 -#define __inline_syscall2(name,ret,arg1,arg2) \ -__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (ret) \ - : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2))); - -#undef __inline_syscall3 -#define __inline_syscall3(name,ret,arg1,arg2,arg3) \ -__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (ret) \ - : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3))); - -#undef __inline_syscall4 -#define __inline_syscall4(name,ret,arg1,arg2,arg3,arg4) \ -__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (ret) \ - : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4))); - -#undef __inline_syscall5 -#define __inline_syscall5(name,ret,arg1,arg2,arg3,arg4,arg5) \ -__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (ret) \ - : "0" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); - -#undef __inline_syscall6 -#define __inline_syscall6(name,ret,arg1,arg2,arg3,arg4,arg5,arg6) \ -__asm__ volatile ("push %%ebx; lea 8(%%ebp),%%ebx; int $0x80; pop %%ebx" \ - : "=a" (ret) \ - : "0" (__NR_##name)); - -#undef _syscall0_base -#define _syscall0_base(type,name) \ -type __libc_##name (void) \ -{ \ -long __res; \ -__inline_syscall0(name,__res) \ -__syscall_return(type,__res); \ -} - -#undef _syscall0 -#define _syscall0(type,name) \ -_syscall0_base(type,name) \ -weak_alias(__libc_##name,name); - -#undef _syscall1_base -#define _syscall1_base(type,name,type1,arg1) \ -type __libc_##name (type1 arg1) \ -{ \ -long __res; \ -__inline_syscall1(name,__res,arg1) \ -__syscall_return(type,__res); \ -} - -#undef _syscall1 -#define _syscall1(type,name,type1,arg1) \ -_syscall1_base(type,name,type1,arg1) \ -weak_alias(__libc_##name,name); - -#undef _syscall2_base -#define _syscall2_base(type,name,type1,arg1,type2,arg2) \ -type __libc_##name (type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__inline_syscall2(name,__res,arg1,arg2) \ -__syscall_return(type,__res); \ -} - -#undef _syscall2 -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -_syscall2_base(type,name,type1,arg1,type2,arg2) \ -weak_alias(__libc_##name,name); - -#undef _syscall3_base -#define _syscall3_base(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type __libc_##name (type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__inline_syscall3(name,__res,arg1,arg2,arg3) \ -__syscall_return(type,__res); \ -} - -#undef _syscall3 -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -_syscall3_base(type,name,type1,arg1,type2,arg2,type3,arg3) \ -weak_alias(__libc_##name,name); - -#undef _syscall4_base -#define _syscall4_base(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type __libc_##name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -__inline_syscall4(name,__res,arg1,arg2,arg3,arg4) \ -__syscall_return(type,__res); \ -} - -#undef _syscall4 -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -_syscall4_base(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -weak_alias(__libc_##name,name); - -#undef _syscall5_base -#define _syscall5_base(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type __libc_##name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -__inline_syscall5(name,__res,arg1,arg2,arg3,arg4,arg5) \ -__syscall_return(type,__res); \ -} \ - -#undef _syscall5 -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -_syscall5_base(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -weak_alias(__libc_##name,name); - -#undef _syscall6_base -#define _syscall6_base(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type __libc_##name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ -long __res; \ -__inline_syscall6(name,__res,arg1,arg2,arg3,arg4,arg5,arg6) \ -__syscall_return(type,__res); \ -} - -#undef _syscall6 -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -_syscall6_base(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ -weak_alias(__libc_##name,name); - -#endif /* __PIC__ && __i386__ */ - -#endif /* SYSCALL_H */ diff --git a/newlib/libc/sys/linux/machine/i386/sysdep.h b/newlib/libc/sys/linux/machine/i386/sysdep.h deleted file mode 100644 index 42becb3fd..000000000 --- a/newlib/libc/sys/linux/machine/i386/sysdep.h +++ /dev/null @@ -1 +0,0 @@ -#define NO_UNDERSCORES diff --git a/newlib/libc/sys/linux/machine/i386/weakalias.h b/newlib/libc/sys/linux/machine/i386/weakalias.h deleted file mode 100644 index 7b0b18a48..000000000 --- a/newlib/libc/sys/linux/machine/i386/weakalias.h +++ /dev/null @@ -1,8 +0,0 @@ -#define weak_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); - -#define weak_extern(symbol) _weak_extern (symbol) -#define _weak_extern(symbol) asm (".weak " #symbol); - -#define weak_function __attribute__ ((weak)) - diff --git a/newlib/libc/sys/linux/malign.c b/newlib/libc/sys/linux/malign.c deleted file mode 100644 index 818e05a75..000000000 --- a/newlib/libc/sys/linux/malign.c +++ /dev/null @@ -1 +0,0 @@ -/* dummy file to override one object in stdlib directory */ diff --git a/newlib/libc/sys/linux/malignr.c b/newlib/libc/sys/linux/malignr.c deleted file mode 100644 index 5b2e14ae4..000000000 --- a/newlib/libc/sys/linux/malignr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void * -_memalign_r (struct _reent *ptr, size_t alignment, size_t bytes) -{ - return memalign (alignment, bytes); -} diff --git a/newlib/libc/sys/linux/mallinfor.c b/newlib/libc/sys/linux/mallinfor.c deleted file mode 100644 index a2ee627bc..000000000 --- a/newlib/libc/sys/linux/mallinfor.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <malloc.h> - -struct mallinfo -_mallinfo_r (struct _reent *ptr) -{ - return mallinfo (); -} diff --git a/newlib/libc/sys/linux/malloc.c b/newlib/libc/sys/linux/malloc.c deleted file mode 100644 index ecebb369c..000000000 --- a/newlib/libc/sys/linux/malloc.c +++ /dev/null @@ -1,5077 +0,0 @@ -/* Malloc implementation for multiple threads without lock contention. - Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> - and Doug Lea <dl@cs.oswego.edu>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* $Id$ - - This work is mainly derived from malloc-2.6.4 by Doug Lea - <dl@cs.oswego.edu>, which is available from: - - ftp://g.oswego.edu/pub/misc/malloc.c - - Most of the original comments are reproduced in the code below. - -* Why use this malloc? - - This is not the fastest, most space-conserving, most portable, or - most tunable malloc ever written. However it is among the fastest - while also being among the most space-conserving, portable and tunable. - Consistent balance across these factors results in a good general-purpose - allocator. For a high-level description, see - http://g.oswego.edu/dl/html/malloc.html - - On many systems, the standard malloc implementation is by itself not - thread-safe, and therefore wrapped with a single global lock around - all malloc-related functions. In some applications, especially with - multiple available processors, this can lead to contention problems - and bad performance. This malloc version was designed with the goal - to avoid waiting for locks as much as possible. Statistics indicate - that this goal is achieved in many cases. - -* Synopsis of public routines - - (Much fuller descriptions are contained in the program documentation below.) - - ptmalloc_init(); - Initialize global configuration. When compiled for multiple threads, - this function must be called once before any other function in the - package. It is not required otherwise. It is called automatically - in the Linux/GNU C libray or when compiling with MALLOC_HOOKS. - malloc(size_t n); - Return a pointer to a newly allocated chunk of at least n bytes, or null - if no space is available. - free(Void_t* p); - Release the chunk of memory pointed to by p, or no effect if p is null. - realloc(Void_t* p, size_t n); - Return a pointer to a chunk of size n that contains the same data - as does chunk p up to the minimum of (n, p's size) bytes, or null - if no space is available. The returned pointer may or may not be - the same as p. If p is null, equivalent to malloc. Unless the - #define REALLOC_ZERO_BYTES_FREES below is set, realloc with a - size argument of zero (re)allocates a minimum-sized chunk. - memalign(size_t alignment, size_t n); - Return a pointer to a newly allocated chunk of n bytes, aligned - in accord with the alignment argument, which must be a power of - two. - valloc(size_t n); - Equivalent to memalign(pagesize, n), where pagesize is the page - size of the system (or as near to this as can be figured out from - all the includes/defines below.) - pvalloc(size_t n); - Equivalent to valloc(minimum-page-that-holds(n)), that is, - round up n to nearest pagesize. - calloc(size_t unit, size_t quantity); - Returns a pointer to quantity * unit bytes, with all locations - set to zero. - cfree(Void_t* p); - Equivalent to free(p). - malloc_trim(size_t pad); - Release all but pad bytes of freed top-most memory back - to the system. Return 1 if successful, else 0. - malloc_usable_size(Void_t* p); - Report the number usable allocated bytes associated with allocated - chunk p. This may or may not report more bytes than were requested, - due to alignment and minimum size constraints. - malloc_stats(); - Prints brief summary statistics on stderr. - mallinfo() - Returns (by copy) a struct containing various summary statistics. - mallopt(int parameter_number, int parameter_value) - Changes one of the tunable parameters described below. Returns - 1 if successful in changing the parameter, else 0. - -* Vital statistics: - - Alignment: 8-byte - 8 byte alignment is currently hardwired into the design. This - seems to suffice for all current machines and C compilers. - - Assumed pointer representation: 4 or 8 bytes - Code for 8-byte pointers is untested by me but has worked - reliably by Wolfram Gloger, who contributed most of the - changes supporting this. - - Assumed size_t representation: 4 or 8 bytes - Note that size_t is allowed to be 4 bytes even if pointers are 8. - - Minimum overhead per allocated chunk: 4 or 8 bytes - Each malloced chunk has a hidden overhead of 4 bytes holding size - and status information. - - Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead) - 8-byte ptrs: 24/32 bytes (including, 4/8 overhead) - - When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte - ptrs but 4 byte size) or 24 (for 8/8) additional bytes are - needed; 4 (8) for a trailing size field - and 8 (16) bytes for free list pointers. Thus, the minimum - allocatable size is 16/24/32 bytes. - - Even a request for zero bytes (i.e., malloc(0)) returns a - pointer to something of the minimum allocatable size. - - Maximum allocated size: 4-byte size_t: 2^31 - 8 bytes - 8-byte size_t: 2^63 - 16 bytes - - It is assumed that (possibly signed) size_t bit values suffice to - represent chunk sizes. `Possibly signed' is due to the fact - that `size_t' may be defined on a system as either a signed or - an unsigned type. To be conservative, values that would appear - as negative numbers are avoided. - Requests for sizes with a negative sign bit will return a - minimum-sized chunk. - - Maximum overhead wastage per allocated chunk: normally 15 bytes - - Alignment demands, plus the minimum allocatable size restriction - make the normal worst-case wastage 15 bytes (i.e., up to 15 - more bytes will be allocated than were requested in malloc), with - two exceptions: - 1. Because requests for zero bytes allocate non-zero space, - the worst case wastage for a request of zero bytes is 24 bytes. - 2. For requests >= mmap_threshold that are serviced via - mmap(), the worst case wastage is 8 bytes plus the remainder - from a system page (the minimal mmap unit); typically 4096 bytes. - -* Limitations - - Here are some features that are NOT currently supported - - * No automated mechanism for fully checking that all accesses - to malloced memory stay within their bounds. - * No support for compaction. - -* Synopsis of compile-time options: - - People have reported using previous versions of this malloc on all - versions of Unix, sometimes by tweaking some of the defines - below. It has been tested most extensively on Solaris and - Linux. People have also reported adapting this malloc for use in - stand-alone embedded systems. - - The implementation is in straight, hand-tuned ANSI C. Among other - consequences, it uses a lot of macros. Because of this, to be at - all usable, this code should be compiled using an optimizing compiler - (for example gcc -O2) that can simplify expressions and control - paths. - - __STD_C (default: derived from C compiler defines) - Nonzero if using ANSI-standard C compiler, a C++ compiler, or - a C compiler sufficiently close to ANSI to get away with it. - MALLOC_DEBUG (default: NOT defined) - Define to enable debugging. Adds fairly extensive assertion-based - checking to help track down memory errors, but noticeably slows down - execution. - MALLOC_HOOKS (default: NOT defined) - Define to enable support run-time replacement of the allocation - functions through user-defined `hooks'. - REALLOC_ZERO_BYTES_FREES (default: defined) - Define this if you think that realloc(p, 0) should be equivalent - to free(p). (The C standard requires this behaviour, therefore - it is the default.) Otherwise, since malloc returns a unique - pointer for malloc(0), so does realloc(p, 0). - HAVE_MEMCPY (default: defined) - Define if you are not otherwise using ANSI STD C, but still - have memcpy and memset in your C library and want to use them. - Otherwise, simple internal versions are supplied. - USE_MEMCPY (default: 1 if HAVE_MEMCPY is defined, 0 otherwise) - Define as 1 if you want the C library versions of memset and - memcpy called in realloc and calloc (otherwise macro versions are used). - At least on some platforms, the simple macro versions usually - outperform libc versions. - HAVE_MMAP (default: defined as 1) - Define to non-zero to optionally make malloc() use mmap() to - allocate very large blocks. - HAVE_MREMAP (default: defined as 0 unless Linux libc set) - Define to non-zero to optionally make realloc() use mremap() to - reallocate very large blocks. - USE_ARENAS (default: the same as HAVE_MMAP) - Enable support for multiple arenas, allocated using mmap(). - malloc_getpagesize (default: derived from system #includes) - Either a constant or routine call returning the system page size. - HAVE_USR_INCLUDE_MALLOC_H (default: NOT defined) - Optionally define if you are on a system with a /usr/include/malloc.h - that declares struct mallinfo. It is not at all necessary to - define this even if you do, but will ensure consistency. - INTERNAL_SIZE_T (default: size_t) - Define to a 32-bit type (probably `unsigned int') if you are on a - 64-bit machine, yet do not want or need to allow malloc requests of - greater than 2^31 to be handled. This saves space, especially for - very small chunks. - _LIBC (default: NOT defined) - Defined only when compiled as part of the Linux libc/glibc. - Also note that there is some odd internal name-mangling via defines - (for example, internally, `malloc' is named `mALLOc') needed - when compiling in this case. These look funny but don't otherwise - affect anything. - LACKS_UNISTD_H (default: undefined) - Define this if your system does not have a <unistd.h>. - MORECORE (default: sbrk) - The name of the routine to call to obtain more memory from the system. - MORECORE_FAILURE (default: -1) - The value returned upon failure of MORECORE. - MORECORE_CLEARS (default 1) - The degree to which the routine mapped to MORECORE zeroes out - memory: never (0), only for newly allocated space (1) or always - (2). The distinction between (1) and (2) is necessary because on - some systems, if the application first decrements and then - increments the break value, the contents of the reallocated space - are unspecified. - DEFAULT_TRIM_THRESHOLD - DEFAULT_TOP_PAD - DEFAULT_MMAP_THRESHOLD - DEFAULT_MMAP_MAX - Default values of tunable parameters (described in detail below) - controlling interaction with host system routines (sbrk, mmap, etc). - These values may also be changed dynamically via mallopt(). The - preset defaults are those that give best performance for typical - programs/systems. - DEFAULT_CHECK_ACTION - When the standard debugging hooks are in place, and a pointer is - detected as corrupt, do nothing (0), print an error message (1), - or call abort() (2). - - -*/ - -/* - -* Compile-time options for multiple threads: - - USE_PTHREADS, USE_THR, USE_SPROC - Define one of these as 1 to select the thread interface: - POSIX threads, Solaris threads or SGI sproc's, respectively. - If none of these is defined as non-zero, you get a `normal' - malloc implementation which is not thread-safe. Support for - multiple threads requires HAVE_MMAP=1. As an exception, when - compiling for GNU libc, i.e. when _LIBC is defined, then none of - the USE_... symbols have to be defined. - - HEAP_MIN_SIZE - HEAP_MAX_SIZE - When thread support is enabled, additional `heap's are created - with mmap calls. These are limited in size; HEAP_MIN_SIZE should - be a multiple of the page size, while HEAP_MAX_SIZE must be a power - of two for alignment reasons. HEAP_MAX_SIZE should be at least - twice as large as the mmap threshold. - THREAD_STATS - When this is defined as non-zero, some statistics on mutex locking - are computed. - -*/ - - - - -/* Preliminaries */ - -#ifndef __STD_C -#if defined (__STDC__) -#define __STD_C 1 -#else -#if __cplusplus -#define __STD_C 1 -#else -#define __STD_C 0 -#endif /*__cplusplus*/ -#endif /*__STDC__*/ -#endif /*__STD_C*/ - -#ifndef Void_t -#if __STD_C -#define Void_t void -#else -#define Void_t char -#endif -#endif /*Void_t*/ - -#if __STD_C -# include <stddef.h> /* for size_t */ -# if defined _LIBC || defined MALLOC_HOOKS -# include <stdlib.h> /* for getenv(), abort() */ -# endif -#else -# include <sys/types.h> -# if defined _LIBC || defined MALLOC_HOOKS -extern char* getenv(); -# endif -#endif - -/* newlib modifications */ - -#include <libc-symbols.h> -#include <sys/types.h> - -extern void __pthread_initialize (void) __attribute__((weak)); -extern void *__mmap (void *__addr, size_t __len, int __prot, - int __flags, int __fd, off_t __offset); -extern int __munmap (void *__addr, size_t __len); -extern void *__mremap (void *__addr, size_t __old_len, size_t __new_len, - int __may_move); -extern int __getpagesize (void); - -#define __libc_enable_secure 1 - -/* Macros for handling mutexes and thread-specific data. This is - included early, because some thread-related header files (such as - pthread.h) should be included before any others. */ -#include <bits/libc-lock.h> -#include "thread-m.h" - -void *(*__malloc_internal_tsd_get) (enum __libc_tsd_key_t) = NULL; -int (*__malloc_internal_tsd_set) (enum __libc_tsd_key_t, - __const void *) = NULL; - -weak_alias(__malloc_internal_tsd_get, __libc_internal_tsd_get) -weak_alias(__malloc_internal_tsd_set, __libc_internal_tsd_set) - - -#ifdef __cplusplus -extern "C" { -#endif - -#include <errno.h> -#include <stdio.h> /* needed for malloc_stats */ - - -/* - Compile-time options -*/ - - -/* - Debugging: - - Because freed chunks may be overwritten with link fields, this - malloc will often die when freed memory is overwritten by user - programs. This can be very effective (albeit in an annoying way) - in helping track down dangling pointers. - - If you compile with -DMALLOC_DEBUG, a number of assertion checks are - enabled that will catch more memory errors. You probably won't be - able to make much sense of the actual assertion errors, but they - should help you locate incorrectly overwritten memory. The - checking is fairly extensive, and will slow down execution - noticeably. Calling malloc_stats or mallinfo with MALLOC_DEBUG set will - attempt to check every non-mmapped allocated and free chunk in the - course of computing the summaries. (By nature, mmapped regions - cannot be checked very much automatically.) - - Setting MALLOC_DEBUG may also be helpful if you are trying to modify - this code. The assertions in the check routines spell out in more - detail the assumptions and invariants underlying the algorithms. - -*/ - -#if MALLOC_DEBUG -#include <assert.h> -#else -#define assert(x) ((void)0) -#endif - - -/* - INTERNAL_SIZE_T is the word-size used for internal bookkeeping - of chunk sizes. On a 64-bit machine, you can reduce malloc - overhead by defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' - at the expense of not being able to handle requests greater than - 2^31. This limitation is hardly ever a concern; you are encouraged - to set this. However, the default version is the same as size_t. -*/ - -#ifndef INTERNAL_SIZE_T -#define INTERNAL_SIZE_T size_t -#endif - -/* - REALLOC_ZERO_BYTES_FREES should be set if a call to realloc with - zero bytes should be the same as a call to free. The C standard - requires this. Otherwise, since this malloc returns a unique pointer - for malloc(0), so does realloc(p, 0). -*/ - - -#define REALLOC_ZERO_BYTES_FREES - - -/* - HAVE_MEMCPY should be defined if you are not otherwise using - ANSI STD C, but still have memcpy and memset in your C library - and want to use them in calloc and realloc. Otherwise simple - macro versions are defined here. - - USE_MEMCPY should be defined as 1 if you actually want to - have memset and memcpy called. People report that the macro - versions are often enough faster than libc versions on many - systems that it is better to use them. - -*/ - -#define HAVE_MEMCPY 1 - -#ifndef USE_MEMCPY -#ifdef HAVE_MEMCPY -#define USE_MEMCPY 1 -#else -#define USE_MEMCPY 0 -#endif -#endif - -#if (__STD_C || defined(HAVE_MEMCPY)) - -#if __STD_C -void* memset(void*, int, size_t); -void* memcpy(void*, const void*, size_t); -void* memmove(void*, const void*, size_t); -#else -Void_t* memset(); -Void_t* memcpy(); -Void_t* memmove(); -#endif -#endif - -/* The following macros are only invoked with (2n+1)-multiples of - INTERNAL_SIZE_T units, with a positive integer n. This is exploited - for fast inline execution when n is small. If the regions to be - copied do overlap, the destination lies always _below_ the source. */ - -#if USE_MEMCPY - -#define MALLOC_ZERO(charp, nbytes) \ -do { \ - INTERNAL_SIZE_T mzsz = (nbytes); \ - if(mzsz <= 9*sizeof(mzsz)) { \ - INTERNAL_SIZE_T* mz = (INTERNAL_SIZE_T*) (charp); \ - if(mzsz >= 5*sizeof(mzsz)) { *mz++ = 0; \ - *mz++ = 0; \ - if(mzsz >= 7*sizeof(mzsz)) { *mz++ = 0; \ - *mz++ = 0; \ - if(mzsz >= 9*sizeof(mzsz)) { *mz++ = 0; \ - *mz++ = 0; }}} \ - *mz++ = 0; \ - *mz++ = 0; \ - *mz = 0; \ - } else memset((charp), 0, mzsz); \ -} while(0) - -/* If the regions overlap, dest is always _below_ src. */ - -#define MALLOC_COPY(dest,src,nbytes,overlap) \ -do { \ - INTERNAL_SIZE_T mcsz = (nbytes); \ - if(mcsz <= 9*sizeof(mcsz)) { \ - INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) (src); \ - INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) (dest); \ - if(mcsz >= 5*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; \ - if(mcsz >= 7*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; \ - if(mcsz >= 9*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; }}} \ - *mcdst++ = *mcsrc++; \ - *mcdst++ = *mcsrc++; \ - *mcdst = *mcsrc ; \ - } else if(overlap) \ - memmove(dest, src, mcsz); \ - else \ - memcpy(dest, src, mcsz); \ -} while(0) - -#else /* !USE_MEMCPY */ - -/* Use Duff's device for good zeroing/copying performance. */ - -#define MALLOC_ZERO(charp, nbytes) \ -do { \ - INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \ - long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ - if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ - switch (mctmp) { \ - case 0: for(;;) { *mzp++ = 0; \ - case 7: *mzp++ = 0; \ - case 6: *mzp++ = 0; \ - case 5: *mzp++ = 0; \ - case 4: *mzp++ = 0; \ - case 3: *mzp++ = 0; \ - case 2: *mzp++ = 0; \ - case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \ - } \ -} while(0) - -/* If the regions overlap, dest is always _below_ src. */ - -#define MALLOC_COPY(dest,src,nbytes,overlap) \ -do { \ - INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \ - INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \ - long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ - if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ - switch (mctmp) { \ - case 0: for(;;) { *mcdst++ = *mcsrc++; \ - case 7: *mcdst++ = *mcsrc++; \ - case 6: *mcdst++ = *mcsrc++; \ - case 5: *mcdst++ = *mcsrc++; \ - case 4: *mcdst++ = *mcsrc++; \ - case 3: *mcdst++ = *mcsrc++; \ - case 2: *mcdst++ = *mcsrc++; \ - case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \ - } \ -} while(0) - -#endif - - -#ifndef LACKS_UNISTD_H -# include <unistd.h> -#endif - -/* - Define HAVE_MMAP to optionally make malloc() use mmap() to allocate - very large blocks. These will be returned to the operating system - immediately after a free(). HAVE_MMAP is also a prerequisite to - support multiple `arenas' (see USE_ARENAS below). -*/ - -#ifndef HAVE_MMAP -# ifdef _POSIX_MAPPED_FILES -# define HAVE_MMAP 1 -# endif -#endif - -/* - Define HAVE_MREMAP to make realloc() use mremap() to re-allocate - large blocks. This is currently only possible on Linux with - kernel versions newer than 1.3.77. -*/ - -#ifndef HAVE_MREMAP -#define HAVE_MREMAP defined(__linux__) -#endif - -/* Define USE_ARENAS to enable support for multiple `arenas'. These - are allocated using mmap(), are necessary for threads and - occasionally useful to overcome address space limitations affecting - sbrk(). */ - -#ifndef USE_ARENAS -#define USE_ARENAS HAVE_MMAP -#endif - -#if HAVE_MMAP - -#include <unistd.h> -#include <fcntl.h> -#include <sys/mman.h> - -#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -#define MAP_ANONYMOUS MAP_ANON -#endif -#if !defined(MAP_FAILED) -#define MAP_FAILED ((char*)-1) -#endif - -#ifndef MAP_NORESERVE -# ifdef MAP_AUTORESRV -# define MAP_NORESERVE MAP_AUTORESRV -# else -# define MAP_NORESERVE 0 -# endif -#endif - -#endif /* HAVE_MMAP */ - -/* - Access to system page size. To the extent possible, this malloc - manages memory from the system in page-size units. - - The following mechanics for getpagesize were adapted from - bsd/gnu getpagesize.h -*/ - -#ifndef malloc_getpagesize -# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ -# ifndef _SC_PAGE_SIZE -# define _SC_PAGE_SIZE _SC_PAGESIZE -# endif -# endif -# ifdef _SC_PAGE_SIZE -# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) -# else -# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) - extern size_t getpagesize(); -# define malloc_getpagesize getpagesize() -# else -# include <sys/param.h> -# ifdef EXEC_PAGESIZE -# define malloc_getpagesize EXEC_PAGESIZE -# else -# ifdef NBPG -# ifndef CLSIZE -# define malloc_getpagesize NBPG -# else -# define malloc_getpagesize (NBPG * CLSIZE) -# endif -# else -# ifdef NBPC -# define malloc_getpagesize NBPC -# else -# ifdef PAGESIZE -# define malloc_getpagesize PAGESIZE -# else -# define malloc_getpagesize (4096) /* just guess */ -# endif -# endif -# endif -# endif -# endif -# endif -#endif - - - -/* - - This version of malloc supports the standard SVID/XPG mallinfo - routine that returns a struct containing the same kind of - information you can get from malloc_stats. It should work on - any SVID/XPG compliant system that has a /usr/include/malloc.h - defining struct mallinfo. (If you'd like to install such a thing - yourself, cut out the preliminary declarations as described above - and below and save them in a malloc.h file. But there's no - compelling reason to bother to do this.) - - The main declaration needed is the mallinfo struct that is returned - (by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a - bunch of fields, most of which are not even meaningful in this - version of malloc. Some of these fields are are instead filled by - mallinfo() with other numbers that might possibly be of interest. - - HAVE_USR_INCLUDE_MALLOC_H should be set if you have a - /usr/include/malloc.h file that includes a declaration of struct - mallinfo. If so, it is included; else an SVID2/XPG2 compliant - version is declared below. These must be precisely the same for - mallinfo() to work. - -*/ - -/* #define HAVE_USR_INCLUDE_MALLOC_H */ - -#if HAVE_USR_INCLUDE_MALLOC_H -# include "/usr/include/malloc.h" -#else -# ifdef _LIBC -# include "malloc.h" -# else -# include "ptmalloc.h" -# endif -#endif - -#include <bp-checks.h> - -#ifndef DEFAULT_TRIM_THRESHOLD -#define DEFAULT_TRIM_THRESHOLD (128 * 1024) -#endif - -/* - M_TRIM_THRESHOLD is the maximum amount of unused top-most memory - to keep before releasing via malloc_trim in free(). - - Automatic trimming is mainly useful in long-lived programs. - Because trimming via sbrk can be slow on some systems, and can - sometimes be wasteful (in cases where programs immediately - afterward allocate more large chunks) the value should be high - enough so that your overall system performance would improve by - releasing. - - The trim threshold and the mmap control parameters (see below) - can be traded off with one another. Trimming and mmapping are - two different ways of releasing unused memory back to the - system. Between these two, it is often possible to keep - system-level demands of a long-lived program down to a bare - minimum. For example, in one test suite of sessions measuring - the XF86 X server on Linux, using a trim threshold of 128K and a - mmap threshold of 192K led to near-minimal long term resource - consumption. - - If you are using this malloc in a long-lived program, it should - pay to experiment with these values. As a rough guide, you - might set to a value close to the average size of a process - (program) running on your system. Releasing this much memory - would allow such a process to run in memory. Generally, it's - worth it to tune for trimming rather than memory mapping when a - program undergoes phases where several large chunks are - allocated and released in ways that can reuse each other's - storage, perhaps mixed with phases where there are no such - chunks at all. And in well-behaved long-lived programs, - controlling release of large blocks via trimming versus mapping - is usually faster. - - However, in most programs, these parameters serve mainly as - protection against the system-level effects of carrying around - massive amounts of unneeded memory. Since frequent calls to - sbrk, mmap, and munmap otherwise degrade performance, the default - parameters are set to relatively high values that serve only as - safeguards. - - The default trim value is high enough to cause trimming only in - fairly extreme (by current memory consumption standards) cases. - It must be greater than page size to have any useful effect. To - disable trimming completely, you can set to (unsigned long)(-1); - - -*/ - - -#ifndef DEFAULT_TOP_PAD -#define DEFAULT_TOP_PAD (0) -#endif - -/* - M_TOP_PAD is the amount of extra `padding' space to allocate or - retain whenever sbrk is called. It is used in two ways internally: - - * When sbrk is called to extend the top of the arena to satisfy - a new malloc request, this much padding is added to the sbrk - request. - - * When malloc_trim is called automatically from free(), - it is used as the `pad' argument. - - In both cases, the actual amount of padding is rounded - so that the end of the arena is always a system page boundary. - - The main reason for using padding is to avoid calling sbrk so - often. Having even a small pad greatly reduces the likelihood - that nearly every malloc request during program start-up (or - after trimming) will invoke sbrk, which needlessly wastes - time. - - Automatic rounding-up to page-size units is normally sufficient - to avoid measurable overhead, so the default is 0. However, in - systems where sbrk is relatively slow, it can pay to increase - this value, at the expense of carrying around more memory than - the program needs. - -*/ - - -#ifndef DEFAULT_MMAP_THRESHOLD -#define DEFAULT_MMAP_THRESHOLD (128 * 1024) -#endif - -/* - - M_MMAP_THRESHOLD is the request size threshold for using mmap() - to service a request. Requests of at least this size that cannot - be allocated using already-existing space will be serviced via mmap. - (If enough normal freed space already exists it is used instead.) - - Using mmap segregates relatively large chunks of memory so that - they can be individually obtained and released from the host - system. A request serviced through mmap is never reused by any - other request (at least not directly; the system may just so - happen to remap successive requests to the same locations). - - Segregating space in this way has the benefit that mmapped space - can ALWAYS be individually released back to the system, which - helps keep the system level memory demands of a long-lived - program low. Mapped memory can never become `locked' between - other chunks, as can happen with normally allocated chunks, which - menas that even trimming via malloc_trim would not release them. - - However, it has the disadvantages that: - - 1. The space cannot be reclaimed, consolidated, and then - used to service later requests, as happens with normal chunks. - 2. It can lead to more wastage because of mmap page alignment - requirements - 3. It causes malloc performance to be more dependent on host - system memory management support routines which may vary in - implementation quality and may impose arbitrary - limitations. Generally, servicing a request via normal - malloc steps is faster than going through a system's mmap. - - All together, these considerations should lead you to use mmap - only for relatively large requests. - - -*/ - - - -#ifndef DEFAULT_MMAP_MAX -#if HAVE_MMAP -#define DEFAULT_MMAP_MAX (1024) -#else -#define DEFAULT_MMAP_MAX (0) -#endif -#endif - -/* - M_MMAP_MAX is the maximum number of requests to simultaneously - service using mmap. This parameter exists because: - - 1. Some systems have a limited number of internal tables for - use by mmap. - 2. In most systems, overreliance on mmap can degrade overall - performance. - 3. If a program allocates many large regions, it is probably - better off using normal sbrk-based allocation routines that - can reclaim and reallocate normal heap memory. Using a - small value allows transition into this mode after the - first few allocations. - - Setting to 0 disables all use of mmap. If HAVE_MMAP is not set, - the default value is 0, and attempts to set it to non-zero values - in mallopt will fail. -*/ - - - -#ifndef DEFAULT_CHECK_ACTION -#define DEFAULT_CHECK_ACTION 1 -#endif - -/* What to do if the standard debugging hooks are in place and a - corrupt pointer is detected: do nothing (0), print an error message - (1), or call abort() (2). */ - - - -#define HEAP_MIN_SIZE (32*1024) -#define HEAP_MAX_SIZE (1024*1024) /* must be a power of two */ - -/* HEAP_MIN_SIZE and HEAP_MAX_SIZE limit the size of mmap()ed heaps - that are dynamically created for multi-threaded programs. The - maximum size must be a power of two, for fast determination of - which heap belongs to a chunk. It should be much larger than - the mmap threshold, so that requests with a size just below that - threshold can be fulfilled without creating too many heaps. -*/ - - - -#ifndef THREAD_STATS -#define THREAD_STATS 0 -#endif - -/* If THREAD_STATS is non-zero, some statistics on mutex locking are - computed. */ - - -/* Macro to set errno. */ -#ifndef __set_errno -# define __set_errno(val) errno = (val) -#endif - -/* On some platforms we can compile internal, not exported functions better. - Let the environment provide a macro and define it to be empty if it - is not available. */ -#ifndef internal_function -# define internal_function -#endif - - -/* - - Special defines for the Linux/GNU C library. - -*/ - - -#ifdef _LIBC - -#if __STD_C - -Void_t * __default_morecore (ptrdiff_t); -Void_t *(*__morecore)(ptrdiff_t) = __default_morecore; - -#else - -Void_t * __default_morecore (); -Void_t *(*__morecore)() = __default_morecore; - -#endif - -#define MORECORE (*__morecore) -#define MORECORE_FAILURE 0 - -#ifndef MORECORE_CLEARS -#define MORECORE_CLEARS 1 -#endif - -static size_t __libc_pagesize; - -#define access __access -#define mmap __mmap -#define munmap __munmap -#define mremap __mremap -#define mprotect __mprotect -#undef malloc_getpagesize -#define malloc_getpagesize __libc_pagesize - -#else /* _LIBC */ - -#if __STD_C -extern Void_t* sbrk(ptrdiff_t); -#else -extern Void_t* sbrk(); -#endif - -#ifndef MORECORE -#define MORECORE sbrk -#endif - -#ifndef MORECORE_FAILURE -#define MORECORE_FAILURE -1 -#endif - -#ifndef MORECORE_CLEARS -#define MORECORE_CLEARS 1 -#endif - -#endif /* _LIBC */ - -#ifdef _LIBC - -#define cALLOc __libc_calloc -#define fREe __libc_free -#define mALLOc __libc_malloc -#define mEMALIGn __libc_memalign -#define rEALLOc __libc_realloc -#define vALLOc __libc_valloc -#define pvALLOc __libc_pvalloc -#define mALLINFo __libc_mallinfo -#define mALLOPt __libc_mallopt -#define mALLOC_STATs __malloc_stats -#define mALLOC_USABLE_SIZe __malloc_usable_size -#define mALLOC_TRIm __malloc_trim -#define mALLOC_GET_STATe __malloc_get_state -#define mALLOC_SET_STATe __malloc_set_state - -#else - -#define cALLOc calloc -#define fREe free -#define mALLOc malloc -#define mEMALIGn memalign -#define rEALLOc realloc -#define vALLOc valloc -#define pvALLOc pvalloc -#define mALLINFo mallinfo -#define mALLOPt mallopt -#define mALLOC_STATs malloc_stats -#define mALLOC_USABLE_SIZe malloc_usable_size -#define mALLOC_TRIm malloc_trim -#define mALLOC_GET_STATe malloc_get_state -#define mALLOC_SET_STATe malloc_set_state - -#endif - -/* Public routines */ - -#if __STD_C - -#ifndef _LIBC -void ptmalloc_init(void); -#endif -Void_t* mALLOc(size_t); -void fREe(Void_t*); -Void_t* rEALLOc(Void_t*, size_t); -Void_t* mEMALIGn(size_t, size_t); -Void_t* vALLOc(size_t); -Void_t* pvALLOc(size_t); -Void_t* cALLOc(size_t, size_t); -void cfree(Void_t*); -int mALLOC_TRIm(size_t); -size_t mALLOC_USABLE_SIZe(Void_t*); -void mALLOC_STATs(void); -int mALLOPt(int, int); -struct mallinfo mALLINFo(void); -Void_t* mALLOC_GET_STATe(void); -int mALLOC_SET_STATe(Void_t*); - -#else /* !__STD_C */ - -#ifndef _LIBC -void ptmalloc_init(); -#endif -Void_t* mALLOc(); -void fREe(); -Void_t* rEALLOc(); -Void_t* mEMALIGn(); -Void_t* vALLOc(); -Void_t* pvALLOc(); -Void_t* cALLOc(); -void cfree(); -int mALLOC_TRIm(); -size_t mALLOC_USABLE_SIZe(); -void mALLOC_STATs(); -int mALLOPt(); -struct mallinfo mALLINFo(); -Void_t* mALLOC_GET_STATe(); -int mALLOC_SET_STATe(); - -#endif /* __STD_C */ - - -#ifdef __cplusplus -} /* end of extern "C" */ -#endif - -#if !defined(NO_THREADS) && !HAVE_MMAP -"Can't have threads support without mmap" -#endif -#if USE_ARENAS && !HAVE_MMAP -"Can't have multiple arenas without mmap" -#endif - - -/* - Type declarations -*/ - - -struct malloc_chunk -{ - INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */ - INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */ - struct malloc_chunk* fd; /* double links -- used only if free. */ - struct malloc_chunk* bk; -}; - -typedef struct malloc_chunk* mchunkptr; - -/* - - malloc_chunk details: - - (The following includes lightly edited explanations by Colin Plumb.) - - Chunks of memory are maintained using a `boundary tag' method as - described in e.g., Knuth or Standish. (See the paper by Paul - Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a - survey of such techniques.) Sizes of free chunks are stored both - in the front of each chunk and at the end. This makes - consolidating fragmented chunks into bigger chunks very fast. The - size fields also hold bits representing whether chunks are free or - in use. - - An allocated chunk looks like this: - - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk, if allocated | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | User data starts here... . - . . - . (malloc_usable_space() bytes) . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - - Where "chunk" is the front of the chunk for the purpose of most of - the malloc code, but "mem" is the pointer that is returned to the - user. "Nextchunk" is the beginning of the next contiguous chunk. - - Chunks always begin on even word boundaries, so the mem portion - (which is returned to the user) is also on an even word boundary, and - thus double-word aligned. - - Free chunks are stored in circular doubly-linked lists, and look like this: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `head:' | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Forward pointer to next chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Back pointer to previous chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Unused space (may be 0 bytes long) . - . . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `foot:' | Size of chunk, in bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - The P (PREV_INUSE) bit, stored in the unused low-order bit of the - chunk size (which is always a multiple of two words), is an in-use - bit for the *previous* chunk. If that bit is *clear*, then the - word before the current chunk size contains the previous chunk - size, and can be used to find the front of the previous chunk. - (The very first chunk allocated always has this bit set, - preventing access to non-existent (or non-owned) memory.) - - Note that the `foot' of the current chunk is actually represented - as the prev_size of the NEXT chunk. (This makes it easier to - deal with alignments etc). - - The two exceptions to all this are - - 1. The special chunk `top', which doesn't bother using the - trailing size field since there is no - next contiguous chunk that would have to index off it. (After - initialization, `top' is forced to always exist. If it would - become less than MINSIZE bytes long, it is replenished via - malloc_extend_top.) - - 2. Chunks allocated via mmap, which have the second-lowest-order - bit (IS_MMAPPED) set in their size fields. Because they are - never merged or traversed from any other chunk, they have no - foot size or inuse information. - - Available chunks are kept in any of several places (all declared below): - - * `av': An array of chunks serving as bin headers for consolidated - chunks. Each bin is doubly linked. The bins are approximately - proportionally (log) spaced. There are a lot of these bins - (128). This may look excessive, but works very well in - practice. All procedures maintain the invariant that no - consolidated chunk physically borders another one. Chunks in - bins are kept in size order, with ties going to the - approximately least recently used chunk. - - The chunks in each bin are maintained in decreasing sorted order by - size. This is irrelevant for the small bins, which all contain - the same-sized chunks, but facilitates best-fit allocation for - larger chunks. (These lists are just sequential. Keeping them in - order almost never requires enough traversal to warrant using - fancier ordered data structures.) Chunks of the same size are - linked with the most recently freed at the front, and allocations - are taken from the back. This results in LRU or FIFO allocation - order, which tends to give each chunk an equal opportunity to be - consolidated with adjacent freed chunks, resulting in larger free - chunks and less fragmentation. - - * `top': The top-most available chunk (i.e., the one bordering the - end of available memory) is treated specially. It is never - included in any bin, is used only if no other chunk is - available, and is released back to the system if it is very - large (see M_TRIM_THRESHOLD). - - * `last_remainder': A bin holding only the remainder of the - most recently split (non-top) chunk. This bin is checked - before other non-fitting chunks, so as to provide better - locality for runs of sequentially allocated chunks. - - * Implicitly, through the host system's memory mapping tables. - If supported, requests greater than a threshold are usually - serviced via calls to mmap, and then later released via munmap. - -*/ - -/* - Bins - - The bins are an array of pairs of pointers serving as the - heads of (initially empty) doubly-linked lists of chunks, laid out - in a way so that each pair can be treated as if it were in a - malloc_chunk. (This way, the fd/bk offsets for linking bin heads - and chunks are the same). - - Bins for sizes < 512 bytes contain chunks of all the same size, spaced - 8 bytes apart. Larger bins are approximately logarithmically - spaced. (See the table below.) - - Bin layout: - - 64 bins of size 8 - 32 bins of size 64 - 16 bins of size 512 - 8 bins of size 4096 - 4 bins of size 32768 - 2 bins of size 262144 - 1 bin of size what's left - - There is actually a little bit of slop in the numbers in bin_index - for the sake of speed. This makes no difference elsewhere. - - The special chunks `top' and `last_remainder' get their own bins, - (this is implemented via yet more trickery with the av array), - although `top' is never properly linked to its bin since it is - always handled specially. - -*/ - -#define NAV 128 /* number of bins */ - -typedef struct malloc_chunk* mbinptr; - -/* An arena is a configuration of malloc_chunks together with an array - of bins. With multiple threads, it must be locked via a mutex - before changing its data structures. One or more `heaps' are - associated with each arena, except for the main_arena, which is - associated only with the `main heap', i.e. the conventional free - store obtained with calls to MORECORE() (usually sbrk). The `av' - array is never mentioned directly in the code, but instead used via - bin access macros. */ - -typedef struct _arena { - mbinptr av[2*NAV + 2]; - struct _arena *next; - size_t size; -#if THREAD_STATS - long stat_lock_direct, stat_lock_loop, stat_lock_wait; -#endif - mutex_t mutex; -} arena; - - -/* A heap is a single contiguous memory region holding (coalesceable) - malloc_chunks. It is allocated with mmap() and always starts at an - address aligned to HEAP_MAX_SIZE. Not used unless compiling with - USE_ARENAS. */ - -typedef struct _heap_info { - arena *ar_ptr; /* Arena for this heap. */ - struct _heap_info *prev; /* Previous heap. */ - size_t size; /* Current size in bytes. */ - size_t pad; /* Make sure the following data is properly aligned. */ -} heap_info; - - -/* - Static functions (forward declarations) -*/ - -#if __STD_C - -static void chunk_free(arena *ar_ptr, mchunkptr p) internal_function; -static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size) - internal_function; -static mchunkptr chunk_realloc(arena *ar_ptr, mchunkptr oldp, - INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb) - internal_function; -static mchunkptr chunk_align(arena *ar_ptr, INTERNAL_SIZE_T nb, - size_t alignment) internal_function; -static int main_trim(size_t pad) internal_function; -#if USE_ARENAS -static int heap_trim(heap_info *heap, size_t pad) internal_function; -#endif -#if defined _LIBC || defined MALLOC_HOOKS -static Void_t* malloc_check(size_t sz, const Void_t *caller); -static void free_check(Void_t* mem, const Void_t *caller); -static Void_t* realloc_check(Void_t* oldmem, size_t bytes, - const Void_t *caller); -static Void_t* memalign_check(size_t alignment, size_t bytes, - const Void_t *caller); -#ifndef NO_THREADS -static Void_t* malloc_starter(size_t sz, const Void_t *caller); -static void free_starter(Void_t* mem, const Void_t *caller); -static Void_t* malloc_atfork(size_t sz, const Void_t *caller); -static void free_atfork(Void_t* mem, const Void_t *caller); -#endif -#endif - -#else - -static void chunk_free(); -static mchunkptr chunk_alloc(); -static mchunkptr chunk_realloc(); -static mchunkptr chunk_align(); -static int main_trim(); -#if USE_ARENAS -static int heap_trim(); -#endif -#if defined _LIBC || defined MALLOC_HOOKS -static Void_t* malloc_check(); -static void free_check(); -static Void_t* realloc_check(); -static Void_t* memalign_check(); -#ifndef NO_THREADS -static Void_t* malloc_starter(); -static void free_starter(); -static Void_t* malloc_atfork(); -static void free_atfork(); -#endif -#endif - -#endif - - - -/* sizes, alignments */ - -#define SIZE_SZ (sizeof(INTERNAL_SIZE_T)) -/* Allow the default to be overwritten on the compiler command line. */ -#ifndef MALLOC_ALIGNMENT -# define MALLOC_ALIGNMENT (SIZE_SZ + SIZE_SZ) -#endif -#define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1) -#define MINSIZE (sizeof(struct malloc_chunk)) - -/* conversion from malloc headers to user pointers, and back */ - -#define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ)) -#define mem2chunk(mem) chunk_at_offset((mem), -2*SIZE_SZ) - -/* pad request bytes into a usable size, return non-zero on overflow */ - -#define request2size(req, nb) \ - ((nb = (req) + (SIZE_SZ + MALLOC_ALIGN_MASK)),\ - ((long)nb <= 0 || nb < (INTERNAL_SIZE_T) (req) \ - ? (__set_errno (ENOMEM), 1) \ - : ((nb < (MINSIZE + MALLOC_ALIGN_MASK) \ - ? (nb = MINSIZE) : (nb &= ~MALLOC_ALIGN_MASK)), 0))) - -/* Check if m has acceptable alignment */ - -#define aligned_OK(m) (((unsigned long)((m)) & (MALLOC_ALIGN_MASK)) == 0) - - - - -/* - Physical chunk operations -*/ - - -/* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */ - -#define PREV_INUSE 0x1UL - -/* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */ - -#define IS_MMAPPED 0x2UL - -/* Bits to mask off when extracting size */ - -#define SIZE_BITS (PREV_INUSE|IS_MMAPPED) - - -/* Ptr to next physical malloc_chunk. */ - -#define next_chunk(p) chunk_at_offset((p), (p)->size & ~PREV_INUSE) - -/* Ptr to previous physical malloc_chunk */ - -#define prev_chunk(p) chunk_at_offset((p), -(p)->prev_size) - - -/* Treat space at ptr + offset as a chunk */ - -#define chunk_at_offset(p, s) BOUNDED_1((mchunkptr)(((char*)(p)) + (s))) - - - - -/* - Dealing with use bits -*/ - -/* extract p's inuse bit */ - -#define inuse(p) (next_chunk(p)->size & PREV_INUSE) - -/* extract inuse bit of previous chunk */ - -#define prev_inuse(p) ((p)->size & PREV_INUSE) - -/* check for mmap()'ed chunk */ - -#define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED) - -/* set/clear chunk as in use without otherwise disturbing */ - -#define set_inuse(p) (next_chunk(p)->size |= PREV_INUSE) - -#define clear_inuse(p) (next_chunk(p)->size &= ~PREV_INUSE) - -/* check/set/clear inuse bits in known places */ - -#define inuse_bit_at_offset(p, s) \ - (chunk_at_offset((p), (s))->size & PREV_INUSE) - -#define set_inuse_bit_at_offset(p, s) \ - (chunk_at_offset((p), (s))->size |= PREV_INUSE) - -#define clear_inuse_bit_at_offset(p, s) \ - (chunk_at_offset((p), (s))->size &= ~(PREV_INUSE)) - - - - -/* - Dealing with size fields -*/ - -/* Get size, ignoring use bits */ - -#define chunksize(p) ((p)->size & ~(SIZE_BITS)) - -/* Set size at head, without disturbing its use bit */ - -#define set_head_size(p, s) ((p)->size = (((p)->size & PREV_INUSE) | (s))) - -/* Set size/use ignoring previous bits in header */ - -#define set_head(p, s) ((p)->size = (s)) - -/* Set size at footer (only when chunk is not in use) */ - -#define set_foot(p, s) (chunk_at_offset(p, s)->prev_size = (s)) - - - - - -/* access macros */ - -#define bin_at(a, i) BOUNDED_1(_bin_at(a, i)) -#define _bin_at(a, i) ((mbinptr)((char*)&(((a)->av)[2*(i)+2]) - 2*SIZE_SZ)) -#define init_bin(a, i) ((a)->av[2*(i)+2] = (a)->av[2*(i)+3] = bin_at((a), (i))) -#define next_bin(b) ((mbinptr)((char*)(b) + 2 * sizeof(((arena*)0)->av[0]))) -#define prev_bin(b) ((mbinptr)((char*)(b) - 2 * sizeof(((arena*)0)->av[0]))) - -/* - The first 2 bins are never indexed. The corresponding av cells are instead - used for bookkeeping. This is not to save space, but to simplify - indexing, maintain locality, and avoid some initialization tests. -*/ - -#define binblocks(a) (bin_at(a,0)->size)/* bitvector of nonempty blocks */ -#define top(a) (bin_at(a,0)->fd) /* The topmost chunk */ -#define last_remainder(a) (bin_at(a,1)) /* remainder from last split */ - -/* - Because top initially points to its own bin with initial - zero size, thus forcing extension on the first malloc request, - we avoid having any special code in malloc to check whether - it even exists yet. But we still need to in malloc_extend_top. -*/ - -#define initial_top(a) ((mchunkptr)bin_at(a, 0)) - - - -/* field-extraction macros */ - -#define first(b) ((b)->fd) -#define last(b) ((b)->bk) - -/* - Indexing into bins -*/ - -#define bin_index(sz) \ -(((((unsigned long)(sz)) >> 9) == 0) ? (((unsigned long)(sz)) >> 3):\ - ((((unsigned long)(sz)) >> 9) <= 4) ? 56 + (((unsigned long)(sz)) >> 6):\ - ((((unsigned long)(sz)) >> 9) <= 20) ? 91 + (((unsigned long)(sz)) >> 9):\ - ((((unsigned long)(sz)) >> 9) <= 84) ? 110 + (((unsigned long)(sz)) >> 12):\ - ((((unsigned long)(sz)) >> 9) <= 340) ? 119 + (((unsigned long)(sz)) >> 15):\ - ((((unsigned long)(sz)) >> 9) <= 1364) ? 124 + (((unsigned long)(sz)) >> 18):\ - 126) -/* - bins for chunks < 512 are all spaced 8 bytes apart, and hold - identically sized chunks. This is exploited in malloc. -*/ - -#define MAX_SMALLBIN 63 -#define MAX_SMALLBIN_SIZE 512 -#define SMALLBIN_WIDTH 8 - -#define smallbin_index(sz) (((unsigned long)(sz)) >> 3) - -/* - Requests are `small' if both the corresponding and the next bin are small -*/ - -#define is_small_request(nb) ((nb) < MAX_SMALLBIN_SIZE - SMALLBIN_WIDTH) - - - -/* - To help compensate for the large number of bins, a one-level index - structure is used for bin-by-bin searching. `binblocks' is a - one-word bitvector recording whether groups of BINBLOCKWIDTH bins - have any (possibly) non-empty bins, so they can be skipped over - all at once during during traversals. The bits are NOT always - cleared as soon as all bins in a block are empty, but instead only - when all are noticed to be empty during traversal in malloc. -*/ - -#define BINBLOCKWIDTH 4 /* bins per block */ - -/* bin<->block macros */ - -#define idx2binblock(ix) ((unsigned)1 << ((ix) / BINBLOCKWIDTH)) -#define mark_binblock(a, ii) (binblocks(a) |= idx2binblock(ii)) -#define clear_binblock(a, ii) (binblocks(a) &= ~(idx2binblock(ii))) - - - - -/* Static bookkeeping data */ - -/* Helper macro to initialize bins */ -#define IAV(i) _bin_at(&main_arena, i), _bin_at(&main_arena, i) - -static arena main_arena = { - { - 0, 0, - IAV(0), IAV(1), IAV(2), IAV(3), IAV(4), IAV(5), IAV(6), IAV(7), - IAV(8), IAV(9), IAV(10), IAV(11), IAV(12), IAV(13), IAV(14), IAV(15), - IAV(16), IAV(17), IAV(18), IAV(19), IAV(20), IAV(21), IAV(22), IAV(23), - IAV(24), IAV(25), IAV(26), IAV(27), IAV(28), IAV(29), IAV(30), IAV(31), - IAV(32), IAV(33), IAV(34), IAV(35), IAV(36), IAV(37), IAV(38), IAV(39), - IAV(40), IAV(41), IAV(42), IAV(43), IAV(44), IAV(45), IAV(46), IAV(47), - IAV(48), IAV(49), IAV(50), IAV(51), IAV(52), IAV(53), IAV(54), IAV(55), - IAV(56), IAV(57), IAV(58), IAV(59), IAV(60), IAV(61), IAV(62), IAV(63), - IAV(64), IAV(65), IAV(66), IAV(67), IAV(68), IAV(69), IAV(70), IAV(71), - IAV(72), IAV(73), IAV(74), IAV(75), IAV(76), IAV(77), IAV(78), IAV(79), - IAV(80), IAV(81), IAV(82), IAV(83), IAV(84), IAV(85), IAV(86), IAV(87), - IAV(88), IAV(89), IAV(90), IAV(91), IAV(92), IAV(93), IAV(94), IAV(95), - IAV(96), IAV(97), IAV(98), IAV(99), IAV(100), IAV(101), IAV(102), IAV(103), - IAV(104), IAV(105), IAV(106), IAV(107), IAV(108), IAV(109), IAV(110), IAV(111), - IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), - IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) - }, - &main_arena, /* next */ - 0, /* size */ -#if THREAD_STATS - 0, 0, 0, /* stat_lock_direct, stat_lock_loop, stat_lock_wait */ -#endif - MUTEX_INITIALIZER /* mutex */ -}; - -#undef IAV - -/* Thread specific data */ - -static tsd_key_t arena_key; -static mutex_t list_lock = MUTEX_INITIALIZER; - -#if THREAD_STATS -static int stat_n_heaps; -#define THREAD_STAT(x) x -#else -#define THREAD_STAT(x) do ; while(0) -#endif - -/* variables holding tunable values */ - -static unsigned long trim_threshold = DEFAULT_TRIM_THRESHOLD; -static unsigned long top_pad = DEFAULT_TOP_PAD; -static unsigned int n_mmaps_max = DEFAULT_MMAP_MAX; -static unsigned long mmap_threshold = DEFAULT_MMAP_THRESHOLD; -static int check_action = DEFAULT_CHECK_ACTION; - -/* The first value returned from sbrk */ -static char* sbrk_base = (char*)(-1); - -/* The maximum memory obtained from system via sbrk */ -static unsigned long max_sbrked_mem; - -/* The maximum via either sbrk or mmap (too difficult to track with threads) */ -#ifdef NO_THREADS -static unsigned long max_total_mem; -#endif - -/* The total memory obtained from system via sbrk */ -#define sbrked_mem (main_arena.size) - -/* Tracking mmaps */ - -static unsigned int n_mmaps; -static unsigned int max_n_mmaps; -static unsigned long mmapped_mem; -static unsigned long max_mmapped_mem; - -/* Mapped memory in non-main arenas (reliable only for NO_THREADS). */ -static unsigned long arena_mem; - - - -#ifndef _LIBC -#define weak_variable -#else -/* In GNU libc we want the hook variables to be weak definitions to - avoid a problem with Emacs. */ -#define weak_variable weak_function -#endif - -/* Already initialized? */ -int __malloc_initialized = -1; - - -#ifndef NO_THREADS - -/* Magic value for the thread-specific arena pointer when - malloc_atfork() is in use. */ - -#define ATFORK_ARENA_PTR ((Void_t*)-1) - -/* The following two functions are registered via thread_atfork() to - make sure that the mutexes remain in a consistent state in the - fork()ed version of a thread. Also adapt the malloc and free hooks - temporarily, because the `atfork' handler mechanism may use - malloc/free internally (e.g. in LinuxThreads). */ - -#if defined _LIBC || defined MALLOC_HOOKS -static __malloc_ptr_t (*save_malloc_hook) __MALLOC_P ((size_t __size, - const __malloc_ptr_t)); -static void (*save_free_hook) __MALLOC_P ((__malloc_ptr_t __ptr, - const __malloc_ptr_t)); -static Void_t* save_arena; -#endif - -static void -ptmalloc_lock_all __MALLOC_P((void)) -{ - arena *ar_ptr; - - (void)mutex_lock(&list_lock); - for(ar_ptr = &main_arena;;) { - (void)mutex_lock(&ar_ptr->mutex); - ar_ptr = ar_ptr->next; - if(ar_ptr == &main_arena) break; - } -#if defined _LIBC || defined MALLOC_HOOKS - save_malloc_hook = __malloc_hook; - save_free_hook = __free_hook; - __malloc_hook = malloc_atfork; - __free_hook = free_atfork; - /* Only the current thread may perform malloc/free calls now. */ - tsd_getspecific(arena_key, save_arena); - tsd_setspecific(arena_key, ATFORK_ARENA_PTR); -#endif -} - -static void -ptmalloc_unlock_all __MALLOC_P((void)) -{ - arena *ar_ptr; - -#if defined _LIBC || defined MALLOC_HOOKS - tsd_setspecific(arena_key, save_arena); - __malloc_hook = save_malloc_hook; - __free_hook = save_free_hook; -#endif - for(ar_ptr = &main_arena;;) { - (void)mutex_unlock(&ar_ptr->mutex); - ar_ptr = ar_ptr->next; - if(ar_ptr == &main_arena) break; - } - (void)mutex_unlock(&list_lock); -} - -static void -ptmalloc_init_all __MALLOC_P((void)) -{ - arena *ar_ptr; - -#if defined _LIBC || defined MALLOC_HOOKS - tsd_setspecific(arena_key, save_arena); - __malloc_hook = save_malloc_hook; - __free_hook = save_free_hook; -#endif - for(ar_ptr = &main_arena;;) { - (void)mutex_init(&ar_ptr->mutex); - ar_ptr = ar_ptr->next; - if(ar_ptr == &main_arena) break; - } - (void)mutex_init(&list_lock); -} - -#endif /* !defined NO_THREADS */ - -/* Initialization routine. */ -#if defined(_LIBC) -#if 0 -static void ptmalloc_init __MALLOC_P ((void)) __attribute__ ((constructor)); -#endif - -#ifdef _LIBC -#include <string.h> -extern char **environ; - -static char * -internal_function -next_env_entry (char ***position) -{ - char **current = *position; - char *result = NULL; - - while (*current != NULL) - { - if (__builtin_expect ((*current)[0] == 'M', 0) - && (*current)[1] == 'A' - && (*current)[2] == 'L' - && (*current)[3] == 'L' - && (*current)[4] == 'O' - && (*current)[5] == 'C' - && (*current)[6] == '_') - { - result = &(*current)[7]; - - /* Save current position for next visit. */ - *position = ++current; - - break; - } - - ++current; - } - - return result; -} -#endif - -static void -ptmalloc_init __MALLOC_P((void)) -#else -void -ptmalloc_init __MALLOC_P((void)) -#endif -{ -#if defined _LIBC || defined MALLOC_HOOKS -# if __STD_C - const char* s; -# else - char* s; -# endif -#endif - int secure; - - if(__malloc_initialized >= 0) return; - __malloc_initialized = 0; -#ifdef _LIBC - __libc_pagesize = __getpagesize(); -#endif -#ifndef NO_THREADS -#if defined _LIBC || defined MALLOC_HOOKS - /* With some threads implementations, creating thread-specific data - or initializing a mutex may call malloc() itself. Provide a - simple starter version (realloc() won't work). */ - save_malloc_hook = __malloc_hook; - save_free_hook = __free_hook; - __malloc_hook = malloc_starter; - __free_hook = free_starter; -#endif -#ifdef _LIBC - /* Initialize the pthreads interface. */ - if (__pthread_initialize != NULL) - __pthread_initialize(); -#endif -#endif /* !defined NO_THREADS */ - mutex_init(&main_arena.mutex); - mutex_init(&list_lock); - tsd_key_create(&arena_key, NULL); - tsd_setspecific(arena_key, (Void_t *)&main_arena); - thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all); -#if defined _LIBC || defined MALLOC_HOOKS -#ifndef NO_THREADS - __malloc_hook = save_malloc_hook; - __free_hook = save_free_hook; -#endif - secure = __libc_enable_secure; -#ifdef _LIBC - s = NULL; - if (environ != NULL) - { - char **runp = environ; - char *envline; - - while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL, 0)) - { - size_t len = strcspn (envline, "="); - - if (envline[len] != '=') - /* This is a "MALLOC_" variable at the end of the string - without a '=' character. Ignore it since otherwise we - will access invalid memory below. */ - continue; - - switch (len) - { - case 6: - if (memcmp (envline, "CHECK_", 6) == 0) - s = &envline[7]; - break; - case 8: - if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0) - mALLOPt(M_TOP_PAD, atoi(&envline[9])); - break; - case 9: - if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0) - mALLOPt(M_MMAP_MAX, atoi(&envline[10])); - break; - case 15: - if (! secure) - { - if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0) - mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16])); - else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0) - mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16])); - } - break; - default: - break; - } - } - } -#else - if (! secure) - { - if((s = getenv("MALLOC_TRIM_THRESHOLD_"))) - mALLOPt(M_TRIM_THRESHOLD, atoi(s)); - if((s = getenv("MALLOC_TOP_PAD_"))) - mALLOPt(M_TOP_PAD, atoi(s)); - if((s = getenv("MALLOC_MMAP_THRESHOLD_"))) - mALLOPt(M_MMAP_THRESHOLD, atoi(s)); - if((s = getenv("MALLOC_MMAP_MAX_"))) - mALLOPt(M_MMAP_MAX, atoi(s)); - } - s = getenv("MALLOC_CHECK_"); -#endif - if(s) { - if(s[0]) mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0')); - __malloc_check_init(); - } - if(__malloc_initialize_hook != NULL) - (*__malloc_initialize_hook)(); -#endif - __malloc_initialized = 1; -} - -/* There are platforms (e.g. Hurd) with a link-time hook mechanism. */ -#ifdef thread_atfork_static -thread_atfork_static(ptmalloc_lock_all, ptmalloc_unlock_all, \ - ptmalloc_init_all) -#endif - -#if defined _LIBC || defined MALLOC_HOOKS - -/* Hooks for debugging versions. The initial hooks just call the - initialization routine, then do the normal work. */ - -static Void_t* -#if __STD_C -malloc_hook_ini(size_t sz, const __malloc_ptr_t caller) -#else -malloc_hook_ini(sz, caller) - size_t sz; const __malloc_ptr_t caller; -#endif -{ - __malloc_hook = NULL; - ptmalloc_init(); - return mALLOc(sz); -} - -static Void_t* -#if __STD_C -realloc_hook_ini(Void_t* ptr, size_t sz, const __malloc_ptr_t caller) -#else -realloc_hook_ini(ptr, sz, caller) - Void_t* ptr; size_t sz; const __malloc_ptr_t caller; -#endif -{ - __malloc_hook = NULL; - __realloc_hook = NULL; - ptmalloc_init(); - return rEALLOc(ptr, sz); -} - -static Void_t* -#if __STD_C -memalign_hook_ini(size_t alignment, size_t sz, const __malloc_ptr_t caller) -#else -memalign_hook_ini(alignment, sz, caller) - size_t alignment; size_t sz; const __malloc_ptr_t caller; -#endif -{ - __memalign_hook = NULL; - ptmalloc_init(); - return mEMALIGn(alignment, sz); -} - -void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL; -void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr, - const __malloc_ptr_t)) = NULL; -__malloc_ptr_t weak_variable (*__malloc_hook) - __MALLOC_P ((size_t __size, const __malloc_ptr_t)) = malloc_hook_ini; -__malloc_ptr_t weak_variable (*__realloc_hook) - __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t)) - = realloc_hook_ini; -__malloc_ptr_t weak_variable (*__memalign_hook) - __MALLOC_P ((size_t __alignment, size_t __size, const __malloc_ptr_t)) - = memalign_hook_ini; -void weak_variable (*__after_morecore_hook) __MALLOC_P ((void)) = NULL; - -/* Whether we are using malloc checking. */ -static int using_malloc_checking; - -/* A flag that is set by malloc_set_state, to signal that malloc checking - must not be enabled on the request from the user (via the MALLOC_CHECK_ - environment variable). It is reset by __malloc_check_init to tell - malloc_set_state that the user has requested malloc checking. - - The purpose of this flag is to make sure that malloc checking is not - enabled when the heap to be restored was constructed without malloc - checking, and thus does not contain the required magic bytes. - Otherwise the heap would be corrupted by calls to free and realloc. If - it turns out that the heap was created with malloc checking and the - user has requested it malloc_set_state just calls __malloc_check_init - again to enable it. On the other hand, reusing such a heap without - further malloc checking is safe. */ -static int disallow_malloc_check; - -/* Activate a standard set of debugging hooks. */ -void -__malloc_check_init() -{ - if (disallow_malloc_check) { - disallow_malloc_check = 0; - return; - } - using_malloc_checking = 1; - __malloc_hook = malloc_check; - __free_hook = free_check; - __realloc_hook = realloc_check; - __memalign_hook = memalign_check; - if(check_action & 1) - fprintf(stderr, "malloc: using debugging hooks\n"); -} - -#endif - - - - - -/* Routines dealing with mmap(). */ - -#if HAVE_MMAP - -#ifndef MAP_ANONYMOUS - -static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ - -#define MMAP(addr, size, prot, flags) ((dev_zero_fd < 0) ? \ - (dev_zero_fd = open("/dev/zero", O_RDWR), \ - mmap((addr), (size), (prot), (flags), dev_zero_fd, 0)) : \ - mmap((addr), (size), (prot), (flags), dev_zero_fd, 0)) - -#else - -#define MMAP(addr, size, prot, flags) \ - (mmap((addr), (size), (prot), (flags)|MAP_ANONYMOUS, -1, 0)) - -#endif - -#if defined __GNUC__ && __GNUC__ >= 2 -/* This function is only called from one place, inline it. */ -__inline__ -#endif -static mchunkptr -internal_function -#if __STD_C -mmap_chunk(size_t size) -#else -mmap_chunk(size) size_t size; -#endif -{ - size_t page_mask = malloc_getpagesize - 1; - mchunkptr p; - - /* For mmapped chunks, the overhead is one SIZE_SZ unit larger, because - * there is no following chunk whose prev_size field could be used. - */ - size = (size + SIZE_SZ + page_mask) & ~page_mask; - - p = (mchunkptr)MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE); - if(p == (mchunkptr) MAP_FAILED) return 0; - - n_mmaps++; - if (n_mmaps > max_n_mmaps) max_n_mmaps = n_mmaps; - - /* We demand that eight bytes into a page must be 8-byte aligned. */ - assert(aligned_OK(chunk2mem(p))); - - /* The offset to the start of the mmapped region is stored - * in the prev_size field of the chunk; normally it is zero, - * but that can be changed in memalign(). - */ - p->prev_size = 0; - set_head(p, size|IS_MMAPPED); - - mmapped_mem += size; - if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) - max_mmapped_mem = mmapped_mem; -#ifdef NO_THREADS - if ((unsigned long)(mmapped_mem + arena_mem + sbrked_mem) > max_total_mem) - max_total_mem = mmapped_mem + arena_mem + sbrked_mem; -#endif - return p; -} - -static void -internal_function -#if __STD_C -munmap_chunk(mchunkptr p) -#else -munmap_chunk(p) mchunkptr p; -#endif -{ - INTERNAL_SIZE_T size = chunksize(p); - int ret; - - assert (chunk_is_mmapped(p)); - assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); - assert((n_mmaps > 0)); - assert(((p->prev_size + size) & (malloc_getpagesize-1)) == 0); - - n_mmaps--; - mmapped_mem -= (size + p->prev_size); - - ret = munmap((char *)p - p->prev_size, size + p->prev_size); - - /* munmap returns non-zero on failure */ - assert(ret == 0); -} - -#if HAVE_MREMAP - -static mchunkptr -internal_function -#if __STD_C -mremap_chunk(mchunkptr p, size_t new_size) -#else -mremap_chunk(p, new_size) mchunkptr p; size_t new_size; -#endif -{ - size_t page_mask = malloc_getpagesize - 1; - INTERNAL_SIZE_T offset = p->prev_size; - INTERNAL_SIZE_T size = chunksize(p); - char *cp; - - assert (chunk_is_mmapped(p)); - assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); - assert((n_mmaps > 0)); - assert(((size + offset) & (malloc_getpagesize-1)) == 0); - - /* Note the extra SIZE_SZ overhead as in mmap_chunk(). */ - new_size = (new_size + offset + SIZE_SZ + page_mask) & ~page_mask; - - cp = (char *)mremap((char *)p - offset, size + offset, new_size, - MREMAP_MAYMOVE); - - if (cp == MAP_FAILED) return 0; - - p = (mchunkptr)(cp + offset); - - assert(aligned_OK(chunk2mem(p))); - - assert((p->prev_size == offset)); - set_head(p, (new_size - offset)|IS_MMAPPED); - - mmapped_mem -= size + offset; - mmapped_mem += new_size; - if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) - max_mmapped_mem = mmapped_mem; -#ifdef NO_THREADS - if ((unsigned long)(mmapped_mem + arena_mem + sbrked_mem) > max_total_mem) - max_total_mem = mmapped_mem + arena_mem + sbrked_mem; -#endif - return p; -} - -#endif /* HAVE_MREMAP */ - -#endif /* HAVE_MMAP */ - - - -/* Managing heaps and arenas (for concurrent threads) */ - -#if USE_ARENAS - -/* Create a new heap. size is automatically rounded up to a multiple - of the page size. */ - -static heap_info * -internal_function -#if __STD_C -new_heap(size_t size) -#else -new_heap(size) size_t size; -#endif -{ - size_t page_mask = malloc_getpagesize - 1; - char *p1, *p2; - unsigned long ul; - heap_info *h; - - if(size+top_pad < HEAP_MIN_SIZE) - size = HEAP_MIN_SIZE; - else if(size+top_pad <= HEAP_MAX_SIZE) - size += top_pad; - else if(size > HEAP_MAX_SIZE) - return 0; - else - size = HEAP_MAX_SIZE; - size = (size + page_mask) & ~page_mask; - - /* A memory region aligned to a multiple of HEAP_MAX_SIZE is needed. - No swap space needs to be reserved for the following large - mapping (on Linux, this is the case for all non-writable mappings - anyway). */ - p1 = (char *)MMAP(0, HEAP_MAX_SIZE<<1, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE); - if(p1 != MAP_FAILED) { - p2 = (char *)(((unsigned long)p1 + (HEAP_MAX_SIZE-1)) & ~(HEAP_MAX_SIZE-1)); - ul = p2 - p1; - if (ul) - munmap(p1, ul); - munmap(p2 + HEAP_MAX_SIZE, HEAP_MAX_SIZE - ul); - } else { - /* Try to take the chance that an allocation of only HEAP_MAX_SIZE - is already aligned. */ - p2 = (char *)MMAP(0, HEAP_MAX_SIZE, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE); - if(p2 == MAP_FAILED) - return 0; - if((unsigned long)p2 & (HEAP_MAX_SIZE-1)) { - munmap(p2, HEAP_MAX_SIZE); - return 0; - } - } - if(MMAP(p2, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED) - == (char *) MAP_FAILED) { - munmap(p2, HEAP_MAX_SIZE); - return 0; - } - h = (heap_info *)p2; - h->size = size; - THREAD_STAT(stat_n_heaps++); - return h; -} - -/* Grow or shrink a heap. size is automatically rounded up to a - multiple of the page size if it is positive. */ - -static int -#if __STD_C -grow_heap(heap_info *h, long diff) -#else -grow_heap(h, diff) heap_info *h; long diff; -#endif -{ - size_t page_mask = malloc_getpagesize - 1; - long new_size; - - if(diff >= 0) { - diff = (diff + page_mask) & ~page_mask; - new_size = (long)h->size + diff; - if(new_size > HEAP_MAX_SIZE) - return -1; - if(MMAP((char *)h + h->size, diff, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_FIXED) == (char *) MAP_FAILED) - return -2; - } else { - new_size = (long)h->size + diff; - if(new_size < (long)sizeof(*h)) - return -1; - /* Try to re-map the extra heap space freshly to save memory, and - make it inaccessible. */ - if((char *)MMAP((char *)h + new_size, -diff, PROT_NONE, - MAP_PRIVATE|MAP_FIXED) == (char *) MAP_FAILED) - return -2; - } - h->size = new_size; - return 0; -} - -/* Delete a heap. */ - -#define delete_heap(heap) munmap((char*)(heap), HEAP_MAX_SIZE) - -/* arena_get() acquires an arena and locks the corresponding mutex. - First, try the one last locked successfully by this thread. (This - is the common case and handled with a macro for speed.) Then, loop - once over the circularly linked list of arenas. If no arena is - readily available, create a new one. In this latter case, `size' - is just a hint as to how much memory will be required immediately - in the new arena. */ - -#define arena_get(ptr, size) do { \ - Void_t *vptr = NULL; \ - ptr = (arena *)tsd_getspecific(arena_key, vptr); \ - if(ptr && !mutex_trylock(&ptr->mutex)) { \ - THREAD_STAT(++(ptr->stat_lock_direct)); \ - } else \ - ptr = arena_get2(ptr, (size)); \ -} while(0) - -static arena * -internal_function -#if __STD_C -arena_get2(arena *a_tsd, size_t size) -#else -arena_get2(a_tsd, size) arena *a_tsd; size_t size; -#endif -{ - arena *a; - heap_info *h; - char *ptr; - int i; - unsigned long misalign; - - if(!a_tsd) - a = a_tsd = &main_arena; - else { - a = a_tsd->next; - if(!a) { - /* This can only happen while initializing the new arena. */ - (void)mutex_lock(&main_arena.mutex); - THREAD_STAT(++(main_arena.stat_lock_wait)); - return &main_arena; - } - } - - /* Check the global, circularly linked list for available arenas. */ - repeat: - do { - if(!mutex_trylock(&a->mutex)) { - THREAD_STAT(++(a->stat_lock_loop)); - tsd_setspecific(arena_key, (Void_t *)a); - return a; - } - a = a->next; - } while(a != a_tsd); - - /* If not even the list_lock can be obtained, try again. This can - happen during `atfork', or for example on systems where thread - creation makes it temporarily impossible to obtain _any_ - locks. */ - if(mutex_trylock(&list_lock)) { - a = a_tsd; - goto repeat; - } - (void)mutex_unlock(&list_lock); - - /* Nothing immediately available, so generate a new arena. */ - h = new_heap(size + (sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT)); - if(!h) { - /* Maybe size is too large to fit in a single heap. So, just try - to create a minimally-sized arena and let chunk_alloc() attempt - to deal with the large request via mmap_chunk(). */ - h = new_heap(sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT); - if(!h) - return 0; - } - a = h->ar_ptr = (arena *)(h+1); - for(i=0; i<NAV; i++) - init_bin(a, i); - a->next = NULL; - a->size = h->size; - arena_mem += h->size; -#ifdef NO_THREADS - if((unsigned long)(mmapped_mem + arena_mem + sbrked_mem) > max_total_mem) - max_total_mem = mmapped_mem + arena_mem + sbrked_mem; -#endif - tsd_setspecific(arena_key, (Void_t *)a); - mutex_init(&a->mutex); - i = mutex_lock(&a->mutex); /* remember result */ - - /* Set up the top chunk, with proper alignment. */ - ptr = (char *)(a + 1); - misalign = (unsigned long)chunk2mem(ptr) & MALLOC_ALIGN_MASK; - if (misalign > 0) - ptr += MALLOC_ALIGNMENT - misalign; - top(a) = (mchunkptr)ptr; - set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE); - - /* Add the new arena to the list. */ - (void)mutex_lock(&list_lock); - a->next = main_arena.next; - main_arena.next = a; - (void)mutex_unlock(&list_lock); - - if(i) /* locking failed; keep arena for further attempts later */ - return 0; - - THREAD_STAT(++(a->stat_lock_loop)); - return a; -} - -/* find the heap and corresponding arena for a given ptr */ - -#define heap_for_ptr(ptr) \ - ((heap_info *)((unsigned long)(ptr) & ~(HEAP_MAX_SIZE-1))) -#define arena_for_ptr(ptr) \ - (((mchunkptr)(ptr) < top(&main_arena) && (char *)(ptr) >= sbrk_base) ? \ - &main_arena : heap_for_ptr(ptr)->ar_ptr) - -#else /* !USE_ARENAS */ - -/* There is only one arena, main_arena. */ - -#define arena_get(ptr, sz) (ptr = &main_arena) -#define arena_for_ptr(ptr) (&main_arena) - -#endif /* USE_ARENAS */ - - - -/* - Debugging support -*/ - -#if MALLOC_DEBUG - - -/* - These routines make a number of assertions about the states - of data structures that should be true at all times. If any - are not true, it's very likely that a user program has somehow - trashed memory. (It's also possible that there is a coding error - in malloc. In which case, please report it!) -*/ - -#if __STD_C -static void do_check_chunk(arena *ar_ptr, mchunkptr p) -#else -static void do_check_chunk(ar_ptr, p) arena *ar_ptr; mchunkptr p; -#endif -{ - INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; - - /* No checkable chunk is mmapped */ - assert(!chunk_is_mmapped(p)); - -#if USE_ARENAS - if(ar_ptr != &main_arena) { - heap_info *heap = heap_for_ptr(p); - assert(heap->ar_ptr == ar_ptr); - if(p != top(ar_ptr)) - assert((char *)p + sz <= (char *)heap + heap->size); - else - assert((char *)p + sz == (char *)heap + heap->size); - return; - } -#endif - - /* Check for legal address ... */ - assert((char*)p >= sbrk_base); - if (p != top(ar_ptr)) - assert((char*)p + sz <= (char*)top(ar_ptr)); - else - assert((char*)p + sz <= sbrk_base + sbrked_mem); - -} - - -#if __STD_C -static void do_check_free_chunk(arena *ar_ptr, mchunkptr p) -#else -static void do_check_free_chunk(ar_ptr, p) arena *ar_ptr; mchunkptr p; -#endif -{ - INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; - mchunkptr next = chunk_at_offset(p, sz); - - do_check_chunk(ar_ptr, p); - - /* Check whether it claims to be free ... */ - assert(!inuse(p)); - - /* Must have OK size and fields */ - assert((long)sz >= (long)MINSIZE); - assert((sz & MALLOC_ALIGN_MASK) == 0); - assert(aligned_OK(chunk2mem(p))); - /* ... matching footer field */ - assert(next->prev_size == sz); - /* ... and is fully consolidated */ - assert(prev_inuse(p)); - assert (next == top(ar_ptr) || inuse(next)); - - /* ... and has minimally sane links */ - assert(p->fd->bk == p); - assert(p->bk->fd == p); -} - -#if __STD_C -static void do_check_inuse_chunk(arena *ar_ptr, mchunkptr p) -#else -static void do_check_inuse_chunk(ar_ptr, p) arena *ar_ptr; mchunkptr p; -#endif -{ - mchunkptr next = next_chunk(p); - do_check_chunk(ar_ptr, p); - - /* Check whether it claims to be in use ... */ - assert(inuse(p)); - - /* ... whether its size is OK (it might be a fencepost) ... */ - assert(chunksize(p) >= MINSIZE || next->size == (0|PREV_INUSE)); - - /* ... and is surrounded by OK chunks. - Since more things can be checked with free chunks than inuse ones, - if an inuse chunk borders them and debug is on, it's worth doing them. - */ - if (!prev_inuse(p)) - { - mchunkptr prv = prev_chunk(p); - assert(next_chunk(prv) == p); - do_check_free_chunk(ar_ptr, prv); - } - if (next == top(ar_ptr)) - { - assert(prev_inuse(next)); - assert(chunksize(next) >= MINSIZE); - } - else if (!inuse(next)) - do_check_free_chunk(ar_ptr, next); - -} - -#if __STD_C -static void do_check_malloced_chunk(arena *ar_ptr, - mchunkptr p, INTERNAL_SIZE_T s) -#else -static void do_check_malloced_chunk(ar_ptr, p, s) -arena *ar_ptr; mchunkptr p; INTERNAL_SIZE_T s; -#endif -{ - INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; - long room = sz - s; - - do_check_inuse_chunk(ar_ptr, p); - - /* Legal size ... */ - assert((long)sz >= (long)MINSIZE); - assert((sz & MALLOC_ALIGN_MASK) == 0); - assert(room >= 0); - assert(room < (long)MINSIZE); - - /* ... and alignment */ - assert(aligned_OK(chunk2mem(p))); - - - /* ... and was allocated at front of an available chunk */ - assert(prev_inuse(p)); - -} - - -#define check_free_chunk(A,P) do_check_free_chunk(A,P) -#define check_inuse_chunk(A,P) do_check_inuse_chunk(A,P) -#define check_chunk(A,P) do_check_chunk(A,P) -#define check_malloced_chunk(A,P,N) do_check_malloced_chunk(A,P,N) -#else -#define check_free_chunk(A,P) -#define check_inuse_chunk(A,P) -#define check_chunk(A,P) -#define check_malloced_chunk(A,P,N) -#endif - - - -/* - Macro-based internal utilities -*/ - - -/* - Linking chunks in bin lists. - Call these only with variables, not arbitrary expressions, as arguments. -*/ - -/* - Place chunk p of size s in its bin, in size order, - putting it ahead of others of same size. -*/ - - -#define frontlink(A, P, S, IDX, BK, FD) \ -{ \ - if (S < MAX_SMALLBIN_SIZE) \ - { \ - IDX = smallbin_index(S); \ - mark_binblock(A, IDX); \ - BK = bin_at(A, IDX); \ - FD = BK->fd; \ - P->bk = BK; \ - P->fd = FD; \ - FD->bk = BK->fd = P; \ - } \ - else \ - { \ - IDX = bin_index(S); \ - BK = bin_at(A, IDX); \ - FD = BK->fd; \ - if (FD == BK) mark_binblock(A, IDX); \ - else \ - { \ - while (FD != BK && S < chunksize(FD)) FD = FD->fd; \ - BK = FD->bk; \ - } \ - P->bk = BK; \ - P->fd = FD; \ - FD->bk = BK->fd = P; \ - } \ -} - - -/* take a chunk off a list */ - -#define unlink(P, BK, FD) \ -{ \ - BK = P->bk; \ - FD = P->fd; \ - FD->bk = BK; \ - BK->fd = FD; \ -} \ - -/* Place p as the last remainder */ - -#define link_last_remainder(A, P) \ -{ \ - last_remainder(A)->fd = last_remainder(A)->bk = P; \ - P->fd = P->bk = last_remainder(A); \ -} - -/* Clear the last_remainder bin */ - -#define clear_last_remainder(A) \ - (last_remainder(A)->fd = last_remainder(A)->bk = last_remainder(A)) - - - - - -/* - Extend the top-most chunk by obtaining memory from system. - Main interface to sbrk (but see also malloc_trim). -*/ - -#if defined __GNUC__ && __GNUC__ >= 2 -/* This function is called only from one place, inline it. */ -__inline__ -#endif -static void -internal_function -#if __STD_C -malloc_extend_top(arena *ar_ptr, INTERNAL_SIZE_T nb) -#else -malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb; -#endif -{ - unsigned long pagesz = malloc_getpagesize; - mchunkptr old_top = top(ar_ptr); /* Record state of old top */ - INTERNAL_SIZE_T old_top_size = chunksize(old_top); - INTERNAL_SIZE_T top_size; /* new size of top chunk */ - -#if USE_ARENAS - if(ar_ptr == &main_arena) { -#endif - - char* brk; /* return value from sbrk */ - INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of sbrked space */ - INTERNAL_SIZE_T correction; /* bytes for 2nd sbrk call */ - char* new_brk; /* return of 2nd sbrk call */ - char* old_end = (char*)(chunk_at_offset(old_top, old_top_size)); - - /* Pad request with top_pad plus minimal overhead */ - INTERNAL_SIZE_T sbrk_size = nb + top_pad + MINSIZE; - - /* If not the first time through, round to preserve page boundary */ - /* Otherwise, we need to correct to a page size below anyway. */ - /* (We also correct below if an intervening foreign sbrk call.) */ - - if (sbrk_base != (char*)(-1)) - sbrk_size = (sbrk_size + (pagesz - 1)) & ~(pagesz - 1); - - brk = (char*)(MORECORE (sbrk_size)); - - /* Fail if sbrk failed or if a foreign sbrk call killed our space */ - if (brk == (char*)(MORECORE_FAILURE) || - (brk < old_end && old_top != initial_top(&main_arena))) - return; - -#if defined _LIBC || defined MALLOC_HOOKS - /* Call the `morecore' hook if necessary. */ - if (__after_morecore_hook) - (*__after_morecore_hook) (); -#endif - - sbrked_mem += sbrk_size; - - if (brk == old_end) { /* can just add bytes to current top */ - top_size = sbrk_size + old_top_size; - set_head(old_top, top_size | PREV_INUSE); - old_top = 0; /* don't free below */ - } else { - if (sbrk_base == (char*)(-1)) /* First time through. Record base */ - sbrk_base = brk; - else - /* Someone else called sbrk(). Count those bytes as sbrked_mem. */ - sbrked_mem += brk - (char*)old_end; - - /* Guarantee alignment of first new chunk made from this space */ - front_misalign = (unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK; - if (front_misalign > 0) { - correction = (MALLOC_ALIGNMENT) - front_misalign; - brk += correction; - } else - correction = 0; - - /* Guarantee the next brk will be at a page boundary */ - correction += pagesz - ((unsigned long)(brk + sbrk_size) & (pagesz - 1)); - - /* Allocate correction */ - new_brk = (char*)(MORECORE (correction)); - if (new_brk == (char*)(MORECORE_FAILURE)) return; - -#if defined _LIBC || defined MALLOC_HOOKS - /* Call the `morecore' hook if necessary. */ - if (__after_morecore_hook) - (*__after_morecore_hook) (); -#endif - - sbrked_mem += correction; - - top(&main_arena) = chunk_at_offset(brk, 0); - top_size = new_brk - brk + correction; - set_head(top(&main_arena), top_size | PREV_INUSE); - - if (old_top == initial_top(&main_arena)) - old_top = 0; /* don't free below */ - } - - if ((unsigned long)sbrked_mem > (unsigned long)max_sbrked_mem) - max_sbrked_mem = sbrked_mem; -#ifdef NO_THREADS - if ((unsigned long)(mmapped_mem + arena_mem + sbrked_mem) > max_total_mem) - max_total_mem = mmapped_mem + arena_mem + sbrked_mem; -#endif - -#if USE_ARENAS - } else { /* ar_ptr != &main_arena */ - heap_info *old_heap, *heap; - size_t old_heap_size; - - if(old_top_size < MINSIZE) /* this should never happen */ - return; - - /* First try to extend the current heap. */ - if(MINSIZE + nb <= old_top_size) - return; - old_heap = heap_for_ptr(old_top); - old_heap_size = old_heap->size; - if(grow_heap(old_heap, MINSIZE + nb - old_top_size) == 0) { - ar_ptr->size += old_heap->size - old_heap_size; - arena_mem += old_heap->size - old_heap_size; -#ifdef NO_THREADS - if(mmapped_mem + arena_mem + sbrked_mem > max_total_mem) - max_total_mem = mmapped_mem + arena_mem + sbrked_mem; -#endif - top_size = ((char *)old_heap + old_heap->size) - (char *)old_top; - set_head(old_top, top_size | PREV_INUSE); - return; - } - - /* A new heap must be created. */ - heap = new_heap(nb + (MINSIZE + sizeof(*heap))); - if(!heap) - return; - heap->ar_ptr = ar_ptr; - heap->prev = old_heap; - ar_ptr->size += heap->size; - arena_mem += heap->size; -#ifdef NO_THREADS - if((unsigned long)(mmapped_mem + arena_mem + sbrked_mem) > max_total_mem) - max_total_mem = mmapped_mem + arena_mem + sbrked_mem; -#endif - - /* Set up the new top, so we can safely use chunk_free() below. */ - top(ar_ptr) = chunk_at_offset(heap, sizeof(*heap)); - top_size = heap->size - sizeof(*heap); - set_head(top(ar_ptr), top_size | PREV_INUSE); - } -#endif /* USE_ARENAS */ - - /* We always land on a page boundary */ - assert(((unsigned long)((char*)top(ar_ptr) + top_size) & (pagesz-1)) == 0); - - /* Setup fencepost and free the old top chunk. */ - if(old_top) { - /* The fencepost takes at least MINSIZE bytes, because it might - become the top chunk again later. Note that a footer is set - up, too, although the chunk is marked in use. */ - old_top_size -= MINSIZE; - set_head(chunk_at_offset(old_top, old_top_size + 2*SIZE_SZ), 0|PREV_INUSE); - if(old_top_size >= MINSIZE) { - set_head(chunk_at_offset(old_top, old_top_size), (2*SIZE_SZ)|PREV_INUSE); - set_foot(chunk_at_offset(old_top, old_top_size), (2*SIZE_SZ)); - set_head_size(old_top, old_top_size); - chunk_free(ar_ptr, old_top); - } else { - set_head(old_top, (old_top_size + 2*SIZE_SZ)|PREV_INUSE); - set_foot(old_top, (old_top_size + 2*SIZE_SZ)); - } - } -} - - - - -/* Main public routines */ - - -/* - Malloc Algorithm: - - The requested size is first converted into a usable form, `nb'. - This currently means to add 4 bytes overhead plus possibly more to - obtain 8-byte alignment and/or to obtain a size of at least - MINSIZE (currently 16, 24, or 32 bytes), the smallest allocatable - size. (All fits are considered `exact' if they are within MINSIZE - bytes.) - - From there, the first successful of the following steps is taken: - - 1. The bin corresponding to the request size is scanned, and if - a chunk of exactly the right size is found, it is taken. - - 2. The most recently remaindered chunk is used if it is big - enough. This is a form of (roving) first fit, used only in - the absence of exact fits. Runs of consecutive requests use - the remainder of the chunk used for the previous such request - whenever possible. This limited use of a first-fit style - allocation strategy tends to give contiguous chunks - coextensive lifetimes, which improves locality and can reduce - fragmentation in the long run. - - 3. Other bins are scanned in increasing size order, using a - chunk big enough to fulfill the request, and splitting off - any remainder. This search is strictly by best-fit; i.e., - the smallest (with ties going to approximately the least - recently used) chunk that fits is selected. - - 4. If large enough, the chunk bordering the end of memory - (`top') is split off. (This use of `top' is in accord with - the best-fit search rule. In effect, `top' is treated as - larger (and thus less well fitting) than any other available - chunk since it can be extended to be as large as necessary - (up to system limitations). - - 5. If the request size meets the mmap threshold and the - system supports mmap, and there are few enough currently - allocated mmapped regions, and a call to mmap succeeds, - the request is allocated via direct memory mapping. - - 6. Otherwise, the top of memory is extended by - obtaining more space from the system (normally using sbrk, - but definable to anything else via the MORECORE macro). - Memory is gathered from the system (in system page-sized - units) in a way that allows chunks obtained across different - sbrk calls to be consolidated, but does not require - contiguous memory. Thus, it should be safe to intersperse - mallocs with other sbrk calls. - - - All allocations are made from the `lowest' part of any found - chunk. (The implementation invariant is that prev_inuse is - always true of any allocated chunk; i.e., that each allocated - chunk borders either a previously allocated and still in-use chunk, - or the base of its memory arena.) - -*/ - -#if __STD_C -Void_t* mALLOc(size_t bytes) -#else -Void_t* mALLOc(bytes) size_t bytes; -#endif -{ - arena *ar_ptr; - INTERNAL_SIZE_T nb; /* padded request size */ - mchunkptr victim; - -#if defined _LIBC || defined MALLOC_HOOKS - __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) = - __malloc_hook; - if (hook != NULL) { - Void_t* result; - -#if defined __GNUC__ && __GNUC__ >= 2 - result = (*hook)(bytes, RETURN_ADDRESS (0)); -#else - result = (*hook)(bytes, NULL); -#endif - return result; - } -#endif - - if(request2size(bytes, nb)) - return 0; - arena_get(ar_ptr, nb); - if(!ar_ptr) - return 0; - victim = chunk_alloc(ar_ptr, nb); - if(!victim) { - /* Maybe the failure is due to running out of mmapped areas. */ - if(ar_ptr != &main_arena) { - (void)mutex_unlock(&ar_ptr->mutex); - (void)mutex_lock(&main_arena.mutex); - victim = chunk_alloc(&main_arena, nb); - (void)mutex_unlock(&main_arena.mutex); - } else { -#if USE_ARENAS - /* ... or sbrk() has failed and there is still a chance to mmap() */ - ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, nb); - (void)mutex_unlock(&main_arena.mutex); - if(ar_ptr) { - victim = chunk_alloc(ar_ptr, nb); - (void)mutex_unlock(&ar_ptr->mutex); - } -#endif - } - if(!victim) return 0; - } else - (void)mutex_unlock(&ar_ptr->mutex); - return BOUNDED_N(chunk2mem(victim), bytes); -} - -static mchunkptr -internal_function -#if __STD_C -chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T nb) -#else -chunk_alloc(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb; -#endif -{ - mchunkptr victim; /* inspected/selected chunk */ - INTERNAL_SIZE_T victim_size; /* its size */ - int idx; /* index for bin traversal */ - mbinptr bin; /* associated bin */ - mchunkptr remainder; /* remainder from a split */ - long remainder_size; /* its size */ - int remainder_index; /* its bin index */ - unsigned long block; /* block traverser bit */ - int startidx; /* first bin of a traversed block */ - mchunkptr fwd; /* misc temp for linking */ - mchunkptr bck; /* misc temp for linking */ - mbinptr q; /* misc temp */ - - - /* Check for exact match in a bin */ - - if (is_small_request(nb)) /* Faster version for small requests */ - { - idx = smallbin_index(nb); - - /* No traversal or size check necessary for small bins. */ - - q = _bin_at(ar_ptr, idx); - victim = last(q); - - /* Also scan the next one, since it would have a remainder < MINSIZE */ - if (victim == q) - { - q = next_bin(q); - victim = last(q); - } - if (victim != q) - { - victim_size = chunksize(victim); - unlink(victim, bck, fwd); - set_inuse_bit_at_offset(victim, victim_size); - check_malloced_chunk(ar_ptr, victim, nb); - return victim; - } - - idx += 2; /* Set for bin scan below. We've already scanned 2 bins. */ - - } - else - { - idx = bin_index(nb); - bin = bin_at(ar_ptr, idx); - - for (victim = last(bin); victim != bin; victim = victim->bk) - { - victim_size = chunksize(victim); - remainder_size = victim_size - nb; - - if (remainder_size >= (long)MINSIZE) /* too big */ - { - --idx; /* adjust to rescan below after checking last remainder */ - break; - } - - else if (remainder_size >= 0) /* exact fit */ - { - unlink(victim, bck, fwd); - set_inuse_bit_at_offset(victim, victim_size); - check_malloced_chunk(ar_ptr, victim, nb); - return victim; - } - } - - ++idx; - - } - - /* Try to use the last split-off remainder */ - - if ( (victim = last_remainder(ar_ptr)->fd) != last_remainder(ar_ptr)) - { - victim_size = chunksize(victim); - remainder_size = victim_size - nb; - - if (remainder_size >= (long)MINSIZE) /* re-split */ - { - remainder = chunk_at_offset(victim, nb); - set_head(victim, nb | PREV_INUSE); - link_last_remainder(ar_ptr, remainder); - set_head(remainder, remainder_size | PREV_INUSE); - set_foot(remainder, remainder_size); - check_malloced_chunk(ar_ptr, victim, nb); - return victim; - } - - clear_last_remainder(ar_ptr); - - if (remainder_size >= 0) /* exhaust */ - { - set_inuse_bit_at_offset(victim, victim_size); - check_malloced_chunk(ar_ptr, victim, nb); - return victim; - } - - /* Else place in bin */ - - frontlink(ar_ptr, victim, victim_size, remainder_index, bck, fwd); - } - - /* - If there are any possibly nonempty big-enough blocks, - search for best fitting chunk by scanning bins in blockwidth units. - */ - - if ( (block = idx2binblock(idx)) <= binblocks(ar_ptr)) - { - - /* Get to the first marked block */ - - if ( (block & binblocks(ar_ptr)) == 0) - { - /* force to an even block boundary */ - idx = (idx & ~(BINBLOCKWIDTH - 1)) + BINBLOCKWIDTH; - block <<= 1; - while ((block & binblocks(ar_ptr)) == 0) - { - idx += BINBLOCKWIDTH; - block <<= 1; - } - } - - /* For each possibly nonempty block ... */ - for (;;) - { - startidx = idx; /* (track incomplete blocks) */ - q = bin = _bin_at(ar_ptr, idx); - - /* For each bin in this block ... */ - do - { - /* Find and use first big enough chunk ... */ - - for (victim = last(bin); victim != bin; victim = victim->bk) - { - victim_size = chunksize(victim); - remainder_size = victim_size - nb; - - if (remainder_size >= (long)MINSIZE) /* split */ - { - remainder = chunk_at_offset(victim, nb); - set_head(victim, nb | PREV_INUSE); - unlink(victim, bck, fwd); - link_last_remainder(ar_ptr, remainder); - set_head(remainder, remainder_size | PREV_INUSE); - set_foot(remainder, remainder_size); - check_malloced_chunk(ar_ptr, victim, nb); - return victim; - } - - else if (remainder_size >= 0) /* take */ - { - set_inuse_bit_at_offset(victim, victim_size); - unlink(victim, bck, fwd); - check_malloced_chunk(ar_ptr, victim, nb); - return victim; - } - - } - - bin = next_bin(bin); - - } while ((++idx & (BINBLOCKWIDTH - 1)) != 0); - - /* Clear out the block bit. */ - - do /* Possibly backtrack to try to clear a partial block */ - { - if ((startidx & (BINBLOCKWIDTH - 1)) == 0) - { - binblocks(ar_ptr) &= ~block; - break; - } - --startidx; - q = prev_bin(q); - } while (first(q) == q); - - /* Get to the next possibly nonempty block */ - - if ( (block <<= 1) <= binblocks(ar_ptr) && (block != 0) ) - { - while ((block & binblocks(ar_ptr)) == 0) - { - idx += BINBLOCKWIDTH; - block <<= 1; - } - } - else - break; - } - } - - - /* Try to use top chunk */ - - /* Require that there be a remainder, ensuring top always exists */ - if ( (remainder_size = chunksize(top(ar_ptr)) - nb) < (long)MINSIZE) - { - -#if HAVE_MMAP - /* If the request is big and there are not yet too many regions, - and we would otherwise need to extend, try to use mmap instead. */ - if ((unsigned long)nb >= (unsigned long)mmap_threshold && - n_mmaps < n_mmaps_max && - (victim = mmap_chunk(nb)) != 0) - return victim; -#endif - - /* Try to extend */ - malloc_extend_top(ar_ptr, nb); - if ((remainder_size = chunksize(top(ar_ptr)) - nb) < (long)MINSIZE) - { -#if HAVE_MMAP - /* A last attempt: when we are out of address space in a - non-main arena, try mmap anyway, as long as it is allowed at - all. */ - if (ar_ptr != &main_arena && - n_mmaps_max > 0 && - (victim = mmap_chunk(nb)) != 0) - return victim; -#endif - return 0; /* propagate failure */ - } - } - - victim = top(ar_ptr); - set_head(victim, nb | PREV_INUSE); - top(ar_ptr) = chunk_at_offset(victim, nb); - set_head(top(ar_ptr), remainder_size | PREV_INUSE); - check_malloced_chunk(ar_ptr, victim, nb); - return victim; - -} - - - - -/* - - free() algorithm : - - cases: - - 1. free(0) has no effect. - - 2. If the chunk was allocated via mmap, it is released via munmap(). - - 3. If a returned chunk borders the current high end of memory, - it is consolidated into the top, and if the total unused - topmost memory exceeds the trim threshold, malloc_trim is - called. - - 4. Other chunks are consolidated as they arrive, and - placed in corresponding bins. (This includes the case of - consolidating with the current `last_remainder'). - -*/ - - -#if __STD_C -void fREe(Void_t* mem) -#else -void fREe(mem) Void_t* mem; -#endif -{ - arena *ar_ptr; - mchunkptr p; /* chunk corresponding to mem */ - -#if defined _LIBC || defined MALLOC_HOOKS - void (*hook) __MALLOC_PMT ((__malloc_ptr_t, __const __malloc_ptr_t)) = - __free_hook; - - if (hook != NULL) { -#if defined __GNUC__ && __GNUC__ >= 2 - (*hook)(mem, RETURN_ADDRESS (0)); -#else - (*hook)(mem, NULL); -#endif - return; - } -#endif - - if (mem == 0) /* free(0) has no effect */ - return; - - p = mem2chunk(mem); - -#if HAVE_MMAP - if (chunk_is_mmapped(p)) /* release mmapped memory. */ - { - munmap_chunk(p); - return; - } -#endif - - ar_ptr = arena_for_ptr(p); -#if THREAD_STATS - if(!mutex_trylock(&ar_ptr->mutex)) - ++(ar_ptr->stat_lock_direct); - else { - (void)mutex_lock(&ar_ptr->mutex); - ++(ar_ptr->stat_lock_wait); - } -#else - (void)mutex_lock(&ar_ptr->mutex); -#endif - chunk_free(ar_ptr, p); - (void)mutex_unlock(&ar_ptr->mutex); -} - -static void -internal_function -#if __STD_C -chunk_free(arena *ar_ptr, mchunkptr p) -#else -chunk_free(ar_ptr, p) arena *ar_ptr; mchunkptr p; -#endif -{ - INTERNAL_SIZE_T hd = p->size; /* its head field */ - INTERNAL_SIZE_T sz; /* its size */ - int idx; /* its bin index */ - mchunkptr next; /* next contiguous chunk */ - INTERNAL_SIZE_T nextsz; /* its size */ - INTERNAL_SIZE_T prevsz; /* size of previous contiguous chunk */ - mchunkptr bck; /* misc temp for linking */ - mchunkptr fwd; /* misc temp for linking */ - int islr; /* track whether merging with last_remainder */ - - check_inuse_chunk(ar_ptr, p); - - sz = hd & ~PREV_INUSE; - next = chunk_at_offset(p, sz); - nextsz = chunksize(next); - - if (next == top(ar_ptr)) /* merge with top */ - { - sz += nextsz; - - if (!(hd & PREV_INUSE)) /* consolidate backward */ - { - prevsz = p->prev_size; - p = chunk_at_offset(p, -(long)prevsz); - sz += prevsz; - unlink(p, bck, fwd); - } - - set_head(p, sz | PREV_INUSE); - top(ar_ptr) = p; - -#if USE_ARENAS - if(ar_ptr == &main_arena) { -#endif - if ((unsigned long)(sz) >= (unsigned long)trim_threshold) - main_trim(top_pad); -#if USE_ARENAS - } else { - heap_info *heap = heap_for_ptr(p); - - assert(heap->ar_ptr == ar_ptr); - - /* Try to get rid of completely empty heaps, if possible. */ - if((unsigned long)(sz) >= (unsigned long)trim_threshold || - p == chunk_at_offset(heap, sizeof(*heap))) - heap_trim(heap, top_pad); - } -#endif - return; - } - - islr = 0; - - if (!(hd & PREV_INUSE)) /* consolidate backward */ - { - prevsz = p->prev_size; - p = chunk_at_offset(p, -(long)prevsz); - sz += prevsz; - - if (p->fd == last_remainder(ar_ptr)) /* keep as last_remainder */ - islr = 1; - else - unlink(p, bck, fwd); - } - - if (!(inuse_bit_at_offset(next, nextsz))) /* consolidate forward */ - { - sz += nextsz; - - if (!islr && next->fd == last_remainder(ar_ptr)) - /* re-insert last_remainder */ - { - islr = 1; - link_last_remainder(ar_ptr, p); - } - else - unlink(next, bck, fwd); - - next = chunk_at_offset(p, sz); - } - else - set_head(next, nextsz); /* clear inuse bit */ - - set_head(p, sz | PREV_INUSE); - next->prev_size = sz; - if (!islr) - frontlink(ar_ptr, p, sz, idx, bck, fwd); - -#if USE_ARENAS - /* Check whether the heap containing top can go away now. */ - if(next->size < MINSIZE && - (unsigned long)sz > trim_threshold && - ar_ptr != &main_arena) { /* fencepost */ - heap_info *heap = heap_for_ptr(top(ar_ptr)); - - if(top(ar_ptr) == chunk_at_offset(heap, sizeof(*heap)) && - heap->prev == heap_for_ptr(p)) - heap_trim(heap, top_pad); - } -#endif -} - - - - - -/* - - Realloc algorithm: - - Chunks that were obtained via mmap cannot be extended or shrunk - unless HAVE_MREMAP is defined, in which case mremap is used. - Otherwise, if their reallocation is for additional space, they are - copied. If for less, they are just left alone. - - Otherwise, if the reallocation is for additional space, and the - chunk can be extended, it is, else a malloc-copy-free sequence is - taken. There are several different ways that a chunk could be - extended. All are tried: - - * Extending forward into following adjacent free chunk. - * Shifting backwards, joining preceding adjacent space - * Both shifting backwards and extending forward. - * Extending into newly sbrked space - - Unless the #define REALLOC_ZERO_BYTES_FREES is set, realloc with a - size argument of zero (re)allocates a minimum-sized chunk. - - If the reallocation is for less space, and the new request is for - a `small' (<512 bytes) size, then the newly unused space is lopped - off and freed. - - The old unix realloc convention of allowing the last-free'd chunk - to be used as an argument to realloc is no longer supported. - I don't know of any programs still relying on this feature, - and allowing it would also allow too many other incorrect - usages of realloc to be sensible. - - -*/ - - -#if __STD_C -Void_t* rEALLOc(Void_t* oldmem, size_t bytes) -#else -Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; -#endif -{ - arena *ar_ptr; - INTERNAL_SIZE_T nb; /* padded request size */ - - mchunkptr oldp; /* chunk corresponding to oldmem */ - INTERNAL_SIZE_T oldsize; /* its size */ - - mchunkptr newp; /* chunk to return */ - -#if defined _LIBC || defined MALLOC_HOOKS - __malloc_ptr_t (*hook) __MALLOC_PMT ((__malloc_ptr_t, size_t, - __const __malloc_ptr_t)) = - __realloc_hook; - if (hook != NULL) { - Void_t* result; - -#if defined __GNUC__ && __GNUC__ >= 2 - result = (*hook)(oldmem, bytes, RETURN_ADDRESS (0)); -#else - result = (*hook)(oldmem, bytes, NULL); -#endif - return result; - } -#endif - -#ifdef REALLOC_ZERO_BYTES_FREES - if (bytes == 0 && oldmem != NULL) { fREe(oldmem); return 0; } -#endif - - /* realloc of null is supposed to be same as malloc */ - if (oldmem == 0) return mALLOc(bytes); - - oldp = mem2chunk(oldmem); - oldsize = chunksize(oldp); - - if(request2size(bytes, nb)) - return 0; - -#if HAVE_MMAP - if (chunk_is_mmapped(oldp)) - { - Void_t* newmem; - -#if HAVE_MREMAP - newp = mremap_chunk(oldp, nb); - if(newp) - return BOUNDED_N(chunk2mem(newp), bytes); -#endif - /* Note the extra SIZE_SZ overhead. */ - if(oldsize - SIZE_SZ >= nb) return oldmem; /* do nothing */ - /* Must alloc, copy, free. */ - newmem = mALLOc(bytes); - if (newmem == 0) return 0; /* propagate failure */ - MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ, 0); - munmap_chunk(oldp); - return newmem; - } -#endif - - ar_ptr = arena_for_ptr(oldp); -#if THREAD_STATS - if(!mutex_trylock(&ar_ptr->mutex)) - ++(ar_ptr->stat_lock_direct); - else { - (void)mutex_lock(&ar_ptr->mutex); - ++(ar_ptr->stat_lock_wait); - } -#else - (void)mutex_lock(&ar_ptr->mutex); -#endif - -#ifndef NO_THREADS - /* As in malloc(), remember this arena for the next allocation. */ - tsd_setspecific(arena_key, (Void_t *)ar_ptr); -#endif - - newp = chunk_realloc(ar_ptr, oldp, oldsize, nb); - - (void)mutex_unlock(&ar_ptr->mutex); - return newp ? BOUNDED_N(chunk2mem(newp), bytes) : NULL; -} - -static mchunkptr -internal_function -#if __STD_C -chunk_realloc(arena* ar_ptr, mchunkptr oldp, INTERNAL_SIZE_T oldsize, - INTERNAL_SIZE_T nb) -#else -chunk_realloc(ar_ptr, oldp, oldsize, nb) -arena* ar_ptr; mchunkptr oldp; INTERNAL_SIZE_T oldsize, nb; -#endif -{ - mchunkptr newp = oldp; /* chunk to return */ - INTERNAL_SIZE_T newsize = oldsize; /* its size */ - - mchunkptr next; /* next contiguous chunk after oldp */ - INTERNAL_SIZE_T nextsize; /* its size */ - - mchunkptr prev; /* previous contiguous chunk before oldp */ - INTERNAL_SIZE_T prevsize; /* its size */ - - mchunkptr remainder; /* holds split off extra space from newp */ - INTERNAL_SIZE_T remainder_size; /* its size */ - - mchunkptr bck; /* misc temp for linking */ - mchunkptr fwd; /* misc temp for linking */ - - check_inuse_chunk(ar_ptr, oldp); - - if ((long)(oldsize) < (long)(nb)) - { - Void_t* oldmem = BOUNDED_N(chunk2mem(oldp), oldsize); - - /* Try expanding forward */ - - next = chunk_at_offset(oldp, oldsize); - if (next == top(ar_ptr) || !inuse(next)) - { - nextsize = chunksize(next); - - /* Forward into top only if a remainder */ - if (next == top(ar_ptr)) - { - if ((long)(nextsize + newsize) >= (long)(nb + MINSIZE)) - { - newsize += nextsize; - top(ar_ptr) = chunk_at_offset(oldp, nb); - set_head(top(ar_ptr), (newsize - nb) | PREV_INUSE); - set_head_size(oldp, nb); - return oldp; - } - } - - /* Forward into next chunk */ - else if (((long)(nextsize + newsize) >= (long)(nb))) - { - unlink(next, bck, fwd); - newsize += nextsize; - goto split; - } - } - else - { - next = 0; - nextsize = 0; - } - - oldsize -= SIZE_SZ; - - /* Try shifting backwards. */ - - if (!prev_inuse(oldp)) - { - prev = prev_chunk(oldp); - prevsize = chunksize(prev); - - /* try forward + backward first to save a later consolidation */ - - if (next != 0) - { - /* into top */ - if (next == top(ar_ptr)) - { - if ((long)(nextsize + prevsize + newsize) >= (long)(nb + MINSIZE)) - { - unlink(prev, bck, fwd); - newp = prev; - newsize += prevsize + nextsize; - MALLOC_COPY(BOUNDED_N(chunk2mem(newp), oldsize), oldmem, oldsize, - 1); - top(ar_ptr) = chunk_at_offset(newp, nb); - set_head(top(ar_ptr), (newsize - nb) | PREV_INUSE); - set_head_size(newp, nb); - return newp; - } - } - - /* into next chunk */ - else if (((long)(nextsize + prevsize + newsize) >= (long)(nb))) - { - unlink(next, bck, fwd); - unlink(prev, bck, fwd); - newp = prev; - newsize += nextsize + prevsize; - MALLOC_COPY(BOUNDED_N(chunk2mem(newp), oldsize), oldmem, oldsize, 1); - goto split; - } - } - - /* backward only */ - if (prev != 0 && (long)(prevsize + newsize) >= (long)nb) - { - unlink(prev, bck, fwd); - newp = prev; - newsize += prevsize; - MALLOC_COPY(BOUNDED_N(chunk2mem(newp), oldsize), oldmem, oldsize, 1); - goto split; - } - } - - /* Must allocate */ - - newp = chunk_alloc (ar_ptr, nb); - - if (newp == 0) { - /* Maybe the failure is due to running out of mmapped areas. */ - if (ar_ptr != &main_arena) { - (void)mutex_lock(&main_arena.mutex); - newp = chunk_alloc(&main_arena, nb); - (void)mutex_unlock(&main_arena.mutex); - } else { -#if USE_ARENAS - /* ... or sbrk() has failed and there is still a chance to mmap() */ - arena* ar_ptr2 = arena_get2(ar_ptr->next ? ar_ptr : 0, nb); - if(ar_ptr2) { - newp = chunk_alloc(ar_ptr2, nb); - (void)mutex_unlock(&ar_ptr2->mutex); - } -#endif - } - if (newp == 0) /* propagate failure */ - return 0; - } - - /* Avoid copy if newp is next chunk after oldp. */ - /* (This can only happen when new chunk is sbrk'ed.) */ - - if ( newp == next_chunk(oldp)) - { - newsize += chunksize(newp); - newp = oldp; - goto split; - } - - /* Otherwise copy, free, and exit */ - MALLOC_COPY(BOUNDED_N(chunk2mem(newp), oldsize), oldmem, oldsize, 0); - chunk_free(ar_ptr, oldp); - return newp; - } - - - split: /* split off extra room in old or expanded chunk */ - - if (newsize - nb >= MINSIZE) /* split off remainder */ - { - remainder = chunk_at_offset(newp, nb); - remainder_size = newsize - nb; - set_head_size(newp, nb); - set_head(remainder, remainder_size | PREV_INUSE); - set_inuse_bit_at_offset(remainder, remainder_size); - chunk_free(ar_ptr, remainder); - } - else - { - set_head_size(newp, newsize); - set_inuse_bit_at_offset(newp, newsize); - } - - check_inuse_chunk(ar_ptr, newp); - return newp; -} - - - - -/* - - memalign algorithm: - - memalign requests more than enough space from malloc, finds a spot - within that chunk that meets the alignment request, and then - possibly frees the leading and trailing space. - - The alignment argument must be a power of two. This property is not - checked by memalign, so misuse may result in random runtime errors. - - 8-byte alignment is guaranteed by normal malloc calls, so don't - bother calling memalign with an argument of 8 or less. - - Overreliance on memalign is a sure way to fragment space. - -*/ - - -#if __STD_C -Void_t* mEMALIGn(size_t alignment, size_t bytes) -#else -Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; -#endif -{ - arena *ar_ptr; - INTERNAL_SIZE_T nb; /* padded request size */ - mchunkptr p; - -#if defined _LIBC || defined MALLOC_HOOKS - __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, - __const __malloc_ptr_t)) = - __memalign_hook; - if (hook != NULL) { - Void_t* result; - -#if defined __GNUC__ && __GNUC__ >= 2 - result = (*hook)(alignment, bytes, RETURN_ADDRESS (0)); -#else - result = (*hook)(alignment, bytes, NULL); -#endif - return result; - } -#endif - - /* If need less alignment than we give anyway, just relay to malloc */ - - if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes); - - /* Otherwise, ensure that it is at least a minimum chunk size */ - - if (alignment < MINSIZE) alignment = MINSIZE; - - if(request2size(bytes, nb)) - return 0; - arena_get(ar_ptr, nb + alignment + MINSIZE); - if(!ar_ptr) - return 0; - p = chunk_align(ar_ptr, nb, alignment); - (void)mutex_unlock(&ar_ptr->mutex); - if(!p) { - /* Maybe the failure is due to running out of mmapped areas. */ - if(ar_ptr != &main_arena) { - (void)mutex_lock(&main_arena.mutex); - p = chunk_align(&main_arena, nb, alignment); - (void)mutex_unlock(&main_arena.mutex); - } else { -#if USE_ARENAS - /* ... or sbrk() has failed and there is still a chance to mmap() */ - ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, nb); - if(ar_ptr) { - p = chunk_align(ar_ptr, nb, alignment); - (void)mutex_unlock(&ar_ptr->mutex); - } -#endif - } - if(!p) return 0; - } - return BOUNDED_N(chunk2mem(p), bytes); -} - -static mchunkptr -internal_function -#if __STD_C -chunk_align(arena* ar_ptr, INTERNAL_SIZE_T nb, size_t alignment) -#else -chunk_align(ar_ptr, nb, alignment) -arena* ar_ptr; INTERNAL_SIZE_T nb; size_t alignment; -#endif -{ - unsigned long m; /* memory returned by malloc call */ - mchunkptr p; /* corresponding chunk */ - char* brk; /* alignment point within p */ - mchunkptr newp; /* chunk to return */ - INTERNAL_SIZE_T newsize; /* its size */ - INTERNAL_SIZE_T leadsize; /* leading space befor alignment point */ - mchunkptr remainder; /* spare room at end to split off */ - long remainder_size; /* its size */ - - /* Call chunk_alloc with worst case padding to hit alignment. */ - p = chunk_alloc(ar_ptr, nb + alignment + MINSIZE); - if (p == 0) - return 0; /* propagate failure */ - - m = (unsigned long)chunk2mem(p); - - if ((m % alignment) == 0) /* aligned */ - { -#if HAVE_MMAP - if(chunk_is_mmapped(p)) { - return p; /* nothing more to do */ - } -#endif - } - else /* misaligned */ - { - /* - Find an aligned spot inside chunk. - Since we need to give back leading space in a chunk of at - least MINSIZE, if the first calculation places us at - a spot with less than MINSIZE leader, we can move to the - next aligned spot -- we've allocated enough total room so that - this is always possible. - */ - - brk = (char*)mem2chunk(((m + alignment - 1)) & -(long)alignment); - if ((long)(brk - (char*)(p)) < (long)MINSIZE) brk += alignment; - - newp = chunk_at_offset(brk, 0); - leadsize = brk - (char*)(p); - newsize = chunksize(p) - leadsize; - -#if HAVE_MMAP - if(chunk_is_mmapped(p)) - { - newp->prev_size = p->prev_size + leadsize; - set_head(newp, newsize|IS_MMAPPED); - return newp; - } -#endif - - /* give back leader, use the rest */ - - set_head(newp, newsize | PREV_INUSE); - set_inuse_bit_at_offset(newp, newsize); - set_head_size(p, leadsize); - chunk_free(ar_ptr, p); - p = newp; - - assert (newsize>=nb && (((unsigned long)(chunk2mem(p))) % alignment) == 0); - } - - /* Also give back spare room at the end */ - - remainder_size = chunksize(p) - nb; - - if (remainder_size >= (long)MINSIZE) - { - remainder = chunk_at_offset(p, nb); - set_head(remainder, remainder_size | PREV_INUSE); - set_head_size(p, nb); - chunk_free(ar_ptr, remainder); - } - - check_inuse_chunk(ar_ptr, p); - return p; -} - - - - -/* - valloc just invokes memalign with alignment argument equal - to the page size of the system (or as near to this as can - be figured out from all the includes/defines above.) -*/ - -#if __STD_C -Void_t* vALLOc(size_t bytes) -#else -Void_t* vALLOc(bytes) size_t bytes; -#endif -{ - if(__malloc_initialized < 0) - ptmalloc_init (); - return mEMALIGn (malloc_getpagesize, bytes); -} - -/* - pvalloc just invokes valloc for the nearest pagesize - that will accommodate request -*/ - - -#if __STD_C -Void_t* pvALLOc(size_t bytes) -#else -Void_t* pvALLOc(bytes) size_t bytes; -#endif -{ - size_t pagesize; - if(__malloc_initialized < 0) - ptmalloc_init (); - pagesize = malloc_getpagesize; - return mEMALIGn (pagesize, (bytes + pagesize - 1) & ~(pagesize - 1)); -} - -/* - - calloc calls chunk_alloc, then zeroes out the allocated chunk. - -*/ - -#if __STD_C -Void_t* cALLOc(size_t n, size_t elem_size) -#else -Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size; -#endif -{ - arena *ar_ptr; - mchunkptr p, oldtop; - INTERNAL_SIZE_T sz, csz, oldtopsize; - Void_t* mem; - -#if defined _LIBC || defined MALLOC_HOOKS - __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) = - __malloc_hook; - if (hook != NULL) { - sz = n * elem_size; -#if defined __GNUC__ && __GNUC__ >= 2 - mem = (*hook)(sz, RETURN_ADDRESS (0)); -#else - mem = (*hook)(sz, NULL); -#endif - if(mem == 0) - return 0; -#ifdef HAVE_MEMSET - return memset(mem, 0, sz); -#else - while(sz > 0) ((char*)mem)[--sz] = 0; /* rather inefficient */ - return mem; -#endif - } -#endif - - if(request2size(n * elem_size, sz)) - return 0; - arena_get(ar_ptr, sz); - if(!ar_ptr) - return 0; - - /* Check if expand_top called, in which case there may be - no need to clear. */ -#if MORECORE_CLEARS - oldtop = top(ar_ptr); - oldtopsize = chunksize(top(ar_ptr)); -#if MORECORE_CLEARS < 2 - /* Only newly allocated memory is guaranteed to be cleared. */ - if (ar_ptr == &main_arena && - oldtopsize < sbrk_base + max_sbrked_mem - (char *)oldtop) - oldtopsize = (sbrk_base + max_sbrked_mem - (char *)oldtop); -#endif -#endif - p = chunk_alloc (ar_ptr, sz); - - /* Only clearing follows, so we can unlock early. */ - (void)mutex_unlock(&ar_ptr->mutex); - - if (p == 0) { - /* Maybe the failure is due to running out of mmapped areas. */ - if(ar_ptr != &main_arena) { - (void)mutex_lock(&main_arena.mutex); - p = chunk_alloc(&main_arena, sz); - (void)mutex_unlock(&main_arena.mutex); - } else { -#if USE_ARENAS - /* ... or sbrk() has failed and there is still a chance to mmap() */ - (void)mutex_lock(&main_arena.mutex); - ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, sz); - (void)mutex_unlock(&main_arena.mutex); - if(ar_ptr) { - p = chunk_alloc(ar_ptr, sz); - (void)mutex_unlock(&ar_ptr->mutex); - } -#endif - } - if (p == 0) return 0; - } - mem = BOUNDED_N(chunk2mem(p), n * elem_size); - - /* Two optional cases in which clearing not necessary */ - -#if HAVE_MMAP - if (chunk_is_mmapped(p)) return mem; -#endif - - csz = chunksize(p); - -#if MORECORE_CLEARS - if (p == oldtop && csz > oldtopsize) { - /* clear only the bytes from non-freshly-sbrked memory */ - csz = oldtopsize; - } -#endif - - csz -= SIZE_SZ; - MALLOC_ZERO(BOUNDED_N(chunk2mem(p), csz), csz); - return mem; -} - -/* - - cfree just calls free. It is needed/defined on some systems - that pair it with calloc, presumably for odd historical reasons. - -*/ - -#if !defined(_LIBC) -#if __STD_C -void cfree(Void_t *mem) -#else -void cfree(mem) Void_t *mem; -#endif -{ - fREe(mem); -} -#endif - - - -/* - - Malloc_trim gives memory back to the system (via negative - arguments to sbrk) if there is unused memory at the `high' end of - the malloc pool. You can call this after freeing large blocks of - memory to potentially reduce the system-level memory requirements - of a program. However, it cannot guarantee to reduce memory. Under - some allocation patterns, some large free blocks of memory will be - locked between two used chunks, so they cannot be given back to - the system. - - The `pad' argument to malloc_trim represents the amount of free - trailing space to leave untrimmed. If this argument is zero, - only the minimum amount of memory to maintain internal data - structures will be left (one page or less). Non-zero arguments - can be supplied to maintain enough trailing space to service - future expected allocations without having to re-obtain memory - from the system. - - Malloc_trim returns 1 if it actually released any memory, else 0. - -*/ - -#if __STD_C -int mALLOC_TRIm(size_t pad) -#else -int mALLOC_TRIm(pad) size_t pad; -#endif -{ - int res; - - (void)mutex_lock(&main_arena.mutex); - res = main_trim(pad); - (void)mutex_unlock(&main_arena.mutex); - return res; -} - -/* Trim the main arena. */ - -static int -internal_function -#if __STD_C -main_trim(size_t pad) -#else -main_trim(pad) size_t pad; -#endif -{ - mchunkptr top_chunk; /* The current top chunk */ - long top_size; /* Amount of top-most memory */ - long extra; /* Amount to release */ - char* current_brk; /* address returned by pre-check sbrk call */ - char* new_brk; /* address returned by negative sbrk call */ - - unsigned long pagesz = malloc_getpagesize; - - top_chunk = top(&main_arena); - top_size = chunksize(top_chunk); - extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz; - - if (extra < (long)pagesz) /* Not enough memory to release */ - return 0; - - /* Test to make sure no one else called sbrk */ - current_brk = (char*)(MORECORE (0)); - if (current_brk != (char*)(top_chunk) + top_size) - return 0; /* Apparently we don't own memory; must fail */ - - new_brk = (char*)(MORECORE (-extra)); - -#if defined _LIBC || defined MALLOC_HOOKS - /* Call the `morecore' hook if necessary. */ - if (__after_morecore_hook) - (*__after_morecore_hook) (); -#endif - - if (new_brk == (char*)(MORECORE_FAILURE)) { /* sbrk failed? */ - /* Try to figure out what we have */ - current_brk = (char*)(MORECORE (0)); - top_size = current_brk - (char*)top_chunk; - if (top_size >= (long)MINSIZE) /* if not, we are very very dead! */ - { - sbrked_mem = current_brk - sbrk_base; - set_head(top_chunk, top_size | PREV_INUSE); - } - check_chunk(&main_arena, top_chunk); - return 0; - } - sbrked_mem -= extra; - - /* Success. Adjust top accordingly. */ - set_head(top_chunk, (top_size - extra) | PREV_INUSE); - check_chunk(&main_arena, top_chunk); - return 1; -} - -#if USE_ARENAS - -static int -internal_function -#if __STD_C -heap_trim(heap_info *heap, size_t pad) -#else -heap_trim(heap, pad) heap_info *heap; size_t pad; -#endif -{ - unsigned long pagesz = malloc_getpagesize; - arena *ar_ptr = heap->ar_ptr; - mchunkptr top_chunk = top(ar_ptr), p, bck, fwd; - heap_info *prev_heap; - long new_size, top_size, extra; - - /* Can this heap go away completely ? */ - while(top_chunk == chunk_at_offset(heap, sizeof(*heap))) { - prev_heap = heap->prev; - p = chunk_at_offset(prev_heap, prev_heap->size - (MINSIZE-2*SIZE_SZ)); - assert(p->size == (0|PREV_INUSE)); /* must be fencepost */ - p = prev_chunk(p); - new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ); - assert(new_size>0 && new_size<(long)(2*MINSIZE)); - if(!prev_inuse(p)) - new_size += p->prev_size; - assert(new_size>0 && new_size<HEAP_MAX_SIZE); - if(new_size + (HEAP_MAX_SIZE - prev_heap->size) < pad + MINSIZE + pagesz) - break; - ar_ptr->size -= heap->size; - arena_mem -= heap->size; - delete_heap(heap); - heap = prev_heap; - if(!prev_inuse(p)) { /* consolidate backward */ - p = prev_chunk(p); - unlink(p, bck, fwd); - } - assert(((unsigned long)((char*)p + new_size) & (pagesz-1)) == 0); - assert( ((char*)p + new_size) == ((char*)heap + heap->size) ); - top(ar_ptr) = top_chunk = p; - set_head(top_chunk, new_size | PREV_INUSE); - check_chunk(ar_ptr, top_chunk); - } - top_size = chunksize(top_chunk); - extra = ((top_size - pad - MINSIZE + (pagesz-1))/pagesz - 1) * pagesz; - if(extra < (long)pagesz) - return 0; - /* Try to shrink. */ - if(grow_heap(heap, -extra) != 0) - return 0; - ar_ptr->size -= extra; - arena_mem -= extra; - - /* Success. Adjust top accordingly. */ - set_head(top_chunk, (top_size - extra) | PREV_INUSE); - check_chunk(ar_ptr, top_chunk); - return 1; -} - -#endif /* USE_ARENAS */ - - - -/* - malloc_usable_size: - - This routine tells you how many bytes you can actually use in an - allocated chunk, which may be more than you requested (although - often not). You can use this many bytes without worrying about - overwriting other allocated objects. Not a particularly great - programming practice, but still sometimes useful. - -*/ - -#if __STD_C -size_t mALLOC_USABLE_SIZe(Void_t* mem) -#else -size_t mALLOC_USABLE_SIZe(mem) Void_t* mem; -#endif -{ - mchunkptr p; - - if (mem == 0) - return 0; - else - { - p = mem2chunk(mem); - if(!chunk_is_mmapped(p)) - { - if (!inuse(p)) return 0; - check_inuse_chunk(arena_for_ptr(mem), p); - return chunksize(p) - SIZE_SZ; - } - return chunksize(p) - 2*SIZE_SZ; - } -} - - - - -/* Utility to update mallinfo for malloc_stats() and mallinfo() */ - -static void -#if __STD_C -malloc_update_mallinfo(arena *ar_ptr, struct mallinfo *mi) -#else -malloc_update_mallinfo(ar_ptr, mi) arena *ar_ptr; struct mallinfo *mi; -#endif -{ - int i, navail; - mbinptr b; - mchunkptr p; -#if MALLOC_DEBUG - mchunkptr q; -#endif - INTERNAL_SIZE_T avail; - - (void)mutex_lock(&ar_ptr->mutex); - avail = chunksize(top(ar_ptr)); - navail = ((long)(avail) >= (long)MINSIZE)? 1 : 0; - - for (i = 1; i < NAV; ++i) - { - b = bin_at(ar_ptr, i); - for (p = last(b); p != b; p = p->bk) - { -#if MALLOC_DEBUG - check_free_chunk(ar_ptr, p); - for (q = next_chunk(p); - q != top(ar_ptr) && inuse(q) && (long)chunksize(q) > 0; - q = next_chunk(q)) - check_inuse_chunk(ar_ptr, q); -#endif - avail += chunksize(p); - navail++; - } - } - - mi->arena = ar_ptr->size; - mi->ordblks = navail; - mi->smblks = mi->usmblks = mi->fsmblks = 0; /* clear unused fields */ - mi->uordblks = ar_ptr->size - avail; - mi->fordblks = avail; - mi->hblks = n_mmaps; - mi->hblkhd = mmapped_mem; - mi->keepcost = chunksize(top(ar_ptr)); - - (void)mutex_unlock(&ar_ptr->mutex); -} - -#if USE_ARENAS && MALLOC_DEBUG > 1 - -/* Print the complete contents of a single heap to stderr. */ - -static void -#if __STD_C -dump_heap(heap_info *heap) -#else -dump_heap(heap) heap_info *heap; -#endif -{ - char *ptr; - mchunkptr p; - - fprintf(stderr, "Heap %p, size %10lx:\n", heap, (long)heap->size); - ptr = (heap->ar_ptr != (arena*)(heap+1)) ? - (char*)(heap + 1) : (char*)(heap + 1) + sizeof(arena); - p = (mchunkptr)(((unsigned long)ptr + MALLOC_ALIGN_MASK) & - ~MALLOC_ALIGN_MASK); - for(;;) { - fprintf(stderr, "chunk %p size %10lx", p, (long)p->size); - if(p == top(heap->ar_ptr)) { - fprintf(stderr, " (top)\n"); - break; - } else if(p->size == (0|PREV_INUSE)) { - fprintf(stderr, " (fence)\n"); - break; - } - fprintf(stderr, "\n"); - p = next_chunk(p); - } -} - -#endif - - - -/* - - malloc_stats: - - For all arenas separately and in total, prints on stderr the - amount of space obtained from the system, and the current number - of bytes allocated via malloc (or realloc, etc) but not yet - freed. (Note that this is the number of bytes allocated, not the - number requested. It will be larger than the number requested - because of alignment and bookkeeping overhead.) When not compiled - for multiple threads, the maximum amount of allocated memory - (which may be more than current if malloc_trim and/or munmap got - called) is also reported. When using mmap(), prints the maximum - number of simultaneous mmap regions used, too. - -*/ - -void mALLOC_STATs() -{ - int i; - arena *ar_ptr; - struct mallinfo mi; - unsigned int in_use_b = mmapped_mem, system_b = in_use_b; -#if THREAD_STATS - long stat_lock_direct = 0, stat_lock_loop = 0, stat_lock_wait = 0; -#endif - - for(i=0, ar_ptr = &main_arena;; i++) { - malloc_update_mallinfo(ar_ptr, &mi); - fprintf(stderr, "Arena %d:\n", i); - fprintf(stderr, "system bytes = %10u\n", (unsigned int)mi.arena); - fprintf(stderr, "in use bytes = %10u\n", (unsigned int)mi.uordblks); - system_b += mi.arena; - in_use_b += mi.uordblks; -#if THREAD_STATS - stat_lock_direct += ar_ptr->stat_lock_direct; - stat_lock_loop += ar_ptr->stat_lock_loop; - stat_lock_wait += ar_ptr->stat_lock_wait; -#endif -#if USE_ARENAS && MALLOC_DEBUG > 1 - if(ar_ptr != &main_arena) { - heap_info *heap; - (void)mutex_lock(&ar_ptr->mutex); - heap = heap_for_ptr(top(ar_ptr)); - while(heap) { dump_heap(heap); heap = heap->prev; } - (void)mutex_unlock(&ar_ptr->mutex); - } -#endif - ar_ptr = ar_ptr->next; - if(ar_ptr == &main_arena) break; - } -#if HAVE_MMAP - fprintf(stderr, "Total (incl. mmap):\n"); -#else - fprintf(stderr, "Total:\n"); -#endif - fprintf(stderr, "system bytes = %10u\n", system_b); - fprintf(stderr, "in use bytes = %10u\n", in_use_b); -#ifdef NO_THREADS - fprintf(stderr, "max system bytes = %10u\n", (unsigned int)max_total_mem); -#endif -#if HAVE_MMAP - fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)max_n_mmaps); - fprintf(stderr, "max mmap bytes = %10lu\n", max_mmapped_mem); -#endif -#if THREAD_STATS - fprintf(stderr, "heaps created = %10d\n", stat_n_heaps); - fprintf(stderr, "locked directly = %10ld\n", stat_lock_direct); - fprintf(stderr, "locked in loop = %10ld\n", stat_lock_loop); - fprintf(stderr, "locked waiting = %10ld\n", stat_lock_wait); - fprintf(stderr, "locked total = %10ld\n", - stat_lock_direct + stat_lock_loop + stat_lock_wait); -#endif -} - -/* - mallinfo returns a copy of updated current mallinfo. - The information reported is for the arena last used by the thread. -*/ - -struct mallinfo mALLINFo() -{ - struct mallinfo mi; - Void_t *vptr = NULL; - -#ifndef NO_THREADS - tsd_getspecific(arena_key, vptr); - if(vptr == ATFORK_ARENA_PTR) - vptr = (Void_t*)&main_arena; -#endif - malloc_update_mallinfo((vptr ? (arena*)vptr : &main_arena), &mi); - return mi; -} - - - - -/* - mallopt: - - mallopt is the general SVID/XPG interface to tunable parameters. - The format is to provide a (parameter-number, parameter-value) pair. - mallopt then sets the corresponding parameter to the argument - value if it can (i.e., so long as the value is meaningful), - and returns 1 if successful else 0. - - See descriptions of tunable parameters above. - -*/ - -#if __STD_C -int mALLOPt(int param_number, int value) -#else -int mALLOPt(param_number, value) int param_number; int value; -#endif -{ - switch(param_number) - { - case M_TRIM_THRESHOLD: - trim_threshold = value; return 1; - case M_TOP_PAD: - top_pad = value; return 1; - case M_MMAP_THRESHOLD: -#if USE_ARENAS - /* Forbid setting the threshold too high. */ - if((unsigned long)value > HEAP_MAX_SIZE/2) return 0; -#endif - mmap_threshold = value; return 1; - case M_MMAP_MAX: -#if HAVE_MMAP - n_mmaps_max = value; return 1; -#else - if (value != 0) return 0; else n_mmaps_max = value; return 1; -#endif - case M_CHECK_ACTION: - check_action = value; return 1; - - default: - return 0; - } -} - - - -/* Get/set state: malloc_get_state() records the current state of all - malloc variables (_except_ for the actual heap contents and `hook' - function pointers) in a system dependent, opaque data structure. - This data structure is dynamically allocated and can be free()d - after use. malloc_set_state() restores the state of all malloc - variables to the previously obtained state. This is especially - useful when using this malloc as part of a shared library, and when - the heap contents are saved/restored via some other method. The - primary example for this is GNU Emacs with its `dumping' procedure. - `Hook' function pointers are never saved or restored by these - functions, with two exceptions: If malloc checking was in use when - malloc_get_state() was called, then malloc_set_state() calls - __malloc_check_init() if possible; if malloc checking was not in - use in the recorded state but the user requested malloc checking, - then the hooks are reset to 0. */ - -#define MALLOC_STATE_MAGIC 0x444c4541l -#define MALLOC_STATE_VERSION (0*0x100l + 1l) /* major*0x100 + minor */ - -struct malloc_state { - long magic; - long version; - mbinptr av[NAV * 2 + 2]; - char* sbrk_base; - int sbrked_mem_bytes; - unsigned long trim_threshold; - unsigned long top_pad; - unsigned int n_mmaps_max; - unsigned long mmap_threshold; - int check_action; - unsigned long max_sbrked_mem; - unsigned long max_total_mem; - unsigned int n_mmaps; - unsigned int max_n_mmaps; - unsigned long mmapped_mem; - unsigned long max_mmapped_mem; - int using_malloc_checking; -}; - -Void_t* -mALLOC_GET_STATe() -{ - struct malloc_state* ms; - int i; - mbinptr b; - - ms = (struct malloc_state*)mALLOc(sizeof(*ms)); - if (!ms) - return 0; - (void)mutex_lock(&main_arena.mutex); - ms->magic = MALLOC_STATE_MAGIC; - ms->version = MALLOC_STATE_VERSION; - ms->av[0] = main_arena.av[0]; - ms->av[1] = main_arena.av[1]; - for(i=0; i<NAV; i++) { - b = bin_at(&main_arena, i); - if(first(b) == b) - ms->av[2*i+2] = ms->av[2*i+3] = 0; /* empty bin (or initial top) */ - else { - ms->av[2*i+2] = first(b); - ms->av[2*i+3] = last(b); - } - } - ms->sbrk_base = sbrk_base; - ms->sbrked_mem_bytes = sbrked_mem; - ms->trim_threshold = trim_threshold; - ms->top_pad = top_pad; - ms->n_mmaps_max = n_mmaps_max; - ms->mmap_threshold = mmap_threshold; - ms->check_action = check_action; - ms->max_sbrked_mem = max_sbrked_mem; -#ifdef NO_THREADS - ms->max_total_mem = max_total_mem; -#else - ms->max_total_mem = 0; -#endif - ms->n_mmaps = n_mmaps; - ms->max_n_mmaps = max_n_mmaps; - ms->mmapped_mem = mmapped_mem; - ms->max_mmapped_mem = max_mmapped_mem; -#if defined _LIBC || defined MALLOC_HOOKS - ms->using_malloc_checking = using_malloc_checking; -#else - ms->using_malloc_checking = 0; -#endif - (void)mutex_unlock(&main_arena.mutex); - return (Void_t*)ms; -} - -int -#if __STD_C -mALLOC_SET_STATe(Void_t* msptr) -#else -mALLOC_SET_STATe(msptr) Void_t* msptr; -#endif -{ - struct malloc_state* ms = (struct malloc_state*)msptr; - int i; - mbinptr b; - -#if defined _LIBC || defined MALLOC_HOOKS - disallow_malloc_check = 1; -#endif - ptmalloc_init(); - if(ms->magic != MALLOC_STATE_MAGIC) return -1; - /* Must fail if the major version is too high. */ - if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2; - (void)mutex_lock(&main_arena.mutex); - main_arena.av[0] = ms->av[0]; - main_arena.av[1] = ms->av[1]; - for(i=0; i<NAV; i++) { - b = bin_at(&main_arena, i); - if(ms->av[2*i+2] == 0) - first(b) = last(b) = b; - else { - first(b) = ms->av[2*i+2]; - last(b) = ms->av[2*i+3]; - if(i > 0) { - /* Make sure the links to the `av'-bins in the heap are correct. */ - first(b)->bk = b; - last(b)->fd = b; - } - } - } - sbrk_base = ms->sbrk_base; - sbrked_mem = ms->sbrked_mem_bytes; - trim_threshold = ms->trim_threshold; - top_pad = ms->top_pad; - n_mmaps_max = ms->n_mmaps_max; - mmap_threshold = ms->mmap_threshold; - check_action = ms->check_action; - max_sbrked_mem = ms->max_sbrked_mem; -#ifdef NO_THREADS - max_total_mem = ms->max_total_mem; -#endif - n_mmaps = ms->n_mmaps; - max_n_mmaps = ms->max_n_mmaps; - mmapped_mem = ms->mmapped_mem; - max_mmapped_mem = ms->max_mmapped_mem; - /* add version-dependent code here */ - if (ms->version >= 1) { -#if defined _LIBC || defined MALLOC_HOOKS - /* Check whether it is safe to enable malloc checking, or whether - it is necessary to disable it. */ - if (ms->using_malloc_checking && !using_malloc_checking && - !disallow_malloc_check) - __malloc_check_init (); - else if (!ms->using_malloc_checking && using_malloc_checking) { - __malloc_hook = 0; - __free_hook = 0; - __realloc_hook = 0; - __memalign_hook = 0; - using_malloc_checking = 0; - } -#endif - } - - (void)mutex_unlock(&main_arena.mutex); - return 0; -} - - - -#if defined _LIBC || defined MALLOC_HOOKS - -/* A simple, standard set of debugging hooks. Overhead is `only' one - byte per chunk; still this will catch most cases of double frees or - overruns. The goal here is to avoid obscure crashes due to invalid - usage, unlike in the MALLOC_DEBUG code. */ - -#define MAGICBYTE(p) ( ( ((size_t)p >> 3) ^ ((size_t)p >> 11)) & 0xFF ) - -/* Instrument a chunk with overrun detector byte(s) and convert it - into a user pointer with requested size sz. */ - -static Void_t* -internal_function -#if __STD_C -chunk2mem_check(mchunkptr p, size_t sz) -#else -chunk2mem_check(p, sz) mchunkptr p; size_t sz; -#endif -{ - unsigned char* m_ptr = (unsigned char*)BOUNDED_N(chunk2mem(p), sz); - size_t i; - - for(i = chunksize(p) - (chunk_is_mmapped(p) ? 2*SIZE_SZ+1 : SIZE_SZ+1); - i > sz; - i -= 0xFF) { - if(i-sz < 0x100) { - m_ptr[i] = (unsigned char)(i-sz); - break; - } - m_ptr[i] = 0xFF; - } - m_ptr[sz] = MAGICBYTE(p); - return (Void_t*)m_ptr; -} - -/* Convert a pointer to be free()d or realloc()ed to a valid chunk - pointer. If the provided pointer is not valid, return NULL. */ - -static mchunkptr -internal_function -#if __STD_C -mem2chunk_check(Void_t* mem) -#else -mem2chunk_check(mem) Void_t* mem; -#endif -{ - mchunkptr p; - INTERNAL_SIZE_T sz, c; - unsigned char magic; - - p = mem2chunk(mem); - if(!aligned_OK(p)) return NULL; - if( (char*)p>=sbrk_base && (char*)p<(sbrk_base+sbrked_mem) ) { - /* Must be a chunk in conventional heap memory. */ - if(chunk_is_mmapped(p) || - ( (sz = chunksize(p)), ((char*)p + sz)>=(sbrk_base+sbrked_mem) ) || - sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) || - ( !prev_inuse(p) && (p->prev_size&MALLOC_ALIGN_MASK || - (long)prev_chunk(p)<(long)sbrk_base || - next_chunk(prev_chunk(p))!=p) )) - return NULL; - magic = MAGICBYTE(p); - for(sz += SIZE_SZ-1; (c = ((unsigned char*)p)[sz]) != magic; sz -= c) { - if(c<=0 || sz<(c+2*SIZE_SZ)) return NULL; - } - ((unsigned char*)p)[sz] ^= 0xFF; - } else { - unsigned long offset, page_mask = malloc_getpagesize-1; - - /* mmap()ed chunks have MALLOC_ALIGNMENT or higher power-of-two - alignment relative to the beginning of a page. Check this - first. */ - offset = (unsigned long)mem & page_mask; - if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 && - offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 && - offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 && - offset<0x2000) || - !chunk_is_mmapped(p) || (p->size & PREV_INUSE) || - ( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) || - ( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) ) - return NULL; - magic = MAGICBYTE(p); - for(sz -= 1; (c = ((unsigned char*)p)[sz]) != magic; sz -= c) { - if(c<=0 || sz<(c+2*SIZE_SZ)) return NULL; - } - ((unsigned char*)p)[sz] ^= 0xFF; - } - return p; -} - -/* Check for corruption of the top chunk, and try to recover if - necessary. */ - -static int -internal_function -#if __STD_C -top_check(void) -#else -top_check() -#endif -{ - mchunkptr t = top(&main_arena); - char* brk, * new_brk; - INTERNAL_SIZE_T front_misalign, sbrk_size; - unsigned long pagesz = malloc_getpagesize; - - if((char*)t + chunksize(t) == sbrk_base + sbrked_mem || - t == initial_top(&main_arena)) return 0; - - if(check_action & 1) - fprintf(stderr, "malloc: top chunk is corrupt\n"); - if(check_action & 2) - abort(); - - /* Try to set up a new top chunk. */ - brk = MORECORE(0); - front_misalign = (unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK; - if (front_misalign > 0) - front_misalign = MALLOC_ALIGNMENT - front_misalign; - sbrk_size = front_misalign + top_pad + MINSIZE; - sbrk_size += pagesz - ((unsigned long)(brk + sbrk_size) & (pagesz - 1)); - new_brk = (char*)(MORECORE (sbrk_size)); - if (new_brk == (char*)(MORECORE_FAILURE)) return -1; - sbrked_mem = (new_brk - sbrk_base) + sbrk_size; - - top(&main_arena) = (mchunkptr)(brk + front_misalign); - set_head(top(&main_arena), (sbrk_size - front_misalign) | PREV_INUSE); - - return 0; -} - -static Void_t* -#if __STD_C -malloc_check(size_t sz, const Void_t *caller) -#else -malloc_check(sz, caller) size_t sz; const Void_t *caller; -#endif -{ - mchunkptr victim; - INTERNAL_SIZE_T nb; - - if(request2size(sz+1, nb)) - return 0; - (void)mutex_lock(&main_arena.mutex); - victim = (top_check() >= 0) ? chunk_alloc(&main_arena, nb) : NULL; - (void)mutex_unlock(&main_arena.mutex); - if(!victim) return NULL; - return chunk2mem_check(victim, sz); -} - -static void -#if __STD_C -free_check(Void_t* mem, const Void_t *caller) -#else -free_check(mem, caller) Void_t* mem; const Void_t *caller; -#endif -{ - mchunkptr p; - - if(!mem) return; - (void)mutex_lock(&main_arena.mutex); - p = mem2chunk_check(mem); - if(!p) { - (void)mutex_unlock(&main_arena.mutex); - if(check_action & 1) - fprintf(stderr, "free(): invalid pointer %p!\n", mem); - if(check_action & 2) - abort(); - return; - } -#if HAVE_MMAP - if (chunk_is_mmapped(p)) { - (void)mutex_unlock(&main_arena.mutex); - munmap_chunk(p); - return; - } -#endif -#if 0 /* Erase freed memory. */ - memset(mem, 0, chunksize(p) - (SIZE_SZ+1)); -#endif - chunk_free(&main_arena, p); - (void)mutex_unlock(&main_arena.mutex); -} - -static Void_t* -#if __STD_C -realloc_check(Void_t* oldmem, size_t bytes, const Void_t *caller) -#else -realloc_check(oldmem, bytes, caller) - Void_t* oldmem; size_t bytes; const Void_t *caller; -#endif -{ - mchunkptr oldp, newp; - INTERNAL_SIZE_T nb, oldsize; - - if (oldmem == 0) return malloc_check(bytes, NULL); - (void)mutex_lock(&main_arena.mutex); - oldp = mem2chunk_check(oldmem); - if(!oldp) { - (void)mutex_unlock(&main_arena.mutex); - if(check_action & 1) - fprintf(stderr, "realloc(): invalid pointer %p!\n", oldmem); - if(check_action & 2) - abort(); - return malloc_check(bytes, NULL); - } - oldsize = chunksize(oldp); - - if(request2size(bytes+1, nb)) { - (void)mutex_unlock(&main_arena.mutex); - return 0; - } - -#if HAVE_MMAP - if (chunk_is_mmapped(oldp)) { -#if HAVE_MREMAP - newp = mremap_chunk(oldp, nb); - if(!newp) { -#endif - /* Note the extra SIZE_SZ overhead. */ - if(oldsize - SIZE_SZ >= nb) newp = oldp; /* do nothing */ - else { - /* Must alloc, copy, free. */ - newp = (top_check() >= 0) ? chunk_alloc(&main_arena, nb) : NULL; - if (newp) { - MALLOC_COPY(BOUNDED_N(chunk2mem(newp), nb), - oldmem, oldsize - 2*SIZE_SZ, 0); - munmap_chunk(oldp); - } - } -#if HAVE_MREMAP - } -#endif - } else { -#endif /* HAVE_MMAP */ - newp = (top_check() >= 0) ? - chunk_realloc(&main_arena, oldp, oldsize, nb) : NULL; -#if 0 /* Erase freed memory. */ - nb = chunksize(newp); - if(oldp<newp || oldp>=chunk_at_offset(newp, nb)) { - memset((char*)oldmem + 2*sizeof(mbinptr), 0, - oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1)); - } else if(nb > oldsize+SIZE_SZ) { - memset((char*)BOUNDED_N(chunk2mem(newp), bytes) + oldsize, - 0, nb - (oldsize+SIZE_SZ)); - } -#endif -#if HAVE_MMAP - } -#endif - (void)mutex_unlock(&main_arena.mutex); - - if(!newp) return NULL; - return chunk2mem_check(newp, bytes); -} - -static Void_t* -#if __STD_C -memalign_check(size_t alignment, size_t bytes, const Void_t *caller) -#else -memalign_check(alignment, bytes, caller) - size_t alignment; size_t bytes; const Void_t *caller; -#endif -{ - INTERNAL_SIZE_T nb; - mchunkptr p; - - if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes, NULL); - if (alignment < MINSIZE) alignment = MINSIZE; - - if(request2size(bytes+1, nb)) - return 0; - (void)mutex_lock(&main_arena.mutex); - p = (top_check() >= 0) ? chunk_align(&main_arena, nb, alignment) : NULL; - (void)mutex_unlock(&main_arena.mutex); - if(!p) return NULL; - return chunk2mem_check(p, bytes); -} - -#ifndef NO_THREADS - -/* The following hooks are used when the global initialization in - ptmalloc_init() hasn't completed yet. */ - -static Void_t* -#if __STD_C -malloc_starter(size_t sz, const Void_t *caller) -#else -malloc_starter(sz, caller) size_t sz; const Void_t *caller; -#endif -{ - INTERNAL_SIZE_T nb; - mchunkptr victim; - - if(request2size(sz, nb)) - return 0; - victim = chunk_alloc(&main_arena, nb); - - return victim ? BOUNDED_N(chunk2mem(victim), sz) : 0; -} - -static void -#if __STD_C -free_starter(Void_t* mem, const Void_t *caller) -#else -free_starter(mem, caller) Void_t* mem; const Void_t *caller; -#endif -{ - mchunkptr p; - - if(!mem) return; - p = mem2chunk(mem); -#if HAVE_MMAP - if (chunk_is_mmapped(p)) { - munmap_chunk(p); - return; - } -#endif - chunk_free(&main_arena, p); -} - -/* The following hooks are used while the `atfork' handling mechanism - is active. */ - -static Void_t* -#if __STD_C -malloc_atfork (size_t sz, const Void_t *caller) -#else -malloc_atfork(sz, caller) size_t sz; const Void_t *caller; -#endif -{ - Void_t *vptr = NULL; - INTERNAL_SIZE_T nb; - mchunkptr victim; - - tsd_getspecific(arena_key, vptr); - if(vptr == ATFORK_ARENA_PTR) { - /* We are the only thread that may allocate at all. */ - if(save_malloc_hook != malloc_check) { - if(request2size(sz, nb)) - return 0; - victim = chunk_alloc(&main_arena, nb); - return victim ? BOUNDED_N(chunk2mem(victim), sz) : 0; - } else { - if(top_check()<0 || request2size(sz+1, nb)) - return 0; - victim = chunk_alloc(&main_arena, nb); - return victim ? chunk2mem_check(victim, sz) : 0; - } - } else { - /* Suspend the thread until the `atfork' handlers have completed. - By that time, the hooks will have been reset as well, so that - mALLOc() can be used again. */ - (void)mutex_lock(&list_lock); - (void)mutex_unlock(&list_lock); - return mALLOc(sz); - } -} - -static void -#if __STD_C -free_atfork(Void_t* mem, const Void_t *caller) -#else -free_atfork(mem, caller) Void_t* mem; const Void_t *caller; -#endif -{ - Void_t *vptr = NULL; - arena *ar_ptr; - mchunkptr p; /* chunk corresponding to mem */ - - if (mem == 0) /* free(0) has no effect */ - return; - - p = mem2chunk(mem); /* do not bother to replicate free_check here */ - -#if HAVE_MMAP - if (chunk_is_mmapped(p)) /* release mmapped memory. */ - { - munmap_chunk(p); - return; - } -#endif - - ar_ptr = arena_for_ptr(p); - tsd_getspecific(arena_key, vptr); - if(vptr != ATFORK_ARENA_PTR) - (void)mutex_lock(&ar_ptr->mutex); - chunk_free(ar_ptr, p); - if(vptr != ATFORK_ARENA_PTR) - (void)mutex_unlock(&ar_ptr->mutex); -} - -#endif /* !defined NO_THREADS */ - -#endif /* defined _LIBC || defined MALLOC_HOOKS */ - - - -#ifdef _LIBC - -/* default method of getting more storage */ -__malloc_ptr_t -__default_morecore (int inc) -{ - __malloc_ptr_t result = (__malloc_ptr_t)sbrk (inc); - if (result == (__malloc_ptr_t)-1) - return NULL; - return result; -} - -/* We need a wrapper function for one of the additions of POSIX. */ -int -__posix_memalign (void **memptr, size_t alignment, size_t size) -{ - void *mem; - - /* Test whether the ALIGNMENT argument is valid. It must be a power - of two multiple of sizeof (void *). */ - if (alignment % sizeof (void *) != 0 || (alignment & (alignment - 1)) != 0) - return EINVAL; - - mem = __libc_memalign (alignment, size); - - if (mem != NULL) - { - *memptr = mem; - return 0; - } - - return ENOMEM; -} -weak_alias (__posix_memalign, posix_memalign) - -weak_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc) -weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree) -weak_alias (__libc_free, __free) weak_alias (__libc_free, free) -weak_alias (__libc_malloc, __malloc) weak_alias (__libc_malloc, malloc) -weak_alias (__libc_memalign, __memalign) weak_alias (__libc_memalign, memalign) -weak_alias (__libc_realloc, __realloc) weak_alias (__libc_realloc, realloc) -weak_alias (__libc_valloc, __valloc) weak_alias (__libc_valloc, valloc) -weak_alias (__libc_pvalloc, __pvalloc) weak_alias (__libc_pvalloc, pvalloc) -weak_alias (__libc_mallinfo, __mallinfo) weak_alias (__libc_mallinfo, mallinfo) -weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt) - -weak_alias (__malloc_stats, malloc_stats) -weak_alias (__malloc_usable_size, malloc_usable_size) -weak_alias (__malloc_trim, malloc_trim) -weak_alias (__malloc_get_state, malloc_get_state) -weak_alias (__malloc_set_state, malloc_set_state) -#endif - -/* - -History: - - V2.6.4-pt3 Thu Feb 20 1997 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de) - * Added malloc_get/set_state() (mainly for use in GNU emacs), - using interface from Marcus Daniels - * All parameters are now adjustable via environment variables - - V2.6.4-pt2 Sat Dec 14 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de) - * Added debugging hooks - * Fixed possible deadlock in realloc() when out of memory - * Don't pollute namespace in glibc: use __getpagesize, __mmap, etc. - - V2.6.4-pt Wed Dec 4 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de) - * Very minor updates from the released 2.6.4 version. - * Trimmed include file down to exported data structures. - * Changes from H.J. Lu for glibc-2.0. - - V2.6.3i-pt Sep 16 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de) - * Many changes for multiple threads - * Introduced arenas and heaps - - V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) - * Added pvalloc, as recommended by H.J. Liu - * Added 64bit pointer support mainly from Wolfram Gloger - * Added anonymously donated WIN32 sbrk emulation - * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen - * malloc_extend_top: fix mask error that caused wastage after - foreign sbrks - * Add linux mremap support code from HJ Liu - - V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) - * Integrated most documentation with the code. - * Add support for mmap, with help from - Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Use last_remainder in more cases. - * Pack bins using idea from colin@nyx10.cs.du.edu - * Use ordered bins instead of best-fit threshold - * Eliminate block-local decls to simplify tracing and debugging. - * Support another case of realloc via move into top - * Fix error occurring when initial sbrk_base not word-aligned. - * Rely on page size for units instead of SBRK_UNIT to - avoid surprises about sbrk alignment conventions. - * Add mallinfo, mallopt. Thanks to Raymond Nijssen - (raymond@es.ele.tue.nl) for the suggestion. - * Add `pad' argument to malloc_trim and top_pad mallopt parameter. - * More precautions for cases where other routines call sbrk, - courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Added macros etc., allowing use in linux libc from - H.J. Lu (hjl@gnu.ai.mit.edu) - * Inverted this history list - - V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) - * Re-tuned and fixed to behave more nicely with V2.6.0 changes. - * Removed all preallocation code since under current scheme - the work required to undo bad preallocations exceeds - the work saved in good cases for most test programs. - * No longer use return list or unconsolidated bins since - no scheme using them consistently outperforms those that don't - given above changes. - * Use best fit for very large chunks to prevent some worst-cases. - * Added some support for debugging - - V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) - * Removed footers when chunks are in use. Thanks to - Paul Wilson (wilson@cs.texas.edu) for the suggestion. - - V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) - * Added malloc_trim, with help from Wolfram Gloger - (wmglo@Dent.MED.Uni-Muenchen.DE). - - V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) - - V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) - * realloc: try to expand in both directions - * malloc: swap order of clean-bin strategy; - * realloc: only conditionally expand backwards - * Try not to scavenge used bins - * Use bin counts as a guide to preallocation - * Occasionally bin return list chunks in first scan - * Add a few optimizations from colin@nyx10.cs.du.edu - - V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) - * faster bin computation & slightly different binning - * merged all consolidations to one part of malloc proper - (eliminating old malloc_find_space & malloc_clean_bin) - * Scan 2 returns chunks (not just 1) - * Propagate failure in realloc if malloc returns 0 - * Add stuff to allow compilation on non-ANSI compilers - from kpv@research.att.com - - V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) - * removed potential for odd address access in prev_chunk - * removed dependency on getpagesize.h - * misc cosmetics and a bit more internal documentation - * anticosmetics: mangled names in macros to evade debugger strangeness - * tested on sparc, hp-700, dec-mips, rs6000 - with gcc & native cc (hp, dec only) allowing - Detlefs & Zorn comparison study (in SIGPLAN Notices.) - - Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) - * Based loosely on libg++-1.2X malloc. (It retains some of the overall - structure of old version, but most details differ.) - -*/ diff --git a/newlib/libc/sys/linux/mallocr.c b/newlib/libc/sys/linux/mallocr.c deleted file mode 100644 index b5129a5e1..000000000 --- a/newlib/libc/sys/linux/mallocr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void * -_malloc_r (struct _reent *ptr, size_t size) -{ - return malloc (size); -} diff --git a/newlib/libc/sys/linux/malloptr.c b/newlib/libc/sys/linux/malloptr.c deleted file mode 100644 index 13d4e9f6a..000000000 --- a/newlib/libc/sys/linux/malloptr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -int -_mallopt_r (struct _reent *ptr, int param_number, int value) -{ - return mallopt (param_number, value); -} diff --git a/newlib/libc/sys/linux/mallstatsr.c b/newlib/libc/sys/linux/mallstatsr.c deleted file mode 100644 index 8a1f64211..000000000 --- a/newlib/libc/sys/linux/mallstatsr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void -_malloc_stats_r (struct _reent *ptr) -{ - malloc_stats (); -} diff --git a/newlib/libc/sys/linux/mcheck.c b/newlib/libc/sys/linux/mcheck.c deleted file mode 100644 index 9e42dccad..000000000 --- a/newlib/libc/sys/linux/mcheck.c +++ /dev/null @@ -1,356 +0,0 @@ -/* Standard debugging hooks for `malloc'. - Copyright (C) 1990-1997, 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written May 1989 by Mike Haertel. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib, July 9, 2002 by Jeff Johnston */ - -#ifndef _MALLOC_INTERNAL -# define _MALLOC_INTERNAL -# include <malloc.h> -# include <mcheck.h> -# include <stdint.h> -# include <stdio.h> -# include <stdlib.h> -# include <libintl.h> -# include <sys/cdefs.h> -#endif - -/* Old hook values. */ -static void (*old_free_hook) __P ((__ptr_t ptr, __const __ptr_t)); -static __ptr_t (*old_malloc_hook) __P ((__malloc_size_t size, const __ptr_t)); -static __ptr_t (*old_realloc_hook) __P ((__ptr_t ptr, __malloc_size_t size, - __const __ptr_t)); - -/* Function to call when something awful happens. */ -static void (*abortfunc) __P ((enum mcheck_status)); - -/* Arbitrary magical numbers. */ -#define MAGICWORD 0xfedabeeb -#define MAGICFREE 0xd8675309 -#define MAGICBYTE ((char) 0xd7) -#define MALLOCFLOOD ((char) 0x93) -#define FREEFLOOD ((char) 0x95) - -struct hdr - { - __malloc_size_t size; /* Exact size requested by user. */ - unsigned long int magic; /* Magic number to check header integrity. */ - struct hdr *prev; - struct hdr *next; - }; - -/* This is the beginning of the list of all memory blocks allocated. - It is only constructed if the pedantic testing is requested. */ -static struct hdr *root; - -static int mcheck_used; - -/* Nonzero if pedentic checking of all blocks is requested. */ -static int pedantic; - -#if defined _LIBC || defined STDC_HEADERS || defined USG -# include <string.h> -# define flood memset -#else -static void flood __P ((__ptr_t, int, __malloc_size_t)); -static void -flood (ptr, val, size) - __ptr_t ptr; - int val; - __malloc_size_t size; -{ - char *cp = ptr; - while (size--) - *cp++ = val; -} -#endif - -static enum mcheck_status checkhdr __P ((const struct hdr *)); -static enum mcheck_status -checkhdr (hdr) - const struct hdr *hdr; -{ - enum mcheck_status status; - - if (!mcheck_used) - /* Maybe the mcheck used is disabled? This happens when we find - an error and report it. */ - return MCHECK_OK; - - switch (hdr->magic ^ ((uintptr_t) hdr->prev + (uintptr_t) hdr->next)) - { - default: - status = MCHECK_HEAD; - break; - case MAGICFREE: - status = MCHECK_FREE; - break; - case MAGICWORD: - if (((char *) &hdr[1])[hdr->size] != MAGICBYTE) - status = MCHECK_TAIL; - else - status = MCHECK_OK; - break; - } - if (status != MCHECK_OK) - { - mcheck_used = 0; - (*abortfunc) (status); - mcheck_used = 1; - } - return status; -} - -void -mcheck_check_all () -{ - /* Walk through all the active blocks and test whether they were tempered - with. */ - struct hdr *runp = root; - - /* Temporarily turn off the checks. */ - pedantic = 0; - - while (runp != NULL) - { - (void) checkhdr (runp); - - runp = runp->next; - } - - /* Turn checks on again. */ - pedantic = 1; -} - -static void unlink_blk __P ((struct hdr *ptr)); -static void -unlink_blk (ptr) - struct hdr *ptr; -{ - if (ptr->next != NULL) - { - ptr->next->prev = ptr->prev; - ptr->next->magic = MAGICWORD ^ ((uintptr_t) ptr->next->prev - + (uintptr_t) ptr->next->next); - } - if (ptr->prev != NULL) - { - ptr->prev->next = ptr->next; - ptr->prev->magic = MAGICWORD ^ ((uintptr_t) ptr->prev->prev - + (uintptr_t) ptr->prev->next); - } - else - root = ptr->next; -} - -static void link_blk __P ((struct hdr *ptr)); -static void -link_blk (hdr) - struct hdr *hdr; -{ - hdr->prev = NULL; - hdr->next = root; - root = hdr; - hdr->magic = MAGICWORD ^ (uintptr_t) hdr->next; - - /* And the next block. */ - if (hdr->next != NULL) - { - hdr->next->prev = hdr; - hdr->next->magic = MAGICWORD ^ ((uintptr_t) hdr - + (uintptr_t) hdr->next->next); - } -} - -static void freehook __P ((__ptr_t, const __ptr_t)); -static void -freehook (ptr, caller) - __ptr_t ptr; - const __ptr_t caller; -{ - if (pedantic) - mcheck_check_all (); - if (ptr) - { - struct hdr *hdr = ((struct hdr *) ptr) - 1; - checkhdr (hdr); - hdr->magic = MAGICFREE; - unlink_blk (hdr); - hdr->prev = hdr->next = NULL; - flood (ptr, FREEFLOOD, hdr->size); - ptr = (__ptr_t) hdr; - } - __free_hook = old_free_hook; - if (old_free_hook != NULL) - (*old_free_hook) (ptr, caller); - else - free (ptr); - __free_hook = freehook; -} - -static __ptr_t mallochook __P ((__malloc_size_t, const __ptr_t)); -static __ptr_t -mallochook (size, caller) - __malloc_size_t size; - const __ptr_t caller; -{ - struct hdr *hdr; - - if (pedantic) - mcheck_check_all (); - - __malloc_hook = old_malloc_hook; - if (old_malloc_hook != NULL) - hdr = (struct hdr *) (*old_malloc_hook) (sizeof (struct hdr) + size + 1, - caller); - else - hdr = (struct hdr *) malloc (sizeof (struct hdr) + size + 1); - __malloc_hook = mallochook; - if (hdr == NULL) - return NULL; - - hdr->size = size; - link_blk (hdr); - ((char *) &hdr[1])[size] = MAGICBYTE; - flood ((__ptr_t) (hdr + 1), MALLOCFLOOD, size); - return (__ptr_t) (hdr + 1); -} - -static __ptr_t reallochook __P ((__ptr_t, __malloc_size_t, const __ptr_t)); -static __ptr_t -reallochook (ptr, size, caller) - __ptr_t ptr; - __malloc_size_t size; - const __ptr_t caller; -{ - struct hdr *hdr; - __malloc_size_t osize; - - if (pedantic) - mcheck_check_all (); - - if (ptr) - { - hdr = ((struct hdr *) ptr) - 1; - osize = hdr->size; - - checkhdr (hdr); - unlink_blk (hdr); - if (size < osize) - flood ((char *) ptr + size, FREEFLOOD, osize - size); - } - else - { - osize = 0; - hdr = NULL; - } - __free_hook = old_free_hook; - __malloc_hook = old_malloc_hook; - __realloc_hook = old_realloc_hook; - if (old_realloc_hook != NULL) - hdr = (struct hdr *) (*old_realloc_hook) ((__ptr_t) hdr, - sizeof (struct hdr) + size + 1, - caller); - else - hdr = (struct hdr *) realloc ((__ptr_t) hdr, - sizeof (struct hdr) + size + 1); - __free_hook = freehook; - __malloc_hook = mallochook; - __realloc_hook = reallochook; - if (hdr == NULL) - return NULL; - - hdr->size = size; - link_blk (hdr); - ((char *) &hdr[1])[size] = MAGICBYTE; - if (size > osize) - flood ((char *) (hdr + 1) + osize, MALLOCFLOOD, size - osize); - return (__ptr_t) (hdr + 1); -} - -static void mabort __P ((enum mcheck_status status)) - __attribute__ ((noreturn)); -static void -mabort (status) - enum mcheck_status status; -{ - const char *msg; - switch (status) - { - case MCHECK_OK: - msg = _("memory is consistent, library is buggy\n"); - break; - case MCHECK_HEAD: - msg = _("memory clobbered before allocated block\n"); - break; - case MCHECK_TAIL: - msg = _("memory clobbered past end of allocated block\n"); - break; - case MCHECK_FREE: - msg = _("block freed twice\n"); - break; - default: - msg = _("bogus mcheck_status, library is buggy\n"); - break; - } - fprintf (stderr, "mcheck: %s", msg); - fflush (stderr); - abort (); -} - -int -mcheck (func) - void (*func) __P ((enum mcheck_status)); -{ - abortfunc = (func != NULL) ? func : &mabort; - - /* These hooks may not be safely inserted if malloc is already in use. */ - if (__malloc_initialized <= 0 && !mcheck_used) - { - /* We call malloc() once here to ensure it is initialized. */ - void *p = malloc (0); - free (p); - - old_free_hook = __free_hook; - __free_hook = freehook; - old_malloc_hook = __malloc_hook; - __malloc_hook = mallochook; - old_realloc_hook = __realloc_hook; - __realloc_hook = reallochook; - mcheck_used = 1; - } - - return mcheck_used ? 0 : -1; -} - -int -mcheck_pedantic (func) - void (*func) __P ((enum mcheck_status)); -{ - int res = mcheck (func); - if (res == 0) - pedantic = 1; - return res; -} - -enum mcheck_status -mprobe (__ptr_t ptr) -{ - return mcheck_used ? checkhdr (((struct hdr *) ptr) - 1) : MCHECK_DISABLED; -} diff --git a/newlib/libc/sys/linux/mhooks.h b/newlib/libc/sys/linux/mhooks.h deleted file mode 100644 index 4a2e60656..000000000 --- a/newlib/libc/sys/linux/mhooks.h +++ /dev/null @@ -1,12 +0,0 @@ - -/* Functions used by mcheck/mprobe */ -extern void (*__malloc_initialize_hook) (void); -extern void (*__free_hook) (void * __ptr, const void *); -extern void * (*__malloc_hook) (size_t __size, const void *); -extern void * (*__realloc_hook) (void * __ptr, size_t __size, const void *); -extern void * (*__memalign_hook) (size_t __alignment, size_t __size, - const void *); -extern void (*__after_morecore_hook) (void); -extern void __malloc_check_init (void); - -extern int __malloc_initialized; diff --git a/newlib/libc/sys/linux/mmap.c b/newlib/libc/sys/linux/mmap.c deleted file mode 100644 index 6af2b851d..000000000 --- a/newlib/libc/sys/linux/mmap.c +++ /dev/null @@ -1,20 +0,0 @@ -/* libc/sys/linux/mmap.c - Memory mapping functions */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <sys/mman.h> -#include <machine/syscall.h> - -_syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,off); -_syscall2(int,munmap,void *,addr,size_t,len); -_syscall1(int,mlockall,int,flags); -_syscall0(int,munlockall); -_syscall2(int,mlock,const void *,addr,size_t,len); -_syscall2(int,munlock,const void *,addr,size_t,len); -_syscall3(int,mprotect,void *,addr,size_t,len,int,prot); -_syscall3(int,msync,void *,addr,size_t,len,int,flags); -_syscall4(void *,mremap,void *,addr,size_t,oldlen,size_t,newlen,int,maymove); - -weak_alias(__libc_mmap,__mmap) -weak_alias(__libc_munmap,__munmap) -weak_alias(__libc_mremap,__mremap) diff --git a/newlib/libc/sys/linux/mntent.c b/newlib/libc/sys/linux/mntent.c deleted file mode 100644 index ecd223f50..000000000 --- a/newlib/libc/sys/linux/mntent.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <mntent.h> -#include <stdlib.h> -#include <libc-symbols.h> -#include <bits/libc-lock.h> - -/* We don't want to allocate the static buffer all the time since it - is not always used (in fact, rather infrequently). Accept the - extra cost of a `malloc'. */ -static char *getmntent_buffer; - -/* This is the size of the buffer. This is really big. */ -#define BUFFER_SIZE 4096 - - -static void -allocate (void) -{ - getmntent_buffer = (char *) malloc (BUFFER_SIZE); -} - - -struct mntent * -getmntent (FILE *stream) -{ - static struct mntent m; - static int once; - - do { - if (__pthread_once != NULL) - __pthread_once (&once, allocate); - else if (once == 0) { - allocate (); - once = !(0); - } - } while (0); - - - if (getmntent_buffer == NULL) - /* If no core is available we don't have a chance to run the - program successfully and so returning NULL is an acceptable - result. */ - return NULL; - - return __getmntent_r (stream, &m, getmntent_buffer, BUFFER_SIZE); -} - - -/* Make sure the memory is freed if the programs ends while in - memory-debugging mode and something actually was allocated. */ -static void -__attribute__ ((unused)) -free_mem (void) -{ - free (getmntent_buffer); -} - -text_set_element (__libc_subfreeres, free_mem); diff --git a/newlib/libc/sys/linux/mntent_r.c b/newlib/libc/sys/linux/mntent_r.c deleted file mode 100644 index b534fb69d..000000000 --- a/newlib/libc/sys/linux/mntent_r.c +++ /dev/null @@ -1,256 +0,0 @@ -/* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <alloca.h> -#include <mntent.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <machine/weakalias.h> - -/* Prepare to begin reading and/or writing mount table entries from the - beginning of FILE. MODE is as for `fopen'. */ -FILE * -__setmntent (const char *file, const char *mode) -{ - FILE *result = fopen (file, mode); - - return result; -} -weak_alias (__setmntent, setmntent) - - -/* Close a stream opened with `setmntent'. */ -int -__endmntent (FILE *stream) -{ - if (stream) /* SunOS 4.x allows for NULL stream */ - fclose (stream); - return 1; /* SunOS 4.x says to always return 1 */ -} -weak_alias (__endmntent, endmntent) - - -/* Since the values in a line are separated by spaces, a name cannot - contain a space. Therefore some programs encode spaces in names - by the strings "\040". We undo the encoding when reading an entry. - The decoding happens in place. */ -static char * -decode_name (char *buf) -{ - char *rp = buf; - char *wp = buf; - - do - if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '4' && rp[3] == '0') - { - /* \040 is a SPACE. */ - *wp++ = ' '; - rp += 3; - } - else if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '1' && rp[3] == '2') - { - /* \012 is a TAB. */ - *wp++ = '\t'; - rp += 3; - } - else if (rp[0] == '\\' && rp[1] == '\\') - { - /* We have to escape \\ to be able to represent all characters. */ - *wp++ = '\\'; - rp += 1; - } - else - *wp++ = *rp; - while (*rp++ != '\0'); - - return buf; -} - - -/* Read one mount table entry from STREAM. Returns a pointer to storage - reused on the next call, or null for EOF or error (use feof/ferror to - check). */ -struct mntent * -__getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz) -{ - char *cp; - char *head; - - flockfile (stream); - do - { - char *end_ptr; - - if (fgets (buffer, bufsiz, stream) == NULL) - { - funlockfile (stream); - return NULL; - } - - end_ptr = strchr (buffer, '\n'); - if (end_ptr != NULL) /* chop newline */ - *end_ptr = '\0'; - else - { - /* Not the whole line was read. Do it now but forget it. */ - char tmp[1024]; - while (fgets (tmp, sizeof tmp, stream) != NULL) - if (strchr (tmp, '\n') != NULL) - break; - } - - head = buffer + strspn (buffer, " \t"); - /* skip empty lines and comment lines: */ - } - while (head[0] == '\0' || head[0] == '#'); - - cp = strsep (&head, " \t"); - mp->mnt_fsname = cp != NULL ? decode_name (cp) : (char *) ""; - if (head) - head += strspn (head, " \t"); - cp = strsep (&head, " \t"); - mp->mnt_dir = cp != NULL ? decode_name (cp) : (char *) ""; - if (head) - head += strspn (head, " \t"); - cp = strsep (&head, " \t"); - mp->mnt_type = cp != NULL ? decode_name (cp) : (char *) ""; - if (head) - head += strspn (head, " \t"); - cp = strsep (&head, " \t"); - mp->mnt_opts = cp != NULL ? decode_name (cp) : (char *) ""; - switch (head ? sscanf (head, " %d %d ", &mp->mnt_freq, &mp->mnt_passno) : 0) - { - case 0: - mp->mnt_freq = 0; - case 1: - mp->mnt_passno = 0; - case 2: - break; - } - funlockfile (stream); - - return mp; -} -weak_alias (__getmntent_r, getmntent_r) - - -/* We have to use an encoding for names if they contain spaces or tabs. - To be able to represent all characters we also have to escape the - backslash itself. This "function" must be a macro since we use - `alloca'. */ -#define encode_name(name) \ - do { \ - const char *rp = name; \ - \ - while (*rp != '\0') \ - if (*rp == ' ' || *rp == '\t' || *rp == '\\') \ - break; \ - else \ - ++rp; \ - \ - if (*rp != '\0') \ - { \ - /* In the worst case the length of the string can increase to \ - founr times the current length. */ \ - char *wp; \ - \ - rp = name; \ - name = wp = (char *) alloca (strlen (name) * 4 + 1); \ - \ - do \ - if (*rp == ' ') \ - { \ - *wp++ = '\\'; \ - *wp++ = '0'; \ - *wp++ = '4'; \ - *wp++ = '0'; \ - } \ - else if (*rp == '\t') \ - { \ - *wp++ = '\\'; \ - *wp++ = '0'; \ - *wp++ = '1'; \ - *wp++ = '2'; \ - } \ - else if (*rp == '\\') \ - { \ - *wp++ = '\\'; \ - *wp++ = '\\'; \ - } \ - else \ - *wp++ = *rp; \ - while (*rp++ != '\0'); \ - } \ - } while (0) - - -/* Write the mount table entry described by MNT to STREAM. - Return zero on success, nonzero on failure. */ -int -__addmntent (FILE *stream, const struct mntent *mnt) -{ - struct mntent mntcopy = *mnt; - if (fseek (stream, 0, SEEK_END)) - return 1; - - /* Encode spaces and tabs in the names. */ - encode_name (mntcopy.mnt_fsname); - encode_name (mntcopy.mnt_dir); - encode_name (mntcopy.mnt_type); - encode_name (mntcopy.mnt_opts); - - return (fprintf (stream, "%s %s %s %s %d %d\n", - mntcopy.mnt_fsname, - mntcopy.mnt_dir, - mntcopy.mnt_type, - mntcopy.mnt_opts, - mntcopy.mnt_freq, - mntcopy.mnt_passno) - < 0 ? 1 : 0); -} -weak_alias (__addmntent, addmntent) - - -/* Search MNT->mnt_opts for an option matching OPT. - Returns the address of the substring, or null if none found. */ -char * -__hasmntopt (const struct mntent *mnt, const char *opt) -{ - const size_t optlen = strlen (opt); - char *rest = mnt->mnt_opts, *p; - - while ((p = strstr (rest, opt)) != NULL) - { - if (p == rest - || (p[-1] == ',' - && (p[optlen] == '\0' || - p[optlen] == '=' || - p[optlen] == ','))) - return p; - - rest = strchr (rest, ','); - if (rest == NULL) - break; - ++rest; - } - - return NULL; -} -weak_alias (__hasmntopt, hasmntopt) diff --git a/newlib/libc/sys/linux/mq_close.c b/newlib/libc/sys/linux/mq_close.c deleted file mode 100644 index 884c30f64..000000000 --- a/newlib/libc/sys/linux/mq_close.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <errno.h> -#include <sys/sem.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#include "mqlocal.h" - -int -mq_close (mqd_t msgid) -{ - struct libc_mq *info; - struct sembuf sb0 = {0, -1, 0}; - int rc; - int semid; - - info = __find_mq (msgid); - - if (info == NULL) - { - errno = EBADF; - return -1; - } - - /* lock message queue */ - semid = info->semid; - rc = semop (semid, &sb0, 1); - - if (rc == 0) - { - __cleanup_mq (msgid); - - /* unlock message queue */ - sb0.sem_op = 1; - semop (semid, &sb0, 1); - } - - return rc; -} - - - - - - diff --git a/newlib/libc/sys/linux/mq_getattr.c b/newlib/libc/sys/linux/mq_getattr.c deleted file mode 100644 index 65813f3b3..000000000 --- a/newlib/libc/sys/linux/mq_getattr.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <errno.h> -#include <sys/sem.h> -#include <string.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#include "mqlocal.h" - -int -mq_getattr (mqd_t msgid, struct mq_attr *mqstat) -{ - struct libc_mq *info; - struct sembuf sb0 = {0, -1, 0}; - int num_msgs; - int rc = 0; - - info = __find_mq (msgid); - - if (info == NULL) - { - errno = EBADF; - return -1; - } - - /* temporarily lock message queue */ - semop (info->semid, &sb0, 1); - - num_msgs = semctl (info->semid, 3, GETVAL); - if (num_msgs >= 0) - { - memcpy (mqstat, info->attr, sizeof(struct mq_attr)); - mqstat->mq_curmsgs = num_msgs; - } - else - rc = -1; - - /* release message queue */ - sb0.sem_op = 1; - semop (info->semid, &sb0, 1); - - return rc; -} - - - - - - diff --git a/newlib/libc/sys/linux/mq_notify.c b/newlib/libc/sys/linux/mq_notify.c deleted file mode 100644 index fd4606bd4..000000000 --- a/newlib/libc/sys/linux/mq_notify.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <errno.h> -#include <machine/weakalias.h> - -#include "mqlocal.h" - -int -__libc_mq_notify (mqd_t msgid, const struct sigevent *notification) -{ - errno = ENOSYS; - return -1; -} -weak_alias (__libc_mq_notify, mq_notify) - - - - - - - diff --git a/newlib/libc/sys/linux/mq_open.c b/newlib/libc/sys/linux/mq_open.c deleted file mode 100644 index 744cb9eaa..000000000 --- a/newlib/libc/sys/linux/mq_open.c +++ /dev/null @@ -1,340 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> -#include <sys/stat.h> -#include <sys/mman.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <string.h> -#include <stdlib.h> -#include <time.h> -#include <stdarg.h> -#include <machine/weakalias.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#include "mqlocal.h" - -#define NHASH 32 /* Num of hash lists, must be a power of 2 */ -#define LOCHASH(i) ((i)&(NHASH-1)) - -static long mq_index; /* Index of next entry */ -static struct libc_mq *mq_hash[NHASH]; /* Hash list heads for mqopen_infos */ - -__LOCK_INIT(static, mq_hash_lock); - -mqd_t -mq_open (const char *name, int oflag, ...) -{ - MSG *wrbuf = NULL; - MSG *rdbuf = NULL; - int msgqid = -1; - int rc = -1; - int fd = -1; - int semid = -1; - int created = 0; - key_t key = (key_t)-1; - struct mq_attr *attr = (struct mq_attr *)MAP_FAILED; - struct sembuf sb = {0, 0, 0}; - mode_t mode = 0; - int size; - int i, index, saved_errno; - char *real_name; - char *ptr; - struct mq_attr *user_attr = NULL; - struct libc_mq *info; - union semun arg; - - /* ignore opening slash if present */ - if (*name == '/') - ++name; - size = strlen(name); - - if ((real_name = (char *)malloc (size + sizeof(MSGQ_PREFIX))) == NULL || - (info = (struct libc_mq *)malloc (sizeof(struct libc_mq))) == NULL) - { - errno = ENOSPC; - if (real_name) - free (real_name); - return (mqd_t)-1; - } - - /* use given name to create shared memory file name - we convert any - slashes to underscores so we don't have to create directories */ - memcpy (real_name, MSGQ_PREFIX, sizeof(MSGQ_PREFIX) - 1); - memcpy (real_name + sizeof(MSGQ_PREFIX) - 1, name, size + 1); - ptr = real_name + sizeof(MSGQ_PREFIX) - 1; - for (i = 0; i < size; ++i) - { - if (*ptr == '/') - *ptr = '_'; - ++ptr; - } - - /* open shared memory file based on msg queue open flags and then use memory - file to create a unique key to use for semaphores, etc.. */ - if (oflag & O_CREAT) - { - va_list list; - va_start (list, oflag); - - saved_errno = errno; - mode = (mode_t)va_arg (list, int); - user_attr = va_arg(list,struct mq_attr *); - va_end (list); - - /* attempt to open the shared memory file for exclusive create so we know - whether we are the owners or not */ - fd = open (real_name, O_RDWR | O_CREAT | O_EXCL, mode); - if (fd < 0 && (oflag & O_EXCL)) - { - /* we failed and the user wanted exclusive create */ - free (real_name); - free (info); - return (mqd_t)-1; - } - errno = saved_errno; - created = 1; - } - - if (fd < 0) - fd = open (real_name, O_RDWR, 0); - - if (fd >= 0) - key = ftok(real_name, 255); - - if (key != (key_t)-1) - /* memory map the shared memory file so we have a global shared data area to use */ - attr = (struct mq_attr *)mmap (0, sizeof(struct mq_attr), PROT_READ | PROT_WRITE, - MAP_SHARED, fd, 0); - - if (attr != (struct mq_attr *)MAP_FAILED) - { - /* we need semaphores to prevent multi-process race conditions on the - shared storage which contains a shared structure. The following - are the ones we need. - - 0 = open semaphore - 1 = number of opens - 2 = number of writes left until queue is full - 3 = number of reads available in queue - 4 = notify semaphore - 5 = number of readers */ - arg.val = 0; - /* make sure the creator of the shared memory file also is the creator of the - semaphores...this will ensure that it also creates the message queue */ - if (created) - { - saved_errno = errno; - semid = semget (key, 6, IPC_CREAT | IPC_EXCL | mode); - errno = saved_errno; - /* now that we have created the semaphore, we should initialize it */ - if (semid != -1) - semctl (semid, 0, SETVAL, arg); - } - else - { - /* if we didn't create the shared memory file but have gotten to here, we want - to ensure we haven't gotten ahead of the creator temporarily so we will - loop until the semaphore exists. This ensures that the creator will be the - one to create the message queue with the correct mode and we will be blocked - by the open semaphore 0. We impose a time limit to ensure something terrible - hasn't gone wrong. */ - struct timespec tms; - int i; - - tms.tv_sec = 0; - tms.tv_nsec = 10000; /* 10 microseconds */ - for (i = 0; i < 100; ++i) - { - if ((semid = semget (key, 6, 0)) != -1) - break; - /* sleep in case we our a higher priority process */ - nanosleep (&tms, NULL); - } - } - } - - if (semid != -1) - { - /* acquire main open semaphore if we didn't create it */ - if (!created) - { - sb.sem_op = -1; - rc = semop (semid, &sb, 1); - } - else - rc = 0; /* need this to continue below */ - } - - if (rc == 0) - { - if (created) - { - /* the creator must get here first so the message queue will be created */ - msgqid = msgget (key, IPC_CREAT | mode); - if (msgqid >= 0) - { - /* we have created the message queue so check and set the attributes */ - if ((wrbuf = (MSG *)malloc (user_attr->mq_msgsize + sizeof(int))) == NULL || - (rdbuf = (MSG *)malloc (user_attr->mq_msgsize + sizeof(int))) == NULL || - user_attr == NULL || user_attr->mq_msgsize <= 0 || user_attr->mq_maxmsg <= 0) - { - /* we're out of space and we created the message queue so we should - try to remove it */ - msgctl (msgqid, IPC_RMID, NULL); - msgqid = -1; /* allow clean up to occur below */ - if (wrbuf && rdbuf) - errno = EINVAL; - else - errno = ENOSPC; - } - else /* valid attributes */ - { - write (fd, user_attr, sizeof(struct mq_attr)); - attr->mq_curmsgs = 0; - attr->mq_flags = oflag & O_NONBLOCK; - arg.val = 0; - semctl (semid, 1, SETVAL, arg); /* number of opens starts at 0 */ - semctl (semid, 3, SETVAL, arg); /* number of reads available starts at 0 */ - semctl (semid, 5, SETVAL, arg); /* number of readers starts at 0 */ - arg.val = 1; - semctl (semid, 4, SETVAL, arg); /* notify semaphore */ - arg.val = user_attr->mq_maxmsg; - semctl (semid, 2, SETVAL, arg); /* number of writes left starts at mq_maxmsg */ - } - } - } - else /* just open it */ - msgqid = msgget (key, 0); - - /* release semaphore acquired earlier */ - sb.sem_op = 1; - semop (semid, &sb, 1); - } - - /* if we get here and we haven't got a message queue id, then we need to clean up - our mess and return failure */ - if (msgqid < 0) - { - if (fd >= 0) - close (fd); - if (attr != (struct mq_attr *)MAP_FAILED) - munmap (attr, sizeof(struct mq_attr)); - if (created) - { - unlink (real_name); - if (semid != -1) - semctl (semid, 0, IPC_RMID); - } - free (real_name); - free (info); - if (wrbuf) - free (wrbuf); - if (rdbuf) - free (rdbuf); - return (mqd_t)-1; - } - - /* we are successful so register the message queue */ - - /* up the count of msg queue opens */ - sb.sem_op = 1; - sb.sem_num = 1; - semop (semid, &sb, 1); - - /* success, translate into index into mq_info array */ - __lock_acquire(mq_hash_lock); - index = mq_index++; - info->index = index; - info->msgqid = msgqid; - info->name = real_name; - info->semid = semid; - info->fd = fd; - info->oflag = oflag; - info->wrbuf = wrbuf; - info->rdbuf = rdbuf; - info->cleanup_notify = NULL; - info->next = mq_hash[LOCHASH(index)]; - info->attr = attr; - mq_hash[LOCHASH(index)] = info; - __lock_release(mq_hash_lock); - - return (mqd_t)index; -} - -struct libc_mq * -__find_mq (mqd_t mq) -{ - struct libc_mq *ptr; - - __lock_acquire(mq_hash_lock); - - ptr = mq_hash[LOCHASH((int)mq)]; - - while (ptr) - { - if (ptr->index == (int)mq) - break; - ptr = ptr->next; - } - - __lock_release(mq_hash_lock); - - return ptr; -} - -void -__cleanup_mq (mqd_t mq) -{ - struct libc_mq *ptr; - struct libc_mq *prev; - int semid; - struct sembuf sb = {0, 0, 0}; - - __lock_acquire(mq_hash_lock); - - ptr = mq_hash[LOCHASH((int)mq)]; - prev = NULL; - - while (ptr) - { - if (ptr->index == (int)mq) - break; - prev = ptr; - ptr = ptr->next; - } - - if (ptr != NULL) - { - if (ptr->cleanup_notify != NULL) - ptr->cleanup_notify (ptr); - if (prev != NULL) - prev->next = ptr->next; - else - mq_hash[LOCHASH((int)mq)] = NULL; - munmap (ptr->attr, sizeof(struct mq_attr)); - close (ptr->fd); - free (ptr->name); - free (ptr->wrbuf); - free (ptr->rdbuf); - semid = ptr->semid; - free (ptr); - /* lower the count of msg queue opens */ - sb.sem_op = -1; - sb.sem_num = 1; - sb.sem_flg = IPC_NOWAIT; - semop (semid, &sb, 1); - } - - __lock_release(mq_hash_lock); -} - - - - - diff --git a/newlib/libc/sys/linux/mq_receive.c b/newlib/libc/sys/linux/mq_receive.c deleted file mode 100644 index 4dae0810b..000000000 --- a/newlib/libc/sys/linux/mq_receive.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <string.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#include "mqlocal.h" - -__LOCK_INIT(static, mq_rdbuf_lock); - -ssize_t -mq_receive (mqd_t msgid, char *msg, size_t msg_len, unsigned int *msg_prio) -{ - struct libc_mq *info; - struct sembuf sb2 = {2, 1, 0}; - struct sembuf sb3 = {3, -1, IPC_NOWAIT}; - struct sembuf sb5 = {5, 1, IPC_NOWAIT}; - ssize_t num_bytes; - int ipcflag; - - info = __find_mq (msgid); - - if (info == NULL || (info->oflag & O_ACCMODE) == O_WRONLY) - { - errno = EBADF; - return -1; - } - - if (msg_len < info->attr->mq_msgsize) - { - errno = EMSGSIZE; - return -1; - } - - __lock_acquire (mq_rdbuf_lock); - - ipcflag = (info->attr->mq_flags & O_NONBLOCK) ? IPC_NOWAIT : 0; - - semop (info->semid, &sb5, 1); /* increase number of readers */ - num_bytes = msgrcv (info->msgqid, info->rdbuf, msg_len, -MQ_PRIO_MAX, ipcflag); - sb5.sem_op = -1; - semop (info->semid, &sb5, 1); /* decrease number of readers */ - - if (num_bytes != (ssize_t)-1) - { - semop (info->semid, &sb2, 1); /* add one to messages left to write */ - semop (info->semid, &sb3, 1); /* subtract one from messages to read */ - memcpy (msg, info->rdbuf->text, num_bytes); - if (msg_prio != NULL) - *msg_prio = MQ_PRIO_MAX - info->rdbuf->type; - } - - __lock_release (mq_rdbuf_lock); - return num_bytes; -} - - - - - - diff --git a/newlib/libc/sys/linux/mq_send.c b/newlib/libc/sys/linux/mq_send.c deleted file mode 100644 index d3291fd2e..000000000 --- a/newlib/libc/sys/linux/mq_send.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <string.h> -#include <stdlib.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#include "mqlocal.h" - -__LOCK_INIT(static, mq_wrbuf_lock); - -int -mq_send (mqd_t msgid, const char *msg, size_t msg_len, unsigned int msg_prio) -{ - struct libc_mq *info; - struct sembuf sb2 = {2, -1, 0}; - struct sembuf sb3 = {3, 1, 0}; - int rc; - int ipcflag; - - info = __find_mq (msgid); - - if (info == NULL || (info->oflag & O_ACCMODE) == O_RDONLY) - { - errno = EBADF; - return -1; - } - - if (msg_len > info->attr->mq_msgsize) - { - errno = EMSGSIZE; - return -1; - } - - if (msg_prio > MQ_PRIO_MAX) - { - errno = EINVAL; - return -1; - } - - __lock_acquire (mq_wrbuf_lock); - - memcpy (info->wrbuf->text, msg, msg_len); - info->wrbuf->type = (MQ_PRIO_MAX - msg_prio); - - ipcflag = (info->attr->mq_flags & O_NONBLOCK) ? IPC_NOWAIT : 0; - sb2.sem_flg = ipcflag; - - /* check to see if max msgs are on queue */ - rc = semop (info->semid, &sb2, 1); - - if (rc == 0) - rc = msgsnd (info->msgqid, info->wrbuf, msg_len, ipcflag); - - if (rc == 0) - semop (info->semid, &sb3, 1); /* increment number of reads */ - - __lock_release (mq_wrbuf_lock); - return rc; -} - - - - - - diff --git a/newlib/libc/sys/linux/mq_setattr.c b/newlib/libc/sys/linux/mq_setattr.c deleted file mode 100644 index 69f6cd598..000000000 --- a/newlib/libc/sys/linux/mq_setattr.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <errno.h> -#include <sys/sem.h> -#include <string.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#include "mqlocal.h" - -int -mq_setattr (mqd_t msgid, const struct mq_attr *mqstat, struct mq_attr *omqstat) -{ - struct libc_mq *info; - struct sembuf sb0 = {0, -1, 0}; - int num_msgs; - int rc = 0; - - info = __find_mq (msgid); - - if (info == NULL) - { - errno = EBADF; - return -1; - } - - /* temporarily lock message queue */ - semop (info->semid, &sb0, 1); - - /* make copy of old structure */ - if (omqstat != NULL) - { - num_msgs = semctl (info->semid, 3, GETVAL); - if (num_msgs >= 0) - { - memcpy (omqstat, info->attr, sizeof(struct mq_attr)); - omqstat->mq_curmsgs = num_msgs; - } - else - rc = -1; - } - - /* only the mq_flags field can be changed */ - info->attr->mq_flags = mqstat->mq_flags; - - /* release message queue */ - sb0.sem_op = 1; - semop (info->semid, &sb0, 1); - - return rc; -} - - - - - - diff --git a/newlib/libc/sys/linux/mq_unlink.c b/newlib/libc/sys/linux/mq_unlink.c deleted file mode 100644 index ce7bd0e01..000000000 --- a/newlib/libc/sys/linux/mq_unlink.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <mqueue.h> -#include <errno.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/mman.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <string.h> -#include <stdlib.h> -#include <machine/weakalias.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#include "mqlocal.h" - -int -mq_unlink (const char *name) -{ - int size; - int saved_errno; - char *real_name; - char *ptr; - int i, rc; - int semid, msgqid; - key_t key; - - /* ignore opening slash if present */ - if (*name == '/') - ++name; - size = strlen(name); - - if ((real_name = (char *)malloc (size + sizeof(MSGQ_PREFIX))) == NULL) - { - errno = ENOSPC; - return -1; - } - - /* use given name to create shared memory file name - we convert any - slashes to underscores so we don't have to create directories */ - memcpy (real_name, MSGQ_PREFIX, sizeof(MSGQ_PREFIX) - 1); - memcpy (real_name + sizeof(MSGQ_PREFIX) - 1, name, size + 1); - ptr = real_name + sizeof(MSGQ_PREFIX) - 1; - for (i = 0; i < size; ++i) - { - if (*ptr == '/') - *ptr = '_'; - ++ptr; - } - - /* get key and then unlink shared memory file */ - if ((key = ftok(real_name, 255)) == (key_t)-1) - return -1; - - rc = unlink (real_name); - - if (rc == 0) - { - /* try to remove semaphore and msg queues associated with shared memory file */ - saved_errno = errno; - semid = semget (key, 6, 0); - if (semid != -1) - semctl (semid, 0, IPC_RMID); - msgqid = msgget (key, 0); - if (msgqid != -1) - msgctl (msgqid, IPC_RMID, NULL); - errno = saved_errno; - } - - return rc; -} diff --git a/newlib/libc/sys/linux/mqlocal.h b/newlib/libc/sys/linux/mqlocal.h deleted file mode 100644 index 56fd66c2d..000000000 --- a/newlib/libc/sys/linux/mqlocal.h +++ /dev/null @@ -1,47 +0,0 @@ -/* local definitions needed by mq routines */ - -#include <sys/msg.h> -#include <signal.h> - -/* a message */ -typedef struct -{ - unsigned int type; - char text[1]; -} MSG; - -union semun { - int val; - struct semid_ds *buf; - unsigned short *array; -} arg; - -/* - * One of these structures is malloced to describe any open message queue - * each time mq_open is called. - */ - -struct libc_mq; - -struct libc_mq { - int index; /* index of this message queue */ - int msgqid; /* value returned by msgget */ - int semid; /* semaphore id */ - int fd; /* fd of shared memory file */ - int oflag; /* original open flag used */ - int th; /* thread id for mq_notify */ - char *name; /* name used */ - MSG *wrbuf; /* msg write buffer */ - MSG *rdbuf; /* msg read buffer */ - struct mq_attr *attr; /* pointer to attribute structure */ - struct sigevent *sigevent; /* used for mq_notify */ - void (*cleanup_notify)(struct libc_mq *); /* also used for mq_notify */ - struct libc_mq *next; /* next info struct in hash table */ -}; - -extern struct libc_mq *__find_mq (mqd_t mq); -extern void __cleanup_mq (mqd_t mq); -extern void __cleanup_mq_notify (struct libc_mq *ptr); - -#define MSGQ_PREFIX "/dev/shm/__MSGQ__" - diff --git a/newlib/libc/sys/linux/msize.c b/newlib/libc/sys/linux/msize.c deleted file mode 100644 index 818e05a75..000000000 --- a/newlib/libc/sys/linux/msize.c +++ /dev/null @@ -1 +0,0 @@ -/* dummy file to override one object in stdlib directory */ diff --git a/newlib/libc/sys/linux/msizer.c b/newlib/libc/sys/linux/msizer.c deleted file mode 100644 index 7b7905389..000000000 --- a/newlib/libc/sys/linux/msizer.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -size_t -_malloc_usable_size_r (struct _reent *ptr, void *mem) -{ - return malloc_usable_size (mem); -} diff --git a/newlib/libc/sys/linux/mstats.c b/newlib/libc/sys/linux/mstats.c deleted file mode 100644 index 818e05a75..000000000 --- a/newlib/libc/sys/linux/mstats.c +++ /dev/null @@ -1 +0,0 @@ -/* dummy file to override one object in stdlib directory */ diff --git a/newlib/libc/sys/linux/mtrim.c b/newlib/libc/sys/linux/mtrim.c deleted file mode 100644 index 818e05a75..000000000 --- a/newlib/libc/sys/linux/mtrim.c +++ /dev/null @@ -1 +0,0 @@ -/* dummy file to override one object in stdlib directory */ diff --git a/newlib/libc/sys/linux/mtrimr.c b/newlib/libc/sys/linux/mtrimr.c deleted file mode 100644 index 3b2fbf367..000000000 --- a/newlib/libc/sys/linux/mtrimr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void * -_malloc_trim_r (struct _reent *ptr, size_t pad) -{ - return 0; -} diff --git a/newlib/libc/sys/linux/ntp_gettime.c b/newlib/libc/sys/linux/ntp_gettime.c deleted file mode 100644 index 2bcabbc63..000000000 --- a/newlib/libc/sys/linux/ntp_gettime.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sys/timex.h> - -#ifndef MOD_OFFSET -# define modes mode -#endif - -int -ntp_gettime (ntv) - struct ntptimeval *ntv; -{ - struct timex tntx; - int result; - - tntx.modes = 0; - result = __adjtimex (&tntx); - ntv->time = tntx.time; - ntv->maxerror = tntx.maxerror; - ntv->esterror = tntx.esterror; - return result; -} diff --git a/newlib/libc/sys/linux/pathconf.c b/newlib/libc/sys/linux/pathconf.c deleted file mode 100644 index 796945971..000000000 --- a/newlib/libc/sys/linux/pathconf.c +++ /dev/null @@ -1,300 +0,0 @@ -/* Linux specific extensions to pathconf. - Copyright (C) 1991,95,96,98,99,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib July 19, 2002 - Jeff Johnston */ - -#include <errno.h> -#include <stddef.h> -#include <unistd.h> -#include <limits.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/statfs.h> -#include <sys/statvfs.h> -#include <machine/weakalias.h> -#include "linux_fsinfo.h" - -/* The Linux kernel header mentioned this as a kind of generic value. */ -#define LINUX_LINK_MAX 127 - -static long int posix_pathconf (const char *path, int name); - - -/* Get file-specific information about descriptor FD. */ -long int -__pathconf (path, name) - const char *path; - int name; -{ - if (name == _PC_LINK_MAX) - { - struct statfs fsbuf; - - /* Determine the filesystem type. */ - if (__statfs (path, &fsbuf) < 0) - { - if (errno == ENOSYS) - /* not possible, return the default value. */ - return LINUX_LINK_MAX; - - /* Some error occured. */ - return -1; - } - - switch (fsbuf.f_type) - { - case EXT2_SUPER_MAGIC: - return EXT2_LINK_MAX; - - case MINIX_SUPER_MAGIC: - case MINIX_SUPER_MAGIC2: - return MINIX_LINK_MAX; - - case MINIX2_SUPER_MAGIC: - case MINIX2_SUPER_MAGIC2: - return MINIX2_LINK_MAX; - - case XENIX_SUPER_MAGIC: - return XENIX_LINK_MAX; - - case SYSV4_SUPER_MAGIC: - case SYSV2_SUPER_MAGIC: - return SYSV_LINK_MAX; - - case COH_SUPER_MAGIC: - return COH_LINK_MAX; - - case UFS_MAGIC: - case UFS_CIGAM: - return UFS_LINK_MAX; - - case REISERFS_SUPER_MAGIC: - return REISERFS_LINK_MAX; - - default: - return LINUX_LINK_MAX; - } - } - - return posix_pathconf (path, name); -} - -/* Get file-specific information about PATH. */ -static long int -posix_pathconf (const char *path, int name) -{ - if (path[0] == '\0') - { - __set_errno (ENOENT); - return -1; - } - - switch (name) - { - default: - __set_errno (EINVAL); - return -1; - - case _PC_LINK_MAX: -#ifdef LINK_MAX - return LINK_MAX; -#else - return -1; -#endif - - case _PC_MAX_CANON: -#ifdef MAX_CANON - return MAX_CANON; -#else - return -1; -#endif - - case _PC_MAX_INPUT: -#ifdef MAX_INPUT - return MAX_INPUT; -#else - return -1; -#endif - - case _PC_NAME_MAX: -#ifdef NAME_MAX - { - struct statfs buf; - int save_errno = errno; - - if (__statfs (path, &buf) < 0) - { - if (errno == ENOSYS) - { - errno = save_errno; - return NAME_MAX; - } - return -1; - } - else - { -#ifdef _STATFS_F_NAMELEN - return buf.f_namelen; -#else -# ifdef _STATFS_F_NAME_MAX - return buf.f_name_max; -# else - return NAME_MAX; -# endif -#endif - } - } -#else - return -1; -#endif - - case _PC_PATH_MAX: -#ifdef PATH_MAX - return PATH_MAX; -#else - return -1; -#endif - - case _PC_PIPE_BUF: -#ifdef PIPE_BUF - return PIPE_BUF; -#else - return -1; -#endif - - case _PC_CHOWN_RESTRICTED: -#ifdef _POSIX_CHOWN_RESTRICTED - return _POSIX_CHOWN_RESTRICTED; -#else - return -1; -#endif - - case _PC_NO_TRUNC: -#ifdef _POSIX_NO_TRUNC - return _POSIX_NO_TRUNC; -#else - return -1; -#endif - - case _PC_VDISABLE: -#ifdef _POSIX_VDISABLE - return _POSIX_VDISABLE; -#else - return -1; -#endif - - case _PC_SYNC_IO: -#ifdef _POSIX_SYNC_IO - return _POSIX_SYNC_IO; -#else - return -1; -#endif - - case _PC_ASYNC_IO: -#ifdef _POSIX_ASYNC_IO - { - /* AIO is only allowed on regular files and block devices. */ - struct stat64 st; - - if (stat64 (path, &st) < 0 - || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) - return -1; - else - return 1; - } -#else - return -1; -#endif - - case _PC_PRIO_IO: -#ifdef _POSIX_PRIO_IO - return _POSIX_PRIO_IO; -#else - return -1; -#endif - - case _PC_SOCK_MAXBUF: -#ifdef SOCK_MAXBUF - return SOCK_MAXBUF; -#else - return -1; -#endif - - case _PC_FILESIZEBITS: -#ifdef FILESIZEBITS - return FILESIZEBITS; -#else - /* We let platforms with larger file sizes overwrite this value. */ - return 32; -#endif - - case _PC_REC_INCR_XFER_SIZE: - /* XXX It is not entirely clear what the limit is supposed to do. - What is incremented? */ - return -1; - - case _PC_REC_MAX_XFER_SIZE: - /* XXX It is not entirely clear what the limit is supposed to do. - In general there is no top limit of the number of bytes which - case be transported at once. */ - return -1; - - case _PC_REC_MIN_XFER_SIZE: - { - /* XXX It is not entirely clear what the limit is supposed to do. - I assume this is the block size of the filesystem. */ - struct statvfs64 sv; - - if (__statvfs64 (path, &sv) < 0) - return -1; - return sv.f_bsize; - } - - case _PC_REC_XFER_ALIGN: - { - /* XXX It is not entirely clear what the limit is supposed to do. - I assume that the number should reflect the minimal block - alignment. */ - struct statvfs64 sv; - - if (__statvfs64 (path, &sv) < 0) - return -1; - return sv.f_frsize; - } - - case _PC_ALLOC_SIZE_MIN: - { - /* XXX It is not entirely clear what the limit is supposed to do. - I assume that the number should reflect the minimal block - alignment. */ - struct statvfs64 sv; - - if (__statvfs64 (path, &sv) < 0) - return -1; - return sv.f_frsize; - } - - case _PC_SYMLINK_MAX: - /* In general there are no limits. If a system has one it should - overwrite this case. */ - return -1; - } -} - -weak_alias (__pathconf, pathconf) diff --git a/newlib/libc/sys/linux/pread.c b/newlib/libc/sys/linux/pread.c deleted file mode 100644 index ff8371e15..000000000 --- a/newlib/libc/sys/linux/pread.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Linux version of pread so we can have a weak_alias */ - -#include <_ansi.h> -#include <unistd.h> -#include <reent.h> -#include <machine/weakalias.h> - -ssize_t -_DEFUN (_pread_r, (rptr, fd, buf, n, off), - struct _reent *rptr _AND - int fd _AND - _PTR buf _AND - size_t n _AND - off_t off) -{ - off_t cur_pos; - _READ_WRITE_RETURN_TYPE num_read; - - if ((cur_pos = _lseek_r (rptr, fd, 0, SEEK_CUR)) == (off_t)-1) - return -1; - - if (_lseek_r (rptr, fd, off, SEEK_SET) == (off_t)-1) - return -1; - - num_read = _read_r (rptr, fd, buf, n); - - if (_lseek_r (rptr, fd, cur_pos, SEEK_SET) == (off_t)-1) - return -1; - - return (ssize_t)num_read; -} - -#ifndef _REENT_ONLY - -ssize_t -_DEFUN (__libc_pread, (fd, buf, n, off), - int fd _AND - _PTR buf _AND - size_t n _AND - off_t off) -{ - return _pread_r (_REENT, fd, buf, n, off); -} -weak_alias(__libc_pread,pread) - -#endif diff --git a/newlib/libc/sys/linux/pread64.c b/newlib/libc/sys/linux/pread64.c deleted file mode 100644 index c4bdca706..000000000 --- a/newlib/libc/sys/linux/pread64.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -FUNCTION -<<pread64>>---read a large file from specified position - -INDEX - pread64 - -ANSI_SYNOPSIS - #include <unistd.h> - ssize_t pread64(int <[fd]>, void *<[buf]>, size_t <[n]>, loff_t <[off]>); - -TRAD_SYNOPSIS - #include <unistd.h> - ssize_t pread64(<[fd]>, <[buf]>, <[n]>, <[off]>) - int <[fd]>; - void *<[buf]>; - size_t <[n]>; - loff_t <[off]>; - -DESCRIPTION -The <<pread64>> function is similar to <<pread>>. The only difference is -that it operates on large files and so takes a 64-bit offset. Like <<pread>>>, -the file position is unchanged by the function (i.e. the file position -is the same before and after a call to <<pread>>). - -RETURNS -<<pread64>> returns the number of bytes read or <<-1>> if failure occurred. - -PORTABILITY -<<pread64>> is an EL/IX extension. - -Supporting OS subroutine required: <<read>>, <<lseek64>>. -*/ - -#include <_ansi.h> -#include <unistd.h> -#include <reent.h> -#include <machine/weakalias.h> - -ssize_t -_DEFUN (__libc_pread64, (fd, buf, n, off), - int fd _AND - _PTR buf _AND - size_t n _AND - loff_t off) -{ - loff_t cur_pos; - _READ_WRITE_RETURN_TYPE num_read; - - if ((cur_pos = lseek64 (fd, 0, SEEK_CUR)) == (loff_t)-1) - return -1; - - if (lseek64 (fd, off, SEEK_SET) == (loff_t)-1) - return -1; - - num_read = read (fd, buf, n); - - if (lseek64 (fd, cur_pos, SEEK_SET) == (loff_t)-1) - return -1; - - return (ssize_t)num_read; -} -weak_alias(__libc_pread64,pread64); -weak_alias(__libc_pread64,__pread64); - diff --git a/newlib/libc/sys/linux/process.c b/newlib/libc/sys/linux/process.c deleted file mode 100644 index 160b80137..000000000 --- a/newlib/libc/sys/linux/process.c +++ /dev/null @@ -1,58 +0,0 @@ -/* libc/sys/linux/process.c - Process-related system calls */ - -/* Written 2000 by Werner Almesberger */ - - -#include <sys/unistd.h> -#include <sys/wait.h> -#include <machine/syscall.h> - - -#define __NR__exit __NR_exit -#define __NR__execve __NR_execve - -_syscall0(int,getpid) -_syscall0(pid_t,getppid) - -weak_alias(__libc_getpid,__getpid); - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 -_syscall3(int,_execve,const char *,file,char * const *,argv,char * const *,envp) -_syscall0(int,fork) -#endif /* _ELIX_LEVEL >= 3 */ - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4 -_syscall0(pid_t,getpgrp) -_syscall2(int,setpgid,pid_t,pid,pid_t,pgid) -_syscall0(pid_t,setsid) - -/* Here we implement vfork in terms of fork, since - * Linux's vfork system call is not reliable. - */ -pid_t vfork(void) -{ - pid_t pid; - - pid = fork(); - - if(!pid) - { - /* In child. */ - return 0; - } - else - { - /* In parent. Wait for child to finish. */ - if (waitpid (pid, NULL, 0) < 0) - return pid; - } -} -#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 4 */ - - -/* Although _exit is listed as level 3, we use it from level 1 interfaces */ -/* FIXME: get rid of noreturn warning */ - -#define return for (;;) -_syscall1(void,_exit,int,exitcode) -#undef return diff --git a/newlib/libc/sys/linux/prof-freq.c b/newlib/libc/sys/linux/prof-freq.c deleted file mode 100644 index 829979bbb..000000000 --- a/newlib/libc/sys/linux/prof-freq.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Return frequency of ticks reported by profil. Generic version. */ -/*- - * Copyright (c) 1983, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - - -#include <sys/types.h> -#include <sys/time.h> -#include <libc-internal.h> - -int -__profile_frequency (void) -{ - /* - * Discover the tick frequency of the machine if something goes wrong, - * we return 0, an impossible hertz. - */ - struct itimerval tim; - - tim.it_interval.tv_sec = 0; - tim.it_interval.tv_usec = 1; - tim.it_value.tv_sec = 0; - tim.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &tim, 0); - setitimer(ITIMER_REAL, 0, &tim); - if (tim.it_interval.tv_usec < 2) - return 0; - return (1000000 / tim.it_interval.tv_usec); -} diff --git a/newlib/libc/sys/linux/profile.c b/newlib/libc/sys/linux/profile.c deleted file mode 100644 index f36e2c753..000000000 --- a/newlib/libc/sys/linux/profile.c +++ /dev/null @@ -1,12 +0,0 @@ -/* libc/sys/linux/profile.c - profiling system call */ - -#include <errno.h> -#include <sys/types.h> -#include <machine/syscall.h> - -#define __NR_profil 98 - -int profil(u_short *buf, size_t bufsiz, size_t offset, - u_int scale); - -_syscall4(int,profil,unsigned short *,buf,size_t,bufsiz,size_t,offset,unsigned int, scale) diff --git a/newlib/libc/sys/linux/psignal.c b/newlib/libc/sys/linux/psignal.c deleted file mode 100644 index f5fedc9fa..000000000 --- a/newlib/libc/sys/linux/psignal.c +++ /dev/null @@ -1,15 +0,0 @@ -/* libc/sys/linux/psignal.c - print signal message to stderr */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <stdio.h> -#include <string.h> - -void -psignal (int sig, const char *s) -{ - if (s != NULL) - fprintf (stderr, "%s: %s\n", s, strsignal (sig)); - else - fprintf (stderr, "%s\n", strsignal (sig)); -} diff --git a/newlib/libc/sys/linux/pvallocr.c b/newlib/libc/sys/linux/pvallocr.c deleted file mode 100644 index 716ea0c12..000000000 --- a/newlib/libc/sys/linux/pvallocr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void * -_pvalloc_r (struct _reent *ptr, size_t bytes) -{ - return pvalloc (bytes); -} diff --git a/newlib/libc/sys/linux/pwrite.c b/newlib/libc/sys/linux/pwrite.c deleted file mode 100644 index 239463e59..000000000 --- a/newlib/libc/sys/linux/pwrite.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Linux version of pwrite so we can have a weak alias */ - -#include <_ansi.h> -#include <unistd.h> -#include <reent.h> -#include <machine/weakalias.h> - -ssize_t -_DEFUN (_pwrite_r, (rptr, fd, buf, n, off), - struct _reent *rptr _AND - int fd _AND - _CONST _PTR buf _AND - size_t n _AND - off_t off) -{ - off_t cur_pos; - _READ_WRITE_RETURN_TYPE num_written; - - if ((cur_pos = _lseek_r (rptr, fd, 0, SEEK_CUR)) == (off_t)-1) - return -1; - - if (_lseek_r (rptr, fd, off, SEEK_SET) == (off_t)-1) - return -1; - - num_written = _write_r (rptr, fd, buf, n); - - if (_lseek_r (rptr, fd, cur_pos, SEEK_SET) == (off_t)-1) - return -1; - - return (ssize_t)num_written; -} - -#ifndef _REENT_ONLY - -ssize_t -_DEFUN (__libc_pwrite, (fd, buf, n, off), - int fd _AND - _CONST _PTR buf _AND - size_t n _AND - off_t off) -{ - return _pwrite_r (_REENT, fd, buf, n, off); -} -weak_alias(__libc_pwrite,pwrite) - -#endif diff --git a/newlib/libc/sys/linux/pwrite64.c b/newlib/libc/sys/linux/pwrite64.c deleted file mode 100644 index f1d678493..000000000 --- a/newlib/libc/sys/linux/pwrite64.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -FUNCTION -<<pwrite64>>---write a large file from specified position - -INDEX - pwrite64 - -ANSI_SYNOPSIS - #include <unistd.h> - ssize_t pwrite64(int <[fd]>, void *<[buf]>, size_t <[n]>, loff_t <[off]>); - -TRAD_SYNOPSIS - #include <unistd.h> - ssize_t pwrite64(<[fd]>, <[buf]>, <[n]>, <[off]>) - int <[fd]>; - void *<[buf]>; - size_t <[n]>; - loff_t <[off]>; - -DESCRIPTION -The <<pwrite64>> function is similar to <<pwrite>>. The only difference is -that it operates on large files and so takes a 64-bit offset. Like <<pwrite>>>, -the file position is unchanged by the function (i.e. the file position -is the same before and after a call to <<pwrite>>). - -RETURNS -<<pwrite64>> returns the number of bytes written or <<-1>> if failure occurred. - -PORTABILITY -<<pwrite64>> is an EL/IX extension. - -Supporting OS subroutine required: <<write>>, <<lseek64>>. -*/ - -#include <_ansi.h> -#include <unistd.h> -#include <reent.h> -#include <machine/weakalias.h> - -ssize_t -_DEFUN (__libc_pwrite64, (fd, buf, n, off), - int fd _AND - _PTR buf _AND - size_t n _AND - loff_t off) -{ - loff_t cur_pos; - _READ_WRITE_RETURN_TYPE num_written; - - if ((cur_pos = lseek64 (fd, 0, SEEK_CUR)) == (loff_t)-1) - return -1; - - if (lseek64 (fd, off, SEEK_SET) == (loff_t)-1) - return -1; - - num_written = write (fd, buf, n); - - if (lseek64 (fd, cur_pos, SEEK_SET) == (loff_t)-1) - return -1; - - return (ssize_t)num_written; -} -weak_alias(__libc_pwrite64,pwrite64) - diff --git a/newlib/libc/sys/linux/raise.c b/newlib/libc/sys/linux/raise.c deleted file mode 100644 index d69561be1..000000000 --- a/newlib/libc/sys/linux/raise.c +++ /dev/null @@ -1,3 +0,0 @@ -/* empty file so we override regular raise */ - - diff --git a/newlib/libc/sys/linux/readdir64.c b/newlib/libc/sys/linux/readdir64.c deleted file mode 100644 index 78fe98e90..000000000 --- a/newlib/libc/sys/linux/readdir64.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* Modified from newlib/libc/posix/readdir.c */ - -#include <dirent.h> -#include <machine/syscall.h> - -#define __NR___getdents64 __NR_getdents64 - -static _syscall3(int,__getdents64,int,fd,struct dirent64 *,dirp,unsigned int,count) - -/* - * get next entry in a directory. - */ -struct dirent64 * -__readdir64 (dirp) -register DIR *dirp; { - register struct dirent64 *dp; - -#ifdef HAVE_DD_LOCK - __lock_acquire_recursive(dirp->dd_lock); -#endif - - if (dirp->dd_fd == -1) - return NULL; - - for (;;) { - if (dirp->dd_loc == 0) { - dirp->dd_size = __getdents64 (dirp->dd_fd, - (void *)dirp->dd_buf, - dirp->dd_len); - - if (dirp->dd_size <= 0) { -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return NULL; - } - } - if (dirp->dd_loc >= dirp->dd_size) { - dirp->dd_loc = 0; - continue; - } - dp = (struct dirent64 *)(dirp->dd_buf + dirp->dd_loc); - if ((int)dp & 03) { /* bogus pointer check */ -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return NULL; - } - if (dp->d_reclen <= 0 || - dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc) { -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return NULL; - } - dirp->dd_loc += dp->d_reclen; - if (dp->d_ino == 0) - continue; -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return (dp); - } -} diff --git a/newlib/libc/sys/linux/realloc.c b/newlib/libc/sys/linux/realloc.c deleted file mode 100644 index 818e05a75..000000000 --- a/newlib/libc/sys/linux/realloc.c +++ /dev/null @@ -1 +0,0 @@ -/* dummy file to override one object in stdlib directory */ diff --git a/newlib/libc/sys/linux/reallocr.c b/newlib/libc/sys/linux/reallocr.c deleted file mode 100644 index 873c1b0e5..000000000 --- a/newlib/libc/sys/linux/reallocr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void * -_realloc_r (struct _reent *ptr, void *old, size_t newlen) -{ - return realloc (old, newlen); -} diff --git a/newlib/libc/sys/linux/realpath.c b/newlib/libc/sys/linux/realpath.c deleted file mode 100644 index 8aa5eb445..000000000 --- a/newlib/libc/sys/linux/realpath.c +++ /dev/null @@ -1,92 +0,0 @@ -/* realpath.c - Return the canonicalized absolute pathname */ - -/* Written 2000 by Werner Almesberger */ - - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <limits.h> -#include <errno.h> -#include <sys/stat.h> - - -/* FIXME: buffer overrun possible, loops forever on cyclic symlinks */ - - -/* - * Canonical name: never ends with a slash - */ - -static int resolve_path(char *path,char *result,char *pos) -{ - if (*path == '/') { - *result = '/'; - pos = result+1; - path++; - } - *pos = 0; - if (!*path) return 0; - while (1) { - char *slash; - struct stat st; - - slash = *path ? strchr(path,'/') : NULL; - if (slash) *slash = 0; - if (!path[0] || (path[0] == '.' && - (!path[1] || (path[1] == '.' && !path[2])))) { - pos--; - if (pos != result && path[0] && path[1]) - while (*--pos != '/'); - } - else { - strcpy(pos,path); - if (lstat(result,&st) < 0) return -1; - if (S_ISLNK(st.st_mode)) { - char buf[PATH_MAX]; - - if (readlink(result,buf,sizeof(buf)) < 0) return -1; - *pos = 0; - if (slash) { - *slash = '/'; - strcat(buf,slash); - } - strcpy(path,buf); - if (*path == '/') result[1] = 0; - pos = strchr(result,0); - continue; - } - pos = strchr(result,0); - } - if (slash) { - *pos++ = '/'; - path = slash+1; - } - *pos = 0; - if (!slash) break; - } - return 0; -} - - -char *realpath(const char *path,char *resolved_path) -{ - char cwd[PATH_MAX]; - char *path_copy; - int res; - - if (!*path) { - errno = ENOENT; /* SUSv2 */ - return NULL; - } - if (!getcwd(cwd,sizeof(cwd))) return NULL; - strcpy(resolved_path,"/"); - if (resolve_path(cwd,resolved_path,resolved_path)) return NULL; - strcat(resolved_path,"/"); - path_copy = strdup(path); - if (!path_copy) return NULL; - res = resolve_path(path_copy,resolved_path,strchr(resolved_path,0)); - free(path_copy); - if (res) return NULL; - return resolved_path; -} diff --git a/newlib/libc/sys/linux/rename.c b/newlib/libc/sys/linux/rename.c deleted file mode 100644 index d6bf4598e..000000000 --- a/newlib/libc/sys/linux/rename.c +++ /dev/null @@ -1,9 +0,0 @@ -/* libc/sys/linux/rename.c - rename a file */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <stdio.h> -#include <machine/syscall.h> - -_syscall2(int,rename,const char *,old,const char *,new) - diff --git a/newlib/libc/sys/linux/resource.c b/newlib/libc/sys/linux/resource.c deleted file mode 100644 index 54a049da9..000000000 --- a/newlib/libc/sys/linux/resource.c +++ /dev/null @@ -1,17 +0,0 @@ -/* libc/sys/linux/resource.c - Process resource functions */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <sys/resource.h> -#include <machine/syscall.h> - -_syscall2(int,getrusage,int,who,struct rusage *,r_usage) -_syscall2(int,getrlimit,int,resource,struct rlimit *,rlp) - -weak_alias(__libc_getrlimit,__getrlimit) - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 -_syscall2(int,setrlimit,int,resource,const struct rlimit *,rlp) -weak_alias(__libc_setrlimit,__setrlimit) -#endif - diff --git a/newlib/libc/sys/linux/scandir64.c b/newlib/libc/sys/linux/scandir64.c deleted file mode 100644 index b21b42342..000000000 --- a/newlib/libc/sys/linux/scandir64.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)scandir.c 5.10 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ - -/* - * Scan the directory dirname calling select to make a list of selected - * directory entries then sort using qsort and compare routine dcomp. - * Returns the number of entries and a pointer to a list of pointers to - * struct dirent64 (through namelist). Returns -1 if there were any errors. - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <dirent.h> -#include <stdlib.h> -#include <string.h> -#include <sys/lock.h> - -extern struct dirent64 *__readdir64 (DIR *); - -/* - * The DIRSIZ macro gives the minimum record length which will hold - * the directory entry. This requires the amount of space in struct dirent64 - * without the d_name field, plus enough space for the name with a terminating - * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. - */ -#undef DIRSIZ -#ifdef _DIRENT_HAVE_D_NAMLEN -#define DIRSIZ(dp) \ - ((sizeof (struct dirent64) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) -#else -#define DIRSIZ(dp) \ - ((sizeof (struct dirent64) - (MAXNAMLEN+1)) + ((strlen((dp)->d_name)+1 + 3) &~ 3)) -#endif - -#ifndef __P -#define __P(args) () -#endif - -int -scandir64(dirname, namelist, select, dcomp) - const char *dirname; - struct dirent64 ***namelist; - int (*select) __P((struct dirent64 *)); - int (*dcomp) __P((const void *, const void *)); -{ - register struct dirent64 *d, *p, **names; - register size_t nitems; - struct stat64 stb; - long arraysz; - DIR *dirp; - - if ((dirp = opendir(dirname)) == NULL) - return(-1); -#ifdef HAVE_DD_LOCK - __lock_acquire_recursive(dirp->dd_lock); -#endif - if (fstat64(dirp->dd_fd, &stb) < 0) { -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return(-1); - } - - /* - * estimate the array size by taking the size of the directory file - * and dividing it by a multiple of the minimum size entry. - */ - arraysz = (stb.st_size / 24); - names = (struct dirent64 **)malloc(arraysz * sizeof(struct dirent64 *)); - if (names == NULL) { -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return(-1); - } - - nitems = 0; - while ((d = __readdir64(dirp)) != NULL) { - if (select != NULL && !(*select)(d)) - continue; /* just selected names */ - /* - * Make a minimum size copy of the data - */ - p = (struct dirent64 *)malloc(DIRSIZ(d)); - if (p == NULL) { -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return(-1); - } - p->d_ino = d->d_ino; - p->d_reclen = d->d_reclen; -#ifdef _DIRENT_HAVE_D_NAMLEN - p->d_namlen = d->d_namlen; - bcopy(d->d_name, p->d_name, p->d_namlen + 1); -#else - strcpy(p->d_name, d->d_name); -#endif - /* - * Check to make sure the array has space left and - * realloc the maximum size. - */ - if (++nitems >= arraysz) { - if (fstat64(dirp->dd_fd, &stb) < 0) { -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return(-1); /* just might have grown */ - } - arraysz = stb.st_size / 12; - names = (struct dirent64 **)realloc((char *)names, - arraysz * sizeof(struct dirent64 *)); - if (names == NULL) { -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return(-1); - } - } - names[nitems-1] = p; - } - closedir(dirp); - if (nitems && dcomp != NULL) - qsort(names, nitems, sizeof(struct dirent64 *), dcomp); - *namelist = names; -#ifdef HAVE_DD_LOCK - __lock_release_recursive(dirp->dd_lock); -#endif - return(nitems); -} - -/* - * Alphabetic order comparison routine for those who want it. - */ -int -alphasort64(d1, d2) - const struct dirent64 **d1; - const struct dirent64 **d2; -{ - return(strcmp((*d1)->d_name, (*d2)->d_name)); -} - diff --git a/newlib/libc/sys/linux/sched.c b/newlib/libc/sys/linux/sched.c deleted file mode 100644 index 031b1b553..000000000 --- a/newlib/libc/sys/linux/sched.c +++ /dev/null @@ -1,26 +0,0 @@ -/* libc/sys/linux/sched.c - Process scheduling functions */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <time.h> -#include <sched.h> -#include <machine/syscall.h> - -_syscall1(int,sched_get_priority_max,int,policy); -_syscall1(int,sched_get_priority_min,int,policy); -_syscall2(int,sched_rr_get_interval,pid_t,pid,struct timespec *,interval); -_syscall0(int,sched_yield); - -weak_alias(__libc_sched_get_priority_max,__sched_get_priority_max); -weak_alias(__libc_sched_get_priority_min,__sched_get_priority_min); - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 3 -_syscall2(int,sched_getparam,pid_t,pid,struct sched_param *,sched); -_syscall1(int,sched_getscheduler,pid_t,pid); -_syscall2(int,sched_setparam,pid_t,pid,const struct sched_param *,sched); -_syscall3(int,sched_setscheduler,pid_t,pid,int,policy,const struct sched_param *,sched); -weak_alias(__libc_sched_getparam,__sched_getparam); -weak_alias(__libc_sched_getscheduler,__sched_getscheduler); -weak_alias(__libc_sched_setscheduler,__sched_setscheduler); -#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 3 */ - diff --git a/newlib/libc/sys/linux/select.c b/newlib/libc/sys/linux/select.c deleted file mode 100644 index 882f54167..000000000 --- a/newlib/libc/sys/linux/select.c +++ /dev/null @@ -1,17 +0,0 @@ -/* libc/sys/linux/select.c - The select system calls */ - -/* Written 2000 by Werner Almesberger */ - - -#include <sys/types.h> -#include <sys/time.h> -#include <machine/syscall.h> - - -static _syscall5(int,_newselect,int,n,fd_set *,readfds,fd_set *,writefds,fd_set *,exceptfds,struct timeval *,timeout) - -int select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout) -{ - return _newselect(n, readfds, writefds, exceptfds, timeout); -} diff --git a/newlib/libc/sys/linux/seteuid.c b/newlib/libc/sys/linux/seteuid.c deleted file mode 100644 index c3fa384fd..000000000 --- a/newlib/libc/sys/linux/seteuid.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <errno.h> -#include <unistd.h> - -int -seteuid (uid_t uid) -{ - int result; - - if (uid == (uid_t) ~0) - { - errno = (EINVAL); - return -1; - } - - return setresuid (-1, uid, -1); -} diff --git a/newlib/libc/sys/linux/sethostname.c b/newlib/libc/sys/linux/sethostname.c deleted file mode 100644 index 669df3d74..000000000 --- a/newlib/libc/sys/linux/sethostname.c +++ /dev/null @@ -1,8 +0,0 @@ -/* libc/sys/linux/sethostname.c - Set host name */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <unistd.h> -#include <machine/syscall.h> - -_syscall2(int,sethostname,const char *,name,size_t,len); diff --git a/newlib/libc/sys/linux/setrlimit64.c b/newlib/libc/sys/linux/setrlimit64.c deleted file mode 100644 index d4b4bfce0..000000000 --- a/newlib/libc/sys/linux/setrlimit64.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991,1995,1996,1997,1998,2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <sys/resource.h> -#include <sys/types.h> - -/* Set the soft and hard limits for RESOURCE to *RLIMITS. - Only the super-user can increase hard limits. - Return 0 if successful, -1 if not (and sets errno). */ -int -setrlimit64 (resource, rlimits) - enum __rlimit_resource resource; - const struct rlimit64 *rlimits; -{ - struct rlimit rlimits32; - - if (rlimits->rlim_cur >= RLIM_INFINITY) - rlimits32.rlim_cur = RLIM_INFINITY; - else - rlimits32.rlim_cur = rlimits->rlim_cur; - if (rlimits->rlim_max >= RLIM_INFINITY) - rlimits32.rlim_max = RLIM_INFINITY; - else - rlimits32.rlim_max = rlimits->rlim_max; - - return __setrlimit (resource, &rlimits32); -} diff --git a/newlib/libc/sys/linux/shared.ld b/newlib/libc/sys/linux/shared.ld deleted file mode 100644 index f51a2b1e6..000000000 --- a/newlib/libc/sys/linux/shared.ld +++ /dev/null @@ -1,3 +0,0 @@ -VERS_1.10 { - global: *; -}; diff --git a/newlib/libc/sys/linux/shm_open.c b/newlib/libc/sys/linux/shm_open.c deleted file mode 100644 index cb92c3ae4..000000000 --- a/newlib/libc/sys/linux/shm_open.c +++ /dev/null @@ -1,48 +0,0 @@ -/* shm_open - open a shared memory file */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <sys/types.h> -#include <sys/mman.h> -#include <unistd.h> -#include <string.h> -#include <fcntl.h> -#include <limits.h> - -int -shm_open (const char *name, int oflag, mode_t mode) -{ - int fd; - char shm_name[PATH_MAX+20] = "/dev/shm/"; - - /* skip opening slash */ - if (*name == '/') - ++name; - - /* create special shared memory file name and leave enough space to - cause a path/name error if name is too long */ - strlcpy (shm_name + 9, name, PATH_MAX + 10); - - fd = open (shm_name, oflag, mode); - - if (fd != -1) - { - /* once open we must add FD_CLOEXEC flag to file descriptor */ - int flags = fcntl (fd, F_GETFD, 0); - - if (flags >= 0) - { - flags |= FD_CLOEXEC; - flags = fcntl (fd, F_SETFD, flags); - } - - /* on failure, just close file and give up */ - if (flags == -1) - { - close (fd); - fd = -1; - } - } - - return fd; -} diff --git a/newlib/libc/sys/linux/shm_unlink.c b/newlib/libc/sys/linux/shm_unlink.c deleted file mode 100644 index cf259c627..000000000 --- a/newlib/libc/sys/linux/shm_unlink.c +++ /dev/null @@ -1,28 +0,0 @@ -/* shm_unlink - remove a shared memory file */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <sys/types.h> -#include <sys/mman.h> -#include <unistd.h> -#include <string.h> -#include <limits.h> - -int -shm_unlink (const char *name) -{ - int rc; - char shm_name[PATH_MAX+20] = "/dev/shm/"; - - /* skip opening slash */ - if (*name == '/') - ++name; - - /* create special shared memory file name and leave enough space to - cause a path/name error if name is too long */ - strlcpy (shm_name + 9, name, PATH_MAX + 10); - - rc = unlink (shm_name); - - return rc; -} diff --git a/newlib/libc/sys/linux/sig.c b/newlib/libc/sys/linux/sig.c deleted file mode 100644 index 6e22873ee..000000000 --- a/newlib/libc/sys/linux/sig.c +++ /dev/null @@ -1,87 +0,0 @@ -/* libc/sys/linux/signal.c - Signal handling functions */ - -/* Written 2000 by Werner Almesberger */ - - -#include <signal.h> -#include <unistd.h> -#include <sys/types.h> -#include <machine/syscall.h> - -/* avoid name space pollution */ -#define __NR___sgetmask __NR_sgetmask -#define __NR___ssetmask __NR_ssetmask -#define __NR___rt_sigtimedwait __NR_rt_sigtimedwait -#define __NR___rt_sigpending __NR_rt_sigpending -#define __NR___rt_sigprocmask __NR_rt_sigprocmask -#define __NR___rt_sigsuspend __NR_rt_sigsuspend - -_syscall2(int,kill,pid_t,pid,int,sig) -_syscall2(__sighandler_t,signal,int,signum,__sighandler_t,handler) -_syscall0(int,pause) -_syscall1(unsigned int,alarm,unsigned int,seconds) - -static _syscall2(int,__rt_sigpending,sigset_t *,set,size_t,size) -static _syscall4(int,__rt_sigprocmask,int,how,const sigset_t *,set,sigset_t *,oldset,size_t,size) -static _syscall2(int,__rt_sigsuspend,const sigset_t *,mask,size_t,size) -static _syscall4(int,__rt_sigtimedwait,const sigset_t *,set,siginfo_t *,info,struct timespec *,timeout,size_t,size) - -int __sigsuspend (const sigset_t *mask) -{ - return __rt_sigsuspend(mask, NSIG/8); -} -weak_alias(__sigsuspend,sigsuspend) - -int sigmask(int signum) /* BSD */ -{ - return 1 << signum; -} - -int __libc_raise(int sig) -{ - return kill(getpid(),sig); -} -weak_alias(__libc_raise,raise) - -int __sigpending(sigset_t *set) -{ - return __rt_sigpending(set, NSIG/8); -} -weak_alias(__sigpending,sigpending) - -int __sigprocmask (int how,const sigset_t *set,sigset_t *oldset) -{ - return __rt_sigprocmask(how, set, oldset, NSIG/8); -} -weak_alias(__sigprocmask,sigprocmask) - -int sigtimedwait(const sigset_t *set, siginfo_t *info, - struct timespec *timeout) -{ - return __rt_sigtimedwait(set, info, timeout, NSIG/8); -} - -int sigwaitinfo(const sigset_t *set, siginfo_t *info) -{ - return __rt_sigtimedwait(set, info, NULL, NSIG/8); -} - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4 - -static _syscall1(int,__ssetmask,int,newmask) -static _syscall0(int,__sgetmask) - -int sigblock(int mask) /* BSD */ -{ - return __ssetmask(mask | __sgetmask()); -} - -int sigsetmask(int newmask) /* BSD */ -{ - return __ssetmask(newmask); -} -#endif - -const char *const sys_siglist[] = { -#include "siglist.inc" -}; diff --git a/newlib/libc/sys/linux/sigaction.c b/newlib/libc/sys/linux/sigaction.c deleted file mode 100644 index 6ee3fa2cb..000000000 --- a/newlib/libc/sys/linux/sigaction.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified 05/30/02 by Jeff Johnston, Red Hat Inc. */ - -#include <errno.h> -#include <signal.h> -#include <string.h> - -#include <machine/syscall.h> - -/* The difference here is that the sigaction structure used in the - kernel is not the same as we use in the libc. Therefore we must - translate it here. */ -#include <kernel_sigaction.h> - -#define __NR___rt_sigaction __NR_rt_sigaction - -static _syscall4(int,__rt_sigaction,int,sig, - const struct kernel_sigaction *,act, - struct kernel_sigaction *,oact,size_t,size); - -/* If ACT is not NULL, change the action for SIG to *ACT. - If OACT is not NULL, put the old action for SIG in *OACT. */ -int -__libc_sigaction (sig, act, oact) - int sig; - const struct sigaction *act; - struct sigaction *oact; -{ - int result; - struct kernel_sigaction kact, koact; - /* Save the current error value for later. We need not do this - if we are guaranteed to have realtime signals. */ - - if (act) - { - kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); - kact.sa_flags = act->sa_flags; - kact.sa_restorer = act->sa_restorer; - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - result = __rt_sigaction (sig, - act ? (&kact) : NULL, - oact ? (&koact) : NULL, NSIG / 8); - - if (oact && result >= 0) - { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); - oact->sa_flags = koact.sa_flags; - oact->sa_restorer = koact.sa_restorer; - } - - return result; -} - -weak_alias (__libc_sigaction, __sigaction) -weak_alias (__libc_sigaction, sigaction) diff --git a/newlib/libc/sys/linux/siglongjmp.c b/newlib/libc/sys/linux/siglongjmp.c deleted file mode 100644 index bc3c5b79e..000000000 --- a/newlib/libc/sys/linux/siglongjmp.c +++ /dev/null @@ -1,18 +0,0 @@ -/* libc/sys/linux/siglongjmp.c - siglongjmp function */ - -/* Copyright 2002, Red Hat Inc. */ - - -#include <setjmp.h> -#include <signal.h> -#include <machine/weakalias.h> - -void -__libc_siglongjmp (sigjmp_buf env, int val) -{ - if (env.__is_mask_saved) - sigprocmask (SIG_SETMASK, &env.__saved_mask, NULL); - - __libc_longjmp (env.__buf, val); -} -weak_alias(__libc_siglongjmp,siglongjmp); diff --git a/newlib/libc/sys/linux/signal.c b/newlib/libc/sys/linux/signal.c deleted file mode 100644 index b43cd778c..000000000 --- a/newlib/libc/sys/linux/signal.c +++ /dev/null @@ -1,54 +0,0 @@ -/* BSD-like signal function. - Copyright (C) 1991, 1992, 1996, 1997, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <signal.h> -#include <machine/weakalias.h> - -sigset_t _sigintr; /* Set by siginterrupt. */ - -/* Set the handler for the signal SIG to HANDLER, - returning the old handler, or SIG_ERR on error. */ -__sighandler_t -__bsd_signal (sig, handler) - int sig; - __sighandler_t handler; -{ - struct sigaction act, oact; - - /* Check signal extents to protect __sigismember. */ - if (handler == SIG_ERR || sig < 1 || sig >= NSIG) - { - errno = (EINVAL); - return SIG_ERR; - } - - act.sa_handler = handler; - if (sigemptyset (&act.sa_mask) < 0 - || sigaddset (&act.sa_mask, sig) < 0) - return SIG_ERR; - act.sa_flags = sigismember (&_sigintr, sig) ? 0 : SA_RESTART; - if (sigaction (sig, &act, &oact) < 0) - return SIG_ERR; - - return oact.sa_handler; -} -weak_alias (__bsd_signal, bsd_signal) -weak_alias (__bsd_signal, signal) -weak_alias (__bsd_signal, ssignal) diff --git a/newlib/libc/sys/linux/sigqueue.c b/newlib/libc/sys/linux/sigqueue.c deleted file mode 100644 index 60c4fed20..000000000 --- a/newlib/libc/sys/linux/sigqueue.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib by Jeff Johnston, May 30, 2002 */ - -#include <errno.h> -#include <signal.h> -#include <unistd.h> -#include <string.h> - -#include <machine/syscall.h> - -#define __NR___rt_sigqueueinfo __NR_rt_sigqueueinfo - -extern uid_t __getuid(); -extern pid_t __getpid(); - -static _syscall3(int,__rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,info) - -/* Return any pending signal or wait for one for the given time. */ -int -__sigqueue (pid, sig, val) - pid_t pid; - int sig; - const union sigval val; -{ - siginfo_t info; - - /* First, clear the siginfo_t structure, so that we don't pass our - stack content to other tasks. */ - memset (&info, 0, sizeof (siginfo_t)); - /* We must pass the information about the data in a siginfo_t value. */ - info.si_signo = sig; - info.si_code = SI_QUEUE; - info.si_pid = __getpid (); - info.si_uid = __getuid (); - info.si_value = val; - - return __rt_sigqueueinfo(pid, sig, &info); -} -weak_alias (__sigqueue, sigqueue) diff --git a/newlib/libc/sys/linux/sigset.c b/newlib/libc/sys/linux/sigset.c deleted file mode 100644 index b6f2d79e5..000000000 --- a/newlib/libc/sys/linux/sigset.c +++ /dev/null @@ -1,98 +0,0 @@ -/* sigset.c - signal set manipulation functions */ - -/* Copyright 2002, Red Hat Inc. */ - -/* Note: these are currently grouped together in one file so that - it will override the default version in the libc/unix - directory which has grouped all functions in one file. */ - -/* sigaddset function */ - -#include <signal.h> -#include <bits/sigset.h> -#include <errno.h> -#include <string.h> -#include <machine/weakalias.h> - -int -sigaddset (sigset_t *set, const int signo) -{ - int index, mask; - __sigset_t *st = (__sigset_t *)set; - - if (signo > NSIG) - { - errno = EINVAL; - return -1; - } - - index = (signo - 1) / (8 * sizeof(long)); - mask = 1 << ((signo - 1) % (8 * sizeof(long))); - - st->__val[index] |= mask; - return 0; -} - -/* sigdelset function */ - -int -sigdelset (sigset_t *set, const int signo) -{ - int index, mask; - __sigset_t *st = (__sigset_t *)set; - - if (signo > NSIG) - { - errno = EINVAL; - return -1; - } - - index = (signo - 1) / (8 * sizeof(long)); - mask = 1 << ((signo - 1) % (8 * sizeof(long))); - - st->__val[index] &= ~mask; - return 0; -} - -/* sigemptyset function */ - -int -sigemptyset (sigset_t *set) -{ - int size = NSIG / 8; - __sigset_t *st = (__sigset_t *)set; - memset (st->__val, 0, size); - return 0; -} - -/* sigfillset function */ - -int -sigfillset (sigset_t *set) -{ - int size = NSIG / 8; - __sigset_t *st = (__sigset_t *)set; - memset (st->__val, 0xff, size); - return 0; -} - -/* sigismember function */ - -int -sigismember (const sigset_t *set, int signo) -{ - int index, mask; - __sigset_t *st = (__sigset_t *)set; - - if (signo > NSIG) - { - errno = EINVAL; - return -1; - } - - index = (signo - 1) / (8 * sizeof(long)); - mask = 1 << ((signo - 1) % (8 * sizeof(long))); - - return (st->__val[index] & mask) != 0; -} - diff --git a/newlib/libc/sys/linux/sigwait.c b/newlib/libc/sys/linux/sigwait.c deleted file mode 100644 index 09a4190e7..000000000 --- a/newlib/libc/sys/linux/sigwait.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Implementation of sigwait function from POSIX.1c. - Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <signal.h> -#include <stddef.h> /* For NULL. */ - -#include <machine/weakalias.h> - -/* This is our dummy signal handler we use here. */ -static void ignore_signal (int sig); - -/* Place where to remember which signal we got. Please note that this - implementation cannot be used for the threaded libc. The - libpthread must provide an own version. */ -static int was_sig; - - -int -__sigwait (const sigset_t *set, int *sig) -{ - sigset_t tmp_mask; - struct sigaction saved[NSIG]; - struct sigaction action; - int save_errno; - int this; - - /* Prepare set. */ - sigfillset (&tmp_mask); - - /* Unblock all signals in the SET and register our nice handler. */ - action.sa_handler = ignore_signal; - action.sa_flags = 0; - sigfillset (&action.sa_mask); /* Block all signals for handler. */ - - /* Make sure we recognize error conditions by setting WAS_SIG to a - value which does not describe a legal signal number. */ - was_sig = -1; - - for (this = 1; this < NSIG; ++this) - if (sigismember (set, this)) - { - /* Unblock this signal. */ - sigdelset (&tmp_mask, this); - - /* Register temporary action handler. */ - if (__sigaction (this, &action, &saved[this]) != 0) - goto restore_handler; - } - - /* Now we can wait for signals. */ - __sigsuspend (&tmp_mask); - - restore_handler: - save_errno = errno; - - while (--this >= 1) - if (sigismember (set, this)) - /* We ignore errors here since we must restore all handlers. */ - __sigaction (this, &saved[this], NULL); - - errno = (save_errno); - - /* Store the result and return. */ - *sig = was_sig; - return was_sig == -1 ? -1 : 0; -} -weak_alias (__sigwait, sigwait) - - -static void -ignore_signal (int sig) -{ - /* Remember the signal. */ - was_sig = sig; -} diff --git a/newlib/libc/sys/linux/sleep.c b/newlib/libc/sys/linux/sleep.c deleted file mode 100644 index 7cc2bede6..000000000 --- a/newlib/libc/sys/linux/sleep.c +++ /dev/null @@ -1,20 +0,0 @@ -/* libc/sys/linux/sleep.c - sleep function */ - -/* Written 2000 by Werner Almesberger */ - - -#include <errno.h> -#include <sys/types.h> -#include <sys/time.h> -#include <linux/times.h> - -unsigned int sleep(unsigned int seconds) -{ - struct timespec ts; - - ts.tv_sec = seconds; - ts.tv_nsec = 0; - if (!nanosleep(&ts,&ts)) return 0; - if (errno == EINTR) return ts.tv_sec; - return -1; -} diff --git a/newlib/libc/sys/linux/socket.c b/newlib/libc/sys/linux/socket.c deleted file mode 100644 index daba98934..000000000 --- a/newlib/libc/sys/linux/socket.c +++ /dev/null @@ -1,32 +0,0 @@ -/* libc/sys/linux/socket.c - socket system calls */ - -/* Copyright 2002, Red Hat Inc. */ - -#define __KERNEL_PROTOTYPES - -#include <stdarg.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <machine/socketcall.h> - -_sockcall3(int,accept,int,fd,struct sockaddr *,addr,socklen_t *,addr_len) -_sockcall3(int,bind,int,fd,const struct sockaddr *,addr,socklen_t,len) -_sockcall3(int,connect,int,fd,const struct sockaddr *,addr,socklen_t,len) -_sockcall3(int,getpeername,int,fd,struct sockaddr *,addr,socklen_t *,len) -_sockcall3(int,getsockname,int,fd,struct sockaddr *,addr,socklen_t *,len) -_sockcall5(int,getsockopt,int,fd,int,level,int,opt,void *,optval,socklen_t *,optlen) -_sockcall2(int,listen,int,fd,int,n) -_sockcall4(ssize_t,recv,int,fd,void *,buf,size_t,n,int,flags) -_sockcall6(ssize_t,recvfrom,int,fd,void *,buf,size_t,n,int,flags,struct sockaddr *,addr,socklen_t *,addr_len) -_sockcall3(ssize_t,recvmsg,int,fd,struct msghdr *,message,int,flags) -_sockcall4(ssize_t,send,int,fd,const void *,buf,size_t,n,int,flags) -_sockcall6(ssize_t,sendto,int,fd,const void *,buf,size_t,n,int,flags,const struct sockaddr *,addr,socklen_t,addr_len) -_sockcall5(int,setsockopt,int,fd,int,level,int,opt,const void *,optval,socklen_t,optlen) -_sockcall2(int,shutdown,int,fd,int,how) -_sockcall3(int,socket,int,domain,int,type,int,protocol) -_sockcall4(int,socketpair,int,domain,int,type,int,protocol,int,fds[2]) -_sockcall3(ssize_t,sendmsg,int,fd,const struct msghdr *,message,int,flags) - -weak_alias(__libc_connect,__connect); -weak_alias(__libc_send,__send); diff --git a/newlib/libc/sys/linux/sockops.h b/newlib/libc/sys/linux/sockops.h deleted file mode 100644 index 7a421f26d..000000000 --- a/newlib/libc/sys/linux/sockops.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Linux socket syscall subopcodes */ - -#ifndef _SOCKOPS_H - -#define _SOCKOPS_H - -#define SOCK_socket 1 -#define SOCK_bind 2 -#define SOCK_connect 3 -#define SOCK_listen 4 -#define SOCK_accept 5 -#define SOCK_getsockname 6 -#define SOCK_getpeername 7 -#define SOCK_socketpair 8 -#define SOCK_send 9 -#define SOCK_recv 10 -#define SOCK_sendto 11 -#define SOCK_recvfrom 12 -#define SOCK_shutdown 13 -#define SOCK_setsockopt 14 -#define SOCK_getsockopt 15 -#define SOCK_sendmsg 16 -#define SOCK_recvmsg 17 - -#endif /* _SOCKOPS_H */ - - diff --git a/newlib/libc/sys/linux/stack.c b/newlib/libc/sys/linux/stack.c deleted file mode 100644 index 52a181cf2..000000000 --- a/newlib/libc/sys/linux/stack.c +++ /dev/null @@ -1,10 +0,0 @@ -/* libc/sys/linux/stack.c - Basic stack system calls */ - -/* Copyright 2002, Red Hat Inc. */ - -#include <signal.h> -#include <unistd.h> -#include <sys/types.h> -#include <machine/syscall.h> - -_syscall2(int,sigaltstack,const stack_t *,ss,stack_t *,oss) diff --git a/newlib/libc/sys/linux/statvfs.c b/newlib/libc/sys/linux/statvfs.c deleted file mode 100644 index 4b0d51abd..000000000 --- a/newlib/libc/sys/linux/statvfs.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define _GNU_SOURCE - -#include <errno.h> -#include <mntent.h> -#include <paths.h> -#include <string.h> -#include <sys/mount.h> -#include <sys/stat.h> -#include <sys/statfs.h> -#include <sys/statvfs.h> - - -int -statvfs (const char *file, struct statvfs *buf) -{ - struct statfs fsbuf; - struct stat64 st; - - /* Get as much information as possible from the system. */ - if (__statfs (file, &fsbuf) < 0) - return -1; - -#define STAT(st) stat64 (file, st) -#include "internal_statvfs.c" - - /* We signal success if the statfs call succeeded. */ - return 0; -} diff --git a/newlib/libc/sys/linux/statvfs64.c b/newlib/libc/sys/linux/statvfs64.c deleted file mode 100644 index f612b991d..000000000 --- a/newlib/libc/sys/linux/statvfs64.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Return information about the filesystem on which FILE resides. - Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <sys/statvfs.h> -#include <stddef.h> -#include <string.h> -#include <machine/weakalias.h> - -/* Return information about the filesystem on which FILE resides. */ -int -__statvfs64 (const char *file, struct statvfs64 *buf) -{ - struct statvfs buf32; - - if (statvfs (file, &buf32) < 0) - return -1; - - buf->f_bsize = buf32.f_bsize; - buf->f_frsize = buf32.f_frsize; - buf->f_blocks = buf32.f_blocks; - buf->f_bfree = buf32.f_bfree; - buf->f_bavail = buf32.f_bavail; - buf->f_files = buf32.f_files; - buf->f_ffree = buf32.f_ffree; - buf->f_favail = buf32.f_favail; - buf->f_fsid = buf32.f_fsid; - buf->f_flag = buf32.f_flag; - buf->f_namemax = buf32.f_namemax; - memcpy (buf->__f_spare, buf32.__f_spare, sizeof (buf32.__f_spare)); - - return 0; -} -weak_alias (__statvfs64, statvfs64) diff --git a/newlib/libc/sys/linux/strsignal.c b/newlib/libc/sys/linux/strsignal.c deleted file mode 100644 index 3f95e18a7..000000000 --- a/newlib/libc/sys/linux/strsignal.c +++ /dev/null @@ -1,63 +0,0 @@ -#include <string.h> -#include <signal.h> -#include <stdio.h> -#include <reent.h> - -static const char *sigstring[] = - { - "Signal 0", - "Hangup", - "Interrupt", - "Quit", - "Illegal instruction", - "Trace/breakpoint trap", - "IOT trap", - "EMT trap", - "Floating point exception", - "Killed", - "Bus error", - "Segmentation fault", - "Bad system call", - "Broken pipe", - "Alarm clock", - "Terminated", - "Urgent I/O condition", - "Stopped (signal)", - "Stopped", - "Continued", - "Child exited", - "Stopped (tty input)", - "Stopped (tty output)", - "I/O possible", - "CPU time limit exceeded", - "File size limit exceeded", - "Virtual timer expired", - "Profiling timer expired", - "Window changed", - "Resource lost", - "User defined signal 1", - "User defined signal 2" - }; - -char * -strsignal (int sig) -{ - if (sig < 0 || sig >= __SIGRTMIN) - { - char *buffer; - struct _reent *ptr; - - ptr = _REENT; - - _REENT_CHECK_SIGNAL_BUF(ptr); - buffer = _REENT_SIGNAL_BUF(ptr); - - if (sig < 0 || sig > __SIGRTMAX) - siprintf (buffer, "Unknown signal %d", sig); - else - siprintf (buffer, "Real-time signal %d", sig - __SIGRTMIN); - return buffer; - } - else - return sigstring[sig]; -} diff --git a/newlib/libc/sys/linux/strverscmp.c b/newlib/libc/sys/linux/strverscmp.c deleted file mode 100644 index 2a9cbf48a..000000000 --- a/newlib/libc/sys/linux/strverscmp.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Compare strings while treating digits characters numerically. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <string.h> -#include <ctype.h> -#include <machine/weakalias.h> - -/* states: S_N: normal, S_I: comparing integral part, S_F: comparing - fractionnal parts, S_Z: idem but with leading Zeroes only */ -#define S_N 0x0 -#define S_I 0x4 -#define S_F 0x8 -#define S_Z 0xC - -/* result_type: CMP: return diff; LEN: compare using len_diff/diff */ -#define CMP 2 -#define LEN 3 - - -/* Compare S1 and S2 as strings holding indices/version numbers, - returning less than, equal to or greater than zero if S1 is less than, - equal to or greater than S2 (for more info, see the texinfo doc). -*/ - -int -__strverscmp (s1, s2) - const char *s1; - const char *s2; -{ - const unsigned char *p1 = (const unsigned char *) s1; - const unsigned char *p2 = (const unsigned char *) s2; - unsigned char c1, c2; - int state; - int diff; - - /* Symbol(s) 0 [1-9] others (padding) - Transition (10) 0 (01) d (00) x (11) - */ - static const unsigned int next_state[] = - { - /* state x d 0 - */ - /* S_N */ S_N, S_I, S_Z, S_N, - /* S_I */ S_N, S_I, S_I, S_I, - /* S_F */ S_N, S_F, S_F, S_F, - /* S_Z */ S_N, S_F, S_Z, S_Z - }; - - static const int result_type[] = - { - /* state x/x x/d x/0 x/- d/x d/d d/0 d/- - 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ - - /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, - CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, - /* S_I */ CMP, -1, -1, CMP, +1, LEN, LEN, CMP, - +1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, - /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, - CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, - /* S_Z */ CMP, +1, +1, CMP, -1, CMP, CMP, CMP, - -1, CMP, CMP, CMP - }; - - if (p1 == p2) - return 0; - - c1 = *p1++; - c2 = *p2++; - /* Hint: '0' is a digit too. */ - state = S_N | ((c1 == '0') + (isdigit (c1) != 0)); - - while ((diff = c1 - c2) == 0 && c1 != '\0') - { - state = next_state[state]; - c1 = *p1++; - c2 = *p2++; - state |= (c1 == '0') + (isdigit (c1) != 0); - } - - state = result_type[state << 2 | (((c2 == '0') + (isdigit (c2) != 0)))]; - - switch (state) - { - case CMP: - return diff; - - case LEN: - while (isdigit (*p1++)) - if (!isdigit (*p2++)) - return 1; - - return isdigit (*p2) ? -1 : diff; - - default: - return state; - } -} -weak_alias (__strverscmp, strverscmp) diff --git a/newlib/libc/sys/linux/sys/_types.h b/newlib/libc/sys/linux/sys/_types.h deleted file mode 100644 index 15ccf1061..000000000 --- a/newlib/libc/sys/linux/sys/_types.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ANSI C namespace clean utility typedefs */ - -/* This file defines various typedefs needed by the system calls that support - the C library. Basically, they're just the POSIX versions with an '_' - prepended. This file lives in the `sys' directory so targets can provide - their own if desired (or they can put target dependant conditionals here). -*/ - -#ifndef _SYS__TYPES_H -#define _SYS__TYPES_H - -typedef long _off_t; -__extension__ typedef long long _off64_t; - -#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 -typedef int _ssize_t; -#else -typedef long _ssize_t; -#endif - -#define __need_wint_t -#include <stddef.h> - -/* Conversion state information. */ -typedef struct -{ - int __count; - union - { - wint_t __wch; - unsigned char __wchb[4]; - } __value; /* Value so far. */ -} _mbstate_t; - -struct __flock_t_tmp; -typedef struct -{ - int __a; - int __b; - struct - { - long int __c1; - int __c2; - } __c; - int __d; - struct __flock_t_tmp * __e; -} _flock_t; - -#endif /* _SYS__TYPES_H */ diff --git a/newlib/libc/sys/linux/sys/cdefs.h b/newlib/libc/sys/linux/sys/cdefs.h deleted file mode 100644 index 459785bcb..000000000 --- a/newlib/libc/sys/linux/sys/cdefs.h +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_CDEFS_H -#define _SYS_CDEFS_H 1 - -/* We are almost always included from features.h. */ -#ifndef _FEATURES_H -# include <features.h> -#endif - -/* The GNU libc does not support any K&R compilers or the traditional mode - of ISO C compilers anymore. Check for some of the combinations not - anymore supported. */ -#if defined __GNUC__ && !defined __STDC__ -# error "You need a ISO C conforming compiler to use the glibc headers" -#endif - -#define __FBSDID(x) /* nothing */ - -/* Some user header file might have defined this before. */ -#undef __P -#undef __PMT - -#ifdef __GNUC__ - -/* GCC can always grok prototypes. For C++ programs we add throw() - to help it optimize the function calls. But this works only with - gcc 2.8.x and egcs. */ -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW -# endif -# define __P(args) args __THROW -/* This macro will be used for functions which might take C++ callback - functions. */ -# define __PMT(args) args - -#else /* Not GCC. */ - -# define __inline /* No inline functions. */ - -# define __THROW -# define __P(args) args -# define __PMT(args) args - -# define __const const -# define __signed signed -# define __volatile volatile - -#endif /* GCC. */ - -/* For these things, GCC behaves the ANSI way normally, - and the non-ANSI way under -traditional. */ - -#define __CONCAT(x,y) x ## y -#define __STRING(x) #x - -/* This is not a typedef so `const __ptr_t' does the right thing. */ -#define __ptr_t void * -#define __long_double_t long double - - -/* C++ needs to know that types and declarations are C, not C++. */ -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS -# define __END_DECLS -#endif - - -/* Support for bounded pointers. */ -#ifndef __BOUNDED_POINTERS__ -# define __bounded /* nothing */ -# define __unbounded /* nothing */ -# define __ptrvalue /* nothing */ -#endif - - -/* Support for flexible arrays. */ -#if __GNUC_PREREQ (2,97) -/* GCC 2.97 supports C99 flexible array members. */ -# define __flexarr [] -#else -# ifdef __GNUC__ -# define __flexarr [0] -# else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define __flexarr [] -# else -/* Some other non-C99 compiler. Approximate with [1]. */ -# define __flexarr [1] -# endif -# endif -#endif - - -/* __asm__ ("xyz") is used throughout the headers to rename functions - at the assembly language level. This is wrapped by the __REDIRECT - macro, in order to support compilers that can do this some other - way. When compilers don't support asm-names at all, we have to do - preprocessor tricks instead (which don't have exactly the right - semantics, but it's the best we can do). - - Example: - int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ - -#if defined __GNUC__ && __GNUC__ >= 2 - -# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) -# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -# define __ASMNAME2(prefix, cname) __STRING (prefix) cname - -/* -#elif __SOME_OTHER_COMPILER__ - -# define __REDIRECT(name, proto, alias) name proto; \ - _Pragma("let " #name " = " #alias) -*/ -#endif - -/* GCC has various useful declarations that can be made with the - `__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !defined __GNUC__ || __GNUC__ < 2 -# define __attribute__(xyz) /* Ignore */ -#endif - -/* At some point during the gcc 2.96 development the `malloc' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) -# define __attribute_malloc__ __attribute__ ((__malloc__)) -#else -# define __attribute_malloc__ /* Ignore */ -#endif - -/* At some point during the gcc 2.96 development the `pure' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) -# define __attribute_pure__ __attribute__ ((__pure__)) -#else -# define __attribute_pure__ /* Ignore */ -#endif - -/* At some point during the gcc 3.1 development the `used' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (3,1) -# define __attribute_used__ __attribute__ ((__used__)) -# define __attribute_noinline__ __attribute__ ((__noinline__)) -#else -# define __attribute_used__ __attribute__ ((__unused__)) -# define __attribute_noinline__ /* Ignore */ -#endif - -/* At some point during the gcc 2.8 development the `format_arg' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. - If several `format_arg' attributes are given for the same function, in - gcc-3.0 and older, all but the last one are ignored. In newer gccs, - all designated arguments are considered. */ -#if __GNUC_PREREQ (2,8) -# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) -#else -# define __attribute_format_arg__(x) /* Ignore */ -#endif - -/* At some point during the gcc 2.97 development the `strfmon' format - attribute for functions was introduced. We don't want to use it - unconditionally (although this would be possible) since it - generates warnings. */ -#if __GNUC_PREREQ (2,97) -# define __attribute_format_strfmon__(a,b) \ - __attribute__ ((__format__ (__strfmon__, a, b))) -#else -# define __attribute_format_strfmon__(a,b) /* Ignore */ -#endif - -/* It is possible to compile containing GCC extensions even if GCC is - run in pedantic mode if the uses are carefully marked using the - `__extension__' keyword. But this is not generally available before - version 2.8. */ -#if !__GNUC_PREREQ (2,8) -# define __extension__ /* Ignore */ -#endif - -/* __restrict is known in EGCS 1.2 and above. */ -#if !__GNUC_PREREQ (2,92) -# define __restrict /* Ignore */ -#endif - -/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is - array_name[restrict] - GCC 3.1 supports this. */ -#if __GNUC_PREREQ (3,1) && !defined __GNUG__ -# define __restrict_arr __restrict -#else -# ifdef __GNUC__ -# define __restrict_arr /* Not supported in old GCC. */ -# else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define __restrict_arr restrict -# else -/* Some other non-C99 compiler. */ -# define __restrict_arr /* Not supported. */ -# endif -# endif -#endif - -#endif /* sys/cdefs.h */ diff --git a/newlib/libc/sys/linux/sys/dirent.h b/newlib/libc/sys/linux/sys/dirent.h deleted file mode 100644 index f9b6fec7a..000000000 --- a/newlib/libc/sys/linux/sys/dirent.h +++ /dev/null @@ -1,56 +0,0 @@ -/* libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_DIRENT_H -#define _SYS_DIRENT_H - -#include <sys/types.h> -#include <linux/dirent.h> -#define _LIBC 1 -#include <sys/lock.h> -#undef _LIBC - -#define HAVE_NO_D_NAMLEN /* no struct dirent->d_namlen */ -#define HAVE_DD_LOCK /* have locking mechanism */ - -#define MAXNAMLEN 255 /* sizeof(struct dirent.d_name)-1 */ - - -typedef struct { - int dd_fd; /* directory file */ - int dd_loc; /* position in buffer */ - int dd_seek; - char *dd_buf; /* buffer */ - int dd_len; /* buffer length */ - int dd_size; /* amount of data in buffer */ - _LOCK_RECURSIVE_T dd_lock; -} DIR; - - -#define __dirfd(dir) (dir)->dd_fd - -/* --- redundant --- */ - -DIR *opendir(const char *); -struct dirent *readdir(DIR *); -void rewinddir(DIR *); -int closedir(DIR *); - -/* internal prototype */ -void _seekdir(DIR *dir,off_t offset); - -#ifndef _POSIX_SOURCE -long telldir (DIR *); -void seekdir (DIR *, off_t loc); - -int scandir (const char *__dir, - struct dirent ***__namelist, - int (*select) (const struct dirent *), - int (*compar) (const struct dirent **, const struct dirent **)); - -int alphasort (const struct dirent **__a, const struct dirent **__b); -#endif /* _POSIX_SOURCE */ - -#endif diff --git a/newlib/libc/sys/linux/sys/errno.h b/newlib/libc/sys/linux/sys/errno.h deleted file mode 100644 index 82c84c944..000000000 --- a/newlib/libc/sys/linux/sys/errno.h +++ /dev/null @@ -1,34 +0,0 @@ -/* libc/sys/linux/sys/errno.h - Errno variable and codes */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_ERRNO_H -#define _SYS_ERRNO_H - -/* --- from newlin's sys/errno.h --- */ - -#include <sys/reent.h> - -#ifndef _REENT_ONLY -#define errno (*__errno()) -extern int *__errno _PARAMS ((void)); -#endif - -extern __IMPORT _CONST char * _CONST _sys_errlist[]; -extern __IMPORT int _sys_nerr; - -#define __errno_r(ptr) ((ptr)->_errno) - -/* --- end of slight redundancy (the use of struct _reent->_errno is - hard-coded in perror.c so why pretend anything else could work too ? */ - -#define __set_errno(x) (errno = (x)) - -#include <asm/errno.h> - -#define ENOTSUP EOPNOTSUPP -#define EFTYPE 79 /* Inappropriate file type or format */ -#define EILSEQ 84 - -#endif diff --git a/newlib/libc/sys/linux/sys/fcntl.h b/newlib/libc/sys/linux/sys/fcntl.h deleted file mode 100644 index 78914fd8f..000000000 --- a/newlib/libc/sys/linux/sys/fcntl.h +++ /dev/null @@ -1,29 +0,0 @@ -/* libc/sys/linux/sys/fcntl.h - File access */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_FCNTL_H -#define _SYS_FCNTL_H - -#include <sys/types.h> -#include <linux/fcntl.h> - -/* --- redundant stuff below --- */ - -#include <_ansi.h> - -extern int creat _PARAMS ((const char *, mode_t)); -extern int _open _PARAMS ((const char *, int, ...)); - -#ifdef __KERNEL_PROTOTYPES -extern int open(const char *pathname, int flags, mode_t mode); -extern int fcntl(int fd, int cmd, long arg); -#else -extern int open _PARAMS ((const char *, int, ...)); -extern int fcntl _PARAMS ((int, int, ...)); -#endif - -extern int _fcntl _PARAMS ((int, int, ...)); - -#endif diff --git a/newlib/libc/sys/linux/sys/features.h b/newlib/libc/sys/linux/sys/features.h deleted file mode 100644 index 34cd0eb80..000000000 --- a/newlib/libc/sys/linux/sys/features.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _SYS_FEATURES_H -#define _SYS_FEATURES_H - -#include <bits/posix_opt.h> - -/* We do not support asynchronous I/O. */ -#undef _POSIX_ASYNCHRONOUS_IO -#undef _POSIX_ASYNC_IO -#undef _LFS_ASYNCHRONOUS_IO -#undef _LFS64_ASYNCHRONOUS_IO - -/* POSIX message queues are supported. */ -#undef _POSIX_MESSAGE_PASSING -#define _POSIX_MESSAGE_PASSING 1 - -#endif /* _SYS_FEATURES_H */ diff --git a/newlib/libc/sys/linux/sys/file.h b/newlib/libc/sys/linux/sys/file.h deleted file mode 100644 index 875ee18c4..000000000 --- a/newlib/libc/sys/linux/sys/file.h +++ /dev/null @@ -1,13 +0,0 @@ -/* libc/sys/linux/sys/file.h - BSD compatibility */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_FILE_H -#define _SYS_FILE_H - -#include <sys/fcntl.h> - -int flock(int fd,int operation); - -#endif diff --git a/newlib/libc/sys/linux/sys/ioctl.h b/newlib/libc/sys/linux/sys/ioctl.h deleted file mode 100644 index 12e0cd22d..000000000 --- a/newlib/libc/sys/linux/sys/ioctl.h +++ /dev/null @@ -1,11 +0,0 @@ -/* libc/sys/linux/sys/ioctl.h - ioctl prototype */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_IOCTL_H -#define _SYS_IOCTL_H - -int ioctl(int fd,int request,...); - -#endif diff --git a/newlib/libc/sys/linux/sys/linux_time.h b/newlib/libc/sys/linux/sys/linux_time.h deleted file mode 100644 index e71f70bba..000000000 --- a/newlib/libc/sys/linux/sys/linux_time.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _LINUX_TIME_H -#define _LINUX_TIME_H - -#include <asm/param.h> -#include <sys/types.h> - -#ifndef _STRUCT_TIMESPEC -#define _STRUCT_TIMESPEC -struct timespec { - time_t tv_sec; /* seconds */ - long tv_nsec; /* nanoseconds */ -}; -#endif /* _STRUCT_TIMESPEC */ - -/* - * Change timeval to jiffies, trying to avoid the - * most obvious overflows.. - * - * And some not so obvious. - * - * Note that we don't want to return MAX_LONG, because - * for various timeout reasons we often end up having - * to wait "jiffies+1" in order to guarantee that we wait - * at _least_ "jiffies" - so "jiffies+1" had better still - * be positive. - */ -#define MAX_JIFFY_OFFSET ((~0UL >> 1)-1) - -static __inline__ unsigned long -timespec_to_jiffies(struct timespec *value) -{ - unsigned long sec = value->tv_sec; - long nsec = value->tv_nsec; - - if (sec >= (MAX_JIFFY_OFFSET / HZ)) - return MAX_JIFFY_OFFSET; - nsec += 1000000000L / HZ - 1; - nsec /= 1000000000L / HZ; - return HZ * sec + nsec; -} - -static __inline__ void -jiffies_to_timespec(unsigned long jiffies, struct timespec *value) -{ - value->tv_nsec = (jiffies % HZ) * (1000000000L / HZ); - value->tv_sec = jiffies / HZ; -} - -#ifndef _STRUCT_TIMEVAL -#define _STRUCT_TIMEVAL -struct timeval { - time_t tv_sec; /* seconds */ - suseconds_t tv_usec; /* microseconds */ -}; -#endif - -struct timezone { - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - -#define ITIMER_REAL 0 -#define ITIMER_VIRTUAL 1 -#define ITIMER_PROF 2 - -struct itimerspec { - struct timespec it_interval; /* timer period */ - struct timespec it_value; /* timer expiration */ -}; - -struct itimerval { - struct timeval it_interval; /* timer interval */ - struct timeval it_value; /* current value */ -}; - -#endif diff --git a/newlib/libc/sys/linux/sys/resource.h b/newlib/libc/sys/linux/sys/resource.h deleted file mode 100644 index f804731f9..000000000 --- a/newlib/libc/sys/linux/sys/resource.h +++ /dev/null @@ -1,12 +0,0 @@ -/* libc/sys/linux/sys/resource.h - Resource usage */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_RESOURCE_H -#define _SYS_RESOURCE_H - -#include <sys/types.h> -#include <bits/resource.h> - -#endif diff --git a/newlib/libc/sys/linux/sys/select.h b/newlib/libc/sys/linux/sys/select.h deleted file mode 100644 index ddd2ac9d2..000000000 --- a/newlib/libc/sys/linux/sys/select.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _SYS_SELECT_H -#define _SYS_SELECT_H 1 - -#include <sys/types.h> -#include <bits/sigset.h> -#include <time.h> - -extern int select (int __nfds, fd_set *__restrict __readfds, - fd_set *__restrict __writefds, - fd_set *__restrict __exceptfds, - struct timeval *__restrict __timeout) __THROW; - -#endif /* sys/select.h */ diff --git a/newlib/libc/sys/linux/sys/signal.h b/newlib/libc/sys/linux/sys/signal.h deleted file mode 100644 index cef7058cd..000000000 --- a/newlib/libc/sys/linux/sys/signal.h +++ /dev/null @@ -1,56 +0,0 @@ -/* libc/sys/linux/sys/signal.h - Signal handling */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_SIGNAL_H -#define _SYS_SIGNAL_H -#define _SIGNAL_H - -#include <sys/types.h> -#include <bits/sigset.h> -#include <bits/signum.h> - -/* we want RT signals so we must override the definition of sigset_t - and NSIG */ - -#undef NSIG -#define NSIG _NSIG -#undef sigset_t -#define sigset_t __sigset_t - -typedef void (*_sig_func_ptr) (int); -typedef _sig_func_ptr __sighandler_t; - -#include <bits/siginfo.h> -#include <bits/sigaction.h> -#include <bits/sigstack.h> - -/* --- include/signal.h thinks it knows better :-( --- */ - -#undef SIG_DFL -#undef SIG_IGN -#undef SIG_ERR - -/* --- redundant stuff below --- */ - -#include <_ansi.h> - -int _EXFUN(kill, (int, int)); -_VOID _EXFUN(psignal, (int, const char *)); -int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *)); -int _EXFUN(sigaddset, (sigset_t *, const int)); -int _EXFUN(sigdelset, (sigset_t *, const int)); -int _EXFUN(sigismember, (const sigset_t *, int)); -int _EXFUN(sigfillset, (sigset_t *)); -int _EXFUN(sigemptyset, (sigset_t *)); -int _EXFUN(sigpending, (sigset_t *)); -int _EXFUN(sigsuspend, (const sigset_t *)); -int _EXFUN(sigpause, (int)); - -#ifndef _POSIX_SOURCE -extern const char *const sys_siglist[]; -typedef __sighandler_t sig_t; /* BSDism */ -#endif - -#endif diff --git a/newlib/libc/sys/linux/sys/stat.h b/newlib/libc/sys/linux/sys/stat.h deleted file mode 100644 index 7bc06f7ae..000000000 --- a/newlib/libc/sys/linux/sys/stat.h +++ /dev/null @@ -1,32 +0,0 @@ -/* libc/sys/linux/sys/stat.h - Stat structure and macros */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_STAT_H -#define _SYS_STAT_H - -#include <asm/stat.h> -#define __KERNEL__ -#include <linux/stat.h> -#undef __KERNEL__ - -/* --- redundant stuff below --- */ - -#include <_ansi.h> -#include <sys/types.h> - -int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); -int _EXFUN(mkdir,( const char *_path, mode_t __mode )); -int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); -int _EXFUN(stat,( const char *__path, struct stat *__sbuf )); -mode_t _EXFUN(umask,( mode_t __mask )); - -#ifndef _POSIX_SOURCE -int _EXFUN(fstat64,( int __fd, struct stat *__sbuf )); -int _EXFUN(lstat,( const char *file_name, struct stat *buf)); -int _EXFUN(lstat64,( const char *file_name, struct stat *buf)); -int _EXFUN(stat64,( const char *__path, struct stat *__sbuf )); -#endif /* _POSIX_SOURCE */ - -#endif /* _SYS_STAT_H */ diff --git a/newlib/libc/sys/linux/sys/stdio.h b/newlib/libc/sys/linux/sys/stdio.h deleted file mode 100644 index a99308161..000000000 --- a/newlib/libc/sys/linux/sys/stdio.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _NEWLIB_STDIO_H -#define _NEWLIB_STDIO_H - -/* Internal locking macros, used to protect stdio functions. In the - linux case, expand to flockfile, and funlockfile, both defined in - LinuxThreads. */ -#if !defined(__SINGLE_THREAD__) -# if !defined(_flockfile) -# define _flockfile(fp) flockfile(fp) -# endif -# if !defined(_funlockfile) -# define _funlockfile(fp) funlockfile(fp) -# endif -#endif /* __SINGLE_THREAD__ */ - -#define getline __getline -#define getdelim __getdelim - -char * _EXFUN(ctermid, (char *)); - -#endif /* _NEWLIB_STDIO_H */ diff --git a/newlib/libc/sys/linux/sys/termios.h b/newlib/libc/sys/linux/sys/termios.h deleted file mode 100644 index ae053b5e4..000000000 --- a/newlib/libc/sys/linux/sys/termios.h +++ /dev/null @@ -1,17 +0,0 @@ -/* libc/sys/linux/sys/termios.h - Terminal control definitions */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_TERMIOS_H -#define _SYS_TERMIOS_H - -#include <linux/termios.h> -#include <machine/termios.h> - -/* grr, this shouldn't have to be here */ - -int tcgetattr(int fd,struct termios *termios_p); -int tcsetattr(int fd,int optional_actions,const struct termios *termios_p); - -#endif diff --git a/newlib/libc/sys/linux/sys/time.h b/newlib/libc/sys/linux/sys/time.h deleted file mode 100644 index f2c656e5a..000000000 --- a/newlib/libc/sys/linux/sys/time.h +++ /dev/null @@ -1,94 +0,0 @@ -/* libc/sys/linux/sys/time.h - Time handling */ - -/* Written 2000 by Werner Almesberger */ - -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)time.h 8.5 (Berkeley) 5/4/95 - * $FreeBSD: src/sys/sys/time.h,v 1.56 2002/05/05 04:33:09 bde Exp $ - */ - -#ifndef _SYS_TIME_H -#define _SYS_TIME_H - -#include <sys/types.h> -#include <sys/linux_time.h> - -/* Macros for converting between `struct timeval' and `struct timespec'. */ -# define TIMEVAL_TO_TIMESPEC(tv, ts) { \ - (ts)->tv_sec = (tv)->tv_sec; \ - (ts)->tv_nsec = (tv)->tv_usec * 1000; \ -} -# define TIMESPEC_TO_TIMEVAL(tv, ts) { \ - (tv)->tv_sec = (ts)->tv_sec; \ - (tv)->tv_usec = (ts)->tv_nsec / 1000; \ -} - -/* Convenience macros for operations on timevals. - NOTE: `timercmp' does not work for >= or <=. */ -# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) -# define timercmp(a, b, CMP) \ - (((a)->tv_sec == (b)->tv_sec) ? \ - ((a)->tv_usec CMP (b)->tv_usec) : \ - ((a)->tv_sec CMP (b)->tv_sec)) -# define timeradd(a, b, result) \ - do { \ - (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ - if ((result)->tv_usec >= 1000000) \ - { \ - ++(result)->tv_sec; \ - (result)->tv_usec -= 1000000; \ - } \ - } while (0) -# define timersub(a, b, result) \ - do { \ - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ - if ((result)->tv_usec < 0) { \ - --(result)->tv_sec; \ - (result)->tv_usec += 1000000; \ - } \ - } while (0) -/* --- redundant stuff below --- */ - -#include <_ansi.h> - -int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); -int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); -int _EXFUN(utimes, (const char *__path, const struct timeval __tvp[2])); -int _EXFUN(getitimer, (int __which, struct itimerval *__value)); -int _EXFUN(setitimer, (int __which, const struct itimerval *__value, - struct itimerval *__ovalue)); -#endif diff --git a/newlib/libc/sys/linux/sys/types.h b/newlib/libc/sys/linux/sys/types.h deleted file mode 100644 index 90011ea83..000000000 --- a/newlib/libc/sys/linux/sys/types.h +++ /dev/null @@ -1,176 +0,0 @@ -/* libc/sys/linux/sys/types.h - The usual type zoo */ - -/* Written 2000 by Werner Almesberger */ - -/*- - * Copyright (c) 1982, 1986, 1991, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)types.h 8.6 (Berkeley) 2/19/95 - * $FreeBSD: src/sys/sys/types.h,v 1.60 2002/04/10 15:58:13 mike Exp $ - */ - -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H - -/* Newlib has it's own time_t and clock_t definitions in - * libc/include/sys/types.h. Repeat those here and - * skip the kernel's definitions. */ - -#include <sys/config.h> -#include <machine/types.h> -#include <sys/_types.h> - -#if !defined(__time_t_defined) && !defined(_TIME_T) -#define _TIME_T -#define __time_t_defined -typedef _TIME_T_ time_t; -#endif - -#if !defined(__clock_t_defined) && !defined(_CLOCK_T) -#define _CLOCK_T -#define __clock_t_defined -typedef _CLOCK_T_ clock_t; -#endif - -#ifndef _SSIZE_T -#define _SSIZE_T -typedef _ssize_t ssize_t; -#endif - -#ifndef __u_char_defined -#ifdef __GNUC__ -__extension__ typedef long long quad_t; -__extension__ typedef unsigned long long u_quad_t; -#else -typedef struct - { - long int __val[2]; - } quad_t; -typedef struct - { - unsigned long __val[2]; - } u_quad_t; -#endif -typedef struct - { - int __val[2]; - } fsid_t; -#define __u_char_defined -#endif - -typedef int clockid_t; - -# define _SYS_TYPES_FD_SET -# define NBBY 8 /* number of bits in a byte */ -/* - * Select uses bit masks of file descriptors in longs. - * These macros manipulate such bit fields (the filesystem macros use chars). - * FD_SETSIZE may be defined by the user, but the default here - * should be >= NOFILE (param.h). - */ -# ifndef FD_SETSIZE -# define FD_SETSIZE 64 -# endif - -typedef long fd_mask; -# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -# ifndef howmany -# define howmany(x,y) (((x)+((y)-1))/(y)) -# endif - -#define fd_set _types_fd_set - -# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) -# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) -# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) -# define FD_ZERO(p) (__extension__ (void)({ \ - size_t __i; \ - char *__tmp = (char *)p; \ - for (__i = 0; __i < sizeof (*(p)); ++__i) \ - *__tmp++ = 0; \ -})) - -#include <linux/types.h> -#include <bits/types.h> -#define __mode_t_defined -#define __gid_t_defined -#define __uid_t_defined -#define __pid_t_defined -#define __ssize_t_defined -#define __key_t_defined -#define __off_t_defined -#define __off64_t_defined - -typedef __ino64_t ino64_t; -typedef __uint32_t uintptr_t; -typedef __int32_t intptr_t; -typedef __off64_t off64_t; -typedef __off_t off_t; - -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -typedef struct _physadr { - int r[1]; -} *physadr; - -typedef struct label_t { - int val[6]; -} label_t; -#endif - -typedef unsigned int vm_offset_t; -typedef __int64_t vm_ooffset_t; -typedef unsigned int vm_pindex_t; -typedef unsigned int vm_size_t; - -typedef __int32_t register_t; -typedef __uint32_t u_register_t; - -#ifdef _KERNEL -typedef int intfptr_t; -typedef unsigned int uintfptr_t; -#endif - -/* Critical section value */ -typedef register_t critical_t; - -/* Interrupt mask (spl, xxx_imask, etc) */ -typedef __uint32_t intrmask_t; - -/* Interrupt handler function type. */ -typedef void ointhand2_t(int _device_id); - -#endif diff --git a/newlib/libc/sys/linux/sys/unistd.h b/newlib/libc/sys/linux/sys/unistd.h deleted file mode 100644 index dd3f0f7ea..000000000 --- a/newlib/libc/sys/linux/sys/unistd.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef _UNISTD_H -#define _UNISTD_H - -#include <features.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#include <_ansi.h> -#include <sys/types.h> -#include <sys/_types.h> -#define __need_size_t -#define __need_ptrdiff_t -#include <stddef.h> - -extern char **environ; - -void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((noreturn))); - -int _EXFUN(access,(const char *__path, int __amode )); -unsigned _EXFUN(alarm, (unsigned __secs )); -int _EXFUN(chdir, (const char *__path )); -int _EXFUN(chmod, (const char *__path, mode_t __mode )); -int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group )); -int _EXFUN(chroot, (const char *__path )); -int _EXFUN(close, (int __fildes )); -char _EXFUN(*ctermid, (char *__s )); -char _EXFUN(*cuserid, (char *__s )); -int _EXFUN(dup, (int __fildes )); -int _EXFUN(dup2, (int __fildes, int __fildes2 )); -#if defined(__CYGWIN__) -void _EXFUN(endusershell, (void)); -#endif -int _EXFUN(execl, (const char *__path, const char *, ... )); -int _EXFUN(execle, (const char *__path, const char *, ... )); -int _EXFUN(execlp, (const char *__file, const char *, ... )); -int _EXFUN(execv, (const char *__path, char * const __argv[] )); -int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] )); -int _EXFUN(execvp, (const char *__file, char * const __argv[] )); -int _EXFUN(fchdir, (int __fildes)); -int _EXFUN(fchmod, (int __fildes, mode_t __mode )); -int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group )); -pid_t _EXFUN(fork, (void )); -long _EXFUN(fpathconf, (int __fd, int __name )); -int _EXFUN(fsync, (int __fd)); -char _EXFUN(*getcwd, (char *__buf, size_t __size )); -int _EXFUN(getdomainname ,(char *__name, size_t __len)); -gid_t _EXFUN(getegid, (void )); -uid_t _EXFUN(geteuid, (void )); -gid_t _EXFUN(getgid, (void )); -int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] )); -char _EXFUN(*getlogin, (void )); -#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) -int _EXFUN(getlogin_r, (char *name, size_t namesize) ); -#endif -char _EXFUN(*getpass, (__const char *__prompt)); -size_t _EXFUN(getpagesize, (void)); -pid_t _EXFUN(getpgid, (pid_t)); -pid_t _EXFUN(getpgrp, (void )); -pid_t _EXFUN(getpid, (void )); -pid_t _EXFUN(getppid, (void )); -uid_t _EXFUN(getuid, (void )); -char * _EXFUN(getusershell, (void)); -char _EXFUN(*getwd, (char *__buf )); -int _EXFUN(isatty, (int __fildes )); -int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group )); -int _EXFUN(link, (const char *__path1, const char *__path2 )); -int _EXFUN(nice, (int __nice_value )); -off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); -long _EXFUN(pathconf, (const char *__path, int __name )); -int _EXFUN(pause, (void )); -#ifdef __CYGWIN__ -int _EXFUN(pthread_atfork, (void (*)(void), void (*)(void), void (*)(void))); -#endif -int _EXFUN(pipe, (int __fildes[2] )); -ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset)); -ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset)); -_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte )); -int _EXFUN(rmdir, (const char *__path )); -void * _EXFUN(sbrk, (ptrdiff_t __incr)); -int _EXFUN(setegid, (gid_t __gid )); -int _EXFUN(seteuid, (uid_t __uid )); -int _EXFUN(setgid, (gid_t __gid )); -int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid )); -int _EXFUN(setpgrp, (void )); -pid_t _EXFUN(setsid, (void )); -int _EXFUN(setuid, (uid_t __uid )); -unsigned _EXFUN(sleep, (unsigned int __seconds )); -void _EXFUN(swab, (const void *, void *, ssize_t)); -long _EXFUN(sysconf, (int __name )); -pid_t _EXFUN(tcgetpgrp, (int __fildes )); -int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); -char * _EXFUN(ttyname, (int __fildes )); -int _EXFUN(ttyname_r, (int __fildes, char *__buf, size_t __len)); -int _EXFUN(unlink, (const char *__path )); -int _EXFUN(vhangup, (void )); -_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte )); - -extern char *optarg; /* getopt(3) external variables */ -extern int optind, opterr, optopt; -int getopt(int, char * const [], const char *); -extern int optreset; /* getopt(3) external variable */ - -#ifndef _POSIX_SOURCE -pid_t _EXFUN(vfork, (void )); - -extern char *suboptarg; /* getsubopt(3) external variable */ -int getsubopt(char **, char * const *, char **); -#endif /* _POSIX_SOURCE */ - -/* Provide prototypes for most of the _<systemcall> names that are - provided in newlib for some compilers. */ -int _EXFUN(_close, (int __fildes )); -pid_t _EXFUN(_fork, (void )); -pid_t _EXFUN(_getpid, (void )); -int _EXFUN(_link, (const char *__path1, const char *__path2 )); -off_t _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence )); -_READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte )); -void * _EXFUN(_sbrk, (size_t __incr)); -int _EXFUN(_unlink, (const char *__path )); -_READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte )); -int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] )); - -#define F_OK 0 -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 - -# define SEEK_SET 0 -# define SEEK_CUR 1 -# define SEEK_END 2 - -#include <sys/features.h> - -#define STDIN_FILENO 0 /* standard input file descriptor */ -#define STDOUT_FILENO 1 /* standard output file descriptor */ -#define STDERR_FILENO 2 /* standard error file descriptor */ - -#include <bits/environments.h> -#include <bits/confname.h> - -# define MAXPATHLEN 1024 - -#ifdef __cplusplus -} -#endif -#endif /* _SYS_UNISTD_H */ diff --git a/newlib/libc/sys/linux/sys/utime.h b/newlib/libc/sys/linux/sys/utime.h deleted file mode 100644 index 7499cfe7e..000000000 --- a/newlib/libc/sys/linux/sys/utime.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _SYS_UTIME_H -#define _SYS_UTIME_H 1 - -#include <sys/types.h> - -struct utimbuf - { - time_t actime; /* Access time. */ - time_t modtime; /* Modification time. */ - }; - -int _EXFUN(utime, (const char *__file, const struct utimbuf *__times)); - -#endif /* _SYS_UTIME_H */ diff --git a/newlib/libc/sys/linux/sys/utmp.h b/newlib/libc/sys/linux/sys/utmp.h deleted file mode 100644 index a837483a9..000000000 --- a/newlib/libc/sys/linux/sys/utmp.h +++ /dev/null @@ -1,54 +0,0 @@ -/* libc/sys/linux/sys/utmp.h - utmp structure */ - -/* Written 2000 by Werner Almesberger */ - - -/* Some things copied from glibc's /usr/include/bits/utmp.h */ - - -#ifndef _SYS_UTMP_H -#define _SYS_UTMP_H - - -#include <sys/types.h> - - -#define UTMP_FILE "/var/run/utmp" - -#define UT_LINESIZE 32 -#define UT_NAMESIZE 32 -#define UT_HOSTSIZE 256 - -struct utmp { - short int ut_type; - pid_t ut_pid; - char ut_line[UT_LINESIZE]; - char ut_id[4]; - char ut_user[UT_NAMESIZE]; - char ut_host[UT_HOSTSIZE]; - char __filler[52]; -}; - -#define RUN_LVL 1 -#define BOOT_TIME 2 -#define NEW_TIME 3 -#define OLD_TIME 4 - -#define INIT_PROCESS 5 -#define LOGIN_PROCESS 6 -#define USER_PROCESS 7 -#define DEAD_PROCESS 8 - - -/* --- redundant, from sys/cygwin/sys/utmp.h --- */ - -struct utmp *_getutline (struct utmp *); -struct utmp *getutent (void); -struct utmp *getutid (struct utmp *); -struct utmp *getutline (struct utmp *); -void endutent (void); -void pututline (struct utmp *); -void setutent (void); -void utmpname (const char *); - -#endif diff --git a/newlib/libc/sys/linux/sys/utsname.h b/newlib/libc/sys/linux/sys/utsname.h deleted file mode 100644 index 4de4c63be..000000000 --- a/newlib/libc/sys/linux/sys/utsname.h +++ /dev/null @@ -1,23 +0,0 @@ -/* libc/sys/linux/sys/utsname.h - System identification */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -#define __UTSNAMELEN 65 /* synchronize with kernel */ - -struct utsname { - char sysname[__UTSNAMELEN]; - char nodename[__UTSNAMELEN]; - char release[__UTSNAMELEN]; - char version[__UTSNAMELEN]; - char machine[__UTSNAMELEN]; - char domainname[__UTSNAMELEN]; -}; - - -int uname(struct utsname *name); - -#endif diff --git a/newlib/libc/sys/linux/sys/wait.h b/newlib/libc/sys/linux/sys/wait.h deleted file mode 100644 index 4cc337783..000000000 --- a/newlib/libc/sys/linux/sys/wait.h +++ /dev/null @@ -1,40 +0,0 @@ -/* libc/sys/linux/sys/wait.h - Wait for children */ - -/* Written 2000 by Werner Almesberger */ - - -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H - -#include <linux/wait.h> - -#define WIFEXITED(status) (!WTERMSIG(status)) -#define WEXITSTATUS(status) (((status) >> 8) & 0xff) -#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) -#define WTERMSIG(status) ((status ) & 0x7f) -#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) -#define WSTOPSIG(status) WEXITSTATUS(status) - -#ifndef _POSIX_SOURCE -#define WCOREDUMP(status) ((status) & 0x80) -#endif - -/* --- redundant stuff below --- */ - -#include <_ansi.h> -#include <sys/types.h> - -pid_t wait (int *); -pid_t waitpid (pid_t, int *, int); - -pid_t _wait (int *); - - -#ifndef _POSIX_SOURCE -#include <sys/resource.h> - -pid_t wait3(int *status,int options,struct rusage *rusage); -pid_t wait4(pid_t pid,int *status,int options,struct rusage *rusage); -#endif - -#endif diff --git a/newlib/libc/sys/linux/sysconf.c b/newlib/libc/sys/linux/sysconf.c deleted file mode 100644 index 037ae54bf..000000000 --- a/newlib/libc/sys/linux/sysconf.c +++ /dev/null @@ -1,383 +0,0 @@ -/* libc/sys/linux/sysconf.c - The sysconf function */ - -/* Copyright 2002, Red Hat Inc. */ - - -#include <unistd.h> -#include <limits.h> -#include <time.h> -#include <errno.h> -#include <sys/types.h> - -long int -sysconf (int name) -{ - switch (name) - { - case _SC_AIO_LISTIO_MAX: -#ifdef AIO_LISTIO_MAX - return AIO_LISTIO_MAX; -#else - return -1; -#endif - - case _SC_AIO_MAX: -#ifdef AIO_MAX - return AIO_MAX; -#else - return -1; -#endif - - case _SC_AIO_PRIO_DELTA_MAX: -#ifdef AIO_PRIO_DELTA_MAX - return AIO_PRIO_DELTA_MAX; -#else - return -1; -#endif - - case _SC_ARG_MAX: -#ifdef ARG_MAX - return ARG_MAX; -#else - return -1; -#endif - - case _SC_CHILD_MAX: -#ifdef CHILD_MAX - return CHILD_MAX; -#else - return -1; -#endif - - case _SC_CLK_TCK: - return CLK_TCK; - - case _SC_DELAYTIMER_MAX: -#ifdef DELAYTIMER_MAX - return DELAYTIMER_MAX; -#else - return -1; -#endif - - case _SC_GETGR_R_SIZE_MAX: -#ifdef _GETGR_R_SIZE_MAX - return _GETGR_R_SIZE_MAX; -#else - return -1; -#endif - - case _SC_GETPW_R_SIZE_MAX: -#ifdef _GETPW_R_SIZE_MAX - return _GETPW_R_SIZE_MAX; -#else - return -1; -#endif - - case _SC_LOGIN_NAME_MAX: -#ifdef LOGIN_NAME_MAX - return LOGIN_NAME_MAX; -#else - return -1; -#endif - - case _SC_MQ_OPEN_MAX: -#ifdef MQ_OPEN_MAX - return MQ_OPEN_MAX; -#else - return -1; -#endif - - case _SC_MQ_PRIO_MAX: -#ifdef MQ_PRIO_MAX - return MQ_PRIO_MAX; -#else - return -1; -#endif - - case _SC_NGROUPS_MAX: -#ifdef NGROUPS_MAX - return NGROUPS_MAX; -#else - return -1; -#endif - - case _SC_OPEN_MAX: -#ifdef OPEN_MAX - return OPEN_MAX; -#else - return -1; -#endif - - case _SC_PAGESIZE: -#ifdef PAGESIZE - return PAGESIZE; -#else - return -1; -#endif - - case _SC_RTSIG_MAX: -#ifdef RTSIG_MAX - return RTSIG_MAX; -#else - return -1; -#endif - - case _SC_SEM_NSEMS_MAX: -#ifdef SEM_NSEMS_MAX - return SEM_NSEMS_MAX; -#else - return -1; -#endif - - case _SC_SEM_VALUE_MAX: -#ifdef SEM_VALUE_MAX - return SEM_VALUE_MAX; -#else - return -1; -#endif - - case _SC_SIGQUEUE_MAX: -#ifdef SIGQUEUE_MAX - return SIGQUEUE_MAX; -#else - return -1; -#endif - - case _SC_STREAM_MAX: -#ifdef STREAM_MAX - return STREAM_MAX; -#else - return -1; -#endif - - case _SC_THREAD_DESTRUCTOR_ITERATIONS: -#ifdef PTHREAD_DESTRUCTOR_ITERATIONS - return PTHREAD_DESTRUCTOR_ITERATIONS; -#else - return -1; -#endif - - case _SC_THREAD_KEYS_MAX: -#ifdef PTHREAD_KEYS_MAX - return PTHREAD_KEYS_MAX; -#else - return -1; -#endif - - case _SC_THREAD_STACK_MIN: -#ifdef PTHREAD_STACK_MIN - return PTHREAD_STACK_MIN; -#else - return -1; -#endif - - case _SC_THREAD_THREADS_MAX: -#ifdef PTHREAD_THREADS_MAX - return PTHREAD_THREADS_MAX; -#else - return -1; -#endif - - case _SC_TIMER_MAX: -#ifdef TIMER_MAX - return TIMER_MAX; -#else - return -1; -#endif - - case _SC_TTY_NAME_MAX: -#ifdef TTY_NAME_MAX - return TTY_NAME_MAX; -#else - return -1; -#endif - - case _SC_TZNAME_MAX: -#ifdef TZNAME_MAX - return TZNAME_MAX; -#else - return -1; -#endif - - case _SC_ASYNCHRONOUS_IO: -#ifdef _POSIX_ASYNCHRONOUS_IO - return 1; -#else - return -1; -#endif - - case _SC_FSYNC: -#ifdef _POSIX_FSYNC - return 1; -#else - return -1; -#endif - - case _SC_JOB_CONTROL: -#ifdef _POSIX_JOB_CONTROL - return 1; -#else - return -1; -#endif - - case _SC_MAPPED_FILES: -#ifdef _POSIX_MAPPED_FILES - return 1; -#else - return -1; -#endif - - case _SC_MEMLOCK: -#ifdef _POSIX_MEMLOCK - return 1; -#else - return -1; -#endif - - case _SC_MEMLOCK_RANGE: -#ifdef _POSIX_MEMLOCK_RANGE - return _POSIX_MEMLOCK_RANGE; -#else - return -1; -#endif - - case _SC_MEMORY_PROTECTION: -#ifdef _POSIX_MEMORY_PROTECTION - return 1; -#else - return -1; -#endif - - case _SC_MESSAGE_PASSING: -#ifdef _POSIX_MESSAGE_PASSING - return 1; -#else - return -1; -#endif - - case _SC_PRIORITIZED_IO: -#ifdef _POSIX_PRIORITIZED_IO - return 1; -#else - return -1; -#endif - - case _SC_PRIORITY_SCHEDULING: -#ifdef _POSIX_PRIORITY_SCHEDULING - return 1; -#else - return -1; -#endif - - case _SC_REALTIME_SIGNALS: -#ifdef _POSIX_REALTIME_SIGNALS - return 1; -#else - return -1; -#endif - - case _SC_SAVED_IDS: -#ifdef _POSIX_SAVED_IDS - return 1; -#else - return -1; -#endif - - case _SC_SEMAPHORES: -#ifdef _POSIX_SEMAPHORES - return 1; -#else - return -1; -#endif - - case _SC_SHARED_MEMORY_OBJECTS: -#ifdef _POSIX_SHARED_MEMORY_OBJECTS - return 1; -#else - return -1; -#endif - - case _SC_SYNCHRONIZED_IO: -#ifdef _POSIX_SYNCHRONIZED_IO - return 1; -#else - return -1; -#endif - - case _SC_TIMERS: -#ifdef _POSIX_TIMERS - return 1; -#else - return -1; -#endif - - case _SC_THREADS: -#ifdef _POSIX_THREADS - return 1; -#else - return -1; -#endif - - case _SC_THREAD_ATTR_STACKADDR: -#ifdef _POSIX_THREAD_ATTR_STACKADDR - return 1; -#else - return -1; -#endif - - case _SC_THREAD_ATTR_STACKSIZE: -#ifdef _POSIX_THREAD_ATTR_STACKSIZE - return 1; -#else - return -1; -#endif - - case _SC_THREAD_PRIORITY_SCHEDULING: -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - return 1; -#else - return -1; -#endif - - case _SC_THREAD_PRIO_INHERIT: -#ifdef _POSIX_THREAD_PRIO_INHERIT - return 1; -#else - return -1; -#endif - - case _SC_THREAD_PRIO_PROTECT: -#ifdef _POSIX_THREAD_PRIO_PROTECT - return 1; -#else - return -1; -#endif - - case _SC_THREAD_PROCESS_SHARED: -#ifdef _POSIX_THREAD_PROCESS_SHARED - return 1; -#else - return -1; -#endif - - case _SC_THREAD_SAFE_FUNCTIONS: -#ifdef _POSIX_THREAD_SAFE_FUNCTIONS - return 1; -#else - return -1; -#endif - - case _SC_VERSION: -#ifdef _POSIX_VERSION - return _POSIX_VERSION; -#else - return -1; -#endif - - default: - errno = EINVAL; - return -1; - } - - return -1; /* can't get here */ -} diff --git a/newlib/libc/sys/linux/sysctl.c b/newlib/libc/sys/linux/sysctl.c deleted file mode 100644 index 020d431be..000000000 --- a/newlib/libc/sys/linux/sysctl.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Read or write system information. Linux version. - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <sys/sysctl.h> - -#include <machine/syscall.h> - -static _syscall1(int,_sysctl,struct __sysctl_args *,args) - -int -__sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, - void *newval, size_t newlen) -{ - struct __sysctl_args args = - { - name: name, - nlen: nlen, - oldval: oldval, - oldlenp: oldlenp, - newval: newval, - newlen: newlen - }; - - return _sysctl(&args); -} diff --git a/newlib/libc/sys/linux/systat.c b/newlib/libc/sys/linux/systat.c deleted file mode 100644 index 9a57aa7e4..000000000 --- a/newlib/libc/sys/linux/systat.c +++ /dev/null @@ -1,10 +0,0 @@ -/* libc/sys/linux/systat.c - System calls related to overall system state */ - -/* Written 2000 by Werner Almesberger */ - - -#include <sys/utsname.h> -#include <machine/syscall.h> - - -_syscall1(int,uname,struct utsname *,name) diff --git a/newlib/libc/sys/linux/system.c b/newlib/libc/sys/linux/system.c deleted file mode 100644 index f8edfbf63..000000000 --- a/newlib/libc/sys/linux/system.c +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <stddef.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/wait.h> -#include <signal.h> -#include <sys/types.h> -#include <errno.h> -#include <machine/weakalias.h> - - -#ifndef HAVE_GNU_LD -#define __environ environ -#endif - -#define SHELL_PATH "/bin/sh" /* Path of the shell. */ -#define SHELL_NAME "sh" /* Name to give it. */ - -/* Execute LINE as a shell command, returning its status. */ -int -__libc_system (const char *line) -{ - int status, save; - pid_t pid; - struct sigaction sa, intr, quit; -#ifndef WAITPID_CANNOT_BLOCK_SIGCHLD - sigset_t block, omask; -#endif - - if (line == NULL) - /* Check that we have a command processor available. It might - not be available after a chroot(), for example. */ - return __libc_system ("exit 0") == 0; - - sa.sa_handler = SIG_IGN; - sa.sa_flags = 0; - sigemptyset (&sa.sa_mask); - - if (sigaction (SIGINT, &sa, &intr) < 0) - return -1; - if (sigaction (SIGQUIT, &sa, &quit) < 0) - { - save = errno; - (void) sigaction (SIGINT, &intr, (struct sigaction *) NULL); - errno = save; - return -1; - } - -#ifndef WAITPID_CANNOT_BLOCK_SIGCHLD - -/* SCO 3.2v4 has a bug where `waitpid' will never return if SIGCHLD is - blocked. This makes it impossible for `system' to be implemented in - compliance with POSIX.2-1992. They have acknowledged that this is a bug - but I have not seen nor heard of any forthcoming fix. */ - - sigemptyset (&block); - sigaddset (&block, SIGCHLD); - save = errno; - if (sigprocmask (SIG_BLOCK, &block, &omask) < 0) - { - if (errno == ENOSYS) - errno = save; - else - { - save = errno; - (void) sigaction (SIGINT, &intr, (struct sigaction *) NULL); - (void) sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); - errno = save; - return -1; - } - } -# define UNBLOCK sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL) -#else -# define UNBLOCK 0 -#endif - - pid = fork (); - if (pid == (pid_t) 0) - { - /* Child side. */ - const char *new_argv[4]; - new_argv[0] = SHELL_NAME; - new_argv[1] = "-c"; - new_argv[2] = line; - new_argv[3] = NULL; - - /* Restore the signals. */ - (void) sigaction (SIGINT, &intr, (struct sigaction *) NULL); - (void) sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); - (void) UNBLOCK; - - /* Exec the shell. */ - (void) execve (SHELL_PATH, (char *const *) new_argv, __environ); - _exit (127); - } - else if (pid < (pid_t) 0) - /* The fork failed. */ - status = -1; - else - /* Parent side. */ - { -#ifdef NO_WAITPID - pid_t child; - do - { - child = wait (&status); - if (child <= -1 && errno != EINTR) - { - status = -1; - break; - } - /* Note that pid cannot be <= -1 and therefore the loop continues - when wait returned with EINTR. */ - } - while (child != pid); -#else - int n; - - do - n = waitpid (pid, &status, 0); - while (n == -1 && errno == EINTR); - - if (n != pid) - status = -1; -#endif - } - - save = errno; - if ((sigaction (SIGINT, &intr, (struct sigaction *) NULL) | - sigaction (SIGQUIT, &quit, (struct sigaction *) NULL) | - UNBLOCK) != 0) - { - if (errno == ENOSYS) - errno = save; - else - return -1; - } - - return status; -} -weak_alias (__libc_system, system) diff --git a/newlib/libc/sys/linux/tcdrain.c b/newlib/libc/sys/linux/tcdrain.c deleted file mode 100644 index 364fc035f..000000000 --- a/newlib/libc/sys/linux/tcdrain.c +++ /dev/null @@ -1,13 +0,0 @@ -/* tcdrain - wait for transmission of output */ - -#include <termios.h> -#include <sys/ioctl.h> -#include <machine/weakalias.h> - -int -__libc_tcdrain (int fd) -{ - return ioctl (fd, TCSBRK, 1); -} -weak_alias (__libc_tcdrain, tcdrain) - diff --git a/newlib/libc/sys/linux/tcsendbrk.c b/newlib/libc/sys/linux/tcsendbrk.c deleted file mode 100644 index a35a4d8ce..000000000 --- a/newlib/libc/sys/linux/tcsendbrk.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Modified for newlib, May 27, 2002, by Jeff Johnston */ - -#include <errno.h> -#include <stddef.h> -#include <signal.h> -#include <termios.h> -#include <unistd.h> -#include <sys/ioctl.h> - -/* Send zero bits on FD. */ -int -tcsendbreak (fd, duration) - int fd; - int duration; -{ - /* The break lasts 0.25 to 0.5 seconds if DURATION is zero, - and an implementation-defined period if DURATION is nonzero. - We define a positive DURATION to be number of milliseconds to break. */ - if (duration <= 0) - return ioctl (fd, TCSBRK, 0); - - /* ioctl can't send a break of any other duration for us. - This could be changed to use trickery (e.g. lower speed and - send a '\0') to send the break, but for now just return an error. */ - errno = (EINVAL); - return -1; -} diff --git a/newlib/libc/sys/linux/termios.c b/newlib/libc/sys/linux/termios.c deleted file mode 100644 index ac155201d..000000000 --- a/newlib/libc/sys/linux/termios.c +++ /dev/null @@ -1,72 +0,0 @@ -/* libc/sys/linux/termios.c - Terminal control */ - -/* Written 2000 by Werner Almesberger */ - - -#include <errno.h> -#include <sys/types.h> -#include <sys/termios.h> -#include <sys/ioctl.h> - - -int -tcgetattr(int fd,struct termios *termios_p) -{ - return ioctl(fd,TCGETS,termios_p); -} - - -int -tcsetattr(int fd,int optional_actions,const struct termios *termios_p) -{ - int cmd; - - switch (optional_actions) { - case TCSANOW: - cmd = TCSETS; - break; - case TCSADRAIN: - cmd = TCSETSW; - break; - case TCSAFLUSH: - cmd = TCSETSF; - break; - default: - errno = EINVAL; - return -1; - } - return ioctl(fd,cmd,termios_p); -} - -#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4 -pid_t -tcgetpgrp(int fd) -{ - int p; - - if (ioctl(fd,TIOCGPGRP,&p) < 0) - return (pid_t)-1; - return (pid_t)p; -} - - -int -tcsetpgrp(int fd, pid_t pid) -{ - int p = (int)pid; - return ioctl(fd,TIOCSPGRP,&p); -} -#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 4 */ - -int -tcflow (int fd, int action) -{ - return ioctl (fd, TCXONC, action); -} - -int -tcflush (int fd, int queue_selector) -{ - return ioctl (fd, TCFLSH, queue_selector); -} - diff --git a/newlib/libc/sys/linux/thread-m.h b/newlib/libc/sys/linux/thread-m.h deleted file mode 100644 index 2cdacab19..000000000 --- a/newlib/libc/sys/linux/thread-m.h +++ /dev/null @@ -1,241 +0,0 @@ -/* Basic platform-independent macro definitions for mutexes and - thread-specific data. - Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* $Id$ - One out of _LIBC, USE_PTHREADS, USE_THR or USE_SPROC should be - defined, otherwise the token NO_THREADS and dummy implementations - of the macros will be defined. */ - -#ifndef _THREAD_M_H -#define _THREAD_M_H - -#undef thread_atfork_static - -#if defined(_LIBC) /* The GNU C library, a special case of Posix threads */ - -#include <bits/libc-lock.h> - -#ifdef PTHREAD_MUTEX_INITIALIZER - -typedef pthread_t thread_id; - -/* mutex */ -typedef pthread_mutex_t mutex_t; - -#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER - -/* Even if not linking with libpthread, ensure usability of mutex as - an `in use' flag, see also the NO_THREADS case below. Assume - pthread_mutex_t is at least one int wide. */ - -#define mutex_init(m) \ - (__pthread_mutex_init != NULL \ - ? __pthread_mutex_init (m, NULL) : (*(int *)(m) = 0)) -#define mutex_lock(m) \ - (__pthread_mutex_lock != NULL \ - ? __pthread_mutex_lock (m) : ((*(int *)(m) = 1), 0)) -#define mutex_trylock(m) \ - (__pthread_mutex_trylock != NULL \ - ? __pthread_mutex_trylock (m) : (*(int *)(m) ? 1 : ((*(int *)(m) = 1), 0))) -#define mutex_unlock(m) \ - (__pthread_mutex_unlock != NULL \ - ? __pthread_mutex_unlock (m) : (*(int*)(m) = 0)) - -#define thread_atfork(prepare, parent, child) \ - (__pthread_atfork != NULL ? __pthread_atfork(prepare, parent, child) : 0) - -#elif defined(MUTEX_INITIALIZER) -/* Assume hurd, with cthreads */ - -/* Cthreads `mutex_t' is a pointer to a mutex, and malloc wants just the - mutex itself. */ -#undef mutex_t -#define mutex_t struct mutex - -#undef mutex_init -#define mutex_init(m) (__mutex_init(m), 0) - -#undef mutex_lock -#define mutex_lock(m) (__mutex_lock(m), 0) - -#undef mutex_unlock -#define mutex_unlock(m) (__mutex_unlock(m), 0) - -#define mutex_trylock(m) (!__mutex_trylock(m)) - -#define thread_atfork(prepare, parent, child) do {} while(0) -#define thread_atfork_static(prepare, parent, child) \ - text_set_element(_hurd_fork_prepare_hook, prepare); \ - text_set_element(_hurd_fork_parent_hook, parent); \ - text_set_element(_hurd_fork_child_hook, child); - -/* No we're *not* using pthreads. */ -#define __pthread_initialize ((void (*)(void))0) - -#else - -#define NO_THREADS - -#endif /* MUTEX_INITIALIZER && PTHREAD_MUTEX_INITIALIZER */ - -#ifndef NO_THREADS - -/* thread specific data for glibc */ - -#include <libc-tsd.h> - -typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */ -__libc_tsd_define (, MALLOC) /* declaration/common definition */ -#define tsd_key_create(key, destr) ((void) (key)) -#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data)) -#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC)) - -#endif - -#elif defined(USE_PTHREADS) /* Posix threads */ - -#include <pthread.h> - -typedef pthread_t thread_id; - -/* mutex */ -typedef pthread_mutex_t mutex_t; - -#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -#define mutex_init(m) pthread_mutex_init(m, NULL) -#define mutex_lock(m) pthread_mutex_lock(m) -#define mutex_trylock(m) pthread_mutex_trylock(m) -#define mutex_unlock(m) pthread_mutex_unlock(m) - -/* thread specific data */ -#if defined(__sgi) || defined(USE_TSD_DATA_HACK) - -/* Hack for thread-specific data, e.g. on Irix 6.x. We can't use - pthread_setspecific because that function calls malloc() itself. - The hack only works when pthread_t can be converted to an integral - type. */ - -typedef void *tsd_key_t[256]; -#define tsd_key_create(key, destr) do { \ - int i; \ - for(i=0; i<256; i++) (*key)[i] = 0; \ -} while(0) -#define tsd_setspecific(key, data) \ - (key[(unsigned)pthread_self() % 256] = (data)) -#define tsd_getspecific(key, vptr) \ - (vptr = key[(unsigned)pthread_self() % 256]) - -#else - -typedef pthread_key_t tsd_key_t; - -#define tsd_key_create(key, destr) pthread_key_create(key, destr) -#define tsd_setspecific(key, data) pthread_setspecific(key, data) -#define tsd_getspecific(key, vptr) (vptr = pthread_getspecific(key)) - -#endif - -/* at fork */ -#define thread_atfork(prepare, parent, child) \ - pthread_atfork(prepare, parent, child) - -#elif USE_THR /* Solaris threads */ - -#include <thread.h> - -typedef thread_t thread_id; - -#define MUTEX_INITIALIZER { 0 } -#define mutex_init(m) mutex_init(m, USYNC_THREAD, NULL) - -/* - * Hack for thread-specific data on Solaris. We can't use thr_setspecific - * because that function calls malloc() itself. - */ -typedef void *tsd_key_t[256]; -#define tsd_key_create(key, destr) do { \ - int i; \ - for(i=0; i<256; i++) (*key)[i] = 0; \ -} while(0) -#define tsd_setspecific(key, data) (key[(unsigned)thr_self() % 256] = (data)) -#define tsd_getspecific(key, vptr) (vptr = key[(unsigned)thr_self() % 256]) - -#define thread_atfork(prepare, parent, child) do {} while(0) - -#elif USE_SPROC /* SGI sproc() threads */ - -#include <sys/wait.h> -#include <sys/types.h> -#include <sys/prctl.h> -#include <abi_mutex.h> - -typedef int thread_id; - -typedef abilock_t mutex_t; - -#define MUTEX_INITIALIZER { 0 } -#define mutex_init(m) init_lock(m) -#define mutex_lock(m) (spin_lock(m), 0) -#define mutex_trylock(m) acquire_lock(m) -#define mutex_unlock(m) release_lock(m) - -typedef int tsd_key_t; -int tsd_key_next; -#define tsd_key_create(key, destr) ((*key) = tsd_key_next++) -#define tsd_setspecific(key, data) (((void **)(&PRDA->usr_prda))[key] = data) -#define tsd_getspecific(key, vptr) (vptr = ((void **)(&PRDA->usr_prda))[key]) - -#define thread_atfork(prepare, parent, child) do {} while(0) - -#else /* no _LIBC or USE_... are defined */ - -#define NO_THREADS - -#endif /* defined(_LIBC) */ - -#ifdef NO_THREADS /* No threads, provide dummy macros */ - -typedef int thread_id; - -/* The mutex functions used to do absolutely nothing, i.e. lock, - trylock and unlock would always just return 0. However, even - without any concurrently active threads, a mutex can be used - legitimately as an `in use' flag. To make the code that is - protected by a mutex async-signal safe, these macros would have to - be based on atomic test-and-set operations, for example. */ -typedef int mutex_t; - -#define MUTEX_INITIALIZER 0 -#define mutex_init(m) (*(m) = 0) -#define mutex_lock(m) ((*(m) = 1), 0) -#define mutex_trylock(m) (*(m) ? 1 : ((*(m) = 1), 0)) -#define mutex_unlock(m) (*(m) = 0) - -typedef void *tsd_key_t; -#define tsd_key_create(key, destr) do {} while(0) -#define tsd_setspecific(key, data) ((key) = (data)) -#define tsd_getspecific(key, vptr) (vptr = (key)) - -#define thread_atfork(prepare, parent, child) do {} while(0) - -#endif /* defined(NO_THREADS) */ - -#endif /* !defined(_THREAD_M_H) */ diff --git a/newlib/libc/sys/linux/time.c b/newlib/libc/sys/linux/time.c deleted file mode 100644 index a7313505e..000000000 --- a/newlib/libc/sys/linux/time.c +++ /dev/null @@ -1,26 +0,0 @@ -/* libc/sys/linux/time.c - Time-related system calls */ - -/* Written 2000 by Werner Almesberger */ - - -#include <errno.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/timex.h> -#include <linux/times.h> -#include <machine/syscall.h> - -#define __NR___adjtimex __NR_adjtimex - -_syscall1(int,__adjtimex,struct timex *,tx) -_syscall1(time_t,time,time_t *,t) -_syscall1(clock_t,times,struct tms *,buf) -_syscall2(int,getitimer,int,type,struct itimerval *,old) -_syscall3(int,setitimer,int,type,const struct itimerval *,new,struct itimerval *,old) -_syscall2(int,gettimeofday,struct timeval *,tv,struct timezone *,tz) -_syscall2(int,settimeofday,const struct timeval *,tv,const struct timezone *,tz) -_syscall2(int,nanosleep,const struct timespec *,req,struct timespec *,rem) - -weak_alias(__libc_gettimeofday,__gettimeofday); -weak_alias(__adjtimex,adjtimex); -weak_alias(__adjtimex,ntp_adjtime); diff --git a/newlib/libc/sys/linux/ttyname_r.c b/newlib/libc/sys/linux/ttyname_r.c deleted file mode 100644 index efad76a0e..000000000 --- a/newlib/libc/sys/linux/ttyname_r.c +++ /dev/null @@ -1,192 +0,0 @@ -/* Copyright (C) 1991,92,93,1995-1999,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <limits.h> -#include <stddef.h> -#include <dirent.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <machine/weakalias.h> - -static int getttyname_r (char *buf, size_t buflen, - dev_t mydev, ino64_t myino, int save, - int *dostat); - -extern struct dirent64 *__readdir64 (DIR *); - -static int -getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino, - int save, int *dostat) -{ - struct stat64 st; - DIR *dirstream; - struct dirent64 *d; - size_t devlen = strlen (buf); - - dirstream = opendir (buf); - if (dirstream == NULL) - { - *dostat = -1; - return errno; - } - - while ((d = __readdir64 (dirstream)) != NULL) - { - if ((d->d_ino == myino || *dostat) - && strcmp (d->d_name, "stdin") - && strcmp (d->d_name, "stdout") - && strcmp (d->d_name, "stderr")) - { - size_t needed = strlen (d->d_name) + 1; - - if (needed > buflen) - { - *dostat = -1; - (void) closedir (dirstream); - __set_errno (ERANGE); - return ERANGE; - } - - strncpy (buf + devlen, d->d_name, needed); - - if (stat64 (buf, &st) == 0 -#ifdef _STATBUF_ST_RDEV - && S_ISCHR (st.st_mode) && st.st_rdev == mydev -#else - && d->d_ino == myino && st.st_dev == mydev -#endif - ) - { - (void) closedir (dirstream); - __set_errno (save); - return 0; - } - } - } - - (void) closedir (dirstream); - __set_errno (save); - /* It is not clear what to return in this case. `isatty' says FD - refers to a TTY but no entry in /dev has this inode. */ - return ENOTTY; -} - -/* Store at most BUFLEN character of the pathname of the terminal FD is - open on in BUF. Return 0 on success, otherwise an error number. */ -int -__ttyname_r (int fd, char *buf, size_t buflen) -{ - char procname[30]; - struct stat64 st, st1; - int dostat = 0; - int save = errno; - int ret; - - /* Test for the absolute minimal size. This makes life easier inside - the loop. */ - if (!buf) - { - __set_errno (EINVAL); - return EINVAL; - } - - if (buflen < sizeof ("/dev/pts/")) - { - __set_errno (ERANGE); - return ERANGE; - } - - if (!isatty (fd)) - { - __set_errno (ENOTTY); - return ENOTTY; - } - - /* We try using the /proc filesystem. */ - sprintf (procname, "/proc/self/fd/%d", fd); - - ret = readlink (procname, buf, buflen - 1); - if (ret != -1 && buf[0] != '[') - { - buf[ret] = '\0'; - return 0; - } - if (ret == -1 && errno == ENAMETOOLONG) - { - __set_errno (ERANGE); - return ERANGE; - } - - if (fstat64 (fd, &st) < 0) - return errno; - - /* Prepare the result buffer. */ - memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/")); - buflen -= sizeof ("/dev/pts/") - 1; - - if (stat64 (buf, &st1) == 0 && S_ISDIR (st1.st_mode)) - { -#ifdef _STATBUF_ST_RDEV - ret = getttyname_r (buf, buflen, st.st_rdev, st.st_ino, save, - &dostat); -#else - ret = getttyname_r (buf, buflen, st.st_dev, st.st_ino, save, - &dostat); -#endif - } - else - { - __set_errno (save); - ret = ENOENT; - } - - if (ret && dostat != -1) - { - buf[sizeof ("/dev/") - 1] = '\0'; - buflen += sizeof ("pts/") - 1; -#ifdef _STATBUF_ST_RDEV - ret = getttyname_r (buf, buflen, st.st_rdev, st.st_ino, save, - &dostat); -#else - ret = getttyname_r (buf, buflen, st.st_dev, st.st_ino, save, - &dostat); -#endif - } - - if (ret && dostat != -1) - { - buf[sizeof ("/dev/") - 1] = '\0'; - dostat = 1; -#ifdef _STATBUF_ST_RDEV - ret = getttyname_r (buf, buflen, st.st_rdev, st.st_ino, - save, &dostat); -#else - ret = getttyname_r (buf, buflen, st.st_dev, st.st_ino, - save, &dostat); -#endif - } - - return ret; -} - -weak_alias (__ttyname_r, ttyname_r) diff --git a/newlib/libc/sys/linux/usleep.c b/newlib/libc/sys/linux/usleep.c deleted file mode 100644 index fab6911f2..000000000 --- a/newlib/libc/sys/linux/usleep.c +++ /dev/null @@ -1,20 +0,0 @@ -/* libc/sys/linux/usleep.c - usleep function */ - -/* Written 2002 by Jeff Johnston */ - - -#include <errno.h> -#include <sys/types.h> -#include <sys/time.h> -#include <linux/times.h> - -int usleep(__useconds_t useconds) -{ - struct timespec ts; - - ts.tv_sec = (long int)useconds / 1000000; - ts.tv_nsec = ((long int)useconds % 1000000) * 1000; - if (!nanosleep(&ts,&ts)) return 0; - if (errno == EINTR) return ts.tv_sec; - return -1; -} diff --git a/newlib/libc/sys/linux/utimes.c b/newlib/libc/sys/linux/utimes.c deleted file mode 100644 index 0bee55152..000000000 --- a/newlib/libc/sys/linux/utimes.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <utime.h> -#include <sys/time.h> -#include <errno.h> -#include <stddef.h> -#include <machine/weakalias.h> - -/* Change the access time of FILE to TVP[0] and - the modification time of FILE to TVP[1]. */ -int -__utimes (const char *file, const struct timeval tvp[2]) -{ - struct utimbuf buf, *times; - - if (tvp) - { - times = &buf; - times->actime = tvp[0].tv_sec + tvp[0].tv_usec / 1000000; - times->modtime = tvp[1].tv_sec + tvp[1].tv_usec / 1000000; - } - else - times = NULL; - - return utime (file, times); -} - -weak_alias (__utimes, utimes) diff --git a/newlib/libc/sys/linux/vallocr.c b/newlib/libc/sys/linux/vallocr.c deleted file mode 100644 index 8de7ffc21..000000000 --- a/newlib/libc/sys/linux/vallocr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdlib.h> - -void * -_valloc_r (struct _reent *ptr, size_t bytes) -{ - return valloc (bytes); -} diff --git a/newlib/libc/sys/linux/versionsort.c b/newlib/libc/sys/linux/versionsort.c deleted file mode 100644 index 13cbdccfc..000000000 --- a/newlib/libc/sys/linux/versionsort.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <dirent.h> -#include <string.h> - -extern int __strverscmp (char *, char *); - -int -versionsort (const void *a, const void *b) -{ - return __strverscmp ((*(const struct dirent **)a)->d_name, - (*(const struct dirent **)b)->d_name); -} diff --git a/newlib/libc/sys/linux/versionsort64.c b/newlib/libc/sys/linux/versionsort64.c deleted file mode 100644 index 45147b00d..000000000 --- a/newlib/libc/sys/linux/versionsort64.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <dirent.h> -#include <string.h> - -extern int __strverscmp (char *, char *); - -int -versionsort64 (const void *a, const void *b) -{ - return __strverscmp ((*(const struct dirent64 **)a)->d_name, - (*(const struct dirent64 **)b)->d_name); -} diff --git a/newlib/libc/sys/linux/wait.c b/newlib/libc/sys/linux/wait.c deleted file mode 100644 index 31d1cc765..000000000 --- a/newlib/libc/sys/linux/wait.c +++ /dev/null @@ -1,27 +0,0 @@ -/* libc/sys/linux/wait.c - Wait function wrappers */ - -/* Written 2000 by Werner Almesberger */ - - -#include <sys/wait.h> -#include <machine/syscall.h> - - -_syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) -_syscall4(pid_t,wait4,pid_t,pid,int *,status,int,options,struct rusage *,rusage) - - -pid_t __libc_wait3(int *status,int options,struct rusage *rusage) -{ - return __libc_wait4(-1,status,options,rusage); -} -weak_alias(__libc_wait3,wait3) - -pid_t __libc_wait(int *status) -{ - return __libc_waitpid(-1,status,0); -} - -weak_alias(__libc_waitpid,__libc___waitpid); -weak_alias(__libc_wait,__wait); -weak_alias(__libc_wait,wait); |